Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Editor

class Editor extends EventEmitter<EditorEvents> {
constructor(options?: Partial<EditorOptions>);
private capturedTransaction;
private commandManager;
private createCommandManager;
private createExtensionManager;
private createSchema;
private createView;
private css;
private dispatchTransaction;
private injectCSS;
get commands(): SingleCommands;
get $doc(): NodePos;
extensionManager: ExtensionManager;
extensionStorage: Record<string, any>;
isCapturingTransaction: boolean;
get isEditable(): boolean;
isFocused: boolean;
options: EditorOptions;
schema: Schema;
get storage(): Record<string, any>;
get state(): EditorState;
get isEmpty(): boolean;
get isDestroyed(): boolean;
view: EditorView;
 
$node(selector: string, attributes?: {
[key: string]: any;
}
): NodePos | null;
$nodes(selector: string, attributes?: {
[key: string]: any;
}
): NodePos[] | null;
$pos(pos: number): NodePos;
can(): CanCommands;
captureTransaction(fn: Function): Transaction | null;
chain(): ChainedCommands;
createNodeViews(): void;
destroy(): void;
getAttributes(nameOrType: string | NodeType | MarkType): Record<string, any>;
getCharacterCount(): number;
getHTML(): string;
getJSON(): JSONContent;
getText(options?: {
blockSeparator?: string;
textSerializers?: Record<string, TextSerializer>;
}
): string;
isActive(name: string, attributes?: {}): boolean;
isActive(attributes: {}): boolean;
prependClass(): void;
registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void;
setEditable(editable: boolean, emitUpdate?: boolean): void;
setOptions(options?: Partial<EditorOptions>): void;
unregisterPlugin(nameOrPluginKey: string | PluginKey): void;
}

§Extends

§
EventEmitter<EditorEvents>
[src]

§Constructors

§
new Editor(options?: Partial<EditorOptions>)
[src]

§Properties

§
capturedTransaction
[src]
§
commandManager
[src]
§
createCommandManager
[src]

Creates an command manager.

§
createExtensionManager
[src]

Creates an extension manager.

§
createSchema
[src]

Creates a ProseMirror schema.

§
createView
[src]

Creates a ProseMirror view.

§
dispatchTransaction
[src]

The callback over which to send transactions (state updates) produced by the view.

§
injectCSS
[src]

Inject CSS styles.

§
commands: SingleCommands readonly
[src]

An object of all registered commands.

§
$doc: NodePos readonly
[src]
§
extensionManager: ExtensionManager
[src]
§
extensionStorage: Record<string, any>
[src]
§
isCapturingTransaction: boolean
[src]
§
isEditable: boolean readonly
[src]

Returns whether the editor is editable.

§
isFocused: boolean
[src]
§
storage: Record<string, any> readonly
[src]

Returns the editor storage.

§
state: EditorState readonly
[src]

Returns the editor state.

§
isEmpty: boolean readonly
[src]

Check if there is no content.

§
isDestroyed: boolean readonly
[src]

Check if the editor is already destroyed.

§Methods

§
$node(selector: string, attributes?: {
[key: string]: any;
}
): NodePos | null
[src]
§
$nodes(selector: string, attributes?: {
[key: string]: any;
}
): NodePos[] | null
[src]
§
$pos(pos: number): NodePos
[src]
§

Check if a command or a command chain can be executed. Without executing it.

§
captureTransaction(fn: Function): Transaction | null
[src]
§

Create a command chain to call multiple commands at once.

§
createNodeViews(): void
[src]

Creates all node views.

§
destroy(): void
[src]

Destroy the editor.

§
getAttributes(nameOrType: string | NodeType | MarkType): Record<string, any>
[src]

Get attributes of the currently selected node or mark.

§
getCharacterCount(): number deprecated
[src]

Get the number of characters for the current document.

@deprecated
§
getHTML(): string
[src]

Get the document as HTML.

§
getJSON(): JSONContent
[src]

Get the document as JSON.

§
getText(options?: {
blockSeparator?: string;
textSerializers?: Record<string, TextSerializer>;
}
): string
[src]

Get the document as text.

§
isActive(name: string, attributes?: {}): boolean
[src]

Returns if the currently selected node or mark is active.

@param name

Name of the node or mark

@param attributes

Attributes of the node or mark

isActive(attributes: {}): boolean
[src]
§
prependClass(): void
[src]

Prepend class name to element.

§
registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void
[src]

Register a ProseMirror plugin.

@param plugin

A ProseMirror plugin

@param handlePlugins

Control how to merge the plugin into the existing plugins.

§
setEditable(editable: boolean, emitUpdate?: boolean): void
[src]

Update editable state of the editor.

§
setOptions(options?: Partial<EditorOptions>): void
[src]

Update editor options.

@param options

A list of options

§
unregisterPlugin(nameOrPluginKey: string | PluginKey): void
[src]

Unregister a ProseMirror plugin.

@param nameOrPluginKey

The plugins name