Skip to main content

dom

package @remirror/dom

function createDomEditor()​

Create the remirror editor for the DOM environment.

// Get the element to append the editor to.
const element = document.querySelector('#editor');

// Create the manager.
const manager = createDomManager(() => [], {});

// Create the dom editor.
const editor = createDomEditor({ element, manager });

// Focus at the end of the editor.
editor.focus('end');

// Insert some text.
editor.commands.insertText('Hello Friend!');

Signature:

export declare function createDomEditor<Extension extends AnyExtension>(props: DomFrameworkProps<Extension>): DomFrameworkOutput<Extension>;

Parameters:

ParameterTypeDescription
propsDomFrameworkProps<Extension>

Returns:

DomFrameworkOutput<Extension>

function createDomManager()​

Create an editor manager. It comes with the CorePreset already available.

Signature:

export declare function createDomManager<Extension extends AnyExtension>(extensions: Extension[] | (() => Extension[]), options?: CreateCoreManagerOptions): RemirrorManager<CorePreset | BuiltinPreset | Extension>;

Parameters:

ParameterTypeDescription
extensionsExtension[] | (() => Extension[])
optionsCreateCoreManagerOptions(Optional)

Returns:

RemirrorManager<CorePreset | BuiltinPreset | Extension>

interface DomFrameworkOutput​

Signature:

export interface DomFrameworkOutput<Extension extends AnyExtension> extends FrameworkOutput<Extension> 

Extends: FrameworkOutput<Extension>

(Some inherited members may not be shown because they are not represented in the documentation.)

property destroy​

Call this method when cleaning up the DOM. It is called for you if you call manager.destroy().

Signature:

destroy: () => void;

interface DomFrameworkProps​

Signature:

export interface DomFrameworkProps<Extension extends AnyExtension> extends FrameworkProps<Extension> 

Extends: FrameworkProps<Extension>

(Some inherited members may not be shown because they are not represented in the documentation.)

property element​

Provide a container element. Which the editor will be appended to.

Signature:

element: Element;