Slate
ExamplesGitHubSlack
v0.47
v0.47
  • 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
    • Commands & Queries
    • Data Model
    • Plugins
    • Rendering
    • Schemas
  • General
    • Plugins
    • Resources
    • Contributing
    • Changelog
    • FAQ
    • Glossary
  • Slate Core
    • Block
    • Commands
    • Data
    • Decoration
    • Document
    • Editor
    • Inline
    • Mark
    • Node
    • Operation
    • Plugins
    • Point
    • Range
    • Schema
    • Selection
    • Text
    • Utils
    • Value
  • Slate React
    • Editor
    • Plugins
    • Rendering
    • Utils
  • Other Packages
    • slate-html-serializer
    • slate-hyperscript
    • slate-plain-serializer
    • slate-prop-types
Powered by GitBook
On this page
  • Properties
  • key
  • text
  • marks
  • object
  • Static Methods
  • Text.create
  • Text.fromJSON
  • Text.isText
  • Instance Methods
  • toJSON
  1. Slate Core

Text

PreviousSelectionNextUtils

Last updated 5 years ago

import { Text } from 'slate'

A text node in a Slate . Text nodes are always the bottom-most leaves in the document, just like in the DOM.

Properties

Text({
  key: String,
  text: String,
  marks: Immutable.List<Mark>,
})

key

String

A unique identifier for the node.

text

String

The text contents of this node.

marks

Immutable.Set<Mark>,

A list of marks for this node.

object

String

Static Methods

Text.create

Text.create(properties: Object) => Text

Create a text from a plain JavaScript object of properties.

Text.fromJSON

Text.fromJSON(object: Object) => Text

Create a text from a JSON object.

Text.isText

Text.isText(maybeText: Any) => Boolean

Returns a boolean if the passed in argument is a Text.

Instance Methods

toJSON

toJSON() => Object

Returns a JSON representation of the text.

An immutable string value of 'text' for easily separating this node from or nodes.

Document
Inline
Block