Skip to Content
API Referencecorecore/plugins

@stesura/core/plugins

ProseMirror plugins that make up the editor runtime, and the plugin keys for reading their state.

stesuraPlugins(schema, editorId, configuration?, options?) returns the full set: basePlugins (infrastructure) followed by customPlugins (features). Set an entry to false in options to leave that plugin out, e.g. { history: false } when a collab provider supplies its own undo/redo. configPlugin and viewModeInteractionsPlugin are always included; stesuraKeymapPlugin is not part of the set.

Functions & values

basePlugins

Parameters:
NameTypeDefault
schemaSchema<any, any>
editorIdstring
configurationConfigPluginProps
propsBasePluginsProps
Returns:
Plugin<any>[]

closeMathEditor

Parameters:
NameTypeDefault
stateEditorState
dispatch(tr: Transaction) => void
viewEditorView
Returns:
boolean

codeHighlightPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<CodeHighlightPluginState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => CodeHighlightPluginState | undefined

Get the plugin’s state from an editor state.

configPlugin

Parameters:
NameTypeDefault
__0ConfigPluginProps & { editorId: string; }
Returns:
Plugin<ConfigPluginState>

configPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<ConfigPluginState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => ConfigPluginState | undefined

Get the plugin’s state from an editor state.

customPlugins

Parameters:
NameTypeDefault
propsCustomPluginsProps
Returns:
Plugin<any>[]

docStylingPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

formatPainterPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<FormatPainterPluginState>

formatPainterPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<FormatPainterPluginState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => FormatPainterPluginState | undefined

Get the plugin’s state from an editor state.

gapCursorClassPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

getImageUploadPolicy

Parameters:
NameTypeDefault
stateEditorState
Returns:
ImageUploadPolicy | undefined

getMathEditorState

Parameters:
NameTypeDefault
stateEditorState
Returns:
MathEditorState

headerFooterGuardPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

headerFooterRegion

Parameters:
NameTypeDefault
sectionIndexnumber
kind"header" | "footer"
variantstring
Returns:
string

headerFooterSyncPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<any> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => any

Get the plugin’s state from an editor state.

headingInputRulesPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<HeadingInputRuleState | null>

highlightCounterNodesPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<HighlightCounterNodesState>

highlightPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<{ persistedColor: null; }>

highlightPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<HighlightPluginState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => HighlightPluginState | undefined

Get the plugin’s state from an editor state.

imagePlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<DecorationSet>

imagePluginKey

NameTypeDefault
get(state: EditorState) => Plugin<DecorationSet> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => DecorationSet | undefined

Get the plugin’s state from an editor state.

imageUploadPolicy

Parameters:
NameTypeDefault
policyImageUploadPolicy
Returns:
Plugin<ImageUploadPolicy>

imageUploadPolicyKey

NameTypeDefault
get(state: EditorState) => Plugin<ImageUploadPolicy> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => ImageUploadPolicy | undefined

Get the plugin’s state from an editor state.

inlineNodeSelectionHandlerPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<InlineNodeSelectionHandlerState>

invisibleCharacters

Parameters:
This function does not accept any parameters.
Returns:
Plugin<InvisibleCharactersState>

invisibleCharactersPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<InvisibleCharactersState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => InvisibleCharactersState | undefined

Get the plugin’s state from an editor state.

languagePlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<LanguagePluginState>

languagePluginKey

NameTypeDefault
get(state: EditorState) => Plugin<LanguagePluginState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => LanguagePluginState | undefined

Get the plugin’s state from an editor state.

lowlightPlugin

NameTypeDefault
specPluginSpec<CodeHighlightPluginState>

The plugin’s spec object .

propsEditorProps<Plugin<CodeHighlightPluginState>>

The props  exported by this plugin.

getState(state: EditorState) => CodeHighlightPluginState | undefined

Extract the plugin’s state field from an editor state.

mathEditorEnterCmd

Parameters:
NameTypeDefault
stateEditorState
dispatch(tr: Transaction) => void
viewEditorView
Returns:
boolean

mathEditorPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<MathEditorState>

mathEditorPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<MathEditorState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => MathEditorState | undefined

Get the plugin’s state from an editor state.

mathPlugins

Parameters:
NameTypeDefault
schemaSchema<any, any>
Returns:
Plugin<any>[]

numberingInputRulesPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<NumberingInputRuleState | null>

numberingPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

numberingPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<any> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => any

Get the plugin’s state from an editor state.

numberingPropsPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

numberingPropsPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<any> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => any

Get the plugin’s state from an editor state.

openMathEditor

Parameters:
NameTypeDefault
stateEditorState
dispatch(tr: Transaction) => void
viewEditorView
Returns:
boolean

openMathEditorAt

Parameters:
NameTypeDefault
posnumber
Returns:
Command

openMathEditorTarget

Parameters:
NameTypeDefault
stateEditorState
Returns:
{ node: Node; pos: number; } | null

paginationPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<PaginationPluginState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => PaginationPluginState | undefined

Get the plugin’s state from an editor state.

pendingLinkPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<PendingLinkPluginState>

pendingLinkPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<PendingLinkPluginState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => PendingLinkPluginState | undefined

Get the plugin’s state from an editor state.

searchPlugin

Parameters:
NameTypeDefault
options{ initialQuery?: SearchQuery; initialRange?: { from: number; to: number; }; }
Returns:
Plugin<any>

searchPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<SearchState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => SearchState | undefined

Get the plugin’s state from an editor state.

SearchQuery

NameTypeDefault
caseSensitiveboolean
literalboolean
regexpboolean
replacestring
validboolean
wholeWordboolean
skipDeletionsboolean
filter((state: EditorState, result: SearchResult) => boolean) | null
implQueryImpl
eq(other: SearchQuery) => boolean
findNext(state: EditorState, from?: number, to?: number) => SearchResult | null
findPrev(state: EditorState, from?: number, to?: number) => SearchResult | null
checkResult(state: EditorState, result: SearchResult) => boolean
unquote(string: string) => string
getReplacements(state: EditorState, result: SearchResult) => { from: number; to: number; insert: Slice; }[]

sectionUnwrapPastePlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

selectAfterMath

Parameters:
NameTypeDefault
posnumber
Returns:
Command

selectionHighlightPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

setMathSource

Parameters:
NameTypeDefault
posnumber
sourcestring
Returns:
Command

setPilcrowWidgetFactory

Parameters:
NameTypeDefault
factoryPilcrowWidgetFactory
Returns:
void

spacingPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

stesuraKeymapPlugin

Parameters:
NameTypeDefault
schemaSchema<any, any>
Returns:
Plugin<any>

stesuraPlugins

Parameters:
NameTypeDefault
schemaSchema<any, any>
editorIdstring
configurationConfigPluginProps
optionsStesuraPluginsOptions
Returns:
Plugin<any>[]

stripTrackChangesMarksFromSlice

Parameters:
NameTypeDefault
sliceSlice
deletionMarkType
insertionMarkType
modificationMarkType
Returns:
Slice

styleNumberingInstanceId

Parameters:
NameTypeDefault
listRefstring
regionstring
Returns:
string

styleSheetPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

styleSheetPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<StyleSheetState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => StyleSheetState | undefined

Get the plugin’s state from an editor state.

tableCellSelectionPreserver

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

tableDragHandlePlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<TableDragState>

tableDragHandlePluginKey

NameTypeDefault
get(state: EditorState) => Plugin<TableDragState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => TableDragState | undefined

Get the plugin’s state from an editor state.

tableEmptyRowGuardPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

tableHeaderCellsPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

tableResizingPlugin

Parameters:
NameTypeDefault
optionsTableResizingOptions
Returns:
Plugin<ResizeState>

tableSizingPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<boolean>

tabStopsPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<DecorationSet>

tabStopsPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<DecorationSet> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => DecorationSet | undefined

Get the plugin’s state from an editor state.

TOCplugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

tocPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<any> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => any

Get the plugin’s state from an editor state.

trackChangesKey

NameTypeDefault
get(state: EditorState) => Plugin<TrackChangesState> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => TrackChangesState | undefined

Get the plugin’s state from an editor state.

trackChangesStripPastePlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

typographyPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<TypographyState | null>

uniqueIdPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

viewModeInteractionsPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

wordPasteHandlerPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

wordPasteHandlerPluginKey

NameTypeDefault
get(state: EditorState) => Plugin<any> | undefined

Get the active plugin with this key, if any, from an editor state.

getState(state: EditorState) => any

Get the plugin’s state from an editor state.

wrapSelectionWithPlugin

Parameters:
This function does not accept any parameters.
Returns:
Plugin<any>

Types

CodeHighlightPluginState

NameTypeDefault
cacheDecorationCache
decorationsDecorationSet | undefined
promisesPromise<void>[]

ConfigPluginProps

NameTypeDefault
configConfigPluginConfig
toastText(message: ToastMessage) => string

Resolves a toast key to display text. editor-react installs one from the mount’s locale — hosts only need this when they mount core on their own, and without it onToast receives the bare key as its description.

defaultsPartial<EditorStoreDefaults>
extensionStoresRecord<string, PreinitializedWritableAtom<unknown>>
parentEditorIdstring

Marks a sub-editor: store access delegates to this parent, and no stores are created.

PilcrowWidgetFactory

Parameters:
NameTypeDefault
posnumber
Returns:
Decoration

SearchState

NameTypeDefault
enabledboolean
querySearchQuery
range{ from: number; to: number; } | null
decoDecorationSet

StesuraPluginsOptions

NameTypeDefault
historyfalse | { [key: string]: boolean; }
tableEditingfalse | { [key: string]: boolean; }
gapCursorfalse | { [key: string]: boolean; }
dropCursorfalse | { [key: string]: boolean; }
docStylingfalse | { [key: string]: boolean; }
mathPluginsfalse | { [key: string]: boolean; }
uniqueIdPluginfalse | { [key: string]: boolean; }
numberingPluginfalse | { [key: string]: boolean; }
highlightCounterNodesPluginfalse | { [key: string]: boolean; }
TOCpluginfalse | { [key: string]: boolean; }
imagePluginfalse | { [key: string]: boolean; }
selectionHighlightPluginfalse | { [key: string]: boolean; }
formatPainterPluginfalse | { [key: string]: boolean; }
searchPluginfalse | { [key: string]: boolean; }
spacingPluginfalse | { [key: string]: boolean; }
styleSheetPluginfalse | { styles: StyleSheet; }
highlightPluginfalse | { [key: string]: boolean; }
tableResizingPluginfalse | { [key: string]: boolean; }
tableSizingPluginfalse | { [key: string]: boolean; }
tableEmptyRowGuardPluginfalse | { [key: string]: boolean; }
tableHeaderCellsPluginfalse | { [key: string]: boolean; }
pendingLinkPluginfalse | { [key: string]: boolean; }
wrapSelectionWithPluginfalse | { [key: string]: boolean; }
typographyPluginfalse | { [key: string]: boolean; }
linkifyPluginfalse

Autolink typed/pasted URLs (Word’s autoformat).

headingInputRulesPluginfalse | { [key: string]: boolean; }
tableDragHandlePluginfalse | { [key: string]: boolean; }
tableCellSelectionPreserverfalse | { [key: string]: boolean; }
invisibleCharactersfalse | { [key: string]: boolean; }
tabStopsPluginfalse

Lays tab characters out against paragraph tab stops.

languagePluginfalse | { [key: string]: boolean; }
sectionUnwrapPastePluginfalse | { [key: string]: boolean; }
trackChangesStripPastePluginfalse | { [key: string]: boolean; }
wordPasteHandlerPluginfalse | { [key: string]: boolean; }
inlineNodeSelectionHandlerPluginfalse | { [key: string]: boolean; }
lowlightPluginfalse | { [key: string]: boolean; }
headerFooterGuardPluginfalse | { [key: string]: boolean; }

Other exports

ExportTypeDescription
GAP_CURSOR_ACTIVE_CLASS"pm-gapcursor-active"Root class set while the selection is a gap cursor.
NUMBERING_REGION_BODY"body"Counter-stream regions — Word’s “stories”. Numbering DEFINITIONS are document-global; the counters that run off them are per story: the body, all footnotes together, all endnotes together, and each header/footer part.
NUMBERING_REGION_ENDNOTES"endnotes"
NUMBERING_REGION_FOOTNOTES"footnotes"
OVERSIZED_CLAMPS_POKE"oversizedClampsPoke"Payload-less meta key meant to signal that the oversized-node clamp set changed. Currently neither dispatched nor read anywhere.
PAGINATION_CLEAR_ALL_META"clearAllPaginationCaches"Meta key (true) that invalidates every section’s pagination cache, e.g. after a DOCX import. Lives in core so callers need not import pagination.
PAGINATION_DIRTY_NODES_META"paginationDirtyNodes"Meta key carrying node ids (string[]) whose rendered size changed without a doc change, e.g. a nodeview whose async data grew its DOM. Pagination re-measures only those nodes, never wiping the cache.
PILCROW_CLASS"pm-pilcrow"Class the CSS hangs the marker’s styling off.
Last updated on