RichTextMarks

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
ArgumentTypeDescription
core*CoreA 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
ArgumentTypeDescription
core*CoreA MindDrop core instance.
key*stringThe 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
ArgumentTypeDescription
key*stringThe key of the rich text mark for which to retrieve the config.

Returns all registered rich text marks.

RichTextMarks.getAll(): RTMarkConfig[]
NameDataDescription
rich-text-mark:registerRTMarkConfigDispatched when a new rich text mark is registered.
rich-text-mark:unregisterRTMarkConfigDispatched when a rich text mark is unregistered.