Skip to content

Welshman Docs / @welshman/editor / Editor

Class: Editor

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:12

Extends

  • EventEmitter<EditorEvents>

Constructors

Constructor

new Editor(options?): Editor

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:25

Parameters

options?

Partial<EditorOptions>

Returns

Editor

Overrides

EventEmitter<EditorEvents>.constructor

Properties

extensionManager

extensionManager: ExtensionManager

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:14


extensionStorage

extensionStorage: Record<string, any>

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:23


isCapturingTransaction

isCapturingTransaction: boolean

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:103


isFocused

isFocused: boolean

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:18


isInitialized

isInitialized: boolean

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:22

The editor is considered initialized after the create event has been emitted.


options

options: EditorOptions

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:24


schema

schema: Schema

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:16


view

view: EditorView

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:17

Accessors

$doc

Get Signature

get $doc(): NodePos

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:164

Returns

NodePos


commands

Get Signature

get commands(): SingleCommands

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:33

An object of all registered commands.

Returns

SingleCommands


isDestroyed

Get Signature

get isDestroyed(): boolean

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:156

Check if the editor is already destroyed.

Returns

boolean


isEditable

Get Signature

get isEditable(): boolean

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:59

Returns whether the editor is editable.

Returns

boolean


isEmpty

Get Signature

get isEmpty(): boolean

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:142

Check if there is no content.

Returns

boolean


state

Get Signature

get state(): EditorState

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:63

Returns the editor state.

Returns

EditorState


storage

Get Signature

get storage(): Record<string, any>

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:29

Returns the editor storage.

Returns

Record<string, any>

Methods

$node()

$node(selector, attributes?): null | NodePos

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:157

Parameters

selector

string

attributes?

Returns

null | NodePos


$nodes()

$nodes(selector, attributes?): null | NodePos[]

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:160

Parameters

selector

string

attributes?

Returns

null | NodePos[]


$pos()

$pos(pos): NodePos

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:163

Parameters

pos

number

Returns

NodePos


can()

can(): CanCommands

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:41

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

Returns

CanCommands


captureTransaction()

captureTransaction(fn): null | Transaction

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:105

Parameters

fn

() => void

Returns

null | Transaction


chain()

chain(): ChainedCommands

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:37

Create a command chain to call multiple commands at once.

Returns

ChainedCommands


createNodeViews()

createNodeViews(): void

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:98

Creates all node views.

Returns

void


destroy()

destroy(): void

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:152

Destroy the editor.

Returns

void


emit()

emit<EventName>(event, ...args): this

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/EventEmitter.d.ts:7

Type Parameters

EventName

EventName extends keyof EditorEvents

Parameters

event

EventName

args

...CallbackType<EditorEvents, EventName>

Returns

this

Inherited from

EventEmitter.emit


getAttributes()

getAttributes(nameOrType): Record<string, any>

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:115

Get attributes of the currently selected node or mark.

Parameters

nameOrType

string | NodeType | MarkType

Returns

Record<string, any>


getCharacterCount()

getCharacterCount(): number

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:148

Get the number of characters for the current document.

Returns

number

Deprecated


getHTML()

getHTML(): string

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:131

Get the document as HTML.

Returns

string


getJSON()

getJSON(): JSONContent

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:127

Get the document as JSON.

Returns

JSONContent


getText()

getText(options?): string

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:135

Get the document as text.

Parameters

options?
blockSeparator?

string

textSerializers?

Record<string, TextSerializer>

Returns

string


isActive()

Call Signature

isActive(name, attributes?): boolean

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:122

Returns if the currently selected node or mark is active.

Parameters
name

string

Name of the node or mark

attributes?

Attributes of the node or mark

Returns

boolean

Call Signature

isActive(attributes): boolean

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:123

Returns if the currently selected node or mark is active.

Parameters
attributes

Attributes of the node or mark

Returns

boolean


off()

off<EventName>(event, fn?): this

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/EventEmitter.d.ts:8

Type Parameters

EventName

EventName extends keyof EditorEvents

Parameters

event

EventName

fn?

CallbackFunction<EditorEvents, EventName>

Returns

this

Inherited from

EventEmitter.off


on()

on<EventName>(event, fn): this

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/EventEmitter.d.ts:6

Type Parameters

EventName

EventName extends keyof EditorEvents

Parameters

event

EventName

fn

CallbackFunction<EditorEvents, EventName>

Returns

this

Inherited from

EventEmitter.on


once()

once<EventName>(event, fn): this

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/EventEmitter.d.ts:9

Type Parameters

EventName

EventName extends keyof EditorEvents

Parameters

event

EventName

fn

CallbackFunction<EditorEvents, EventName>

Returns

this

Inherited from

EventEmitter.once


prependClass()

prependClass(): void

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:102

Prepend class name to element.

Returns

void


registerPlugin()

registerPlugin(plugin, handlePlugins?): EditorState

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:71

Register a ProseMirror plugin.

Parameters

plugin

Plugin

A ProseMirror plugin

handlePlugins?

(newPlugin, plugins) => Plugin<any>[]

Control how to merge the plugin into the existing plugins.

Returns

EditorState

The new editor state


removeAllListeners()

removeAllListeners(): void

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/EventEmitter.d.ts:10

Returns

void

Inherited from

EventEmitter.removeAllListeners


setEditable()

setEditable(editable, emitUpdate?): void

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:55

Update editable state of the editor.

Parameters

editable

boolean

emitUpdate?

boolean

Returns

void


setOptions()

setOptions(options?): void

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:51

Update editor options.

Parameters

options?

Partial<EditorOptions>

A list of options

Returns

void


unregisterPlugin()

unregisterPlugin(nameOrPluginKeyToRemove): undefined | EditorState

Defined in: node_modules/.pnpm/@tiptap+core@2.27.2_@tiptap+pm@2.27.2/node_modules/@tiptap/core/dist/Editor.d.ts:78

Unregister a ProseMirror plugin.

Parameters

nameOrPluginKeyToRemove

The plugins name

string | PluginKey<any> | (string | PluginKey<any>)[]

Returns

undefined | EditorState

The new editor state or undefined if the editor is destroyed