API Referencev1.0.2
@eigenpal/docx-editor-core/prosemirror/template/prosemirror-plugin
Template ProseMirror Plugin
Simple plugin that finds template tags using regex and creates decorations. No separate parsing layer - everything happens here.
Functions(4)
fn
packages/core/src/prosemirror/template/prosemirror-plugin.ts:209createTemplatePlugin
Create the template plugin
declare function createTemplatePlugin(): Plugin<TemplatePluginState>;fn
packages/core/src/prosemirror/template/prosemirror-plugin.ts:321setHoveredElement
Set hovered tag
declare function setHoveredElement(view: EditorView, id: string | undefined): void;fn
packages/core/src/prosemirror/template/prosemirror-plugin.ts:328setSelectedElement
Set selected tag
declare function setSelectedElement(view: EditorView, id: string | undefined): void;Interfaces(1)
interface
packages/core/src/prosemirror/template/prosemirror-plugin.ts:23TemplateTag
A found template tag
interface TemplateTag| Member | Type | Summary |
|---|---|---|
| from | number | |
| id | string | |
| insideSection? | boolean | True if this variable is inside a section (shown in section's nested vars) |
| name | string | |
| nestedVars? | string[] | For sections: nested variable names |
| rawTag | string | |
| to | number | |
| type | TagType |
Type aliases(1)
Template tag types
type TagType = 'variable' | 'sectionStart' | 'sectionEnd' | 'invertedStart' | 'raw';Variables(2)
const
packages/core/src/prosemirror/template/prosemirror-plugin.ts:335TEMPLATE_DECORATION_STYLES
CSS styles for template decorations
TEMPLATE_DECORATION_STYLES = "\n.docx-template-tag {\n cursor: pointer;\n transition: background-color 0.1s;\n}\n\n.docx-template-tag:hover,\n.docx-template-tag.hovered {\n filter: brightness(0.95);\n}\n\n.docx-template-tag.selected {\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);\n}\n"const
packages/core/src/prosemirror/template/prosemirror-plugin.ts:54templatePluginKey
Plugin key
templatePluginKey: PluginKey<TemplatePluginState>