@eigenpal/docx-editor-core 1.0.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +13 -16
- package/dist/agent/index.d.mts +42 -7
- package/dist/agent/index.d.ts +42 -7
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/chunk-2EQGBVPV.js +2 -0
- package/dist/chunk-2XP6GLA4.mjs +1 -0
- package/dist/chunk-44FHVKSI.js +1 -0
- package/dist/{chunk-2IE6UDHJ.mjs → chunk-44JKHPGF.mjs} +1 -1
- package/dist/{chunk-ABBG4WD2.js → chunk-4QEETB7U.js} +2 -2
- package/dist/chunk-53VKL6CG.js +1 -0
- package/dist/chunk-5BLQHXWK.mjs +1 -0
- package/dist/chunk-5M7TI6TV.js +1 -0
- package/dist/chunk-6JKM7TWJ.mjs +1 -0
- package/dist/{chunk-EQVNAHL7.mjs → chunk-6Y6LON6Y.mjs} +1 -1
- package/dist/{chunk-QVEAQOMR.mjs → chunk-6ZXL3EIP.mjs} +1 -1
- package/dist/{chunk-GHQS3I2W.mjs → chunk-7BVHKWEW.mjs} +1 -1
- package/dist/chunk-7HANRHHL.js +1 -0
- package/dist/chunk-7LRR7RKE.mjs +15 -0
- package/dist/chunk-7OW3VCZE.mjs +1 -0
- package/dist/chunk-7ZN4WI5N.mjs +4 -0
- package/dist/chunk-AMB6Y77B.js +1 -0
- package/dist/{chunk-3JXR6YU4.mjs → chunk-BOOHU5EW.mjs} +1 -1
- package/dist/{chunk-XBHF5Q2F.js → chunk-BXWOLARZ.js} +1 -1
- package/dist/chunk-C45EFOVP.js +1 -0
- package/dist/chunk-CCPBNE2F.mjs +2 -0
- package/dist/{chunk-XWQB6APW.mjs → chunk-D62KS7QG.mjs} +1 -1
- package/dist/chunk-DI6CRWSW.mjs +1 -0
- package/dist/chunk-DTTWBKGN.mjs +0 -0
- package/dist/chunk-DV6GWBUJ.js +2 -0
- package/dist/{chunk-EPX7BBJD.js → chunk-E4JMCA5X.js} +2 -2
- package/dist/chunk-EQAORQC3.mjs +1 -0
- package/dist/chunk-FO6IX2DB.js +6 -0
- package/dist/chunk-FW23IMBF.mjs +1 -0
- package/dist/chunk-FYKRDDKG.js +1 -0
- package/dist/chunk-GSKMHXHG.js +1 -0
- package/dist/chunk-GUQFNJHE.mjs +1 -0
- package/dist/{chunk-D536HC5M.js → chunk-HQPWFUP5.js} +1 -1
- package/dist/chunk-ICE6NC3S.mjs +1 -0
- package/dist/chunk-IFUED5ZS.mjs +1 -0
- package/dist/chunk-ISKTBM4L.js +1 -0
- package/dist/chunk-IYKBX24M.js +1 -0
- package/dist/chunk-KOEWROYV.mjs +6 -0
- package/dist/chunk-KRN6YSR2.mjs +1 -0
- package/dist/chunk-KZXZWGFX.mjs +1 -0
- package/dist/chunk-L24C5TEX.mjs +1 -0
- package/dist/chunk-L72YAV5N.js +3 -0
- package/dist/chunk-LK6I3HMH.mjs +0 -0
- package/dist/{chunk-XBIKSAH6.js → chunk-LTHT4A4S.js} +1 -1
- package/dist/chunk-LWH66Q7Q.js +1 -0
- package/dist/chunk-MERJFGEP.mjs +59 -0
- package/dist/chunk-MJ6XZFVD.mjs +1 -0
- package/dist/chunk-MNOHUTKE.js +15 -0
- package/dist/chunk-MP4QSEO2.mjs +1 -0
- package/dist/{chunk-HL5PQT3A.mjs → chunk-OEXVWIHW.mjs} +1 -1
- package/dist/chunk-PVAVS3IU.js +1 -0
- package/dist/chunk-QEACB5VG.js +1 -0
- package/dist/{chunk-EV6W6KXG.mjs → chunk-QKLY4F2J.mjs} +1 -1
- package/dist/chunk-QYF7BRG3.js +2 -0
- package/dist/chunk-ROG4MNOR.js +4 -0
- package/dist/{chunk-D5E5TA74.js → chunk-RORPREG3.js} +1 -1
- package/dist/chunk-SORYYVJ7.js +1 -0
- package/dist/chunk-SZIOF5SG.js +59 -0
- package/dist/{chunk-SAFW7UQZ.js → chunk-THLJYXFB.js} +1 -1
- package/dist/chunk-TUIEV7Q7.js +1 -0
- package/dist/{chunk-Z4SJCSTS.js → chunk-U4WUDHDK.js} +1 -1
- package/dist/chunk-U4XMGWF7.js +1 -0
- package/dist/chunk-U67MWOPZ.mjs +1 -0
- package/dist/chunk-VMRUBLPI.js +1 -0
- package/dist/chunk-WLDI6N3B.mjs +3 -0
- package/dist/chunk-WLHNIXWC.mjs +2 -0
- package/dist/chunk-WVERBZZU.js +1 -0
- package/dist/chunk-XCKTBNKN.js +1 -0
- package/dist/chunk-XPV6VILW.mjs +1 -0
- package/dist/chunk-Z5MJYQSD.mjs +1 -0
- package/dist/chunk-ZBFNOJGY.js +1 -0
- package/dist/chunk-ZX26QZJ5.mjs +1 -0
- package/dist/content-CE-ZdMwG.d.mts +1418 -0
- package/dist/content-CYXJ2tfQ.d.ts +1418 -0
- package/dist/contentControlValues-DAwTWfgR.d.mts +187 -0
- package/dist/contentControlValues-gyVPsi6m.d.ts +187 -0
- package/dist/core-plugins.d.mts +1 -2
- package/dist/core-plugins.d.ts +1 -2
- package/dist/core-plugins.js +1 -1
- package/dist/core-plugins.mjs +1 -1
- package/dist/core.d.mts +6 -7
- package/dist/core.d.ts +6 -7
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{documentSerializer-C1ueey5d.d.mts → documentSerializer-Bghq9rFI.d.mts} +1 -1
- package/dist/{documentSerializer-Chn7J1WG.d.ts → documentSerializer-C4lFC60P.d.ts} +1 -1
- package/dist/documentStyles-D87dxl18.d.mts +34 -0
- package/dist/documentStyles-DToJv9co.d.ts +34 -0
- package/dist/docx/index.d.mts +1 -2
- package/dist/docx/index.d.ts +1 -2
- package/dist/docx/index.js +1 -1
- package/dist/docx/index.mjs +1 -1
- package/dist/docx/parser.d.mts +1 -2
- package/dist/docx/parser.d.ts +1 -2
- package/dist/docx/parser.js +1 -1
- package/dist/docx/parser.mjs +1 -1
- package/dist/docx/rezip.d.mts +1 -2
- package/dist/docx/rezip.d.ts +1 -2
- package/dist/docx/rezip.js +1 -1
- package/dist/docx/rezip.mjs +1 -1
- package/dist/docx/serializer/index.d.mts +2 -3
- package/dist/docx/serializer/index.d.ts +2 -3
- package/dist/docx/serializer/index.js +1 -1
- package/dist/docx/serializer/index.mjs +1 -1
- package/dist/{fontLoader-QPwbcX5j.d.ts → fontLoader-Cm02v7PO.d.ts} +63 -3
- package/dist/{fontLoader-BOt95Jtf.d.mts → fontLoader-Z7pqeNvZ.d.mts} +63 -3
- package/dist/{headerFooterLayout-B5LyDpSM.d.ts → headerFooterLayout-Bd58Tum3.d.ts} +74 -2
- package/dist/{headerFooterLayout-DVFcJ832.d.mts → headerFooterLayout-CuIJiIzi.d.mts} +74 -2
- package/dist/headless.d.mts +7 -6
- package/dist/headless.d.ts +7 -6
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/layout-bridge/index.d.mts +4 -4
- package/dist/layout-bridge/index.d.ts +4 -4
- package/dist/layout-bridge/index.js +1 -1
- package/dist/layout-bridge/index.mjs +1 -1
- package/dist/layout-bridge/measuring/index.d.mts +4 -0
- package/dist/layout-bridge/measuring/index.d.ts +4 -0
- package/dist/layout-bridge/measuring/index.js +1 -1
- package/dist/layout-bridge/measuring/index.mjs +1 -1
- package/dist/layout-bridge/tableInsertHover.js +1 -1
- package/dist/layout-bridge/tableInsertHover.mjs +1 -1
- package/dist/layout-bridge/toFlowBlocks.d.mts +2 -1
- package/dist/layout-bridge/toFlowBlocks.d.ts +2 -1
- package/dist/layout-bridge/toFlowBlocks.js +1 -1
- package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
- package/dist/layout-engine/index.d.mts +4 -1
- package/dist/layout-engine/index.d.ts +4 -1
- package/dist/layout-engine/index.js +1 -1
- package/dist/layout-engine/index.mjs +1 -1
- package/dist/layout-engine/types.d.mts +74 -1
- package/dist/layout-engine/types.d.ts +74 -1
- package/dist/layout-painter/index.d.mts +4 -4
- package/dist/layout-painter/index.d.ts +4 -4
- package/dist/layout-painter/index.js +1 -1
- package/dist/layout-painter/index.mjs +1 -1
- package/dist/layout-painter/renderPage.d.mts +27 -4
- package/dist/layout-painter/renderPage.d.ts +27 -4
- package/dist/layout-painter/renderPage.js +1 -1
- package/dist/layout-painter/renderPage.mjs +1 -1
- package/dist/managers/AutoSaveManager.d.mts +1 -2
- package/dist/managers/AutoSaveManager.d.ts +1 -2
- package/dist/managers/TableSelectionManager.d.mts +1 -2
- package/dist/managers/TableSelectionManager.d.ts +1 -2
- package/dist/managers/types.d.mts +1 -2
- package/dist/managers/types.d.ts +1 -2
- package/dist/mcp-cli.mjs +23 -22
- package/dist/mcp.d.mts +1 -2
- package/dist/mcp.d.ts +1 -2
- package/dist/mcp.js +3 -3
- package/dist/mcp.mjs +1 -1
- package/dist/{nodes-D7PTUJ2N.d.ts → nodes-BNkRKBBX.d.ts} +64 -3
- package/dist/{nodes-CL8M0L-a.d.mts → nodes-Bz-UHhLE.d.mts} +64 -3
- package/dist/prosemirror/commands/formatting.js +1 -1
- package/dist/prosemirror/commands/formatting.mjs +1 -1
- package/dist/prosemirror/commands/index.d.mts +80 -6
- package/dist/prosemirror/commands/index.d.ts +80 -6
- package/dist/prosemirror/commands/index.js +1 -1
- package/dist/prosemirror/commands/index.mjs +1 -1
- package/dist/prosemirror/commands/paragraph.js +1 -1
- package/dist/prosemirror/commands/paragraph.mjs +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.d.mts +2 -3
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -3
- package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -1
- package/dist/prosemirror/conversion/index.d.mts +3 -4
- package/dist/prosemirror/conversion/index.d.ts +3 -4
- package/dist/prosemirror/conversion/index.js +1 -1
- package/dist/prosemirror/conversion/index.mjs +1 -1
- package/dist/prosemirror/editor.css +302 -95
- package/dist/prosemirror/extensions/index.js +1 -1
- package/dist/prosemirror/extensions/index.mjs +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.js +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.mjs +1 -1
- package/dist/prosemirror/index.d.mts +94 -7
- package/dist/prosemirror/index.d.ts +94 -7
- package/dist/prosemirror/index.js +3 -1
- package/dist/prosemirror/index.mjs +3 -1
- package/dist/prosemirror/plugins/index.d.mts +124 -17
- package/dist/prosemirror/plugins/index.d.ts +124 -17
- package/dist/prosemirror/plugins/index.js +1 -1
- package/dist/prosemirror/plugins/index.mjs +1 -1
- package/dist/prosemirror/schema/index.d.mts +3 -4
- package/dist/prosemirror/schema/index.d.ts +3 -4
- package/dist/prosemirror/schema/index.js +1 -1
- package/dist/prosemirror/schema/index.mjs +1 -1
- package/dist/prosemirror/styles/index.d.mts +9 -0
- package/dist/prosemirror/styles/index.d.ts +9 -0
- package/dist/prosemirror/styles/index.js +1 -1
- package/dist/prosemirror/styles/index.mjs +1 -1
- package/dist/prosemirror/utils/extractTrackedChanges.d.mts +44 -22
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +44 -22
- package/dist/prosemirror/utils/extractTrackedChanges.js +1 -1
- package/dist/prosemirror/utils/extractTrackedChanges.mjs +1 -1
- package/dist/types/content.d.mts +4 -1167
- package/dist/types/content.d.ts +4 -1167
- package/dist/types/document.d.mts +2 -4
- package/dist/types/document.d.ts +2 -4
- package/dist/utils/comments.d.mts +78 -5
- package/dist/utils/comments.d.ts +78 -5
- package/dist/utils/comments.js +1 -1
- package/dist/utils/comments.mjs +1 -1
- package/dist/utils/highlightColors.js +1 -1
- package/dist/utils/highlightColors.mjs +1 -1
- package/dist/utils/index.d.mts +2 -3
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.mjs +3 -3
- package/dist/{variableDetector-CAdt8yOr.d.mts → variableDetector-C7BLz9sJ.d.mts} +1 -1
- package/dist/{variableDetector-W4XEN9YC.d.ts → variableDetector-HPZbJ_gw.d.ts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-3AZWLVLC.js +0 -1
- package/dist/chunk-3NLVHZMT.js +0 -59
- package/dist/chunk-5SU4HPQS.mjs +0 -1
- package/dist/chunk-7PX32GLB.mjs +0 -1
- package/dist/chunk-AHXPHBMT.js +0 -1
- package/dist/chunk-B6LYBJ4H.mjs +0 -1
- package/dist/chunk-BFB4PRS4.mjs +0 -1
- package/dist/chunk-BRHHK4MG.mjs +0 -2
- package/dist/chunk-CP5OSG5Z.mjs +0 -1
- package/dist/chunk-CUXXRGPQ.mjs +0 -1
- package/dist/chunk-D4RPOJC7.js +0 -1
- package/dist/chunk-FWTP7BN7.mjs +0 -4
- package/dist/chunk-G7AKYAKU.mjs +0 -1
- package/dist/chunk-HAAMO2Z2.mjs +0 -1
- package/dist/chunk-ILJUDEZ5.mjs +0 -1
- package/dist/chunk-IN6IYQ2X.js +0 -1
- package/dist/chunk-IO6HZ7KR.js +0 -2
- package/dist/chunk-IP2VXNWG.js +0 -1
- package/dist/chunk-KBU6QQFU.js +0 -9
- package/dist/chunk-LBKMYD3M.mjs +0 -1
- package/dist/chunk-LDKESXXK.mjs +0 -3
- package/dist/chunk-MZOVDLYL.js +0 -1
- package/dist/chunk-N3EIZN65.js +0 -1
- package/dist/chunk-NBLJPT54.mjs +0 -1
- package/dist/chunk-NERY274X.js +0 -1
- package/dist/chunk-NNQWQOC5.mjs +0 -1
- package/dist/chunk-NO5LW2DQ.mjs +0 -1
- package/dist/chunk-OCAX2KJQ.js +0 -4
- package/dist/chunk-OTDF6PZK.js +0 -1
- package/dist/chunk-P3AXSRLG.mjs +0 -1
- package/dist/chunk-Q4CKLXWA.js +0 -1
- package/dist/chunk-QMLIXLZJ.mjs +0 -4
- package/dist/chunk-QXHL67FG.mjs +0 -1
- package/dist/chunk-TGPS3SRR.mjs +0 -1
- package/dist/chunk-TMISJEGL.js +0 -1
- package/dist/chunk-TRJWRZZD.js +0 -1
- package/dist/chunk-TRQN2SFW.mjs +0 -59
- package/dist/chunk-UGXSKZVM.js +0 -1
- package/dist/chunk-V435QKZB.js +0 -3
- package/dist/chunk-V6SWUCTS.js +0 -2
- package/dist/chunk-VQWZHPWI.mjs +0 -1
- package/dist/chunk-X3NB7STJ.js +0 -1
- package/dist/chunk-XOH7YAYL.js +0 -1
- package/dist/chunk-Y5HZAMND.mjs +0 -9
- package/dist/chunk-Y7I5QDCN.mjs +0 -1
- package/dist/chunk-YCDB5TA6.js +0 -4
- package/dist/chunk-YE357WVA.js +0 -1
- package/dist/chunk-YVYB4YCI.js +0 -1
- package/dist/lists-CvG_iVK3.d.mts +0 -148
- package/dist/lists-UTp_tk7B.d.ts +0 -148
|
@@ -15,26 +15,27 @@ export { schema } from './schema/index.mjs';
|
|
|
15
15
|
export { ToProseDocOptions, createEmptyDoc, footnoteToProseDoc, headerFooterToProseDoc, toProseDoc } from './conversion/index.mjs';
|
|
16
16
|
export { fromProseDoc, updateDocumentContent } from './conversion/fromProseDoc.mjs';
|
|
17
17
|
export { ResolvedParagraphStyle, StyleResolver, createStyleResolver } from './styles/index.mjs';
|
|
18
|
-
import { EditorState } from 'prosemirror-state';
|
|
18
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
19
19
|
export { TextSelection } from 'prosemirror-state';
|
|
20
20
|
import { T as TextFormatting, P as ParagraphFormatting } from '../formatting-BH4hcZiq.mjs';
|
|
21
21
|
export { SelectionChangeCallback, SelectionContext, createSelectionTrackerPlugin, extractSelectionContext, getSelectionContext, selectionTrackerKey } from './plugins/selectionTracker.mjs';
|
|
22
|
+
export { c as createDocumentStylesPlugin, d as documentStylesKey, g as getDocumentStyleResolver } from '../documentStyles-D87dxl18.mjs';
|
|
22
23
|
export { clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearTextColor, findHyperlinkRangeAt, getHyperlinkAttrs, getMarkAttr, getSelectedText, insertHyperlink, isHyperlinkActive, isMarkActive, removeHyperlink, setFontFamily, setFontSize, setHighlight, setHyperlink, setTextColor, toggleBold, toggleItalic, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline } from './commands/formatting.mjs';
|
|
23
24
|
export { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, decreaseIndent, decreaseListLevel, generateTOC, getListInfo, getParagraphAlignment, getParagraphBidi, getStyleId, increaseIndent, increaseListLevel, isInList, removeList, removeTabStop, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setRtl, toggleBulletList, toggleNumberedList } from './commands/paragraph.mjs';
|
|
24
25
|
export { a as addColumnLeft, b as addColumnRight, c as addRowAbove, d as addRowBelow, e as applyTableStyle, f as autoFitContents, g as deleteColumn, h as deleteRow, i as deleteTable, j as distributeColumns, k as insertTable, m as mergeCells, r as removeTableBorders, s as selectColumn, l as selectRow, n as selectTable, o as setAllTableBorders, p as setCellBorder, q as setCellFillColor, t as setCellMargins, u as setCellTextDirection, v as setCellVerticalAlign, w as setInsideTableBorders, x as setOutsideTableBorders, y as setRowHeight, z as setTableBorderColor, A as setTableBorderWidth, B as setTableBorders, C as setTableProperties, D as splitCell, E as toggleHeaderRow, F as toggleNoWrap } from '../table-_t_W8oQf.mjs';
|
|
25
26
|
export { insertPageBreak } from './commands/pageBreak.mjs';
|
|
26
|
-
export { I as ImageAttrs, P as ParagraphAttrs } from '../nodes-
|
|
27
|
+
export { I as ImageAttrs, P as ParagraphAttrs } from '../nodes-Bz-UHhLE.mjs';
|
|
28
|
+
import { Node } from 'prosemirror-model';
|
|
29
|
+
import { a as ContentControlFilter, f as ContentControlValue } from '../contentControlValues-DAwTWfgR.mjs';
|
|
30
|
+
import { t as SdtType, u as SdtProperties, v as SdtDataBinding } from '../content-CE-ZdMwG.mjs';
|
|
27
31
|
export { f as findParagraphByParaId, a as findStartPosForParaId } from '../findParagraphByParaId-Maw_8M5D.mjs';
|
|
28
32
|
export { LayoutSelectionGate } from './utils/LayoutSelectionGate.mjs';
|
|
29
33
|
export { B as BorderPreset, T as TableContextInfo, g as getTableContext, i as isInTable } from '../borders-BH_GoYU3.mjs';
|
|
30
34
|
export { F as FontFamilyAttrs, a as FontSizeAttrs, H as HyperlinkAttrs, T as TextColorAttrs, U as UnderlineAttrs } from '../marks-BY573yZn.mjs';
|
|
31
|
-
import 'prosemirror-model';
|
|
32
35
|
import '../types-RchZmPFN.mjs';
|
|
33
|
-
import '../types/document.mjs';
|
|
34
36
|
import '../colors-C3vA7HUU.mjs';
|
|
35
|
-
import '../lists-CvG_iVK3.mjs';
|
|
36
|
-
import '../types/content.mjs';
|
|
37
37
|
import '../docx/wrapTypes.mjs';
|
|
38
|
+
import '../types/document.mjs';
|
|
38
39
|
import '../styles-EI2lxeEN.mjs';
|
|
39
40
|
|
|
40
41
|
/**
|
|
@@ -68,4 +69,90 @@ interface SelectionState {
|
|
|
68
69
|
*/
|
|
69
70
|
declare function extractSelectionState(state: EditorState): SelectionState | null;
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
/**
|
|
73
|
+
* ProseMirror-level content-control (SDT) addressing for the live editor.
|
|
74
|
+
*
|
|
75
|
+
* The headless equivalents in `agent/contentControls` operate on the parsed
|
|
76
|
+
* Document model; these operate on the editor's PM state so the editor adapters
|
|
77
|
+
* (React/Vue) can discover and edit a control by tag without a full reload and
|
|
78
|
+
* with normal undo. Shared by both adapters to keep them in lockstep.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/** A control discovered in the PM doc, with its PM position for scroll/edit. */
|
|
82
|
+
interface PMContentControl {
|
|
83
|
+
tag?: string;
|
|
84
|
+
alias?: string;
|
|
85
|
+
id?: number;
|
|
86
|
+
sdtType: SdtType;
|
|
87
|
+
lock?: SdtProperties['lock'];
|
|
88
|
+
/** Whether the control is currently showing placeholder text. */
|
|
89
|
+
showingPlaceholder?: boolean;
|
|
90
|
+
/** Checkbox state, for checkbox controls. */
|
|
91
|
+
checked?: boolean;
|
|
92
|
+
/** Date format, for date controls. */
|
|
93
|
+
dateFormat?: string;
|
|
94
|
+
/** Dropdown/combobox list items, if modeled. */
|
|
95
|
+
listItems?: {
|
|
96
|
+
displayText: string;
|
|
97
|
+
value: string;
|
|
98
|
+
}[];
|
|
99
|
+
/** XML data binding (`w:dataBinding`), if the control is bound. */
|
|
100
|
+
dataBinding?: SdtDataBinding;
|
|
101
|
+
/** Current date value (ISO `yyyy-mm-dd`) for a date control, from `w:fullDate`. */
|
|
102
|
+
dateValue?: string;
|
|
103
|
+
/** Plain text of the control's content. */
|
|
104
|
+
text: string;
|
|
105
|
+
/** PM position of the `blockSdt` node (its `before` position). */
|
|
106
|
+
pos: number;
|
|
107
|
+
/** Nesting depth among content controls (0 = not inside another control). */
|
|
108
|
+
depth: number;
|
|
109
|
+
}
|
|
110
|
+
/** All block content controls in the PM doc (document order), optionally filtered. */
|
|
111
|
+
declare function findContentControlsInPM(doc: Node, filter?: ContentControlFilter): PMContentControl[];
|
|
112
|
+
/** PM position of the first control matching `filter`, or `null`. */
|
|
113
|
+
declare function findContentControlPos(doc: Node, filter: ContentControlFilter): number | null;
|
|
114
|
+
/**
|
|
115
|
+
* Build a transaction that replaces the first matching control's content with
|
|
116
|
+
* `text` (newlines become paragraphs; a `plainText` control stays one
|
|
117
|
+
* paragraph). Throws if nothing matches, the control is content-locked, a typed
|
|
118
|
+
* (dropdown/date/…) control, or data-bound (unless `force`). The control's
|
|
119
|
+
* identity/raw props are kept; a `w:showingPlcHdr` placeholder flag is cleared
|
|
120
|
+
* so the new content isn't rendered as placeholder.
|
|
121
|
+
*/
|
|
122
|
+
declare function setContentControlContentTr(state: EditorState, filter: ContentControlFilter, text: string, options?: {
|
|
123
|
+
force?: boolean;
|
|
124
|
+
}): Transaction;
|
|
125
|
+
/**
|
|
126
|
+
* Build a transaction that removes the first matching control. With
|
|
127
|
+
* `keepContent` the inner blocks are unwrapped in place; otherwise the whole
|
|
128
|
+
* region is deleted. Throws if nothing matches or the control is
|
|
129
|
+
* deletion-locked (unless `force`).
|
|
130
|
+
*/
|
|
131
|
+
declare function removeContentControlTr(state: EditorState, filter: ContentControlFilter, options?: {
|
|
132
|
+
force?: boolean;
|
|
133
|
+
keepContent?: boolean;
|
|
134
|
+
}): Transaction;
|
|
135
|
+
/**
|
|
136
|
+
* Build a transaction that applies a typed value (dropdown selection, checkbox
|
|
137
|
+
* toggle, or date) to the first control matching `filter`, updating both the
|
|
138
|
+
* visible content and the control's structured attrs (checked / raw w:sdtPr).
|
|
139
|
+
* Reuses the headless value-applier so the live editor and headless paths agree.
|
|
140
|
+
* Throws as the headless {@link setContentControlValue} does.
|
|
141
|
+
*/
|
|
142
|
+
declare function setContentControlValueTr(state: EditorState, filter: ContentControlFilter, value: ContentControlValue, options?: {
|
|
143
|
+
force?: boolean;
|
|
144
|
+
}): Transaction;
|
|
145
|
+
/**
|
|
146
|
+
* Build a transaction that adds a repeating-section item by cloning the item at
|
|
147
|
+
* `itemPos` (its blockSdt `before` position) and inserting the copy after it.
|
|
148
|
+
* Throws {@link RepeatingSectionError} if `itemPos` isn't a repeating item.
|
|
149
|
+
*/
|
|
150
|
+
declare function addRepeatingSectionItemTr(state: EditorState, itemPos: number): Transaction;
|
|
151
|
+
/**
|
|
152
|
+
* Build a transaction that removes the repeating-section item at `itemPos`.
|
|
153
|
+
* Throws {@link RepeatingSectionError} if it isn't an item or is the only one in
|
|
154
|
+
* its section.
|
|
155
|
+
*/
|
|
156
|
+
declare function removeRepeatingSectionItemTr(state: EditorState, itemPos: number): Transaction;
|
|
157
|
+
|
|
158
|
+
export { type PMContentControl, type SelectionState, addRepeatingSectionItemTr, extractSelectionState, findContentControlPos, findContentControlsInPM, removeContentControlTr, removeRepeatingSectionItemTr, setContentControlContentTr, setContentControlValueTr };
|
|
@@ -15,26 +15,27 @@ export { schema } from './schema/index.js';
|
|
|
15
15
|
export { ToProseDocOptions, createEmptyDoc, footnoteToProseDoc, headerFooterToProseDoc, toProseDoc } from './conversion/index.js';
|
|
16
16
|
export { fromProseDoc, updateDocumentContent } from './conversion/fromProseDoc.js';
|
|
17
17
|
export { ResolvedParagraphStyle, StyleResolver, createStyleResolver } from './styles/index.js';
|
|
18
|
-
import { EditorState } from 'prosemirror-state';
|
|
18
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
19
19
|
export { TextSelection } from 'prosemirror-state';
|
|
20
20
|
import { T as TextFormatting, P as ParagraphFormatting } from '../formatting-_OXU8gLB.js';
|
|
21
21
|
export { SelectionChangeCallback, SelectionContext, createSelectionTrackerPlugin, extractSelectionContext, getSelectionContext, selectionTrackerKey } from './plugins/selectionTracker.js';
|
|
22
|
+
export { c as createDocumentStylesPlugin, d as documentStylesKey, g as getDocumentStyleResolver } from '../documentStyles-DToJv9co.js';
|
|
22
23
|
export { clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearTextColor, findHyperlinkRangeAt, getHyperlinkAttrs, getMarkAttr, getSelectedText, insertHyperlink, isHyperlinkActive, isMarkActive, removeHyperlink, setFontFamily, setFontSize, setHighlight, setHyperlink, setTextColor, toggleBold, toggleItalic, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline } from './commands/formatting.js';
|
|
23
24
|
export { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, decreaseIndent, decreaseListLevel, generateTOC, getListInfo, getParagraphAlignment, getParagraphBidi, getStyleId, increaseIndent, increaseListLevel, isInList, removeList, removeTabStop, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setRtl, toggleBulletList, toggleNumberedList } from './commands/paragraph.js';
|
|
24
25
|
export { a as addColumnLeft, b as addColumnRight, c as addRowAbove, d as addRowBelow, e as applyTableStyle, f as autoFitContents, g as deleteColumn, h as deleteRow, i as deleteTable, j as distributeColumns, k as insertTable, m as mergeCells, r as removeTableBorders, s as selectColumn, l as selectRow, n as selectTable, o as setAllTableBorders, p as setCellBorder, q as setCellFillColor, t as setCellMargins, u as setCellTextDirection, v as setCellVerticalAlign, w as setInsideTableBorders, x as setOutsideTableBorders, y as setRowHeight, z as setTableBorderColor, A as setTableBorderWidth, B as setTableBorders, C as setTableProperties, D as splitCell, E as toggleHeaderRow, F as toggleNoWrap } from '../table-P8esKWAc.js';
|
|
25
26
|
export { insertPageBreak } from './commands/pageBreak.js';
|
|
26
|
-
export { I as ImageAttrs, P as ParagraphAttrs } from '../nodes-
|
|
27
|
+
export { I as ImageAttrs, P as ParagraphAttrs } from '../nodes-BNkRKBBX.js';
|
|
28
|
+
import { Node } from 'prosemirror-model';
|
|
29
|
+
import { a as ContentControlFilter, f as ContentControlValue } from '../contentControlValues-gyVPsi6m.js';
|
|
30
|
+
import { t as SdtType, u as SdtProperties, v as SdtDataBinding } from '../content-CYXJ2tfQ.js';
|
|
27
31
|
export { f as findParagraphByParaId, a as findStartPosForParaId } from '../findParagraphByParaId-Maw_8M5D.js';
|
|
28
32
|
export { LayoutSelectionGate } from './utils/LayoutSelectionGate.js';
|
|
29
33
|
export { B as BorderPreset, T as TableContextInfo, g as getTableContext, i as isInTable } from '../borders-Z9hPno2u.js';
|
|
30
34
|
export { F as FontFamilyAttrs, a as FontSizeAttrs, H as HyperlinkAttrs, T as TextColorAttrs, U as UnderlineAttrs } from '../marks-CjC9tF5k.js';
|
|
31
|
-
import 'prosemirror-model';
|
|
32
35
|
import '../types-RchZmPFN.js';
|
|
33
|
-
import '../types/document.js';
|
|
34
36
|
import '../colors-C3vA7HUU.js';
|
|
35
|
-
import '../lists-UTp_tk7B.js';
|
|
36
|
-
import '../types/content.js';
|
|
37
37
|
import '../docx/wrapTypes.js';
|
|
38
|
+
import '../types/document.js';
|
|
38
39
|
import '../styles-BBv7doYK.js';
|
|
39
40
|
|
|
40
41
|
/**
|
|
@@ -68,4 +69,90 @@ interface SelectionState {
|
|
|
68
69
|
*/
|
|
69
70
|
declare function extractSelectionState(state: EditorState): SelectionState | null;
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
/**
|
|
73
|
+
* ProseMirror-level content-control (SDT) addressing for the live editor.
|
|
74
|
+
*
|
|
75
|
+
* The headless equivalents in `agent/contentControls` operate on the parsed
|
|
76
|
+
* Document model; these operate on the editor's PM state so the editor adapters
|
|
77
|
+
* (React/Vue) can discover and edit a control by tag without a full reload and
|
|
78
|
+
* with normal undo. Shared by both adapters to keep them in lockstep.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/** A control discovered in the PM doc, with its PM position for scroll/edit. */
|
|
82
|
+
interface PMContentControl {
|
|
83
|
+
tag?: string;
|
|
84
|
+
alias?: string;
|
|
85
|
+
id?: number;
|
|
86
|
+
sdtType: SdtType;
|
|
87
|
+
lock?: SdtProperties['lock'];
|
|
88
|
+
/** Whether the control is currently showing placeholder text. */
|
|
89
|
+
showingPlaceholder?: boolean;
|
|
90
|
+
/** Checkbox state, for checkbox controls. */
|
|
91
|
+
checked?: boolean;
|
|
92
|
+
/** Date format, for date controls. */
|
|
93
|
+
dateFormat?: string;
|
|
94
|
+
/** Dropdown/combobox list items, if modeled. */
|
|
95
|
+
listItems?: {
|
|
96
|
+
displayText: string;
|
|
97
|
+
value: string;
|
|
98
|
+
}[];
|
|
99
|
+
/** XML data binding (`w:dataBinding`), if the control is bound. */
|
|
100
|
+
dataBinding?: SdtDataBinding;
|
|
101
|
+
/** Current date value (ISO `yyyy-mm-dd`) for a date control, from `w:fullDate`. */
|
|
102
|
+
dateValue?: string;
|
|
103
|
+
/** Plain text of the control's content. */
|
|
104
|
+
text: string;
|
|
105
|
+
/** PM position of the `blockSdt` node (its `before` position). */
|
|
106
|
+
pos: number;
|
|
107
|
+
/** Nesting depth among content controls (0 = not inside another control). */
|
|
108
|
+
depth: number;
|
|
109
|
+
}
|
|
110
|
+
/** All block content controls in the PM doc (document order), optionally filtered. */
|
|
111
|
+
declare function findContentControlsInPM(doc: Node, filter?: ContentControlFilter): PMContentControl[];
|
|
112
|
+
/** PM position of the first control matching `filter`, or `null`. */
|
|
113
|
+
declare function findContentControlPos(doc: Node, filter: ContentControlFilter): number | null;
|
|
114
|
+
/**
|
|
115
|
+
* Build a transaction that replaces the first matching control's content with
|
|
116
|
+
* `text` (newlines become paragraphs; a `plainText` control stays one
|
|
117
|
+
* paragraph). Throws if nothing matches, the control is content-locked, a typed
|
|
118
|
+
* (dropdown/date/…) control, or data-bound (unless `force`). The control's
|
|
119
|
+
* identity/raw props are kept; a `w:showingPlcHdr` placeholder flag is cleared
|
|
120
|
+
* so the new content isn't rendered as placeholder.
|
|
121
|
+
*/
|
|
122
|
+
declare function setContentControlContentTr(state: EditorState, filter: ContentControlFilter, text: string, options?: {
|
|
123
|
+
force?: boolean;
|
|
124
|
+
}): Transaction;
|
|
125
|
+
/**
|
|
126
|
+
* Build a transaction that removes the first matching control. With
|
|
127
|
+
* `keepContent` the inner blocks are unwrapped in place; otherwise the whole
|
|
128
|
+
* region is deleted. Throws if nothing matches or the control is
|
|
129
|
+
* deletion-locked (unless `force`).
|
|
130
|
+
*/
|
|
131
|
+
declare function removeContentControlTr(state: EditorState, filter: ContentControlFilter, options?: {
|
|
132
|
+
force?: boolean;
|
|
133
|
+
keepContent?: boolean;
|
|
134
|
+
}): Transaction;
|
|
135
|
+
/**
|
|
136
|
+
* Build a transaction that applies a typed value (dropdown selection, checkbox
|
|
137
|
+
* toggle, or date) to the first control matching `filter`, updating both the
|
|
138
|
+
* visible content and the control's structured attrs (checked / raw w:sdtPr).
|
|
139
|
+
* Reuses the headless value-applier so the live editor and headless paths agree.
|
|
140
|
+
* Throws as the headless {@link setContentControlValue} does.
|
|
141
|
+
*/
|
|
142
|
+
declare function setContentControlValueTr(state: EditorState, filter: ContentControlFilter, value: ContentControlValue, options?: {
|
|
143
|
+
force?: boolean;
|
|
144
|
+
}): Transaction;
|
|
145
|
+
/**
|
|
146
|
+
* Build a transaction that adds a repeating-section item by cloning the item at
|
|
147
|
+
* `itemPos` (its blockSdt `before` position) and inserting the copy after it.
|
|
148
|
+
* Throws {@link RepeatingSectionError} if `itemPos` isn't a repeating item.
|
|
149
|
+
*/
|
|
150
|
+
declare function addRepeatingSectionItemTr(state: EditorState, itemPos: number): Transaction;
|
|
151
|
+
/**
|
|
152
|
+
* Build a transaction that removes the repeating-section item at `itemPos`.
|
|
153
|
+
* Throws {@link RepeatingSectionError} if it isn't an item or is the only one in
|
|
154
|
+
* its section.
|
|
155
|
+
*/
|
|
156
|
+
declare function removeRepeatingSectionItemTr(state: EditorState, itemPos: number): Transaction;
|
|
157
|
+
|
|
158
|
+
export { type PMContentControl, type SelectionState, addRepeatingSectionItemTr, extractSelectionState, findContentControlPos, findContentControlsInPM, removeContentControlTr, removeRepeatingSectionItemTr, setContentControlContentTr, setContentControlValueTr };
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
'use strict';require('../chunk-TRJWRZZD.js');var chunk4GER4JLW_js=require('../chunk-4GER4JLW.js'),chunkI6PMX4BO_js=require('../chunk-I6PMX4BO.js');require('../chunk-UQ6WNWXX.js');var chunkYE357WVA_js=require('../chunk-YE357WVA.js'),chunkX3NB7STJ_js=require('../chunk-X3NB7STJ.js');require('../chunk-D4RPOJC7.js');var chunkIP2VXNWG_js=require('../chunk-IP2VXNWG.js');require('../chunk-JFZIXFRC.js'),require('../chunk-MZOVDLYL.js'),require('../chunk-EPX7BBJD.js'),require('../chunk-D536HC5M.js'),require('../chunk-TMISJEGL.js');var chunkXOH7YAYL_js=require('../chunk-XOH7YAYL.js'),chunkXBHF5Q2F_js=require('../chunk-XBHF5Q2F.js'),chunkSAFW7UQZ_js=require('../chunk-SAFW7UQZ.js'),chunkGGPKPXON_js=require('../chunk-GGPKPXON.js');require('../chunk-2KHWHVTA.js');var chunkYVYB4YCI_js=require('../chunk-YVYB4YCI.js'),chunkIO6HZ7KR_js=require('../chunk-IO6HZ7KR.js');require('../chunk-BHBOAP6Z.js'),require('../chunk-MZ7LW5CH.js'),require('../chunk-N3Y5BUKV.js');var chunk6LVPRTB6_js=require('../chunk-6LVPRTB6.js'),chunkNERY274X_js=require('../chunk-NERY274X.js');require('../chunk-MJ5FQX7Q.js'),require('../chunk-C2BAPYGJ.js'),require('../chunk-Q4CKLXWA.js'),require('../chunk-4Q2IP5FW.js'),require('../chunk-DC7S76ZX.js');var prosemirrorState=require('prosemirror-state');function fe(i){let{selection:l,doc:s}=i,{from:g,to:h,empty:u}=l,b=s.resolve(g),o=0,n=0;s.forEach((a,m,f)=>{m<=g&&(o=f),m<=h&&(n=f);});let e={},t=b.parent,S=t.type.name==="paragraph"&&t.textContent.length===0,c=t.attrs?.defaultTextFormatting,p=i.storedMarks||l.$from.marks();S&&p.length===0&&c&&(e={...c});for(let a of p)switch(a.type.name){case "bold":e.bold=true;break;case "italic":e.italic=true;break;case "underline":e.underline={style:a.attrs.style||"single",color:a.attrs.color};break;case "strike":a.attrs.double?e.doubleStrike=true:e.strike=true;break;case "textColor":e.color={rgb:a.attrs.rgb,themeColor:a.attrs.themeColor};break;case "highlight":e.highlight=a.attrs.color;break;case "fontSize":e.fontSize=a.attrs.size;break;case "fontFamily":e.fontFamily={ascii:a.attrs.ascii,hAnsi:a.attrs.hAnsi};break;case "superscript":e.vertAlign="superscript";break;case "subscript":e.vertAlign="subscript";break}let r={},d=null;return t.type.name==="paragraph"&&(t.attrs.alignment&&(r.alignment=t.attrs.alignment),t.attrs.lineSpacing&&(r.lineSpacing=t.attrs.lineSpacing,r.lineSpacingRule=t.attrs.lineSpacingRule),t.attrs.numPr&&(r.numPr=t.attrs.numPr),t.attrs.indentLeft&&(r.indentLeft=t.attrs.indentLeft),t.attrs.indentRight&&(r.indentRight=t.attrs.indentRight),t.attrs.indentFirstLine&&(r.indentFirstLine=t.attrs.indentFirstLine),t.attrs.hangingIndent&&(r.hangingIndent=t.attrs.hangingIndent),t.attrs.tabs&&(r.tabs=t.attrs.tabs),t.attrs.bidi&&(r.bidi=true),t.attrs.styleId&&(d=t.attrs.styleId)),{hasSelection:!u,isMultiParagraph:o!==n,textFormatting:e,paragraphFormatting:r,styleId:d,startParagraphIndex:o,endParagraphIndex:n}}Object.defineProperty(exports,"LayoutSelectionGate",{enumerable:true,get:function(){return chunk4GER4JLW_js.a}});Object.defineProperty(exports,"findParagraphByParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.b}});Object.defineProperty(exports,"findStartPosForParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.a}});Object.defineProperty(exports,"fromProseDoc",{enumerable:true,get:function(){return chunkYE357WVA_js.a}});Object.defineProperty(exports,"updateDocumentContent",{enumerable:true,get:function(){return chunkYE357WVA_js.b}});Object.defineProperty(exports,"createEmptyDoc",{enumerable:true,get:function(){return chunkX3NB7STJ_js.d}});Object.defineProperty(exports,"footnoteToProseDoc",{enumerable:true,get:function(){return chunkX3NB7STJ_js.c}});Object.defineProperty(exports,"headerFooterToProseDoc",{enumerable:true,get:function(){return chunkX3NB7STJ_js.b}});Object.defineProperty(exports,"toProseDoc",{enumerable:true,get:function(){return chunkX3NB7STJ_js.a}});Object.defineProperty(exports,"StyleResolver",{enumerable:true,get:function(){return chunkIP2VXNWG_js.a}});Object.defineProperty(exports,"createStyleResolver",{enumerable:true,get:function(){return chunkIP2VXNWG_js.b}});Object.defineProperty(exports,"addColumnLeft",{enumerable:true,get:function(){return chunkXOH7YAYL_js.g}});Object.defineProperty(exports,"addColumnRight",{enumerable:true,get:function(){return chunkXOH7YAYL_js.h}});Object.defineProperty(exports,"addRowAbove",{enumerable:true,get:function(){return chunkXOH7YAYL_js.d}});Object.defineProperty(exports,"addRowBelow",{enumerable:true,get:function(){return chunkXOH7YAYL_js.e}});Object.defineProperty(exports,"applyTableStyle",{enumerable:true,get:function(){return chunkXOH7YAYL_js.E}});Object.defineProperty(exports,"autoFitContents",{enumerable:true,get:function(){return chunkXOH7YAYL_js.C}});Object.defineProperty(exports,"deleteColumn",{enumerable:true,get:function(){return chunkXOH7YAYL_js.i}});Object.defineProperty(exports,"deleteRow",{enumerable:true,get:function(){return chunkXOH7YAYL_js.f}});Object.defineProperty(exports,"deleteTable",{enumerable:true,get:function(){return chunkXOH7YAYL_js.j}});Object.defineProperty(exports,"distributeColumns",{enumerable:true,get:function(){return chunkXOH7YAYL_js.B}});Object.defineProperty(exports,"insertTable",{enumerable:true,get:function(){return chunkXOH7YAYL_js.c}});Object.defineProperty(exports,"mergeCells",{enumerable:true,get:function(){return chunkXOH7YAYL_js.n}});Object.defineProperty(exports,"removeTableBorders",{enumerable:true,get:function(){return chunkXOH7YAYL_js.r}});Object.defineProperty(exports,"selectColumn",{enumerable:true,get:function(){return chunkXOH7YAYL_js.m}});Object.defineProperty(exports,"selectRow",{enumerable:true,get:function(){return chunkXOH7YAYL_js.l}});Object.defineProperty(exports,"selectTable",{enumerable:true,get:function(){return chunkXOH7YAYL_js.k}});Object.defineProperty(exports,"setAllTableBorders",{enumerable:true,get:function(){return chunkXOH7YAYL_js.s}});Object.defineProperty(exports,"setCellBorder",{enumerable:true,get:function(){return chunkXOH7YAYL_js.p}});Object.defineProperty(exports,"setCellFillColor",{enumerable:true,get:function(){return chunkXOH7YAYL_js.F}});Object.defineProperty(exports,"setCellMargins",{enumerable:true,get:function(){return chunkXOH7YAYL_js.w}});Object.defineProperty(exports,"setCellTextDirection",{enumerable:true,get:function(){return chunkXOH7YAYL_js.x}});Object.defineProperty(exports,"setCellVerticalAlign",{enumerable:true,get:function(){return chunkXOH7YAYL_js.v}});Object.defineProperty(exports,"setInsideTableBorders",{enumerable:true,get:function(){return chunkXOH7YAYL_js.u}});Object.defineProperty(exports,"setOutsideTableBorders",{enumerable:true,get:function(){return chunkXOH7YAYL_js.t}});Object.defineProperty(exports,"setRowHeight",{enumerable:true,get:function(){return chunkXOH7YAYL_js.z}});Object.defineProperty(exports,"setTableBorderColor",{enumerable:true,get:function(){return chunkXOH7YAYL_js.G}});Object.defineProperty(exports,"setTableBorderWidth",{enumerable:true,get:function(){return chunkXOH7YAYL_js.H}});Object.defineProperty(exports,"setTableBorders",{enumerable:true,get:function(){return chunkXOH7YAYL_js.q}});Object.defineProperty(exports,"setTableProperties",{enumerable:true,get:function(){return chunkXOH7YAYL_js.D}});Object.defineProperty(exports,"splitCell",{enumerable:true,get:function(){return chunkXOH7YAYL_js.o}});Object.defineProperty(exports,"toggleHeaderRow",{enumerable:true,get:function(){return chunkXOH7YAYL_js.A}});Object.defineProperty(exports,"toggleNoWrap",{enumerable:true,get:function(){return chunkXOH7YAYL_js.y}});Object.defineProperty(exports,"addTabStop",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.z}});Object.defineProperty(exports,"alignCenter",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.c}});Object.defineProperty(exports,"alignJustify",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.e}});Object.defineProperty(exports,"alignLeft",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.b}});Object.defineProperty(exports,"alignRight",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.d}});Object.defineProperty(exports,"applyStyle",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.v}});Object.defineProperty(exports,"clearStyle",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.w}});Object.defineProperty(exports,"decreaseIndent",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.k}});Object.defineProperty(exports,"decreaseListLevel",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.r}});Object.defineProperty(exports,"generateTOC",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.D}});Object.defineProperty(exports,"increaseIndent",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.j}});Object.defineProperty(exports,"increaseListLevel",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.q}});Object.defineProperty(exports,"removeList",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.s}});Object.defineProperty(exports,"removeTabStop",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.A}});Object.defineProperty(exports,"setAlignment",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.a}});Object.defineProperty(exports,"setIndentFirstLine",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.n}});Object.defineProperty(exports,"setIndentLeft",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.l}});Object.defineProperty(exports,"setIndentRight",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.m}});Object.defineProperty(exports,"setLineSpacing",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.f}});Object.defineProperty(exports,"setLtr",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.C}});Object.defineProperty(exports,"setRtl",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.B}});Object.defineProperty(exports,"toggleBulletList",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.o}});Object.defineProperty(exports,"toggleNumberedList",{enumerable:true,get:function(){return chunkXBHF5Q2F_js.p}});Object.defineProperty(exports,"clearFontFamily",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.o}});Object.defineProperty(exports,"clearFontSize",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.m}});Object.defineProperty(exports,"clearHighlight",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.k}});Object.defineProperty(exports,"clearTextColor",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.i}});Object.defineProperty(exports,"insertHyperlink",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.s}});Object.defineProperty(exports,"removeHyperlink",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.r}});Object.defineProperty(exports,"setFontFamily",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.n}});Object.defineProperty(exports,"setFontSize",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.l}});Object.defineProperty(exports,"setHighlight",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.j}});Object.defineProperty(exports,"setHyperlink",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.q}});Object.defineProperty(exports,"setTextColor",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.h}});Object.defineProperty(exports,"toggleBold",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.b}});Object.defineProperty(exports,"toggleItalic",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.c}});Object.defineProperty(exports,"toggleStrike",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.e}});Object.defineProperty(exports,"toggleSubscript",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.g}});Object.defineProperty(exports,"toggleSuperscript",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.f}});Object.defineProperty(exports,"toggleUnderline",{enumerable:true,get:function(){return chunkSAFW7UQZ_js.d}});Object.defineProperty(exports,"insertPageBreak",{enumerable:true,get:function(){return chunkGGPKPXON_js.a}});Object.defineProperty(exports,"schema",{enumerable:true,get:function(){return chunkYVYB4YCI_js.b}});Object.defineProperty(exports,"clearFormatting",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.h}});Object.defineProperty(exports,"findHyperlinkRangeAt",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.n}});Object.defineProperty(exports,"getHyperlinkAttrs",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.l}});Object.defineProperty(exports,"getListInfo",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.p}});Object.defineProperty(exports,"getMarkAttr",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.f}});Object.defineProperty(exports,"getParagraphAlignment",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.a}});Object.defineProperty(exports,"getParagraphBidi",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.d}});Object.defineProperty(exports,"getSelectedText",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.m}});Object.defineProperty(exports,"getStyleId",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.c}});Object.defineProperty(exports,"isHyperlinkActive",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.k}});Object.defineProperty(exports,"isInList",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.o}});Object.defineProperty(exports,"isMarkActive",{enumerable:true,get:function(){return chunkIO6HZ7KR_js.e}});Object.defineProperty(exports,"createSelectionTrackerPlugin",{enumerable:true,get:function(){return chunk6LVPRTB6_js.c}});Object.defineProperty(exports,"extractSelectionContext",{enumerable:true,get:function(){return chunk6LVPRTB6_js.b}});Object.defineProperty(exports,"getSelectionContext",{enumerable:true,get:function(){return chunk6LVPRTB6_js.d}});Object.defineProperty(exports,"selectionTrackerKey",{enumerable:true,get:function(){return chunk6LVPRTB6_js.a}});Object.defineProperty(exports,"getTableContext",{enumerable:true,get:function(){return chunkNERY274X_js.e}});Object.defineProperty(exports,"isInTable",{enumerable:true,get:function(){return chunkNERY274X_js.f}});Object.defineProperty(exports,"TextSelection",{enumerable:true,get:function(){return prosemirrorState.TextSelection}});exports.extractSelectionState=fe;
|
|
1
|
+
'use strict';require('../chunk-53VKL6CG.js');var chunk4GER4JLW_js=require('../chunk-4GER4JLW.js'),chunkI6PMX4BO_js=require('../chunk-I6PMX4BO.js'),chunkFO6IX2DB_js=require('../chunk-FO6IX2DB.js');require('../chunk-UQ6WNWXX.js');var chunkPVAVS3IU_js=require('../chunk-PVAVS3IU.js'),chunkZBFNOJGY_js=require('../chunk-ZBFNOJGY.js'),chunkC45EFOVP_js=require('../chunk-C45EFOVP.js');require('../chunk-ISKTBM4L.js'),require('../chunk-JFZIXFRC.js'),require('../chunk-E4JMCA5X.js'),require('../chunk-HQPWFUP5.js'),require('../chunk-DV6GWBUJ.js');var chunkU4XMGWF7_js=require('../chunk-U4XMGWF7.js'),chunkBXWOLARZ_js=require('../chunk-BXWOLARZ.js'),chunkTHLJYXFB_js=require('../chunk-THLJYXFB.js'),chunkGGPKPXON_js=require('../chunk-GGPKPXON.js');require('../chunk-2KHWHVTA.js'),require('../chunk-IYKBX24M.js');var chunkVMRUBLPI_js=require('../chunk-VMRUBLPI.js'),chunk2EQGBVPV_js=require('../chunk-2EQGBVPV.js');require('../chunk-BHBOAP6Z.js'),require('../chunk-MZ7LW5CH.js'),require('../chunk-N3Y5BUKV.js');var chunkWVERBZZU_js=require('../chunk-WVERBZZU.js'),chunk6LVPRTB6_js=require('../chunk-6LVPRTB6.js'),chunkLWH66Q7Q_js=require('../chunk-LWH66Q7Q.js'),chunkTUIEV7Q7_js=require('../chunk-TUIEV7Q7.js');require('../chunk-7HANRHHL.js'),require('../chunk-MJ5FQX7Q.js'),require('../chunk-C2BAPYGJ.js'),require('../chunk-4Q2IP5FW.js'),require('../chunk-GSKMHXHG.js'),require('../chunk-DC7S76ZX.js');var prosemirrorState=require('prosemirror-state');function Xe(t){let{selection:n,doc:r}=t,{from:e,to:a,empty:i}=n,s=r.resolve(e),d=0,g=0;r.forEach((p,S,y)=>{S<=e&&(d=y),S<=a&&(g=y);});let l={},o=s.parent,h=o.type.name==="paragraph"&&o.textContent.length===0,u=o.attrs?.defaultTextFormatting,m=t.storedMarks||n.$from.marks();h&&m.length===0&&u&&(l={...u});for(let p of m)switch(p.type.name){case "bold":l.bold=true;break;case "italic":l.italic=true;break;case "underline":l.underline={style:p.attrs.style||"single",color:p.attrs.color};break;case "strike":p.attrs.double?l.doubleStrike=true:l.strike=true;break;case "textColor":l.color={rgb:p.attrs.rgb,themeColor:p.attrs.themeColor};break;case "highlight":l.highlight=p.attrs.color;break;case "fontSize":l.fontSize=p.attrs.size;break;case "fontFamily":l.fontFamily={ascii:p.attrs.ascii,hAnsi:p.attrs.hAnsi};break;case "superscript":l.vertAlign="superscript";break;case "subscript":l.vertAlign="subscript";break}let c={},f=null;return o.type.name==="paragraph"&&(o.attrs.alignment&&(c.alignment=o.attrs.alignment),o.attrs.lineSpacing&&(c.lineSpacing=o.attrs.lineSpacing,c.lineSpacingRule=o.attrs.lineSpacingRule),o.attrs.numPr&&(c.numPr=o.attrs.numPr),o.attrs.indentLeft&&(c.indentLeft=o.attrs.indentLeft),o.attrs.indentRight&&(c.indentRight=o.attrs.indentRight),o.attrs.indentFirstLine&&(c.indentFirstLine=o.attrs.indentFirstLine),o.attrs.hangingIndent&&(c.hangingIndent=o.attrs.hangingIndent),o.attrs.tabs&&(c.tabs=o.attrs.tabs),o.attrs.bidi&&(c.bidi=true),o.attrs.styleId&&(f=o.attrs.styleId)),{hasSelection:!i,isMultiParagraph:d!==g,textFormatting:l,paragraphFormatting:c,styleId:f,startParagraphIndex:d,endParagraphIndex:g}}function D(t){if(!(typeof t!="string"||!t))try{return JSON.parse(t)}catch{return}}function X(t,n){return !(n.tag!==void 0&&t.tag!==n.tag||n.alias!==void 0&&t.alias!==n.alias||n.id!==void 0&&t.id!==n.id||n.type!==void 0&&(t.sdtType??"richText")!==n.type)}function ze(t,n,r){let e=t.attrs;return {tag:e.tag!=null?String(e.tag):void 0,alias:e.alias!=null?String(e.alias):void 0,id:typeof e.id=="number"?e.id:void 0,sdtType:e.sdtType??"richText",lock:e.lock??void 0,showingPlaceholder:e.showingPlaceholder===true?true:void 0,checked:typeof e.checked=="boolean"?e.checked:void 0,dateFormat:e.dateFormat!=null?String(e.dateFormat):void 0,listItems:D(e.listItems),dataBinding:D(e.dataBinding),dateValue:/<w:date\b[^>]*\bw:fullDate="(\d{4}-\d{2}-\d{2})/.exec(String(e.rawPropertiesXml??""))?.[1],text:t.textBetween(0,t.content.size,`
|
|
2
|
+
`),pos:n,depth:r}}function z(t,n={}){let r=[],e=(a,i,s)=>{a.forEach((d,g)=>{let l=i+g,o=d.type.name==="blockSdt";o&&X(d.attrs,n)&&r.push(ze(d,l,s)),e(d,l+1,o?s+1:s);});};return e(t,0,0),r}function He(t,n){return z(t,n)[0]?.pos??null}function F(t,n){let r=null;return t.descendants((e,a)=>r?false:e.type.name==="blockSdt"&&X(e.attrs,n)?(r={node:e,pos:a},false):true),r}function Je(t,n,r,e={}){let a=F(t.doc,n);if(!a)throw new chunkFO6IX2DB_js.z(n);let i=a.node.attrs;if(!e.force&&chunkFO6IX2DB_js.E(i.lock))throw new chunkFO6IX2DB_js.A(i.lock,"edit");let s=i.sdtType??"richText";if(!e.force&&!chunkFO6IX2DB_js.D(s))throw new chunkFO6IX2DB_js.B(s);if(!e.force&&i.dataBinding!=null)throw new chunkFO6IX2DB_js.C;let{schema:d}=t,l=(s==="plainText"?[r]:r.split(`
|
|
3
|
+
`)).map(m=>d.nodes.paragraph.create(null,m?d.text(m):null)),o=a.pos+1,h=a.pos+1+a.node.content.size,u=t.tr.replaceWith(o,h,l);return (i.showingPlaceholder||/showingPlcHdr/.test(String(i.rawPropertiesXml??"")))&&u.setNodeMarkup(a.pos,void 0,{...i,showingPlaceholder:false,rawPropertiesXml:chunkFO6IX2DB_js.H(i.rawPropertiesXml==null?void 0:String(i.rawPropertiesXml))}),u}function Ve(t,n,r={}){let e=F(t.doc,n);if(!e)throw new chunkFO6IX2DB_js.z(n);let a=e.node.attrs.lock;if(!r.force&&chunkFO6IX2DB_js.F(a))throw new chunkFO6IX2DB_js.A(a,"remove");if(r.keepContent&&!r.force&&/<w15:repeatingSection(Item)?[\s/>]/.test(String(e.node.attrs.rawPropertiesXml??"")))throw new chunkFO6IX2DB_js.A(a,"remove");let i=e.pos,s=e.pos+e.node.nodeSize;return r.keepContent?t.tr.replaceWith(i,s,e.node.content):t.tr.delete(i,s)}function Oe(t,n,r,e={}){let a=F(t.doc,n);if(!a)throw new chunkFO6IX2DB_js.z(n);let i=chunkC45EFOVP_js.b(a.node.attrs);if(!e.force&&chunkFO6IX2DB_js.E(i.lock))throw new chunkFO6IX2DB_js.A(i.lock,"edit");if(!e.force&&chunkFO6IX2DB_js.G(i))throw new chunkFO6IX2DB_js.C;let{properties:s,content:d}=chunkFO6IX2DB_js.M(i,r),{schema:g}=t,l=g.marks.fontFamily,o=d.map(c=>{if(c.type!=="paragraph")return g.nodes.paragraph.create(null,null);let f=c.content.find(b=>b.type==="run"),p=f?.type==="run"?f.content.map(b=>"text"in b?b.text:"").join(""):"",S=f?.type==="run"?f.formatting?.fontFamily:void 0,y=S&&l?[l.create(S)]:void 0;return g.nodes.paragraph.create(null,p?g.text(p,y):null)}),h=a.pos+1,u=a.pos+1+a.node.content.size,m=t.tr.replaceWith(h,u,o);return m.setNodeMarkup(a.pos,void 0,{...a.node.attrs,...chunkC45EFOVP_js.a(s)}),m}function We(t){let n=0;return t.descendants(r=>(r.type.name==="blockSdt"&&typeof r.attrs.id=="number"&&(n=Math.max(n,r.attrs.id)),true)),n}function $e(t,n,r){let e=r,a=n.toJSON(),i=s=>{if(s.type==="blockSdt"&&s.attrs){let d=++e;s.attrs={...s.attrs,id:d,rawPropertiesXml:chunkFO6IX2DB_js.S(s.attrs.rawPropertiesXml==null?void 0:String(s.attrs.rawPropertiesXml),d)};}s.content?.forEach(i);};return i(a),t.nodeFromJSON(a)}function je(t,n){let r=t.doc.nodeAt(n);if(!r||r.type.name!=="blockSdt"||!chunkFO6IX2DB_js.O(String(r.attrs.rawPropertiesXml??"")))throw new chunkFO6IX2DB_js.R("Position is not a repeating-section item.");let e=$e(t.schema,r,We(t.doc));return t.tr.insert(n+r.nodeSize,e)}function Ke(t,n){let r=t.doc.nodeAt(n);if(!r||r.type.name!=="blockSdt"||!chunkFO6IX2DB_js.O(String(r.attrs.rawPropertiesXml??"")))throw new chunkFO6IX2DB_js.R("Position is not a repeating-section item.");let a=t.doc.resolve(n).parent,i=0;if(a.forEach(s=>{s.type.name==="blockSdt"&&chunkFO6IX2DB_js.O(String(s.attrs.rawPropertiesXml??""))&&(i+=1);}),i<=1)throw new chunkFO6IX2DB_js.R("Cannot remove the last item of a repeating section.");return t.tr.delete(n,n+r.nodeSize)}Object.defineProperty(exports,"LayoutSelectionGate",{enumerable:true,get:function(){return chunk4GER4JLW_js.a}});Object.defineProperty(exports,"findParagraphByParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.b}});Object.defineProperty(exports,"findStartPosForParaId",{enumerable:true,get:function(){return chunkI6PMX4BO_js.a}});Object.defineProperty(exports,"fromProseDoc",{enumerable:true,get:function(){return chunkPVAVS3IU_js.a}});Object.defineProperty(exports,"updateDocumentContent",{enumerable:true,get:function(){return chunkPVAVS3IU_js.b}});Object.defineProperty(exports,"createEmptyDoc",{enumerable:true,get:function(){return chunkZBFNOJGY_js.d}});Object.defineProperty(exports,"footnoteToProseDoc",{enumerable:true,get:function(){return chunkZBFNOJGY_js.c}});Object.defineProperty(exports,"headerFooterToProseDoc",{enumerable:true,get:function(){return chunkZBFNOJGY_js.b}});Object.defineProperty(exports,"toProseDoc",{enumerable:true,get:function(){return chunkZBFNOJGY_js.a}});Object.defineProperty(exports,"addColumnLeft",{enumerable:true,get:function(){return chunkU4XMGWF7_js.g}});Object.defineProperty(exports,"addColumnRight",{enumerable:true,get:function(){return chunkU4XMGWF7_js.h}});Object.defineProperty(exports,"addRowAbove",{enumerable:true,get:function(){return chunkU4XMGWF7_js.d}});Object.defineProperty(exports,"addRowBelow",{enumerable:true,get:function(){return chunkU4XMGWF7_js.e}});Object.defineProperty(exports,"applyTableStyle",{enumerable:true,get:function(){return chunkU4XMGWF7_js.E}});Object.defineProperty(exports,"autoFitContents",{enumerable:true,get:function(){return chunkU4XMGWF7_js.C}});Object.defineProperty(exports,"deleteColumn",{enumerable:true,get:function(){return chunkU4XMGWF7_js.i}});Object.defineProperty(exports,"deleteRow",{enumerable:true,get:function(){return chunkU4XMGWF7_js.f}});Object.defineProperty(exports,"deleteTable",{enumerable:true,get:function(){return chunkU4XMGWF7_js.j}});Object.defineProperty(exports,"distributeColumns",{enumerable:true,get:function(){return chunkU4XMGWF7_js.B}});Object.defineProperty(exports,"insertTable",{enumerable:true,get:function(){return chunkU4XMGWF7_js.c}});Object.defineProperty(exports,"mergeCells",{enumerable:true,get:function(){return chunkU4XMGWF7_js.n}});Object.defineProperty(exports,"removeTableBorders",{enumerable:true,get:function(){return chunkU4XMGWF7_js.r}});Object.defineProperty(exports,"selectColumn",{enumerable:true,get:function(){return chunkU4XMGWF7_js.m}});Object.defineProperty(exports,"selectRow",{enumerable:true,get:function(){return chunkU4XMGWF7_js.l}});Object.defineProperty(exports,"selectTable",{enumerable:true,get:function(){return chunkU4XMGWF7_js.k}});Object.defineProperty(exports,"setAllTableBorders",{enumerable:true,get:function(){return chunkU4XMGWF7_js.s}});Object.defineProperty(exports,"setCellBorder",{enumerable:true,get:function(){return chunkU4XMGWF7_js.p}});Object.defineProperty(exports,"setCellFillColor",{enumerable:true,get:function(){return chunkU4XMGWF7_js.F}});Object.defineProperty(exports,"setCellMargins",{enumerable:true,get:function(){return chunkU4XMGWF7_js.w}});Object.defineProperty(exports,"setCellTextDirection",{enumerable:true,get:function(){return chunkU4XMGWF7_js.x}});Object.defineProperty(exports,"setCellVerticalAlign",{enumerable:true,get:function(){return chunkU4XMGWF7_js.v}});Object.defineProperty(exports,"setInsideTableBorders",{enumerable:true,get:function(){return chunkU4XMGWF7_js.u}});Object.defineProperty(exports,"setOutsideTableBorders",{enumerable:true,get:function(){return chunkU4XMGWF7_js.t}});Object.defineProperty(exports,"setRowHeight",{enumerable:true,get:function(){return chunkU4XMGWF7_js.z}});Object.defineProperty(exports,"setTableBorderColor",{enumerable:true,get:function(){return chunkU4XMGWF7_js.G}});Object.defineProperty(exports,"setTableBorderWidth",{enumerable:true,get:function(){return chunkU4XMGWF7_js.H}});Object.defineProperty(exports,"setTableBorders",{enumerable:true,get:function(){return chunkU4XMGWF7_js.q}});Object.defineProperty(exports,"setTableProperties",{enumerable:true,get:function(){return chunkU4XMGWF7_js.D}});Object.defineProperty(exports,"splitCell",{enumerable:true,get:function(){return chunkU4XMGWF7_js.o}});Object.defineProperty(exports,"toggleHeaderRow",{enumerable:true,get:function(){return chunkU4XMGWF7_js.A}});Object.defineProperty(exports,"toggleNoWrap",{enumerable:true,get:function(){return chunkU4XMGWF7_js.y}});Object.defineProperty(exports,"addTabStop",{enumerable:true,get:function(){return chunkBXWOLARZ_js.z}});Object.defineProperty(exports,"alignCenter",{enumerable:true,get:function(){return chunkBXWOLARZ_js.c}});Object.defineProperty(exports,"alignJustify",{enumerable:true,get:function(){return chunkBXWOLARZ_js.e}});Object.defineProperty(exports,"alignLeft",{enumerable:true,get:function(){return chunkBXWOLARZ_js.b}});Object.defineProperty(exports,"alignRight",{enumerable:true,get:function(){return chunkBXWOLARZ_js.d}});Object.defineProperty(exports,"applyStyle",{enumerable:true,get:function(){return chunkBXWOLARZ_js.v}});Object.defineProperty(exports,"clearStyle",{enumerable:true,get:function(){return chunkBXWOLARZ_js.w}});Object.defineProperty(exports,"decreaseIndent",{enumerable:true,get:function(){return chunkBXWOLARZ_js.k}});Object.defineProperty(exports,"decreaseListLevel",{enumerable:true,get:function(){return chunkBXWOLARZ_js.r}});Object.defineProperty(exports,"generateTOC",{enumerable:true,get:function(){return chunkBXWOLARZ_js.D}});Object.defineProperty(exports,"increaseIndent",{enumerable:true,get:function(){return chunkBXWOLARZ_js.j}});Object.defineProperty(exports,"increaseListLevel",{enumerable:true,get:function(){return chunkBXWOLARZ_js.q}});Object.defineProperty(exports,"removeList",{enumerable:true,get:function(){return chunkBXWOLARZ_js.s}});Object.defineProperty(exports,"removeTabStop",{enumerable:true,get:function(){return chunkBXWOLARZ_js.A}});Object.defineProperty(exports,"setAlignment",{enumerable:true,get:function(){return chunkBXWOLARZ_js.a}});Object.defineProperty(exports,"setIndentFirstLine",{enumerable:true,get:function(){return chunkBXWOLARZ_js.n}});Object.defineProperty(exports,"setIndentLeft",{enumerable:true,get:function(){return chunkBXWOLARZ_js.l}});Object.defineProperty(exports,"setIndentRight",{enumerable:true,get:function(){return chunkBXWOLARZ_js.m}});Object.defineProperty(exports,"setLineSpacing",{enumerable:true,get:function(){return chunkBXWOLARZ_js.f}});Object.defineProperty(exports,"setLtr",{enumerable:true,get:function(){return chunkBXWOLARZ_js.C}});Object.defineProperty(exports,"setRtl",{enumerable:true,get:function(){return chunkBXWOLARZ_js.B}});Object.defineProperty(exports,"toggleBulletList",{enumerable:true,get:function(){return chunkBXWOLARZ_js.o}});Object.defineProperty(exports,"toggleNumberedList",{enumerable:true,get:function(){return chunkBXWOLARZ_js.p}});Object.defineProperty(exports,"clearFontFamily",{enumerable:true,get:function(){return chunkTHLJYXFB_js.o}});Object.defineProperty(exports,"clearFontSize",{enumerable:true,get:function(){return chunkTHLJYXFB_js.m}});Object.defineProperty(exports,"clearHighlight",{enumerable:true,get:function(){return chunkTHLJYXFB_js.k}});Object.defineProperty(exports,"clearTextColor",{enumerable:true,get:function(){return chunkTHLJYXFB_js.i}});Object.defineProperty(exports,"insertHyperlink",{enumerable:true,get:function(){return chunkTHLJYXFB_js.s}});Object.defineProperty(exports,"removeHyperlink",{enumerable:true,get:function(){return chunkTHLJYXFB_js.r}});Object.defineProperty(exports,"setFontFamily",{enumerable:true,get:function(){return chunkTHLJYXFB_js.n}});Object.defineProperty(exports,"setFontSize",{enumerable:true,get:function(){return chunkTHLJYXFB_js.l}});Object.defineProperty(exports,"setHighlight",{enumerable:true,get:function(){return chunkTHLJYXFB_js.j}});Object.defineProperty(exports,"setHyperlink",{enumerable:true,get:function(){return chunkTHLJYXFB_js.q}});Object.defineProperty(exports,"setTextColor",{enumerable:true,get:function(){return chunkTHLJYXFB_js.h}});Object.defineProperty(exports,"toggleBold",{enumerable:true,get:function(){return chunkTHLJYXFB_js.b}});Object.defineProperty(exports,"toggleItalic",{enumerable:true,get:function(){return chunkTHLJYXFB_js.c}});Object.defineProperty(exports,"toggleStrike",{enumerable:true,get:function(){return chunkTHLJYXFB_js.e}});Object.defineProperty(exports,"toggleSubscript",{enumerable:true,get:function(){return chunkTHLJYXFB_js.g}});Object.defineProperty(exports,"toggleSuperscript",{enumerable:true,get:function(){return chunkTHLJYXFB_js.f}});Object.defineProperty(exports,"toggleUnderline",{enumerable:true,get:function(){return chunkTHLJYXFB_js.d}});Object.defineProperty(exports,"insertPageBreak",{enumerable:true,get:function(){return chunkGGPKPXON_js.a}});Object.defineProperty(exports,"schema",{enumerable:true,get:function(){return chunkVMRUBLPI_js.b}});Object.defineProperty(exports,"findHyperlinkRangeAt",{enumerable:true,get:function(){return chunk2EQGBVPV_js.h}});Object.defineProperty(exports,"getHyperlinkAttrs",{enumerable:true,get:function(){return chunk2EQGBVPV_js.f}});Object.defineProperty(exports,"getListInfo",{enumerable:true,get:function(){return chunk2EQGBVPV_js.j}});Object.defineProperty(exports,"getParagraphAlignment",{enumerable:true,get:function(){return chunk2EQGBVPV_js.a}});Object.defineProperty(exports,"getParagraphBidi",{enumerable:true,get:function(){return chunk2EQGBVPV_js.d}});Object.defineProperty(exports,"getSelectedText",{enumerable:true,get:function(){return chunk2EQGBVPV_js.g}});Object.defineProperty(exports,"getStyleId",{enumerable:true,get:function(){return chunk2EQGBVPV_js.c}});Object.defineProperty(exports,"isHyperlinkActive",{enumerable:true,get:function(){return chunk2EQGBVPV_js.e}});Object.defineProperty(exports,"isInList",{enumerable:true,get:function(){return chunk2EQGBVPV_js.i}});Object.defineProperty(exports,"clearFormatting",{enumerable:true,get:function(){return chunkWVERBZZU_js.g}});Object.defineProperty(exports,"createDocumentStylesPlugin",{enumerable:true,get:function(){return chunkWVERBZZU_js.k}});Object.defineProperty(exports,"documentStylesKey",{enumerable:true,get:function(){return chunkWVERBZZU_js.j}});Object.defineProperty(exports,"getDocumentStyleResolver",{enumerable:true,get:function(){return chunkWVERBZZU_js.l}});Object.defineProperty(exports,"getMarkAttr",{enumerable:true,get:function(){return chunkWVERBZZU_js.e}});Object.defineProperty(exports,"isMarkActive",{enumerable:true,get:function(){return chunkWVERBZZU_js.d}});Object.defineProperty(exports,"createSelectionTrackerPlugin",{enumerable:true,get:function(){return chunk6LVPRTB6_js.c}});Object.defineProperty(exports,"extractSelectionContext",{enumerable:true,get:function(){return chunk6LVPRTB6_js.b}});Object.defineProperty(exports,"getSelectionContext",{enumerable:true,get:function(){return chunk6LVPRTB6_js.d}});Object.defineProperty(exports,"selectionTrackerKey",{enumerable:true,get:function(){return chunk6LVPRTB6_js.a}});Object.defineProperty(exports,"StyleResolver",{enumerable:true,get:function(){return chunkLWH66Q7Q_js.a}});Object.defineProperty(exports,"createStyleResolver",{enumerable:true,get:function(){return chunkLWH66Q7Q_js.b}});Object.defineProperty(exports,"getTableContext",{enumerable:true,get:function(){return chunkTUIEV7Q7_js.a}});Object.defineProperty(exports,"isInTable",{enumerable:true,get:function(){return chunkTUIEV7Q7_js.b}});Object.defineProperty(exports,"TextSelection",{enumerable:true,get:function(){return prosemirrorState.TextSelection}});exports.addRepeatingSectionItemTr=je;exports.extractSelectionState=Xe;exports.findContentControlPos=He;exports.findContentControlsInPM=z;exports.removeContentControlTr=Ve;exports.removeRepeatingSectionItemTr=Ke;exports.setContentControlContentTr=Je;exports.setContentControlValueTr=Oe;
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import'../chunk-
|
|
1
|
+
import'../chunk-DTTWBKGN.mjs';export{a as LayoutSelectionGate}from'../chunk-Q5QOBZWT.mjs';export{b as findParagraphByParaId,a as findStartPosForParaId}from'../chunk-3SXJPJSV.mjs';import {z as z$1,E,A,D as D$1,B,C,H,F as F$1,G,M,O,R,S}from'../chunk-KOEWROYV.mjs';import'../chunk-RNOXNNSD.mjs';export{a as fromProseDoc,b as updateDocumentContent}from'../chunk-IFUED5ZS.mjs';export{d as createEmptyDoc,c as footnoteToProseDoc,b as headerFooterToProseDoc,a as toProseDoc}from'../chunk-EQAORQC3.mjs';import {b,a}from'../chunk-7OW3VCZE.mjs';import'../chunk-LK6I3HMH.mjs';import'../chunk-QPFJJPIC.mjs';import'../chunk-6ZXL3EIP.mjs';import'../chunk-OEXVWIHW.mjs';import'../chunk-WLHNIXWC.mjs';export{g as addColumnLeft,h as addColumnRight,d as addRowAbove,e as addRowBelow,E as applyTableStyle,C as autoFitContents,i as deleteColumn,f as deleteRow,j as deleteTable,B as distributeColumns,c as insertTable,n as mergeCells,r as removeTableBorders,m as selectColumn,l as selectRow,k as selectTable,s as setAllTableBorders,p as setCellBorder,F as setCellFillColor,w as setCellMargins,x as setCellTextDirection,v as setCellVerticalAlign,u as setInsideTableBorders,t as setOutsideTableBorders,z as setRowHeight,G as setTableBorderColor,H as setTableBorderWidth,q as setTableBorders,D as setTableProperties,o as splitCell,A as toggleHeaderRow,y as toggleNoWrap}from'../chunk-5BLQHXWK.mjs';export{z as addTabStop,c as alignCenter,e as alignJustify,b as alignLeft,d as alignRight,v as applyStyle,w as clearStyle,k as decreaseIndent,r as decreaseListLevel,D as generateTOC,j as increaseIndent,q as increaseListLevel,s as removeList,A as removeTabStop,a as setAlignment,n as setIndentFirstLine,l as setIndentLeft,m as setIndentRight,f as setLineSpacing,C as setLtr,B as setRtl,o as toggleBulletList,p as toggleNumberedList}from'../chunk-D62KS7QG.mjs';export{o as clearFontFamily,m as clearFontSize,k as clearHighlight,i as clearTextColor,s as insertHyperlink,r as removeHyperlink,n as setFontFamily,l as setFontSize,j as setHighlight,q as setHyperlink,h as setTextColor,b as toggleBold,c as toggleItalic,e as toggleStrike,g as toggleSubscript,f as toggleSuperscript,d as toggleUnderline}from'../chunk-Z5MJYQSD.mjs';export{a as insertPageBreak}from'../chunk-3COGZG7O.mjs';import'../chunk-KQTB5Y7P.mjs';import'../chunk-FW23IMBF.mjs';export{b as schema}from'../chunk-ICE6NC3S.mjs';export{h as findHyperlinkRangeAt,f as getHyperlinkAttrs,j as getListInfo,a as getParagraphAlignment,d as getParagraphBidi,g as getSelectedText,c as getStyleId,e as isHyperlinkActive,i as isInList}from'../chunk-CCPBNE2F.mjs';import'../chunk-MOKKS75W.mjs';import'../chunk-OZMNIX6U.mjs';import'../chunk-AMENZY5F.mjs';export{g as clearFormatting,k as createDocumentStylesPlugin,j as documentStylesKey,l as getDocumentStyleResolver,e as getMarkAttr,d as isMarkActive}from'../chunk-U67MWOPZ.mjs';export{c as createSelectionTrackerPlugin,b as extractSelectionContext,d as getSelectionContext,a as selectionTrackerKey}from'../chunk-BGY3CB37.mjs';export{a as StyleResolver,b as createStyleResolver}from'../chunk-2XP6GLA4.mjs';export{a as getTableContext,b as isInTable}from'../chunk-ZX26QZJ5.mjs';import'../chunk-MJ6XZFVD.mjs';import'../chunk-67LVRQIR.mjs';import'../chunk-LE67NTCN.mjs';import'../chunk-VW22RZ6C.mjs';import'../chunk-DI6CRWSW.mjs';import'../chunk-QYUPLKLP.mjs';export{TextSelection}from'prosemirror-state';function Xe(t){let{selection:n,doc:r}=t,{from:e,to:a,empty:i}=n,s=r.resolve(e),d=0,g=0;r.forEach((p,S,y)=>{S<=e&&(d=y),S<=a&&(g=y);});let l={},o=s.parent,h=o.type.name==="paragraph"&&o.textContent.length===0,u=o.attrs?.defaultTextFormatting,m=t.storedMarks||n.$from.marks();h&&m.length===0&&u&&(l={...u});for(let p of m)switch(p.type.name){case "bold":l.bold=true;break;case "italic":l.italic=true;break;case "underline":l.underline={style:p.attrs.style||"single",color:p.attrs.color};break;case "strike":p.attrs.double?l.doubleStrike=true:l.strike=true;break;case "textColor":l.color={rgb:p.attrs.rgb,themeColor:p.attrs.themeColor};break;case "highlight":l.highlight=p.attrs.color;break;case "fontSize":l.fontSize=p.attrs.size;break;case "fontFamily":l.fontFamily={ascii:p.attrs.ascii,hAnsi:p.attrs.hAnsi};break;case "superscript":l.vertAlign="superscript";break;case "subscript":l.vertAlign="subscript";break}let c={},f=null;return o.type.name==="paragraph"&&(o.attrs.alignment&&(c.alignment=o.attrs.alignment),o.attrs.lineSpacing&&(c.lineSpacing=o.attrs.lineSpacing,c.lineSpacingRule=o.attrs.lineSpacingRule),o.attrs.numPr&&(c.numPr=o.attrs.numPr),o.attrs.indentLeft&&(c.indentLeft=o.attrs.indentLeft),o.attrs.indentRight&&(c.indentRight=o.attrs.indentRight),o.attrs.indentFirstLine&&(c.indentFirstLine=o.attrs.indentFirstLine),o.attrs.hangingIndent&&(c.hangingIndent=o.attrs.hangingIndent),o.attrs.tabs&&(c.tabs=o.attrs.tabs),o.attrs.bidi&&(c.bidi=true),o.attrs.styleId&&(f=o.attrs.styleId)),{hasSelection:!i,isMultiParagraph:d!==g,textFormatting:l,paragraphFormatting:c,styleId:f,startParagraphIndex:d,endParagraphIndex:g}}function D(t){if(!(typeof t!="string"||!t))try{return JSON.parse(t)}catch{return}}function X(t,n){return !(n.tag!==void 0&&t.tag!==n.tag||n.alias!==void 0&&t.alias!==n.alias||n.id!==void 0&&t.id!==n.id||n.type!==void 0&&(t.sdtType??"richText")!==n.type)}function ze(t,n,r){let e=t.attrs;return {tag:e.tag!=null?String(e.tag):void 0,alias:e.alias!=null?String(e.alias):void 0,id:typeof e.id=="number"?e.id:void 0,sdtType:e.sdtType??"richText",lock:e.lock??void 0,showingPlaceholder:e.showingPlaceholder===true?true:void 0,checked:typeof e.checked=="boolean"?e.checked:void 0,dateFormat:e.dateFormat!=null?String(e.dateFormat):void 0,listItems:D(e.listItems),dataBinding:D(e.dataBinding),dateValue:/<w:date\b[^>]*\bw:fullDate="(\d{4}-\d{2}-\d{2})/.exec(String(e.rawPropertiesXml??""))?.[1],text:t.textBetween(0,t.content.size,`
|
|
2
|
+
`),pos:n,depth:r}}function z(t,n={}){let r=[],e=(a,i,s)=>{a.forEach((d,g)=>{let l=i+g,o=d.type.name==="blockSdt";o&&X(d.attrs,n)&&r.push(ze(d,l,s)),e(d,l+1,o?s+1:s);});};return e(t,0,0),r}function He(t,n){return z(t,n)[0]?.pos??null}function F(t,n){let r=null;return t.descendants((e,a)=>r?false:e.type.name==="blockSdt"&&X(e.attrs,n)?(r={node:e,pos:a},false):true),r}function Je(t,n,r,e={}){let a=F(t.doc,n);if(!a)throw new z$1(n);let i=a.node.attrs;if(!e.force&&E(i.lock))throw new A(i.lock,"edit");let s=i.sdtType??"richText";if(!e.force&&!D$1(s))throw new B(s);if(!e.force&&i.dataBinding!=null)throw new C;let{schema:d}=t,l=(s==="plainText"?[r]:r.split(`
|
|
3
|
+
`)).map(m=>d.nodes.paragraph.create(null,m?d.text(m):null)),o=a.pos+1,h=a.pos+1+a.node.content.size,u=t.tr.replaceWith(o,h,l);return (i.showingPlaceholder||/showingPlcHdr/.test(String(i.rawPropertiesXml??"")))&&u.setNodeMarkup(a.pos,void 0,{...i,showingPlaceholder:false,rawPropertiesXml:H(i.rawPropertiesXml==null?void 0:String(i.rawPropertiesXml))}),u}function Ve(t,n,r={}){let e=F(t.doc,n);if(!e)throw new z$1(n);let a=e.node.attrs.lock;if(!r.force&&F$1(a))throw new A(a,"remove");if(r.keepContent&&!r.force&&/<w15:repeatingSection(Item)?[\s/>]/.test(String(e.node.attrs.rawPropertiesXml??"")))throw new A(a,"remove");let i=e.pos,s=e.pos+e.node.nodeSize;return r.keepContent?t.tr.replaceWith(i,s,e.node.content):t.tr.delete(i,s)}function Oe(t,n,r,e={}){let a$1=F(t.doc,n);if(!a$1)throw new z$1(n);let i=b(a$1.node.attrs);if(!e.force&&E(i.lock))throw new A(i.lock,"edit");if(!e.force&&G(i))throw new C;let{properties:s,content:d}=M(i,r),{schema:g}=t,l=g.marks.fontFamily,o=d.map(c=>{if(c.type!=="paragraph")return g.nodes.paragraph.create(null,null);let f=c.content.find(b=>b.type==="run"),p=f?.type==="run"?f.content.map(b=>"text"in b?b.text:"").join(""):"",S=f?.type==="run"?f.formatting?.fontFamily:void 0,y=S&&l?[l.create(S)]:void 0;return g.nodes.paragraph.create(null,p?g.text(p,y):null)}),h=a$1.pos+1,u=a$1.pos+1+a$1.node.content.size,m=t.tr.replaceWith(h,u,o);return m.setNodeMarkup(a$1.pos,void 0,{...a$1.node.attrs,...a(s)}),m}function We(t){let n=0;return t.descendants(r=>(r.type.name==="blockSdt"&&typeof r.attrs.id=="number"&&(n=Math.max(n,r.attrs.id)),true)),n}function $e(t,n,r){let e=r,a=n.toJSON(),i=s=>{if(s.type==="blockSdt"&&s.attrs){let d=++e;s.attrs={...s.attrs,id:d,rawPropertiesXml:S(s.attrs.rawPropertiesXml==null?void 0:String(s.attrs.rawPropertiesXml),d)};}s.content?.forEach(i);};return i(a),t.nodeFromJSON(a)}function je(t,n){let r=t.doc.nodeAt(n);if(!r||r.type.name!=="blockSdt"||!O(String(r.attrs.rawPropertiesXml??"")))throw new R("Position is not a repeating-section item.");let e=$e(t.schema,r,We(t.doc));return t.tr.insert(n+r.nodeSize,e)}function Ke(t,n){let r=t.doc.nodeAt(n);if(!r||r.type.name!=="blockSdt"||!O(String(r.attrs.rawPropertiesXml??"")))throw new R("Position is not a repeating-section item.");let a=t.doc.resolve(n).parent,i=0;if(a.forEach(s=>{s.type.name==="blockSdt"&&O(String(s.attrs.rawPropertiesXml??""))&&(i+=1);}),i<=1)throw new R("Cannot remove the last item of a repeating section.");return t.tr.delete(n,n+r.nodeSize)}export{je as addRepeatingSectionItemTr,Xe as extractSelectionState,He as findContentControlPos,z as findContentControlsInPM,Ve as removeContentControlTr,Ke as removeRepeatingSectionItemTr,Je as setContentControlContentTr,Oe as setContentControlValueTr};
|
|
@@ -7,39 +7,59 @@
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
export { SelectionChangeCallback, SelectionContext, createSelectionTrackerPlugin, extractSelectionContext, getSelectionContext, selectionTrackerKey } from './selectionTracker.mjs';
|
|
10
|
-
import {
|
|
10
|
+
import { PluginKey, EditorState, Transaction, Plugin } from 'prosemirror-state';
|
|
11
|
+
export { c as createDocumentStylesPlugin, d as documentStylesKey, g as getDocumentStyleResolver } from '../../documentStyles-D87dxl18.mjs';
|
|
12
|
+
import { m as RevisionInfo } from '../../content-CE-ZdMwG.mjs';
|
|
11
13
|
import '../../formatting-BH4hcZiq.mjs';
|
|
12
14
|
import '../../colors-C3vA7HUU.mjs';
|
|
15
|
+
import '../../styles-EI2lxeEN.mjs';
|
|
16
|
+
import '../styles/index.mjs';
|
|
17
|
+
import '../../docx/wrapTypes.mjs';
|
|
13
18
|
|
|
14
19
|
/**
|
|
15
|
-
* Suggestion
|
|
16
|
-
*
|
|
17
|
-
* When active, intercepts all text insertions and deletions,
|
|
18
|
-
* wrapping them in tracked change marks (insertion/deletion)
|
|
19
|
-
* instead of modifying the document directly.
|
|
20
|
+
* Suggestion-mode plugin state + shared meta keys.
|
|
20
21
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* (retracting your own suggestion)
|
|
22
|
+
* Kept in its own module to avoid an import cycle: every handler file needs
|
|
23
|
+
* the plugin key + meta constants but should not transitively pull in the
|
|
24
|
+
* plugin factory.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
declare const suggestionModeKey: PluginKey<SuggestionModeState>;
|
|
28
27
|
interface SuggestionModeState {
|
|
29
28
|
active: boolean;
|
|
30
29
|
author: string;
|
|
31
30
|
}
|
|
31
|
+
declare const suggestionModeKey: PluginKey<SuggestionModeState>;
|
|
32
|
+
|
|
32
33
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
34
|
+
* Suggesting-mode toggle / set / query commands. Each dispatches a meta on
|
|
35
|
+
* the plugin key — the plugin's `state.apply` merges it into
|
|
36
|
+
* `SuggestionModeState`. No-ops gracefully when the plugin isn't mounted.
|
|
35
37
|
*/
|
|
36
|
-
|
|
38
|
+
|
|
37
39
|
/**
|
|
38
|
-
* Toggle
|
|
40
|
+
* Toggle suggesting mode on/off. The mounted `createSuggestionModePlugin`
|
|
41
|
+
* is required for the dispatch to have any effect — without it the meta
|
|
42
|
+
* is silently dropped. Returns `false` (no-op) if the plugin is missing.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { toggleSuggestionMode } from '@eigenpal/docx-editor-core/prosemirror/plugins';
|
|
47
|
+
* toggleSuggestionMode(view.state, view.dispatch);
|
|
48
|
+
* ```
|
|
39
49
|
*/
|
|
40
50
|
declare function toggleSuggestionMode(state: EditorState, dispatch?: (tr: Transaction) => void): boolean;
|
|
41
51
|
/**
|
|
42
|
-
* Set
|
|
52
|
+
* Set suggesting mode active state and (optionally) author. Author
|
|
53
|
+
* tracks across every revision minted while the mode is on. The
|
|
54
|
+
* mounted `createSuggestionModePlugin` is required.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { setSuggestionMode } from '@eigenpal/docx-editor-core/prosemirror/plugins';
|
|
59
|
+
* setSuggestionMode(true, view.state, view.dispatch, 'Jane');
|
|
60
|
+
* // ... typed text now wraps in <w:ins> with author="Jane"
|
|
61
|
+
* setSuggestionMode(false, view.state, view.dispatch);
|
|
62
|
+
* ```
|
|
43
63
|
*/
|
|
44
64
|
declare function setSuggestionMode(active: boolean, state: EditorState, dispatch?: (tr: Transaction) => void, author?: string): boolean;
|
|
45
65
|
/**
|
|
@@ -47,4 +67,91 @@ declare function setSuggestionMode(active: boolean, state: EditorState, dispatch
|
|
|
47
67
|
*/
|
|
48
68
|
declare function isSuggestionModeActive(state: EditorState): boolean;
|
|
49
69
|
|
|
50
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Suggestion Mode Plugin
|
|
72
|
+
*
|
|
73
|
+
* When active, intercepts all text insertions and deletions, wrapping
|
|
74
|
+
* them in tracked-change marks (insertion/deletion) instead of modifying
|
|
75
|
+
* the document directly.
|
|
76
|
+
*
|
|
77
|
+
* - Typed text is marked as insertion (green underline)
|
|
78
|
+
* - Deleted text is NOT removed — it's marked as deletion (red strikethrough)
|
|
79
|
+
* - Text already marked as insertion by the current author is deleted
|
|
80
|
+
* normally (retracting your own suggestion)
|
|
81
|
+
*
|
|
82
|
+
* The implementation is split across this directory for readability:
|
|
83
|
+
* - `state.ts` — plugin key, meta constants, shared types
|
|
84
|
+
* - `markAttrs.ts` — fresh-attr minting + projection
|
|
85
|
+
* - `adjacency.ts` — coalescing lookups (sibling, cross-block, cellMarker)
|
|
86
|
+
* - `handlers/` — keyboard / input handlers (delete, insert, structural)
|
|
87
|
+
* - `commands.ts` — toggle / set / isActive
|
|
88
|
+
* - this file — `createSuggestionModePlugin` + public re-exports
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Create the suggestion-mode ProseMirror plugin. **Must be mounted on
|
|
93
|
+
* the editor view for `setSuggestionMode` and `toggleSuggestionMode`
|
|
94
|
+
* to do anything** — both adapters (`@eigenpal/docx-editor-react`,
|
|
95
|
+
* `@eigenpal/docx-editor-vue`) auto-mount this inside the `DocxEditor`
|
|
96
|
+
* component, so consumers using the bundled components don't need to
|
|
97
|
+
* register it themselves.
|
|
98
|
+
*
|
|
99
|
+
* When active, typed text gets the `insertion` mark, deleted text gets
|
|
100
|
+
* the `deletion` mark (text stays in the doc; the painter strikes it
|
|
101
|
+
* through), Enter sets `pPrIns` on the originating paragraph, and
|
|
102
|
+
* Backspace at paragraph start sets `pPrDel` on the previous paragraph.
|
|
103
|
+
* Author + adjacent same-author marks coalesce into one tracked change.
|
|
104
|
+
*
|
|
105
|
+
* @param initialActive - Whether suggesting mode starts on. Default `false`.
|
|
106
|
+
* @param author - Author name attached to every minted revision. Default `'User'`.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* import { createSuggestionModePlugin } from '@eigenpal/docx-editor-core/prosemirror/plugins';
|
|
111
|
+
*
|
|
112
|
+
* const plugin = createSuggestionModePlugin(false, 'Jane');
|
|
113
|
+
* EditorState.create({ doc, plugins: [plugin, ...other] });
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
declare function createSuggestionModePlugin(initialActive?: boolean, author?: string): Plugin;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Single source of tracked-revision ids across the package.
|
|
120
|
+
*
|
|
121
|
+
* Why a shared module-level counter:
|
|
122
|
+
*
|
|
123
|
+
* - Each `revisionId` is the OOXML `<w:ins w:id="…"/>` attribute. Two
|
|
124
|
+
* unrelated revisions emitted by the same author with the same id
|
|
125
|
+
* would silently collapse in the sidebar (grouped by id+author+date)
|
|
126
|
+
* and on accept (resolved by id), so collisions are observable.
|
|
127
|
+
* - Pre-refactor, three call sites each kept their own
|
|
128
|
+
* `Date.now() + offset` counter (suggestionMode.ts, table commands
|
|
129
|
+
* delete.ts, table commands insert.ts). Offsets made first-load
|
|
130
|
+
* collisions rare but not impossible — counters drift independently,
|
|
131
|
+
* and parallel-browser Playwright workers can start from identical
|
|
132
|
+
* `Date.now()` seeds.
|
|
133
|
+
*
|
|
134
|
+
* Routing every mint through this module guarantees within-realm
|
|
135
|
+
* uniqueness even when callers interleave across plugins, commands, and
|
|
136
|
+
* test harnesses.
|
|
137
|
+
*
|
|
138
|
+
* Re-exported as `@public` through `prosemirror/plugins/index.ts` so
|
|
139
|
+
* adapter integrations (image insertion, custom commands) can mint
|
|
140
|
+
* revision triples without reaching into the implementation directly.
|
|
141
|
+
*
|
|
142
|
+
* @packageDocumentation
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Build a fresh `RevisionInfo` triple from the active suggesting-mode
|
|
148
|
+
* state. Returns `null` when suggesting mode is OFF — callers use this to
|
|
149
|
+
* decide whether to track an edit or apply it directly.
|
|
150
|
+
*
|
|
151
|
+
* Shared by `suggestionMode.ts`'s text/paragraph handlers and by the
|
|
152
|
+
* suggesting-aware table commands (`addRowBelow`, `deleteRow`, ...). One
|
|
153
|
+
* source of truth for both the mint and the author/date fields.
|
|
154
|
+
*/
|
|
155
|
+
declare function makeRevisionInfo(state: EditorState): RevisionInfo | null;
|
|
156
|
+
|
|
157
|
+
export { RevisionInfo, createSuggestionModePlugin, isSuggestionModeActive, makeRevisionInfo, setSuggestionMode, suggestionModeKey, toggleSuggestionMode };
|