@stesura/core/sub-editor
Shared machinery behind nested editors (footnotes, endnotes, headers/footers). One SubEditorKindConfig per kind drives the inner schema (buildSubEditorSchema), the inner state (createSubEditorState) and the main-to-inner binding plugin (createSubEditorBindingPlugin). Edits flow back to the main editor through forwardInnerSteps.
Functions & values
buildSubEditorSchema
Parameters:| Name | Type | Default |
|---|---|---|
base | Schema<any, any> | |
config | Pick<SubEditorKindConfig<K>, "kind" | "wrapperName" | "regionNodeName" | "contentExpr" | "filterOutNodes"> |
createSubEditorBindingPlugin
Parameters:| Name | Type | Default |
|---|---|---|
config | SubEditorKindConfig<K> |
createSubEditorRegistry
Parameters:| Name | Type | Default |
|---|---|---|
keyId | (key: K) => string |
createSubEditorState
Parameters:| Name | Type | Default |
|---|---|---|
plugins | Plugin<any>[] | |
schema | Schema<any, any> | |
config | CreateDocConfig | |
wrapperAttrs | Attrs | |
blockContent | Node[] | Fragment |
describeSubEditorFailure
Parameters:| Name | Type | Default |
|---|---|---|
failure | SubEditorBuildFailure |
findUnrepresentableNodeTypes
Parameters:| Name | Type | Default |
|---|---|---|
content | Fragment | |
inner | Schema<any, any> |
forwardInnerSteps
Parameters:| Name | Type | Default |
|---|---|---|
__0 | { outerTr: Transaction; outerSchema: Schema<any, any>; transactions: readonly Transaction[]; regionPos: number; logContext: string; } |
getAllSubEditors
Parameters:| Name | Type | Default |
|---|---|---|
mainEditorId | string |
recoverSubEditorAfterFailedForward
Parameters:| Name | Type | Default |
|---|---|---|
config | SubEditorKindConfig<K> | |
editor | ActiveSubEditor<K> | |
outerState | EditorState |
subscribeSubEditors
Parameters:| Name | Type | Default |
|---|---|---|
listener | () => void |
Types
ActiveSubEditor
AnySubEditor
| Name | Type | Default |
|---|---|---|
view | EditorView | |
mainEditorId | string |
SubEditorBuildFailure
| Name | Type | Default |
|---|---|---|
reason | "schema" | "unrepresentable" |
SubEditorDocResult
| Name | Type | Default |
|---|---|---|
ok | boolean |
SubEditorKindConfig
SubEditorRegion
| Name | Type | Default |
|---|---|---|
pos | number | |
node | Node |
SubEditorRegistry
Other exports
| Export | Type | Description |
|---|---|---|
SUB_EDITOR_EXCLUDED_PLUGINS | string[] | Plugin key labels stripped from the main editor’s plugins before mounting any sub-editor. Kinds add more via SubEditorKindConfig.extraExcludedPlugins. |
Last updated on