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
  • isFocused
  • marks
  • object
  • Computed Properties
  • isBlurred
  • Static Methods
  • Selection.create
  • Selection.createProperties
  • Selection.fromJSON
  • Selection.isSelection
  • Instance Methods
  • toJSON
  • Mutating Methods
  • setIsFocused
  • setMarks
  1. Slate Core

Selection

PreviousSchemaNextText

Last updated 5 years ago

import { Selection } from 'slate'

The user's current selection in a Slate . Selections implement the interface, but also expose data about the current "focus" and the cursor current marks.

Properties

Selection({
  anchor: Point,
  focus: Point,
  isFocused: Boolean,
  marks: Set,
})

isFocused

Boolean

Whether the range currently has focus.

marks

Set

A set of marks associated with the range.

object

String

A string with a value of 'selection'.

Computed Properties

isBlurred

Boolean

The opposite of isFocused, for convenience.

Static Methods

Selection.create

Selection.create(properties: Object) => Selection

Create a new Selection instance with properties.

Selection.createProperties

Selection.createProperties(object: Object|Selection) => Object

Create a new dictionary of range properties from an object.

Selection.fromJSON

Selection.fromJSON(object: Object) => Selection

Create a range from a JSON object.

Selection.isSelection

Selection.isSelection(value: Any) => Boolean

Check whether a value is a Selection.

Instance Methods

toJSON

toJSON() => Object

Return a JSON representation of the range.

Mutating Methods

setIsFocused

setIsFocused(isFocused: Boolean) => Selection

Return a new range with a new isFocused value.

setMarks

setMarks(marks: Set|Null) => Selection

Return a new range with a new set of marks.

Document
Range