Decoration
Last updated
import { Decoration } from 'slate'A decoration is a range of the document that has a specific Mark dynamically applied to it based on its content or some other external state. It is not actually reflected in the document's structure itself. This can be useful for cases like syntax highlighting, or search result highlighting.
Decorations implement the Range interface, but also contain a mark.
Decoration({
anchor: Point,
focus: Point,
mark: Mark,
})markMark
The mark associated with the decoration.
objectString
A string with a value of 'decoration'.
Decoration.createDecoration.create(properties: Object) => Decoration
Create a new Decoration instance with properties.
Decoration.createPropertiesDecoration.createProperties(object: Object|Decoration) => Object
Create a new dictionary of range properties from an object.
Decoration.fromJSONDecoration.fromJSON(object: Object) => Decoration
Create a range from a JSON object.
Decoration.isDecorationDecoration.isDecoration(value: Any) => Boolean
Check whether a value is a Decoration.
toJSONtoJSON() => Object
Return a JSON representation of the range.
setMarksetMark(mark: Mark) => Decoration
Return a new decoration with a new mark.
Last updated