@zeke-02/docx-editor 0.5.2 → 0.5.3
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 +204 -0
- package/dist/FindReplaceDialog-7SQOVQWH.js +1 -0
- package/dist/FindReplaceDialog-RK3A7MSK.mjs +1 -0
- package/dist/{FootnotePropertiesDialog-XQ7NIFIU.js → FootnotePropertiesDialog-2Q2SHVMR.js} +1 -1
- package/dist/{FootnotePropertiesDialog-TNVJJCY6.mjs → FootnotePropertiesDialog-ZKQXW3YO.mjs} +1 -1
- package/dist/{HyperlinkDialog-FR4IZZ7E.mjs → HyperlinkDialog-QV3CVFQU.mjs} +1 -1
- package/dist/HyperlinkDialog-XVAF7FVN.js +1 -0
- package/dist/{ImagePositionDialog-JSZSIKF5.mjs → ImagePositionDialog-EGRH3HPP.mjs} +1 -1
- package/dist/{ImagePositionDialog-2YXRAGZS.js → ImagePositionDialog-HIVHUTBT.js} +1 -1
- package/dist/ImagePropertiesDialog-67WLFIIZ.mjs +1 -0
- package/dist/ImagePropertiesDialog-HSM3JJ22.js +1 -0
- package/dist/KeyboardShortcutsDialog-5D_FoAp6.d.ts +395 -0
- package/dist/KeyboardShortcutsDialog-D7ihAj18.d.mts +395 -0
- package/dist/PageSetupDialog-642IAVG2.js +1 -0
- package/dist/PageSetupDialog-ERUQDHAY.mjs +1 -0
- package/dist/{SplitCellDialog-NP3JJYHD.mjs → SplitCellDialog-GFWCFCTD.mjs} +1 -1
- package/dist/{SplitCellDialog-JIAC3RYV.js → SplitCellDialog-M7WF7ANE.js} +1 -1
- package/dist/{TablePropertiesDialog-TIK4AA5M.mjs → TablePropertiesDialog-TZ7VCL6V.mjs} +1 -1
- package/dist/{TablePropertiesDialog-T7D4HSVP.js → TablePropertiesDialog-ZKU2FTUX.js} +1 -1
- package/dist/agentApi-C41hiW-n.d.mts +486 -0
- package/dist/agentApi-D4AZmNfB.d.ts +486 -0
- package/dist/chunk-2XXILKEQ.js +1 -0
- package/dist/chunk-35DG3R42.js +2 -0
- package/dist/chunk-47VJOBJD.mjs +60 -0
- package/dist/chunk-5UX5CD4C.js +1 -0
- package/dist/chunk-7QQSDIWK.mjs +2 -0
- package/dist/chunk-AW5TISUL.js +3 -0
- package/dist/chunk-AYMGSTNG.js +1 -0
- package/dist/chunk-B45ECEGY.js +18 -0
- package/dist/chunk-B7CCL7SL.mjs +2 -0
- package/dist/chunk-BRMTZRLJ.js +2 -0
- package/dist/chunk-D47GTKGU.js +2 -0
- package/dist/chunk-E6MQXELR.js +1 -0
- package/dist/chunk-F5SERL7X.mjs +2 -0
- package/dist/chunk-FWPVBFKQ.mjs +1 -0
- package/dist/chunk-GGQK26JO.js +2 -0
- package/dist/chunk-GM2S2WMT.mjs +1 -0
- package/dist/chunk-ILYKDR3C.js +1 -0
- package/dist/chunk-IP5NAYHL.js +60 -0
- package/dist/chunk-JPF5R2ZM.mjs +1 -0
- package/dist/chunk-KOXCF3CL.mjs +1 -0
- package/dist/chunk-KRLNX56Y.mjs +2 -0
- package/dist/chunk-LUJ6HCMH.mjs +1 -0
- package/dist/chunk-MKNSJOCN.js +70 -0
- package/dist/chunk-NIBCC7WQ.js +1 -0
- package/dist/chunk-NLFXR2VH.js +2 -0
- package/dist/chunk-ONIYA2FU.mjs +2 -0
- package/dist/chunk-ONNHQWAX.mjs +1 -0
- package/dist/chunk-RCIZ7OM3.mjs +70 -0
- package/dist/{chunk-EHFEG3TX.js → chunk-SNZ57XBI.js} +1 -1
- package/dist/chunk-SOTWG3KJ.mjs +1 -0
- package/dist/chunk-TYPGB4KF.js +1 -0
- package/dist/chunk-U7ZW2DOO.mjs +2 -0
- package/dist/{chunk-PKEOQIQO.mjs → chunk-WPI3YRFO.mjs} +1 -1
- package/dist/chunk-XQZTWWRF.mjs +18 -0
- package/dist/chunk-ZVAFVHWR.mjs +3 -0
- package/dist/chunk-ZXPCJWVY.js +2 -0
- package/dist/{agentApi-DLt94vXk.d.mts → content-B2MzIMwA.d.mts} +8 -755
- package/dist/{agentApi-DLt94vXk.d.ts → content-B2MzIMwA.d.ts} +8 -755
- package/dist/dialogs.d.mts +25 -0
- package/dist/dialogs.d.ts +25 -0
- package/dist/dialogs.js +1 -0
- package/dist/dialogs.mjs +1 -0
- package/dist/document-DZ_ZeZEH.d.ts +294 -0
- package/dist/document-Di1qGqLS.d.mts +294 -0
- package/dist/executor-EPEB53SJ.js +1 -0
- package/dist/executor-TVJ6K6MW.mjs +1 -0
- package/dist/findReplace-CpIoILbP.d.mts +138 -0
- package/dist/findReplace-pkMskVJU.d.ts +138 -0
- package/dist/hooks.d.mts +598 -0
- package/dist/hooks.d.ts +598 -0
- package/dist/hooks.js +1 -0
- package/dist/hooks.mjs +1 -0
- package/dist/index.d.mts +1013 -483
- package/dist/index.d.ts +1013 -483
- package/dist/index.js +40 -120
- package/dist/index.mjs +40 -120
- package/dist/layout-bridge-5GYGYKM5.mjs +1 -0
- package/dist/layout-bridge-QQDA7ELH.js +1 -0
- package/dist/plugin-api.d.mts +176 -0
- package/dist/plugin-api.d.ts +176 -0
- package/dist/plugin-api.js +260 -0
- package/dist/plugin-api.mjs +260 -0
- package/dist/processTemplate-BTBTR7AM.js +1 -0
- package/dist/{processTemplate-W2C5PXZB.mjs → processTemplate-MBX2KDLE.mjs} +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.d.mts +18 -0
- package/dist/styles.d.ts +18 -0
- package/dist/styles.js +1 -0
- package/dist/styles.mjs +1 -0
- package/dist/types-Bd_YzkhG.d.mts +281 -0
- package/dist/types-Bd_YzkhG.d.ts +281 -0
- package/dist/types-CkfDgB0O.d.mts +39 -0
- package/dist/types-DZUhB7Ao.d.mts +18 -0
- package/dist/types-DZUhB7Ao.d.ts +18 -0
- package/dist/types-DcxHFUSc.d.ts +39 -0
- package/dist/ui.d.mts +111 -552
- package/dist/ui.d.ts +111 -552
- package/dist/ui.js +111 -1
- package/dist/ui.mjs +111 -1
- package/dist/useFindReplace-DDs533b-.d.mts +261 -0
- package/dist/useFindReplace-eyhMSZZf.d.ts +261 -0
- package/package.json +41 -43
- package/dist/ClipboardManager-CVKX0v9q.d.ts +0 -464
- package/dist/ClipboardManager-V3aaMnWE.d.mts +0 -464
- package/dist/DocumentAgent-BWflKHpH.d.mts +0 -442
- package/dist/DocumentAgent-DsdXtetF.d.ts +0 -442
- package/dist/FindReplaceDialog-L3YF5HIS.mjs +0 -1
- package/dist/FindReplaceDialog-SEBWC5P7.js +0 -1
- package/dist/HyperlinkDialog-WEK6JSAC.js +0 -1
- package/dist/ImagePropertiesDialog-527MFLQO.mjs +0 -1
- package/dist/ImagePropertiesDialog-HG4K3IE7.js +0 -1
- package/dist/PageSetupDialog-GALVJMUB.js +0 -1
- package/dist/PageSetupDialog-TGQIAMI7.mjs +0 -1
- package/dist/TableToolbar-DUgmob2I.d.ts +0 -1273
- package/dist/TableToolbar-YL74HNS1.d.mts +0 -1273
- package/dist/chunk-23SXXIZS.js +0 -111
- package/dist/chunk-3F52AP2Q.js +0 -1
- package/dist/chunk-42O5GXM5.mjs +0 -82
- package/dist/chunk-54ULJEHM.mjs +0 -1
- package/dist/chunk-5XK326FI.mjs +0 -1
- package/dist/chunk-6WPRCJ5A.mjs +0 -1
- package/dist/chunk-76IYR7C7.mjs +0 -1
- package/dist/chunk-AGRIVA4G.js +0 -1
- package/dist/chunk-BTCQ2QI3.mjs +0 -3
- package/dist/chunk-BUEMG4NW.js +0 -1
- package/dist/chunk-BXRC4U3X.mjs +0 -2
- package/dist/chunk-CPAYKE6X.mjs +0 -1
- package/dist/chunk-DACWLFKI.mjs +0 -1
- package/dist/chunk-EPBFWE36.js +0 -2
- package/dist/chunk-FXES3YDB.js +0 -82
- package/dist/chunk-HI66BSGS.mjs +0 -9
- package/dist/chunk-INTPVEO6.mjs +0 -9
- package/dist/chunk-IOAGVW6Q.mjs +0 -2
- package/dist/chunk-JCEWC5QL.mjs +0 -4
- package/dist/chunk-JTIUFACT.js +0 -1
- package/dist/chunk-LUF7PWIC.js +0 -10
- package/dist/chunk-MGEN6GOE.mjs +0 -2
- package/dist/chunk-MOE2ZGUE.js +0 -18
- package/dist/chunk-MWLHJWB6.js +0 -9
- package/dist/chunk-OFYVDN3U.mjs +0 -2
- package/dist/chunk-P4VSHBGZ.js +0 -2
- package/dist/chunk-P5FQHIES.mjs +0 -1
- package/dist/chunk-PBC7XAYZ.js +0 -3
- package/dist/chunk-PEMB6SZT.js +0 -2
- package/dist/chunk-PQMSZTBB.js +0 -9
- package/dist/chunk-Q7UDQXAF.js +0 -1
- package/dist/chunk-QGTAIC5E.js +0 -1
- package/dist/chunk-QVPR2W5S.js +0 -1
- package/dist/chunk-R3QMYPL5.mjs +0 -59
- package/dist/chunk-RBUTXXQJ.mjs +0 -18
- package/dist/chunk-RRWYZ2TS.mjs +0 -111
- package/dist/chunk-S3STEPVO.js +0 -182
- package/dist/chunk-SFUM35DH.js +0 -2
- package/dist/chunk-SNLC6EK2.js +0 -1
- package/dist/chunk-TMTLIGLZ.js +0 -59
- package/dist/chunk-TSE2PWFX.mjs +0 -10
- package/dist/chunk-UKESXQS5.mjs +0 -182
- package/dist/chunk-UWYD42WV.js +0 -4
- package/dist/chunk-UXVACQCY.mjs +0 -1
- package/dist/chunk-W4EIKDM6.mjs +0 -2
- package/dist/chunk-W53SI3XW.mjs +0 -1
- package/dist/chunk-WNS2RBQD.js +0 -2
- package/dist/chunk-Z3KMSHUP.js +0 -1
- package/dist/core-plugins-reexport.d.mts +0 -31
- package/dist/core-plugins-reexport.d.ts +0 -31
- package/dist/core-plugins-reexport.js +0 -1
- package/dist/core-plugins-reexport.mjs +0 -1
- package/dist/core-reexport.d.mts +0 -340
- package/dist/core-reexport.d.ts +0 -340
- package/dist/core-reexport.js +0 -1
- package/dist/core-reexport.mjs +0 -1
- package/dist/documentSerializer-DtS_-oGA.d.mts +0 -664
- package/dist/documentSerializer-Wj1p2ASa.d.ts +0 -664
- package/dist/executor-C3VXF7QA.mjs +0 -1
- package/dist/executor-GDBV3AGV.js +0 -1
- package/dist/headless-reexport.d.mts +0 -197
- package/dist/headless-reexport.d.ts +0 -197
- package/dist/headless-reexport.js +0 -1
- package/dist/headless-reexport.mjs +0 -1
- package/dist/insertOperations-BTH1Asas.d.mts +0 -176
- package/dist/insertOperations-CbUnXAXH.d.ts +0 -176
- package/dist/layout-bridge-EA4DJ227.js +0 -1
- package/dist/layout-bridge-XDPSO6GO.mjs +0 -1
- package/dist/mcp-reexport.d.mts +0 -156
- package/dist/mcp-reexport.d.ts +0 -156
- package/dist/mcp-reexport.js +0 -16
- package/dist/mcp-reexport.mjs +0 -16
- package/dist/processTemplate-MJ2PCSO5.js +0 -1
- package/dist/react-B0W16SV6.d.ts +0 -1330
- package/dist/react-D0Pn1nww.d.mts +0 -1330
- package/dist/react.css +0 -1
- package/dist/react.d.mts +0 -10
- package/dist/react.d.ts +0 -10
- package/dist/react.js +0 -1
- package/dist/react.mjs +0 -1
- package/dist/registry-CH9V-IX0.d.ts +0 -165
- package/dist/registry-CWBKYlNW.d.mts +0 -165
- package/dist/types-UDsUq8D3.d.mts +0 -310
- package/dist/types-jbivc9Lj.d.ts +0 -310
- package/dist/variableDetector-CdQ7ZTzA.d.mts +0 -204
- package/dist/variableDetector-DsRV3A9z.d.ts +0 -204
- package/i18n/de.json +0 -792
- package/i18n/en.json +0 -792
- package/i18n/he.json +0 -792
- package/i18n/pl.json +0 -792
- package/i18n/pt-BR.json +0 -792
- package/i18n/tr.json +0 -792
- package/i18n/zh-CN.json +0 -792
- /package/dist/{chunk-YC5KZSYD.js → chunk-ESZ6JRTW.js} +0 -0
- /package/dist/{chunk-LVGJKS7Y.mjs → chunk-TZMMD6RR.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Nb as DEFAULT_BODY_MARGIN_PX,Ob as DEFAULT_HF_DISTANCE_PX,Mb as DEFAULT_PAGE_HEIGHT_PX,Lb as DEFAULT_PAGE_WIDTH_PX,kb as FOOTNOTE_SEPARATOR_HEIGHT,lb as MAX_FOOTNOTE_LAYOUT_PASSES,Gb as TABLE_INSERT_EDGE_PROXIMITY,Hb as TABLE_INSERT_HIDE_DELAY_MS,pb as applyFootnotePresentation,H as buildFontString,rb as buildFootnoteContentMap,ub as buildFootnoteRenderItems,sb as calculateFootnoteReservedHeights,xb as calculateHeaderFooterVisualBounds,na as clearAllCaches,ea as clearFontMetricsCache,ka as clearParagraphMeasureCache,$ as clearTextWidthCache,Ea as clickToPosition,La as clickToPositionDom,Ca as clickToPositionInParagraph,Da as clickToPositionInTableCell,nb as collectFootnoteRefs,A as convertBorderSpecToLayout,qb as convertFootnoteToContent,yb as convertHeaderFooterToContent,D as countTableColumns,Ib as detectTableInsertHover,Ia as findBodyEmptyRuns,Ka as findBodyPmAnchor,Ja as findBodyPmAnchors,Ha as findBodyPmSpans,M as findCharacterAtX,mb as footnoteReservedHeightsEqual,ca as getCachedFontMetrics,ia as getCachedParagraphMeasure,Z as getCachedTextWidth,F as getCanvasContext,Pa as getCaretPosition,Na as getCaretPositionFromDom,V as getFloatingMargins,ga as getFontCacheSize,I as getFontMetrics,Qb as getMargins,Ba as getPageBounds,ua as getPageIndexAtY,Pb as getPageSize,ta as getPageTop,ma as getParagraphCacheSize,Ga as getPositionRect,Y as getRunCharWidths,Aa as getScrollYForPage,Ma as getSelectionRectsFromDom,ba as getTextCacheSize,oa as getTotalCacheSize,za as getTotalDocumentHeight,N as getXForCharacter,Ra as groupRectsByPage,S as halfPtToPx,ha as hashParagraphBlock,ya as hitTest,va as hitTestFragment,wa as hitTestImageFragment,sa as hitTestPage,xa as hitTestTableCell,Qa as isMultiPageSelection,ob as mapFootnotesToPages,W as measureParagraph,X as measureParagraphs,L as measureRun,Kb as measureTableBlock,Jb as measureTableCellBlockVisualHeight,K as measureText,J as measureTextWidth,La as mouseToPosition,vb as normalizeHeaderFooterMeasureBlocks,E as normalizeTableColumnWidths,Fa as positionToX,Q as ptToPx,T as pxToHalfPt,R as pxToPt,P as pxToTwips,U as rectsToFloatingZones,z as resetBlockIdCounter,G as resetCanvasContext,Rb as resolveHeaderFooter,wb as resolveHeaderFooterVisualTop,y as resolveListTemplate,C as resolveTableWidthPx,Oa as selectionToRects,da as setCachedFontMetrics,ja as setCachedParagraphMeasure,_ as setCachedTextWidth,fa as setFontCacheSize,la as setParagraphCacheSize,aa as setTextCacheSize,tb as stabilizeFootnoteLayout,B as toFlowBlocks,O as twipsToPx}from'./chunk-XQZTWWRF.mjs';import'./chunk-ONIYA2FU.mjs';import'./chunk-FWPVBFKQ.mjs';import'./chunk-TAUMSKRE.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkB45ECEGY_js=require('./chunk-B45ECEGY.js');require('./chunk-ZXPCJWVY.js'),require('./chunk-ILYKDR3C.js'),require('./chunk-H5NTJZO4.js');Object.defineProperty(exports,"DEFAULT_BODY_MARGIN_PX",{enumerable:true,get:function(){return chunkB45ECEGY_js.Nb}});Object.defineProperty(exports,"DEFAULT_HF_DISTANCE_PX",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ob}});Object.defineProperty(exports,"DEFAULT_PAGE_HEIGHT_PX",{enumerable:true,get:function(){return chunkB45ECEGY_js.Mb}});Object.defineProperty(exports,"DEFAULT_PAGE_WIDTH_PX",{enumerable:true,get:function(){return chunkB45ECEGY_js.Lb}});Object.defineProperty(exports,"FOOTNOTE_SEPARATOR_HEIGHT",{enumerable:true,get:function(){return chunkB45ECEGY_js.kb}});Object.defineProperty(exports,"MAX_FOOTNOTE_LAYOUT_PASSES",{enumerable:true,get:function(){return chunkB45ECEGY_js.lb}});Object.defineProperty(exports,"TABLE_INSERT_EDGE_PROXIMITY",{enumerable:true,get:function(){return chunkB45ECEGY_js.Gb}});Object.defineProperty(exports,"TABLE_INSERT_HIDE_DELAY_MS",{enumerable:true,get:function(){return chunkB45ECEGY_js.Hb}});Object.defineProperty(exports,"applyFootnotePresentation",{enumerable:true,get:function(){return chunkB45ECEGY_js.pb}});Object.defineProperty(exports,"buildFontString",{enumerable:true,get:function(){return chunkB45ECEGY_js.H}});Object.defineProperty(exports,"buildFootnoteContentMap",{enumerable:true,get:function(){return chunkB45ECEGY_js.rb}});Object.defineProperty(exports,"buildFootnoteRenderItems",{enumerable:true,get:function(){return chunkB45ECEGY_js.ub}});Object.defineProperty(exports,"calculateFootnoteReservedHeights",{enumerable:true,get:function(){return chunkB45ECEGY_js.sb}});Object.defineProperty(exports,"calculateHeaderFooterVisualBounds",{enumerable:true,get:function(){return chunkB45ECEGY_js.xb}});Object.defineProperty(exports,"clearAllCaches",{enumerable:true,get:function(){return chunkB45ECEGY_js.na}});Object.defineProperty(exports,"clearFontMetricsCache",{enumerable:true,get:function(){return chunkB45ECEGY_js.ea}});Object.defineProperty(exports,"clearParagraphMeasureCache",{enumerable:true,get:function(){return chunkB45ECEGY_js.ka}});Object.defineProperty(exports,"clearTextWidthCache",{enumerable:true,get:function(){return chunkB45ECEGY_js.$}});Object.defineProperty(exports,"clickToPosition",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ea}});Object.defineProperty(exports,"clickToPositionDom",{enumerable:true,get:function(){return chunkB45ECEGY_js.La}});Object.defineProperty(exports,"clickToPositionInParagraph",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ca}});Object.defineProperty(exports,"clickToPositionInTableCell",{enumerable:true,get:function(){return chunkB45ECEGY_js.Da}});Object.defineProperty(exports,"collectFootnoteRefs",{enumerable:true,get:function(){return chunkB45ECEGY_js.nb}});Object.defineProperty(exports,"convertBorderSpecToLayout",{enumerable:true,get:function(){return chunkB45ECEGY_js.A}});Object.defineProperty(exports,"convertFootnoteToContent",{enumerable:true,get:function(){return chunkB45ECEGY_js.qb}});Object.defineProperty(exports,"convertHeaderFooterToContent",{enumerable:true,get:function(){return chunkB45ECEGY_js.yb}});Object.defineProperty(exports,"countTableColumns",{enumerable:true,get:function(){return chunkB45ECEGY_js.D}});Object.defineProperty(exports,"detectTableInsertHover",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ib}});Object.defineProperty(exports,"findBodyEmptyRuns",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ia}});Object.defineProperty(exports,"findBodyPmAnchor",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ka}});Object.defineProperty(exports,"findBodyPmAnchors",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ja}});Object.defineProperty(exports,"findBodyPmSpans",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ha}});Object.defineProperty(exports,"findCharacterAtX",{enumerable:true,get:function(){return chunkB45ECEGY_js.M}});Object.defineProperty(exports,"footnoteReservedHeightsEqual",{enumerable:true,get:function(){return chunkB45ECEGY_js.mb}});Object.defineProperty(exports,"getCachedFontMetrics",{enumerable:true,get:function(){return chunkB45ECEGY_js.ca}});Object.defineProperty(exports,"getCachedParagraphMeasure",{enumerable:true,get:function(){return chunkB45ECEGY_js.ia}});Object.defineProperty(exports,"getCachedTextWidth",{enumerable:true,get:function(){return chunkB45ECEGY_js.Z}});Object.defineProperty(exports,"getCanvasContext",{enumerable:true,get:function(){return chunkB45ECEGY_js.F}});Object.defineProperty(exports,"getCaretPosition",{enumerable:true,get:function(){return chunkB45ECEGY_js.Pa}});Object.defineProperty(exports,"getCaretPositionFromDom",{enumerable:true,get:function(){return chunkB45ECEGY_js.Na}});Object.defineProperty(exports,"getFloatingMargins",{enumerable:true,get:function(){return chunkB45ECEGY_js.V}});Object.defineProperty(exports,"getFontCacheSize",{enumerable:true,get:function(){return chunkB45ECEGY_js.ga}});Object.defineProperty(exports,"getFontMetrics",{enumerable:true,get:function(){return chunkB45ECEGY_js.I}});Object.defineProperty(exports,"getMargins",{enumerable:true,get:function(){return chunkB45ECEGY_js.Qb}});Object.defineProperty(exports,"getPageBounds",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ba}});Object.defineProperty(exports,"getPageIndexAtY",{enumerable:true,get:function(){return chunkB45ECEGY_js.ua}});Object.defineProperty(exports,"getPageSize",{enumerable:true,get:function(){return chunkB45ECEGY_js.Pb}});Object.defineProperty(exports,"getPageTop",{enumerable:true,get:function(){return chunkB45ECEGY_js.ta}});Object.defineProperty(exports,"getParagraphCacheSize",{enumerable:true,get:function(){return chunkB45ECEGY_js.ma}});Object.defineProperty(exports,"getPositionRect",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ga}});Object.defineProperty(exports,"getRunCharWidths",{enumerable:true,get:function(){return chunkB45ECEGY_js.Y}});Object.defineProperty(exports,"getScrollYForPage",{enumerable:true,get:function(){return chunkB45ECEGY_js.Aa}});Object.defineProperty(exports,"getSelectionRectsFromDom",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ma}});Object.defineProperty(exports,"getTextCacheSize",{enumerable:true,get:function(){return chunkB45ECEGY_js.ba}});Object.defineProperty(exports,"getTotalCacheSize",{enumerable:true,get:function(){return chunkB45ECEGY_js.oa}});Object.defineProperty(exports,"getTotalDocumentHeight",{enumerable:true,get:function(){return chunkB45ECEGY_js.za}});Object.defineProperty(exports,"getXForCharacter",{enumerable:true,get:function(){return chunkB45ECEGY_js.N}});Object.defineProperty(exports,"groupRectsByPage",{enumerable:true,get:function(){return chunkB45ECEGY_js.Ra}});Object.defineProperty(exports,"halfPtToPx",{enumerable:true,get:function(){return chunkB45ECEGY_js.S}});Object.defineProperty(exports,"hashParagraphBlock",{enumerable:true,get:function(){return chunkB45ECEGY_js.ha}});Object.defineProperty(exports,"hitTest",{enumerable:true,get:function(){return chunkB45ECEGY_js.ya}});Object.defineProperty(exports,"hitTestFragment",{enumerable:true,get:function(){return chunkB45ECEGY_js.va}});Object.defineProperty(exports,"hitTestImageFragment",{enumerable:true,get:function(){return chunkB45ECEGY_js.wa}});Object.defineProperty(exports,"hitTestPage",{enumerable:true,get:function(){return chunkB45ECEGY_js.sa}});Object.defineProperty(exports,"hitTestTableCell",{enumerable:true,get:function(){return chunkB45ECEGY_js.xa}});Object.defineProperty(exports,"isMultiPageSelection",{enumerable:true,get:function(){return chunkB45ECEGY_js.Qa}});Object.defineProperty(exports,"mapFootnotesToPages",{enumerable:true,get:function(){return chunkB45ECEGY_js.ob}});Object.defineProperty(exports,"measureParagraph",{enumerable:true,get:function(){return chunkB45ECEGY_js.W}});Object.defineProperty(exports,"measureParagraphs",{enumerable:true,get:function(){return chunkB45ECEGY_js.X}});Object.defineProperty(exports,"measureRun",{enumerable:true,get:function(){return chunkB45ECEGY_js.L}});Object.defineProperty(exports,"measureTableBlock",{enumerable:true,get:function(){return chunkB45ECEGY_js.Kb}});Object.defineProperty(exports,"measureTableCellBlockVisualHeight",{enumerable:true,get:function(){return chunkB45ECEGY_js.Jb}});Object.defineProperty(exports,"measureText",{enumerable:true,get:function(){return chunkB45ECEGY_js.K}});Object.defineProperty(exports,"measureTextWidth",{enumerable:true,get:function(){return chunkB45ECEGY_js.J}});Object.defineProperty(exports,"mouseToPosition",{enumerable:true,get:function(){return chunkB45ECEGY_js.La}});Object.defineProperty(exports,"normalizeHeaderFooterMeasureBlocks",{enumerable:true,get:function(){return chunkB45ECEGY_js.vb}});Object.defineProperty(exports,"normalizeTableColumnWidths",{enumerable:true,get:function(){return chunkB45ECEGY_js.E}});Object.defineProperty(exports,"positionToX",{enumerable:true,get:function(){return chunkB45ECEGY_js.Fa}});Object.defineProperty(exports,"ptToPx",{enumerable:true,get:function(){return chunkB45ECEGY_js.Q}});Object.defineProperty(exports,"pxToHalfPt",{enumerable:true,get:function(){return chunkB45ECEGY_js.T}});Object.defineProperty(exports,"pxToPt",{enumerable:true,get:function(){return chunkB45ECEGY_js.R}});Object.defineProperty(exports,"pxToTwips",{enumerable:true,get:function(){return chunkB45ECEGY_js.P}});Object.defineProperty(exports,"rectsToFloatingZones",{enumerable:true,get:function(){return chunkB45ECEGY_js.U}});Object.defineProperty(exports,"resetBlockIdCounter",{enumerable:true,get:function(){return chunkB45ECEGY_js.z}});Object.defineProperty(exports,"resetCanvasContext",{enumerable:true,get:function(){return chunkB45ECEGY_js.G}});Object.defineProperty(exports,"resolveHeaderFooter",{enumerable:true,get:function(){return chunkB45ECEGY_js.Rb}});Object.defineProperty(exports,"resolveHeaderFooterVisualTop",{enumerable:true,get:function(){return chunkB45ECEGY_js.wb}});Object.defineProperty(exports,"resolveListTemplate",{enumerable:true,get:function(){return chunkB45ECEGY_js.y}});Object.defineProperty(exports,"resolveTableWidthPx",{enumerable:true,get:function(){return chunkB45ECEGY_js.C}});Object.defineProperty(exports,"selectionToRects",{enumerable:true,get:function(){return chunkB45ECEGY_js.Oa}});Object.defineProperty(exports,"setCachedFontMetrics",{enumerable:true,get:function(){return chunkB45ECEGY_js.da}});Object.defineProperty(exports,"setCachedParagraphMeasure",{enumerable:true,get:function(){return chunkB45ECEGY_js.ja}});Object.defineProperty(exports,"setCachedTextWidth",{enumerable:true,get:function(){return chunkB45ECEGY_js._}});Object.defineProperty(exports,"setFontCacheSize",{enumerable:true,get:function(){return chunkB45ECEGY_js.fa}});Object.defineProperty(exports,"setParagraphCacheSize",{enumerable:true,get:function(){return chunkB45ECEGY_js.la}});Object.defineProperty(exports,"setTextCacheSize",{enumerable:true,get:function(){return chunkB45ECEGY_js.aa}});Object.defineProperty(exports,"stabilizeFootnoteLayout",{enumerable:true,get:function(){return chunkB45ECEGY_js.tb}});Object.defineProperty(exports,"toFlowBlocks",{enumerable:true,get:function(){return chunkB45ECEGY_js.B}});Object.defineProperty(exports,"twipsToPx",{enumerable:true,get:function(){return chunkB45ECEGY_js.O}});
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { P as PluginHostProps, b as PluginHostRef, R as RenderedDomContext, c as PositionCoordinates, d as ReactEditorPlugin } from './types-Bd_YzkhG.mjs';
|
|
2
|
+
export { E as EditorPlugin, e as PanelConfig, f as PluginContext, g as PluginPanelProps, a as ReactSidebarItem, S as SidebarItem, h as SidebarItemContext, i as SidebarItemRenderProps } from './types-Bd_YzkhG.mjs';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as prosemirror_state from 'prosemirror-state';
|
|
5
|
+
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
6
|
+
import { DecorationSet, EditorView } from 'prosemirror-view';
|
|
7
|
+
import 'prosemirror-model';
|
|
8
|
+
|
|
9
|
+
declare const PLUGIN_HOST_STYLES = "\n.plugin-host {\n display: flex;\n width: 100%;\n height: 100%;\n overflow: visible;\n position: relative;\n}\n\n.plugin-host-editor {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-width: 0;\n overflow: visible;\n}\n\n\n.plugin-panels-left,\n.plugin-panels-right {\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n background: #f8f9fa;\n border-color: #e9ecef;\n}\n\n.plugin-panels-left {\n border-right: 1px solid #e9ecef;\n}\n\n.plugin-panels-right {\n border-left: 1px solid #e9ecef;\n}\n\n.plugin-panels-bottom {\n border-top: 1px solid #e9ecef;\n background: #f8f9fa;\n}\n\n.plugin-panel {\n position: relative;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n transition: width 0.2s ease, height 0.2s ease;\n}\n\n.plugin-panel.collapsed {\n overflow: visible;\n}\n\n.plugin-panel-toggle {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 6px 8px;\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: 12px;\n color: #6c757d;\n white-space: nowrap;\n}\n\n.plugin-panel.collapsed .plugin-panel-toggle {\n writing-mode: vertical-rl;\n text-orientation: mixed;\n flex-direction: column;\n height: 100%;\n padding: 8px 6px;\n}\n\n.plugin-panel-toggle:hover {\n background: #e9ecef;\n color: #495057;\n}\n\n.plugin-panel-toggle-icon {\n font-weight: bold;\n font-size: 14px;\n}\n\n.plugin-panel.collapsed .plugin-panel-toggle-icon {\n transform: rotate(90deg);\n}\n\n.plugin-panel-toggle-label {\n font-weight: 500;\n}\n\n.plugin-panel-content {\n flex: 1;\n overflow: auto;\n}\n\n/* Right panel rendered inside viewport - scrolls with content */\n.plugin-panel-in-viewport {\n position: absolute;\n top: 0;\n /* Position is set dynamically via inline styles based on page edge */\n width: 220px;\n pointer-events: auto;\n z-index: 10;\n overflow: visible;\n}\n\n.plugin-panel-in-viewport.collapsed {\n width: 32px;\n}\n\n.plugin-panel-in-viewport .plugin-panel-toggle {\n position: sticky;\n top: 0;\n background: rgba(255, 255, 255, 0.95);\n border-radius: 4px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n.plugin-panel-in-viewport-content {\n overflow: visible;\n position: relative;\n}\n\n/* Plugin overlay container for rendering highlights/decorations */\n.plugin-overlays-container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n overflow: visible;\n z-index: 5;\n}\n\n.plugin-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n}\n\n/* Individual overlay children manage their own pointer-events.\n Do NOT set pointer-events: auto here \u2014 it overrides overlay containers\n that need pointer-events: none to let clicks pass through to the editor. */\n";
|
|
10
|
+
/**
|
|
11
|
+
* PluginHost Component
|
|
12
|
+
*
|
|
13
|
+
* Wraps the editor and provides:
|
|
14
|
+
* - Plugin state management
|
|
15
|
+
* - Panel rendering for each plugin
|
|
16
|
+
* - CSS injection for plugin styles
|
|
17
|
+
* - Callbacks for editor interaction
|
|
18
|
+
*/
|
|
19
|
+
declare const PluginHost: React.ForwardRefExoticComponent<PluginHostProps & React.RefAttributes<PluginHostRef>>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* RenderedDomContext Implementation
|
|
23
|
+
*
|
|
24
|
+
* Provides DOM-based position mapping for the LayoutPainter output.
|
|
25
|
+
* Uses the same data-pm-start/data-pm-end attribute pattern as the
|
|
26
|
+
* selection overlay in PagedEditor.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Implementation of RenderedDomContext.
|
|
31
|
+
*
|
|
32
|
+
* This class provides position mapping between ProseMirror document
|
|
33
|
+
* positions and pixel coordinates in the rendered DOM. It uses the
|
|
34
|
+
* data-pm-start and data-pm-end attributes that LayoutPainter adds
|
|
35
|
+
* to span elements.
|
|
36
|
+
*/
|
|
37
|
+
declare class RenderedDomContextImpl implements RenderedDomContext {
|
|
38
|
+
pagesContainer: HTMLElement;
|
|
39
|
+
zoom: number;
|
|
40
|
+
constructor(pagesContainer: HTMLElement, zoom?: number);
|
|
41
|
+
/**
|
|
42
|
+
* Get pixel coordinates for a ProseMirror position.
|
|
43
|
+
* Uses the browser's text rendering via Range API for precise positioning.
|
|
44
|
+
*/
|
|
45
|
+
getCoordinatesForPosition(pmPos: number): PositionCoordinates | null;
|
|
46
|
+
/**
|
|
47
|
+
* Find DOM elements that overlap with a ProseMirror position range.
|
|
48
|
+
*/
|
|
49
|
+
findElementsForRange(from: number, to: number): Element[];
|
|
50
|
+
/**
|
|
51
|
+
* Get bounding rectangles for a range of text.
|
|
52
|
+
* Handles line wraps by returning multiple rects.
|
|
53
|
+
*/
|
|
54
|
+
getRectsForRange(from: number, to: number): Array<{
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Get the offset of the pages container from its parent viewport.
|
|
62
|
+
* This is needed for positioning overlays that are rendered in the
|
|
63
|
+
* viewport container rather than directly in the pages container.
|
|
64
|
+
*/
|
|
65
|
+
getContainerOffset(): {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Create a RenderedDomContext for a pages container element.
|
|
72
|
+
*
|
|
73
|
+
* @param pagesContainer - The container element holding rendered pages
|
|
74
|
+
* @param zoom - Current zoom level (default 1)
|
|
75
|
+
*/
|
|
76
|
+
declare function createRenderedDomContext(pagesContainer: HTMLElement, zoom?: number): RenderedDomContext;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Template tag types
|
|
80
|
+
*/
|
|
81
|
+
type TagType = 'variable' | 'sectionStart' | 'sectionEnd' | 'invertedStart' | 'raw';
|
|
82
|
+
/**
|
|
83
|
+
* A found template tag
|
|
84
|
+
*/
|
|
85
|
+
interface TemplateTag {
|
|
86
|
+
id: string;
|
|
87
|
+
type: TagType;
|
|
88
|
+
name: string;
|
|
89
|
+
rawTag: string;
|
|
90
|
+
from: number;
|
|
91
|
+
to: number;
|
|
92
|
+
/** For sections: nested variable names */
|
|
93
|
+
nestedVars?: string[];
|
|
94
|
+
/** True if this variable is inside a section (shown in section's nested vars) */
|
|
95
|
+
insideSection?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Plugin state
|
|
99
|
+
*/
|
|
100
|
+
interface TemplatePluginState$1 {
|
|
101
|
+
tags: TemplateTag[];
|
|
102
|
+
decorations: DecorationSet;
|
|
103
|
+
hoveredId?: string;
|
|
104
|
+
selectedId?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Plugin key
|
|
108
|
+
*/
|
|
109
|
+
declare const templatePluginKey: PluginKey<TemplatePluginState$1>;
|
|
110
|
+
/**
|
|
111
|
+
* Create the template plugin
|
|
112
|
+
*/
|
|
113
|
+
declare function createTemplatePlugin(): Plugin<TemplatePluginState$1>;
|
|
114
|
+
/**
|
|
115
|
+
* Get tags from editor state
|
|
116
|
+
*/
|
|
117
|
+
declare function getTemplateTags(state: prosemirror_state.EditorState): TemplateTag[];
|
|
118
|
+
/**
|
|
119
|
+
* Set hovered tag
|
|
120
|
+
*/
|
|
121
|
+
declare function setHoveredElement(view: EditorView, id: string | undefined): void;
|
|
122
|
+
/**
|
|
123
|
+
* Set selected tag
|
|
124
|
+
*/
|
|
125
|
+
declare function setSelectedElement(view: EditorView, id: string | undefined): void;
|
|
126
|
+
/**
|
|
127
|
+
* CSS styles for template decorations
|
|
128
|
+
*/
|
|
129
|
+
declare const 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";
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Template Plugin
|
|
133
|
+
*
|
|
134
|
+
* Docxtemplater template support as a plugin for the DOCX Editor.
|
|
135
|
+
*
|
|
136
|
+
* Features:
|
|
137
|
+
* - Full docxtemplater syntax detection (variables, loops, conditionals)
|
|
138
|
+
* - Sidebar annotation chips showing template structure (via getSidebarItems)
|
|
139
|
+
* - Differentiated visual highlighting by element type
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```tsx
|
|
143
|
+
* import { PluginHost, templatePlugin } from '@eigenpal/docx-editor-react/plugin-api';
|
|
144
|
+
*
|
|
145
|
+
* function MyEditor() {
|
|
146
|
+
* return (
|
|
147
|
+
* <PluginHost plugins={[templatePlugin]}>
|
|
148
|
+
* <DocxEditor document={doc} onChange={handleChange} />
|
|
149
|
+
* </PluginHost>
|
|
150
|
+
* );
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
interface TemplatePluginState {
|
|
156
|
+
tags: TemplateTag[];
|
|
157
|
+
hoveredId?: string;
|
|
158
|
+
selectedId?: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Create the template plugin instance.
|
|
162
|
+
*/
|
|
163
|
+
declare function createPlugin(_options?: {
|
|
164
|
+
/** @deprecated — panel is no longer used; template chips render in the unified sidebar */
|
|
165
|
+
defaultCollapsed?: boolean;
|
|
166
|
+
/** @deprecated */
|
|
167
|
+
panelPosition?: 'left' | 'right';
|
|
168
|
+
/** @deprecated */
|
|
169
|
+
panelWidth?: number;
|
|
170
|
+
}): ReactEditorPlugin<TemplatePluginState>;
|
|
171
|
+
/**
|
|
172
|
+
* Default template plugin instance.
|
|
173
|
+
*/
|
|
174
|
+
declare const templatePlugin: ReactEditorPlugin<TemplatePluginState>;
|
|
175
|
+
|
|
176
|
+
export { PLUGIN_HOST_STYLES, PluginHost, PluginHostProps, PluginHostRef, PositionCoordinates, ReactEditorPlugin, RenderedDomContext, RenderedDomContextImpl, TEMPLATE_DECORATION_STYLES, type TagType, type TemplateTag, createRenderedDomContext, createPlugin as createTemplatePlugin, createTemplatePlugin as createTemplateProseMirrorPlugin, getTemplateTags as getTemplatePluginTags, setHoveredElement, setSelectedElement, templatePlugin, templatePluginKey };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { P as PluginHostProps, b as PluginHostRef, R as RenderedDomContext, c as PositionCoordinates, d as ReactEditorPlugin } from './types-Bd_YzkhG.js';
|
|
2
|
+
export { E as EditorPlugin, e as PanelConfig, f as PluginContext, g as PluginPanelProps, a as ReactSidebarItem, S as SidebarItem, h as SidebarItemContext, i as SidebarItemRenderProps } from './types-Bd_YzkhG.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as prosemirror_state from 'prosemirror-state';
|
|
5
|
+
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
6
|
+
import { DecorationSet, EditorView } from 'prosemirror-view';
|
|
7
|
+
import 'prosemirror-model';
|
|
8
|
+
|
|
9
|
+
declare const PLUGIN_HOST_STYLES = "\n.plugin-host {\n display: flex;\n width: 100%;\n height: 100%;\n overflow: visible;\n position: relative;\n}\n\n.plugin-host-editor {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-width: 0;\n overflow: visible;\n}\n\n\n.plugin-panels-left,\n.plugin-panels-right {\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n background: #f8f9fa;\n border-color: #e9ecef;\n}\n\n.plugin-panels-left {\n border-right: 1px solid #e9ecef;\n}\n\n.plugin-panels-right {\n border-left: 1px solid #e9ecef;\n}\n\n.plugin-panels-bottom {\n border-top: 1px solid #e9ecef;\n background: #f8f9fa;\n}\n\n.plugin-panel {\n position: relative;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n transition: width 0.2s ease, height 0.2s ease;\n}\n\n.plugin-panel.collapsed {\n overflow: visible;\n}\n\n.plugin-panel-toggle {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 6px 8px;\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: 12px;\n color: #6c757d;\n white-space: nowrap;\n}\n\n.plugin-panel.collapsed .plugin-panel-toggle {\n writing-mode: vertical-rl;\n text-orientation: mixed;\n flex-direction: column;\n height: 100%;\n padding: 8px 6px;\n}\n\n.plugin-panel-toggle:hover {\n background: #e9ecef;\n color: #495057;\n}\n\n.plugin-panel-toggle-icon {\n font-weight: bold;\n font-size: 14px;\n}\n\n.plugin-panel.collapsed .plugin-panel-toggle-icon {\n transform: rotate(90deg);\n}\n\n.plugin-panel-toggle-label {\n font-weight: 500;\n}\n\n.plugin-panel-content {\n flex: 1;\n overflow: auto;\n}\n\n/* Right panel rendered inside viewport - scrolls with content */\n.plugin-panel-in-viewport {\n position: absolute;\n top: 0;\n /* Position is set dynamically via inline styles based on page edge */\n width: 220px;\n pointer-events: auto;\n z-index: 10;\n overflow: visible;\n}\n\n.plugin-panel-in-viewport.collapsed {\n width: 32px;\n}\n\n.plugin-panel-in-viewport .plugin-panel-toggle {\n position: sticky;\n top: 0;\n background: rgba(255, 255, 255, 0.95);\n border-radius: 4px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n.plugin-panel-in-viewport-content {\n overflow: visible;\n position: relative;\n}\n\n/* Plugin overlay container for rendering highlights/decorations */\n.plugin-overlays-container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n overflow: visible;\n z-index: 5;\n}\n\n.plugin-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n}\n\n/* Individual overlay children manage their own pointer-events.\n Do NOT set pointer-events: auto here \u2014 it overrides overlay containers\n that need pointer-events: none to let clicks pass through to the editor. */\n";
|
|
10
|
+
/**
|
|
11
|
+
* PluginHost Component
|
|
12
|
+
*
|
|
13
|
+
* Wraps the editor and provides:
|
|
14
|
+
* - Plugin state management
|
|
15
|
+
* - Panel rendering for each plugin
|
|
16
|
+
* - CSS injection for plugin styles
|
|
17
|
+
* - Callbacks for editor interaction
|
|
18
|
+
*/
|
|
19
|
+
declare const PluginHost: React.ForwardRefExoticComponent<PluginHostProps & React.RefAttributes<PluginHostRef>>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* RenderedDomContext Implementation
|
|
23
|
+
*
|
|
24
|
+
* Provides DOM-based position mapping for the LayoutPainter output.
|
|
25
|
+
* Uses the same data-pm-start/data-pm-end attribute pattern as the
|
|
26
|
+
* selection overlay in PagedEditor.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Implementation of RenderedDomContext.
|
|
31
|
+
*
|
|
32
|
+
* This class provides position mapping between ProseMirror document
|
|
33
|
+
* positions and pixel coordinates in the rendered DOM. It uses the
|
|
34
|
+
* data-pm-start and data-pm-end attributes that LayoutPainter adds
|
|
35
|
+
* to span elements.
|
|
36
|
+
*/
|
|
37
|
+
declare class RenderedDomContextImpl implements RenderedDomContext {
|
|
38
|
+
pagesContainer: HTMLElement;
|
|
39
|
+
zoom: number;
|
|
40
|
+
constructor(pagesContainer: HTMLElement, zoom?: number);
|
|
41
|
+
/**
|
|
42
|
+
* Get pixel coordinates for a ProseMirror position.
|
|
43
|
+
* Uses the browser's text rendering via Range API for precise positioning.
|
|
44
|
+
*/
|
|
45
|
+
getCoordinatesForPosition(pmPos: number): PositionCoordinates | null;
|
|
46
|
+
/**
|
|
47
|
+
* Find DOM elements that overlap with a ProseMirror position range.
|
|
48
|
+
*/
|
|
49
|
+
findElementsForRange(from: number, to: number): Element[];
|
|
50
|
+
/**
|
|
51
|
+
* Get bounding rectangles for a range of text.
|
|
52
|
+
* Handles line wraps by returning multiple rects.
|
|
53
|
+
*/
|
|
54
|
+
getRectsForRange(from: number, to: number): Array<{
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Get the offset of the pages container from its parent viewport.
|
|
62
|
+
* This is needed for positioning overlays that are rendered in the
|
|
63
|
+
* viewport container rather than directly in the pages container.
|
|
64
|
+
*/
|
|
65
|
+
getContainerOffset(): {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Create a RenderedDomContext for a pages container element.
|
|
72
|
+
*
|
|
73
|
+
* @param pagesContainer - The container element holding rendered pages
|
|
74
|
+
* @param zoom - Current zoom level (default 1)
|
|
75
|
+
*/
|
|
76
|
+
declare function createRenderedDomContext(pagesContainer: HTMLElement, zoom?: number): RenderedDomContext;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Template tag types
|
|
80
|
+
*/
|
|
81
|
+
type TagType = 'variable' | 'sectionStart' | 'sectionEnd' | 'invertedStart' | 'raw';
|
|
82
|
+
/**
|
|
83
|
+
* A found template tag
|
|
84
|
+
*/
|
|
85
|
+
interface TemplateTag {
|
|
86
|
+
id: string;
|
|
87
|
+
type: TagType;
|
|
88
|
+
name: string;
|
|
89
|
+
rawTag: string;
|
|
90
|
+
from: number;
|
|
91
|
+
to: number;
|
|
92
|
+
/** For sections: nested variable names */
|
|
93
|
+
nestedVars?: string[];
|
|
94
|
+
/** True if this variable is inside a section (shown in section's nested vars) */
|
|
95
|
+
insideSection?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Plugin state
|
|
99
|
+
*/
|
|
100
|
+
interface TemplatePluginState$1 {
|
|
101
|
+
tags: TemplateTag[];
|
|
102
|
+
decorations: DecorationSet;
|
|
103
|
+
hoveredId?: string;
|
|
104
|
+
selectedId?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Plugin key
|
|
108
|
+
*/
|
|
109
|
+
declare const templatePluginKey: PluginKey<TemplatePluginState$1>;
|
|
110
|
+
/**
|
|
111
|
+
* Create the template plugin
|
|
112
|
+
*/
|
|
113
|
+
declare function createTemplatePlugin(): Plugin<TemplatePluginState$1>;
|
|
114
|
+
/**
|
|
115
|
+
* Get tags from editor state
|
|
116
|
+
*/
|
|
117
|
+
declare function getTemplateTags(state: prosemirror_state.EditorState): TemplateTag[];
|
|
118
|
+
/**
|
|
119
|
+
* Set hovered tag
|
|
120
|
+
*/
|
|
121
|
+
declare function setHoveredElement(view: EditorView, id: string | undefined): void;
|
|
122
|
+
/**
|
|
123
|
+
* Set selected tag
|
|
124
|
+
*/
|
|
125
|
+
declare function setSelectedElement(view: EditorView, id: string | undefined): void;
|
|
126
|
+
/**
|
|
127
|
+
* CSS styles for template decorations
|
|
128
|
+
*/
|
|
129
|
+
declare const 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";
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Template Plugin
|
|
133
|
+
*
|
|
134
|
+
* Docxtemplater template support as a plugin for the DOCX Editor.
|
|
135
|
+
*
|
|
136
|
+
* Features:
|
|
137
|
+
* - Full docxtemplater syntax detection (variables, loops, conditionals)
|
|
138
|
+
* - Sidebar annotation chips showing template structure (via getSidebarItems)
|
|
139
|
+
* - Differentiated visual highlighting by element type
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```tsx
|
|
143
|
+
* import { PluginHost, templatePlugin } from '@eigenpal/docx-editor-react/plugin-api';
|
|
144
|
+
*
|
|
145
|
+
* function MyEditor() {
|
|
146
|
+
* return (
|
|
147
|
+
* <PluginHost plugins={[templatePlugin]}>
|
|
148
|
+
* <DocxEditor document={doc} onChange={handleChange} />
|
|
149
|
+
* </PluginHost>
|
|
150
|
+
* );
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
interface TemplatePluginState {
|
|
156
|
+
tags: TemplateTag[];
|
|
157
|
+
hoveredId?: string;
|
|
158
|
+
selectedId?: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Create the template plugin instance.
|
|
162
|
+
*/
|
|
163
|
+
declare function createPlugin(_options?: {
|
|
164
|
+
/** @deprecated — panel is no longer used; template chips render in the unified sidebar */
|
|
165
|
+
defaultCollapsed?: boolean;
|
|
166
|
+
/** @deprecated */
|
|
167
|
+
panelPosition?: 'left' | 'right';
|
|
168
|
+
/** @deprecated */
|
|
169
|
+
panelWidth?: number;
|
|
170
|
+
}): ReactEditorPlugin<TemplatePluginState>;
|
|
171
|
+
/**
|
|
172
|
+
* Default template plugin instance.
|
|
173
|
+
*/
|
|
174
|
+
declare const templatePlugin: ReactEditorPlugin<TemplatePluginState>;
|
|
175
|
+
|
|
176
|
+
export { PLUGIN_HOST_STYLES, PluginHost, PluginHostProps, PluginHostRef, PositionCoordinates, ReactEditorPlugin, RenderedDomContext, RenderedDomContextImpl, TEMPLATE_DECORATION_STYLES, type TagType, type TemplateTag, createRenderedDomContext, createPlugin as createTemplatePlugin, createTemplatePlugin as createTemplateProseMirrorPlugin, getTemplateTags as getTemplatePluginTags, setHoveredElement, setSelectedElement, templatePlugin, templatePluginKey };
|