📉
slate
  • Introduction
  • Walkthroughs
    • Installing Slate
    • Adding Event Handlers
    • Defining Custom Block Nodes
    • Applying Custom Formatting
    • Using Plugins
    • Saving to a Database
    • Saving and Loading HTML Content
  • Guides
    • Changes
    • Data Model
    • Plugins
    • Rendering
    • Schemas
  • General
    • Plugins
    • Resources
    • Contributing
    • Changelog
    • FAQ
    • Glossary
  • Slate Core
    • Block
    • Change
    • Data
    • Decoration
    • Document
    • Inline
    • Mark
    • Node
    • Operation
    • Point
    • Range
    • Schema
    • Selection
    • Text
    • Value
    • setKeyGenerator
    • resetKeyGenerator
  • Slate React
    • Editor
    • Plugins
    • Custom Nodes
    • Core Plugins
    • cloneFragment
    • findDOMNode
    • findDOMRange
    • findNode
    • findRange
    • getEventRange
    • getEventTransfer
    • setEventTransfer
  • Other Packages
    • slate-html-serializer
    • slate-hyperscript
    • slate-plain-serializer
    • slate-prop-types
    • slate-simulator
Powered by GitBook
On this page
  • Example
  • Methods
  • Plain.deserialize
  • Plain.serialize

Was this helpful?

  1. Other Packages

slate-plain-serializer

Previousslate-hyperscriptNextslate-prop-types

Last updated 5 years ago

Was this helpful?

import Plain from 'slate-plain-serializer'

A serializer that converts a Slate to and from a plain text string.

Example

The Slate editor gives you full control over the logic you can add.\n
In its simplest form, when representing plain text, Slate is a glorified <textarea>. But you can augment it to be much more than that.\n
Check out http://slatejs.org for examples!

Methods

Plain.deserialize

Plain.deserialize(string: String, [options: Object]) => Value

Deserialize a plain text string into a . A series of blocks will be created by splitting the input string on \n characters. Each block is given a type of 'line'.

If you pass toJSON: true as an option, the return value will be a JSON object instead of a object.

Plain.serialize

Plain.serialize(value: Value) => String

Serialize a value into a plain text string. Each direct child block of the document will be separated by a \n character.

Value
Value
Value