An interface for retrieving and managing rich text mark configs.
In rich text documents, text nodes are the lowest-level nodes in the tree, containing the text content of the document, along with any formatting.
To implement formatting such as bold, text nodes can contain custom properties refered to as 'marks'.
Marks are defined using a RTMarkConfig object.
Reigsters one or more rich text marks. Dispatches a rich-text-marks:register event for each config.
RichTextMarks.register(
core: Core,
config: RTMarkConfig | RTMarkConfig[],
): void
| Argument | Type | Description |
|---|---|---|
core* | Core | A MindDrop core instance. |
config* | RTMarkConfig | RTMarkConfig[] | The rich text mark config(s) to reigster. |
Unregisters a rich text mark by key and dispaches a rich-text-mark:unregister event.
RichTextMarks.unregister(core: Core, key: string): void
| Argument | Type | Description |
|---|---|---|
core* | Core | A MindDrop core instance. |
key* | string | The key of the rich text mark to unregister. |
Retrieves a rich text mark config by key. Returns undefined if the mark is not registered.
RichTextMarks.get(key: string): RTMarkConfig | undefined
| Argument | Type | Description |
|---|---|---|
key* | string | The key of the rich text mark for which to retrieve the config. |
Returns all registered rich text marks.
RichTextMarks.getAll(): RTMarkConfig[]
| Name | Data | Description |
|---|---|---|
rich-text-mark:register | RTMarkConfig | Dispatched when a new rich text mark is registered. |
rich-text-mark:unregister | RTMarkConfig | Dispatched when a rich text mark is unregistered. |