@arbidocs/blocks 0.4.101 → 0.4.103
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/dist/chunk-6MG62I5B.cjs +272 -0
- package/dist/chunk-6MG62I5B.cjs.map +1 -0
- package/dist/{chunk-MYALCKDR.js → chunk-CVYY4X5R.js} +306 -75
- package/dist/chunk-CVYY4X5R.js.map +1 -0
- package/dist/chunk-EQB3WELX.js +269 -0
- package/dist/chunk-EQB3WELX.js.map +1 -0
- package/dist/{chunk-G5JH2YMQ.js → chunk-GQTIAATM.js} +3 -3
- package/dist/{chunk-G5JH2YMQ.js.map → chunk-GQTIAATM.js.map} +1 -1
- package/dist/{chunk-YGREW5TZ.js → chunk-H6DFXG5N.js} +3 -3
- package/dist/{chunk-YGREW5TZ.js.map → chunk-H6DFXG5N.js.map} +1 -1
- package/dist/{chunk-ZT2EBBSC.cjs → chunk-N36PWG7A.cjs} +5 -5
- package/dist/{chunk-ZT2EBBSC.cjs.map → chunk-N36PWG7A.cjs.map} +1 -1
- package/dist/{chunk-FAGQTB3D.cjs → chunk-O33EBMIX.cjs} +305 -74
- package/dist/chunk-O33EBMIX.cjs.map +1 -0
- package/dist/{chunk-Y5XW57U4.cjs → chunk-TFDU2KGS.cjs} +5 -5
- package/dist/{chunk-Y5XW57U4.cjs.map → chunk-TFDU2KGS.cjs.map} +1 -1
- package/dist/connect/docx.cjs +6 -6
- package/dist/connect/docx.js +4 -4
- package/dist/connect/index.cjs +3 -3
- package/dist/connect/index.js +2 -2
- package/dist/document-tools/AdoptSignatureDialog.d.ts +25 -0
- package/dist/document-tools/DocumentToolButtons.d.ts +2 -0
- package/dist/document-tools/SignatureRequestBanner.d.ts +18 -0
- package/dist/document-tools/index.cjs +175 -0
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.ts +3 -1
- package/dist/document-tools/index.js +168 -3
- package/dist/document-tools/index.js.map +1 -1
- package/dist/document-tools/viewer/GuidedSigningViewer.d.ts +26 -0
- package/dist/document-tools/viewer/SignatureFieldsOverlay.d.ts +41 -0
- package/dist/document-tools/viewer/SignatureRequestEditor.d.ts +26 -0
- package/dist/document-tools/viewer/index.cjs +983 -0
- package/dist/document-tools/viewer/index.cjs.map +1 -1
- package/dist/document-tools/viewer/index.d.ts +3 -0
- package/dist/document-tools/viewer/index.js +983 -5
- package/dist/document-tools/viewer/index.js.map +1 -1
- package/dist/docx/RibbonMenu.d.ts +4 -1
- package/dist/docx/RibbonOverflow.d.ts +27 -0
- package/dist/docx/WordReferences.d.ts +3 -2
- package/dist/docx/index.cjs +35 -35
- package/dist/docx/index.js +3 -3
- package/dist/docx/noteStyles.d.ts +46 -0
- package/dist/docx/overflowPlan.d.ts +15 -0
- package/dist/index.cjs +5 -5
- package/dist/index.js +1 -1
- package/node_modules/@arbidocs/coedit/LICENSE +21 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.cjs +751 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.d.cts +192 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.d.ts +192 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.js +716 -0
- package/node_modules/@arbidocs/coedit/dist/encoding.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs +1759 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.cts +39 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.ts +39 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.js +1736 -0
- package/node_modules/@arbidocs/coedit/dist/hocuspocus.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/index.cjs +1692 -0
- package/node_modules/@arbidocs/coedit/dist/index.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/index.d.cts +16 -0
- package/node_modules/@arbidocs/coedit/dist/index.d.ts +16 -0
- package/node_modules/@arbidocs/coedit/dist/index.js +1664 -0
- package/node_modules/@arbidocs/coedit/dist/index.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/server.cjs +1852 -0
- package/node_modules/@arbidocs/coedit/dist/server.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/server.d.cts +43 -0
- package/node_modules/@arbidocs/coedit/dist/server.d.ts +43 -0
- package/node_modules/@arbidocs/coedit/dist/server.js +1822 -0
- package/node_modules/@arbidocs/coedit/dist/server.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/session-Cf9iu1Vt.d.cts +82 -0
- package/node_modules/@arbidocs/coedit/dist/session-Cf9iu1Vt.d.ts +82 -0
- package/node_modules/@arbidocs/coedit/dist/template.cjs +1627 -0
- package/node_modules/@arbidocs/coedit/dist/template.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/template.d.cts +125 -0
- package/node_modules/@arbidocs/coedit/dist/template.d.ts +125 -0
- package/node_modules/@arbidocs/coedit/dist/template.js +1612 -0
- package/node_modules/@arbidocs/coedit/dist/template.js.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/versions-DXiFQMA6.d.cts +8 -0
- package/node_modules/@arbidocs/coedit/dist/versions-DXiFQMA6.d.ts +8 -0
- package/node_modules/@arbidocs/coedit/package.json +68 -0
- package/node_modules/@docx-editor.dev/core/LICENSE +201 -0
- package/node_modules/@docx-editor.dev/core/README.md +125 -0
- package/node_modules/@docx-editor.dev/core/THIRD_PARTY_NOTICES.md +56 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.d.ts +162 -0
- package/node_modules/@docx-editor.dev/core/dist/automation.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.d.ts +164 -0
- package/node_modules/@docx-editor.dev/core/dist/binding.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-2GO5T2JU.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-2RC2EPND.js +3 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-4GBTELJV.cjs +28 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-4R3TEXMN.js +18 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-5CSUYANV.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6APGXLBB.cjs +3 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6AWEKBLB.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6EYYL7FL.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-6JIJOZDW.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-BTQKU64Q.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-E7BQA6UP.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-EO4C5QJW.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-ETTO6GK3.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-FIJZIQXA.cjs +18 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-FRXAOVTB.js +28 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-J6BVWIDB.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-JGNVNT2A.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-K5U2PLDP.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-KKIJG3C6.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-LWDSDCMO.js +27 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-NBCVVZOM.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-O2AL2HSJ.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-O5INAWZQ.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-QMLCVPCD.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-RCHS4ZEH.cjs +27 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-RIYSCEFQ.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-S6J4O5XP.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-SRPILEWV.cjs +5 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-TSLBZ26X.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-UKVVUHZL.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VDNNLG6X.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VHAVHCQY.js +7 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-VX43VBAX.cjs +7 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-Z6WBFXJU.js +5 -0
- package/node_modules/@docx-editor.dev/core/dist/chunk-ZUHOMK52.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.d.ts +270 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.d.ts +269 -0
- package/node_modules/@docx-editor.dev/core/dist/collaboration.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.d.ts +290 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/document.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.d.ts +22 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/editor.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.d.ts +103 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.d.ts +143 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/modules.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.d.ts +11 -0
- package/node_modules/@docx-editor.dev/core/dist/contracts/types.js +0 -0
- package/node_modules/@docx-editor.dev/core/dist/custom-node-writes-cvL5rhcD.d.ts +323 -0
- package/node_modules/@docx-editor.dev/core/dist/dist-PKZR6RSH.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/document-protection-BAGVGqaP.d.ts +20 -0
- package/node_modules/@docx-editor.dev/core/dist/editor-Ci7IZGmG.d.ts +2448 -0
- package/node_modules/@docx-editor.dev/core/dist/editor-scope-OHPwVQ5l.d.ts +84 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.css +15 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.d.ts +1394 -0
- package/node_modules/@docx-editor.dev/core/dist/editor.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/export.cjs +2 -0
- package/node_modules/@docx-editor.dev/core/dist/export.d.ts +391 -0
- package/node_modules/@docx-editor.dev/core/dist/export.js +2 -0
- package/node_modules/@docx-editor.dev/core/dist/failure-NS2lsya4.d.ts +115 -0
- package/node_modules/@docx-editor.dev/core/dist/font-resolver-BVQB14qT.d.ts +256 -0
- package/node_modules/@docx-editor.dev/core/dist/harfbuzz.wasm +0 -0
- package/node_modules/@docx-editor.dev/core/dist/headless-document-view-qH331moE.d.ts +143 -0
- package/node_modules/@docx-editor.dev/core/dist/image-resources-BN-hUgCn.d.ts +211 -0
- package/node_modules/@docx-editor.dev/core/dist/index-Bsg7oIKP.d.ts +3869 -0
- package/node_modules/@docx-editor.dev/core/dist/index.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/index.d.ts +53 -0
- package/node_modules/@docx-editor.dev/core/dist/index.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/layout-shaping-BEyuiQOk.d.ts +246 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.d.ts +3151 -0
- package/node_modules/@docx-editor.dev/core/dist/layout.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/node-module-shim-TTKTT66I.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/note-properties-4Y9o6Gyk.d.ts +68 -0
- package/node_modules/@docx-editor.dev/core/dist/omml-equation-CuzBL5DD.d.ts +85 -0
- package/node_modules/@docx-editor.dev/core/dist/output.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/output.d.ts +97 -0
- package/node_modules/@docx-editor.dev/core/dist/output.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/protocol-Bqk4Izjc.d.ts +1651 -0
- package/node_modules/@docx-editor.dev/core/dist/review-pane-D9jm8DcY.d.ts +128 -0
- package/node_modules/@docx-editor.dev/core/dist/review-paragraph-order-DT-n6ouC.d.ts +85 -0
- package/node_modules/@docx-editor.dev/core/dist/revision-projection-DZ4kKVev.d.ts +242 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-cell-selection-D9D1KSXq.d.ts +464 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-interaction-CIC-PooQ.d.ts +135 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-paint-BME37OMv.d.ts +326 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-record-queries-CBlZqZNa.d.ts +177 -0
- package/node_modules/@docx-editor.dev/core/dist/semantic-records-4B3WwFAi.d.ts +3532 -0
- package/node_modules/@docx-editor.dev/core/dist/store.cjs +1 -0
- package/node_modules/@docx-editor.dev/core/dist/store.d.ts +2706 -0
- package/node_modules/@docx-editor.dev/core/dist/store.js +1 -0
- package/node_modules/@docx-editor.dev/core/dist/tree-package-fragment-BeeKxDw8.d.ts +1201 -0
- package/node_modules/@docx-editor.dev/core/dist/tree-session-contract-CVbmlMlq.d.ts +664 -0
- package/node_modules/@docx-editor.dev/core/dist/types-barrel-D3xCgQX6.d.ts +4269 -0
- package/node_modules/@docx-editor.dev/core/licenses/HarfBuzz-COPYING.txt +42 -0
- package/node_modules/@docx-editor.dev/core/package.json +140 -0
- package/node_modules/@docx-editor.dev/react/LICENSE +201 -0
- package/node_modules/@docx-editor.dev/react/README.md +141 -0
- package/node_modules/@docx-editor.dev/react/THIRD_PARTY_NOTICES.md +18 -0
- package/node_modules/@docx-editor.dev/react/dist/index.d.mts +4928 -0
- package/node_modules/@docx-editor.dev/react/dist/index.d.ts +4928 -0
- package/node_modules/@docx-editor.dev/react/dist/index.js +4 -0
- package/node_modules/@docx-editor.dev/react/dist/index.mjs +4 -0
- package/node_modules/@docx-editor.dev/react/package.json +74 -0
- package/node_modules/@docx-editor.dev/react/src/styles/editor.css +6 -0
- package/node_modules/@docx-editor.dev/react/src/styles/zIndex.ts +28 -0
- package/package.json +26 -15
- package/src/docx/README.md +10 -0
- package/src/docx/styles.css +73 -5
- package/dist/chunk-FAGQTB3D.cjs.map +0 -1
- package/dist/chunk-MYALCKDR.js.map +0 -1
|
@@ -2194,7 +2194,9 @@ function RibbonMenu({
|
|
|
2194
2194
|
children,
|
|
2195
2195
|
className,
|
|
2196
2196
|
testId,
|
|
2197
|
-
title
|
|
2197
|
+
title,
|
|
2198
|
+
keepMounted = false,
|
|
2199
|
+
popoverClassName
|
|
2198
2200
|
}) {
|
|
2199
2201
|
const [open, setOpen] = React3.useState(false);
|
|
2200
2202
|
const element = React3.useRef(null);
|
|
@@ -2228,12 +2230,13 @@ function RibbonMenu({
|
|
|
2228
2230
|
children: icon
|
|
2229
2231
|
}
|
|
2230
2232
|
),
|
|
2231
|
-
open && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2233
|
+
(open || keepMounted) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2232
2234
|
"div",
|
|
2233
2235
|
{
|
|
2234
|
-
className: "native-docx-ribbon-popover",
|
|
2236
|
+
className: ["native-docx-ribbon-popover", popoverClassName].filter(Boolean).join(" "),
|
|
2235
2237
|
role: "group",
|
|
2236
2238
|
"aria-label": label,
|
|
2239
|
+
hidden: !open,
|
|
2237
2240
|
onMouseDown: (event) => {
|
|
2238
2241
|
if (!(event.target instanceof HTMLInputElement || event.target instanceof HTMLSelectElement))
|
|
2239
2242
|
event.preventDefault();
|
|
@@ -2511,6 +2514,163 @@ var WordDraftStream = class {
|
|
|
2511
2514
|
}
|
|
2512
2515
|
};
|
|
2513
2516
|
|
|
2517
|
+
// src/docx/overflowPlan.ts
|
|
2518
|
+
function planOverflow(items, available, moreWidth) {
|
|
2519
|
+
const collapsed = /* @__PURE__ */ new Set();
|
|
2520
|
+
let used = items.reduce((sum, item) => sum + item.width, 0);
|
|
2521
|
+
if (used <= available) return collapsed;
|
|
2522
|
+
used += moreWidth;
|
|
2523
|
+
const order = items.map((item, index) => ({ item, index })).sort((a, b) => a.item.priority - b.item.priority || b.index - a.index);
|
|
2524
|
+
for (const { item } of order) {
|
|
2525
|
+
if (used <= available) break;
|
|
2526
|
+
collapsed.add(item.id);
|
|
2527
|
+
used -= item.width;
|
|
2528
|
+
}
|
|
2529
|
+
return collapsed;
|
|
2530
|
+
}
|
|
2531
|
+
var Overflow = React3.createContext(null);
|
|
2532
|
+
var MORE_WIDTH = 32;
|
|
2533
|
+
var sameSet = (a, b) => a.size === b.size && [...a].every((id) => b.has(id));
|
|
2534
|
+
function RibbonOverflow({ tab, children }) {
|
|
2535
|
+
const row = React3.useRef(null);
|
|
2536
|
+
const items = React3.useRef(/* @__PURE__ */ new Map());
|
|
2537
|
+
const widths = React3.useRef(/* @__PURE__ */ new Map());
|
|
2538
|
+
const [version, setVersion] = React3.useState(0);
|
|
2539
|
+
const [collapsed, setCollapsed] = React3.useState(() => /* @__PURE__ */ new Set());
|
|
2540
|
+
const [slots, setSlots] = React3.useState({});
|
|
2541
|
+
const [menu, setMenu] = React3.useState([]);
|
|
2542
|
+
const register = React3.useCallback((id, item) => {
|
|
2543
|
+
items.current.set(id, item);
|
|
2544
|
+
setVersion((v) => v + 1);
|
|
2545
|
+
return () => {
|
|
2546
|
+
if (items.current.get(id) === item) items.current.delete(id);
|
|
2547
|
+
setVersion((v) => v + 1);
|
|
2548
|
+
};
|
|
2549
|
+
}, []);
|
|
2550
|
+
const plan = React3.useCallback(() => {
|
|
2551
|
+
const element = row.current;
|
|
2552
|
+
if (!element) return;
|
|
2553
|
+
const gap = parseFloat(getComputedStyle(element).columnGap) || 0;
|
|
2554
|
+
const ordered = Array.from(element.querySelectorAll("[data-ribbon-item]")).map((node) => node.dataset.ribbonItem).filter((id) => items.current.has(id));
|
|
2555
|
+
const measured = ordered.map((id) => {
|
|
2556
|
+
const { element: node, priority } = items.current.get(id);
|
|
2557
|
+
if (!node.hidden) {
|
|
2558
|
+
const width = node.getBoundingClientRect().width;
|
|
2559
|
+
widths.current.set(id, width ? width + gap : 0);
|
|
2560
|
+
}
|
|
2561
|
+
return { id, priority, width: widths.current.get(id) ?? 0 };
|
|
2562
|
+
});
|
|
2563
|
+
const next = planOverflow(measured, element.clientWidth, MORE_WIDTH);
|
|
2564
|
+
setCollapsed((current) => sameSet(current, next) ? current : next);
|
|
2565
|
+
const entries = ordered.filter((id) => next.has(id)).map((id) => ({ id, label: items.current.get(id).label }));
|
|
2566
|
+
setMenu(
|
|
2567
|
+
(current) => current.length === entries.length && current.every((entry, i) => entry.id === entries[i].id && entry.label === entries[i].label) ? current : entries
|
|
2568
|
+
);
|
|
2569
|
+
}, []);
|
|
2570
|
+
React3.useLayoutEffect(plan, [plan, version, tab, collapsed]);
|
|
2571
|
+
React3.useLayoutEffect(() => {
|
|
2572
|
+
const element = row.current;
|
|
2573
|
+
if (!element) return;
|
|
2574
|
+
const observer = new ResizeObserver(() => plan());
|
|
2575
|
+
observer.observe(element);
|
|
2576
|
+
for (const item of items.current.values()) observer.observe(item.element);
|
|
2577
|
+
return () => observer.disconnect();
|
|
2578
|
+
}, [plan, version]);
|
|
2579
|
+
const slotRef = React3.useCallback(
|
|
2580
|
+
(id) => (node) => setSlots((current) => {
|
|
2581
|
+
if (node ? current[id] === node : !(id in current)) return current;
|
|
2582
|
+
const next = { ...current };
|
|
2583
|
+
if (node) next[id] = node;
|
|
2584
|
+
else delete next[id];
|
|
2585
|
+
return next;
|
|
2586
|
+
}),
|
|
2587
|
+
[]
|
|
2588
|
+
);
|
|
2589
|
+
const context = React3.useMemo(() => ({ collapsed, slots, register }), [collapsed, slots, register]);
|
|
2590
|
+
const shown = menu.filter((entry) => collapsed.has(entry.id));
|
|
2591
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Overflow.Provider, { value: context, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "native-docx-ribbon-row", ref: row, "data-testid": "docx-ribbon-row", children: [
|
|
2592
|
+
children,
|
|
2593
|
+
shown.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2594
|
+
RibbonMenu,
|
|
2595
|
+
{
|
|
2596
|
+
label: "More",
|
|
2597
|
+
title: "More commands",
|
|
2598
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Ellipsis, { size: 16 }),
|
|
2599
|
+
testId: "docx-ribbon-more",
|
|
2600
|
+
keepMounted: true,
|
|
2601
|
+
popoverClassName: "native-docx-ribbon-more",
|
|
2602
|
+
children: (close) => /* @__PURE__ */ jsxRuntime.jsx(MoreRows, { entries: shown, slotRef, close })
|
|
2603
|
+
},
|
|
2604
|
+
tab
|
|
2605
|
+
)
|
|
2606
|
+
] }) });
|
|
2607
|
+
}
|
|
2608
|
+
function MoreRows({
|
|
2609
|
+
entries,
|
|
2610
|
+
slotRef,
|
|
2611
|
+
close
|
|
2612
|
+
}) {
|
|
2613
|
+
const refs = React3.useRef(/* @__PURE__ */ new Map());
|
|
2614
|
+
const refFor = (id) => {
|
|
2615
|
+
let ref = refs.current.get(id);
|
|
2616
|
+
if (!ref) refs.current.set(id, ref = slotRef(id));
|
|
2617
|
+
return ref;
|
|
2618
|
+
};
|
|
2619
|
+
const list = React3.useRef(null);
|
|
2620
|
+
const latest = React3.useRef(close);
|
|
2621
|
+
latest.current = close;
|
|
2622
|
+
React3.useEffect(() => {
|
|
2623
|
+
const element = list.current;
|
|
2624
|
+
if (!element) return;
|
|
2625
|
+
const onClick = (event) => {
|
|
2626
|
+
const target = event.target;
|
|
2627
|
+
const row = target.closest(".native-docx-ribbon-more-row");
|
|
2628
|
+
if (!row) return;
|
|
2629
|
+
const control = row.querySelector(".native-docx-ribbon-more-control");
|
|
2630
|
+
if (!control.contains(target)) {
|
|
2631
|
+
control.querySelector("button:not([disabled])")?.click();
|
|
2632
|
+
return;
|
|
2633
|
+
}
|
|
2634
|
+
const button = target.closest("button");
|
|
2635
|
+
if (button && !button.disabled && !control.querySelector(".native-docx-ribbon-popover")?.contains(button) && !button.hasAttribute("aria-expanded") && !button.hasAttribute("aria-haspopup"))
|
|
2636
|
+
latest.current();
|
|
2637
|
+
};
|
|
2638
|
+
element.addEventListener("click", onClick, true);
|
|
2639
|
+
return () => element.removeEventListener("click", onClick, true);
|
|
2640
|
+
}, []);
|
|
2641
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "native-docx-ribbon-more-list", ref: list, children: entries.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "native-docx-ribbon-more-row", "data-ribbon-more": entry.id, children: [
|
|
2642
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "native-docx-ribbon-more-control", ref: refFor(entry.id) }),
|
|
2643
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "native-docx-ribbon-more-label", children: entry.label })
|
|
2644
|
+
] }, entry.id)) });
|
|
2645
|
+
}
|
|
2646
|
+
function RibbonItem({
|
|
2647
|
+
id,
|
|
2648
|
+
label,
|
|
2649
|
+
priority = 0,
|
|
2650
|
+
children
|
|
2651
|
+
}) {
|
|
2652
|
+
const context = React3.useContext(Overflow);
|
|
2653
|
+
const element = React3.useRef(null);
|
|
2654
|
+
const register = context?.register;
|
|
2655
|
+
React3.useLayoutEffect(() => {
|
|
2656
|
+
if (!register || !element.current) return;
|
|
2657
|
+
return register(id, { label, priority, element: element.current });
|
|
2658
|
+
}, [register, id, label, priority]);
|
|
2659
|
+
if (!context) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
2660
|
+
const collapsed = context.collapsed.has(id);
|
|
2661
|
+
const slot = context.slots[id];
|
|
2662
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2663
|
+
"span",
|
|
2664
|
+
{
|
|
2665
|
+
ref: element,
|
|
2666
|
+
className: "native-docx-ribbon-item",
|
|
2667
|
+
"data-ribbon-item": id,
|
|
2668
|
+
hidden: collapsed || void 0,
|
|
2669
|
+
children: collapsed ? slot ? reactDom.createPortal(children, slot) : null : children
|
|
2670
|
+
}
|
|
2671
|
+
);
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2514
2674
|
// src/docx/wordStyles.ts
|
|
2515
2675
|
var QUICK_STYLES = ["Normal", "Title", "heading 1", "heading 2", "heading 3"];
|
|
2516
2676
|
function findStyle(options, name) {
|
|
@@ -2696,18 +2856,87 @@ function StyleGallery() {
|
|
|
2696
2856
|
}
|
|
2697
2857
|
);
|
|
2698
2858
|
}
|
|
2859
|
+
var W = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
2860
|
+
var DEFAULT_PARAGRAPH_FONT = {
|
|
2861
|
+
id: "DefaultParagraphFont",
|
|
2862
|
+
type: "character",
|
|
2863
|
+
xml: '<w:style w:type="character" w:default="1" w:styleId="DefaultParagraphFont"><w:name w:val="Default Paragraph Font"/><w:uiPriority w:val="1"/><w:semiHidden/><w:unhideWhenUsed/></w:style>'
|
|
2864
|
+
};
|
|
2865
|
+
function stylesOf(kind) {
|
|
2866
|
+
const Kind = kind === "footnote" ? "Footnote" : "Endnote";
|
|
2867
|
+
const text = `${Kind}Text`;
|
|
2868
|
+
return [
|
|
2869
|
+
{
|
|
2870
|
+
id: text,
|
|
2871
|
+
type: "paragraph",
|
|
2872
|
+
xml: `<w:style w:type="paragraph" w:styleId="${text}"><w:name w:val="${kind} text"/><w:basedOn w:val="Normal"/><w:link w:val="${text}Char"/><w:uiPriority w:val="99"/><w:semiHidden/><w:unhideWhenUsed/><w:pPr><w:spacing w:after="0" w:line="240" w:lineRule="auto"/></w:pPr><w:rPr><w:sz w:val="20"/><w:szCs w:val="20"/></w:rPr></w:style>`
|
|
2873
|
+
},
|
|
2874
|
+
{
|
|
2875
|
+
id: `${text}Char`,
|
|
2876
|
+
type: "character",
|
|
2877
|
+
xml: `<w:style w:type="character" w:customStyle="1" w:styleId="${text}Char"><w:name w:val="${Kind} Text Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="${text}"/><w:uiPriority w:val="99"/><w:semiHidden/><w:rPr><w:sz w:val="20"/><w:szCs w:val="20"/></w:rPr></w:style>`
|
|
2878
|
+
},
|
|
2879
|
+
{
|
|
2880
|
+
id: `${Kind}Reference`,
|
|
2881
|
+
type: "character",
|
|
2882
|
+
xml: `<w:style w:type="character" w:styleId="${Kind}Reference"><w:name w:val="${kind} reference"/><w:basedOn w:val="DefaultParagraphFont"/><w:uiPriority w:val="99"/><w:semiHidden/><w:unhideWhenUsed/><w:rPr><w:vertAlign w:val="superscript"/></w:rPr></w:style>`
|
|
2883
|
+
}
|
|
2884
|
+
];
|
|
2885
|
+
}
|
|
2886
|
+
function noteTextStyle(styles, kind) {
|
|
2887
|
+
const paragraph = styles.filter((style) => style.type === "paragraph");
|
|
2888
|
+
const id = kind === "footnote" ? "FootnoteText" : "EndnoteText";
|
|
2889
|
+
return paragraph.find((style) => style.name.toLowerCase() === `${kind} text`)?.styleId ?? paragraph.find((style) => style.styleId === id)?.styleId;
|
|
2890
|
+
}
|
|
2891
|
+
function missingNoteStyles(styles, kind) {
|
|
2892
|
+
const has = (type, id) => styles.some((style) => style.type === type && style.styleId === id);
|
|
2893
|
+
const text = noteTextStyle(styles, kind);
|
|
2894
|
+
const missing = stylesOf(kind).filter(
|
|
2895
|
+
(style) => style.type === "paragraph" ? !text : !has("character", style.id)
|
|
2896
|
+
);
|
|
2897
|
+
if (!missing.length) return [];
|
|
2898
|
+
const base = has("character", DEFAULT_PARAGRAPH_FONT.id) ? [] : [DEFAULT_PARAGRAPH_FONT];
|
|
2899
|
+
return [...base, ...missing].map((style) => style.xml);
|
|
2900
|
+
}
|
|
2901
|
+
var CONTENT_TYPES = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/></Types>';
|
|
2902
|
+
function stylesOnlyClipboardHtml(styles) {
|
|
2903
|
+
const fragment = fflate.zipSync({
|
|
2904
|
+
"[Content_Types].xml": fflate.strToU8(CONTENT_TYPES),
|
|
2905
|
+
"_rels/.rels": fflate.strToU8(
|
|
2906
|
+
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/></Relationships>'
|
|
2907
|
+
),
|
|
2908
|
+
"word/document.xml": fflate.strToU8(
|
|
2909
|
+
`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2910
|
+
<w:document xmlns:w="${W}"><w:body><w:p/></w:body></w:document>`
|
|
2911
|
+
),
|
|
2912
|
+
"word/_rels/document.xml.rels": fflate.strToU8(
|
|
2913
|
+
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rIdStyles" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>'
|
|
2914
|
+
),
|
|
2915
|
+
"word/styles.xml": fflate.strToU8(
|
|
2916
|
+
`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2917
|
+
<w:styles xmlns:w="${W}">${styles.join("")}</w:styles>`
|
|
2918
|
+
)
|
|
2919
|
+
});
|
|
2920
|
+
return template.fragmentClipboardHtml(fragment, false);
|
|
2921
|
+
}
|
|
2922
|
+
function ensureNoteStyles(editor, kind, direct = (fn) => fn()) {
|
|
2923
|
+
if (!editor.can({ type: "insertNote", noteKind: kind }).ok) return void 0;
|
|
2924
|
+
const missing = missingNoteStyles(editor.getDocumentStyles(), kind);
|
|
2925
|
+
if (missing.length)
|
|
2926
|
+
direct(() => editor.exec({ type: "paste", text: "", html: stylesOnlyClipboardHtml(missing) }));
|
|
2927
|
+
return noteTextStyle(editor.getDocumentStyles(), kind);
|
|
2928
|
+
}
|
|
2699
2929
|
function useInsertNote(kind) {
|
|
2700
2930
|
const command = react.useEditorCommand(kind === "footnote" ? "insert.footnote" : "insert.endnote");
|
|
2701
|
-
const { options } = react.useParagraphStyle();
|
|
2702
2931
|
const editor = react.useDocxEditor();
|
|
2703
2932
|
const insert = () => {
|
|
2933
|
+
const text = editor && ensureNoteStyles(editor, kind, (fn) => withDirectEditing(editor, fn));
|
|
2704
2934
|
if (!command.execute()) return false;
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
);
|
|
2935
|
+
if (editor) {
|
|
2936
|
+
if (text)
|
|
2937
|
+
withDirectEditing(editor, () => editor.exec({ type: "setParagraphStyle", styleId: text }));
|
|
2938
|
+
editor.exec({ type: "insertText", text: " " });
|
|
2939
|
+
}
|
|
2711
2940
|
return true;
|
|
2712
2941
|
};
|
|
2713
2942
|
return { insert, isEnabled: command.isEnabled, disabledReason: command.disabledReason };
|
|
@@ -2719,7 +2948,7 @@ function NoteAction({
|
|
|
2719
2948
|
icon
|
|
2720
2949
|
}) {
|
|
2721
2950
|
const note = useInsertNote(kind);
|
|
2722
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2951
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: `references-${kind}`, label, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2723
2952
|
react.DocxEditor.Toolbar.Action,
|
|
2724
2953
|
{
|
|
2725
2954
|
label: `${label} (${shortcut})`,
|
|
@@ -2729,7 +2958,7 @@ function NoteAction({
|
|
|
2729
2958
|
onSelect: () => void note.insert(),
|
|
2730
2959
|
className: `native-docx-insert-${kind}`
|
|
2731
2960
|
}
|
|
2732
|
-
);
|
|
2961
|
+
) });
|
|
2733
2962
|
}
|
|
2734
2963
|
function NoteButtons() {
|
|
2735
2964
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -3014,10 +3243,10 @@ function LayoutButtons() {
|
|
|
3014
3243
|
const [dialog, setDialog] = React3.useState(false);
|
|
3015
3244
|
const props = { setup: pageSetup, apply, openDialog: () => setDialog(true) };
|
|
3016
3245
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3017
|
-
/* @__PURE__ */ jsxRuntime.jsx(Margins, { ...props }),
|
|
3018
|
-
/* @__PURE__ */ jsxRuntime.jsx(Orientation, { ...props }),
|
|
3019
|
-
/* @__PURE__ */ jsxRuntime.jsx(Size, { ...props }),
|
|
3020
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3246
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "layout-margins", label: "Margins", children: /* @__PURE__ */ jsxRuntime.jsx(Margins, { ...props }) }),
|
|
3247
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "layout-orientation", label: "Orientation", children: /* @__PURE__ */ jsxRuntime.jsx(Orientation, { ...props }) }),
|
|
3248
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "layout-size", label: "Size", children: /* @__PURE__ */ jsxRuntime.jsx(Size, { ...props }) }),
|
|
3249
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "layout-columns", label: "Columns", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3021
3250
|
react.DocxEditor.Toolbar.Action,
|
|
3022
3251
|
{
|
|
3023
3252
|
label: "Columns",
|
|
@@ -3026,9 +3255,9 @@ function LayoutButtons() {
|
|
|
3026
3255
|
disabledReason: COLUMNS_UNSUPPORTED,
|
|
3027
3256
|
className: "native-docx-layout-columns"
|
|
3028
3257
|
}
|
|
3029
|
-
),
|
|
3030
|
-
/* @__PURE__ */ jsxRuntime.jsx(Breaks, {}),
|
|
3031
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3258
|
+
) }),
|
|
3259
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "layout-breaks", label: "Breaks", children: /* @__PURE__ */ jsxRuntime.jsx(Breaks, {}) }),
|
|
3260
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "layout-page-setup", label: "Page Setup\u2026", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3032
3261
|
react.DocxEditor.Toolbar.Action,
|
|
3033
3262
|
{
|
|
3034
3263
|
label: "Page Setup\u2026",
|
|
@@ -3036,7 +3265,7 @@ function LayoutButtons() {
|
|
|
3036
3265
|
onSelect: () => setDialog(true),
|
|
3037
3266
|
className: "native-docx-layout-page-setup"
|
|
3038
3267
|
}
|
|
3039
|
-
),
|
|
3268
|
+
) }),
|
|
3040
3269
|
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.PageSetupDialog, { open: dialog, onClose: () => setDialog(false) })
|
|
3041
3270
|
] });
|
|
3042
3271
|
}
|
|
@@ -3063,7 +3292,7 @@ function CommandGallery({
|
|
|
3063
3292
|
rows
|
|
3064
3293
|
}) {
|
|
3065
3294
|
const bound = useRows(rows);
|
|
3066
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RibbonMenu, { label, icon, testId, children: (close) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3295
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: testId, label, children: /* @__PURE__ */ jsxRuntime.jsx(RibbonMenu, { label, icon, testId, children: (close) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3067
3296
|
RibbonGallery,
|
|
3068
3297
|
{
|
|
3069
3298
|
label,
|
|
@@ -3077,7 +3306,7 @@ function CommandGallery({
|
|
|
3077
3306
|
})),
|
|
3078
3307
|
onPick: (id) => void bound.find((row) => row.id === id)?.state.execute()
|
|
3079
3308
|
}
|
|
3080
|
-
) });
|
|
3309
|
+
) }) });
|
|
3081
3310
|
}
|
|
3082
3311
|
function CommandAction({
|
|
3083
3312
|
command,
|
|
@@ -3086,7 +3315,7 @@ function CommandAction({
|
|
|
3086
3315
|
testId
|
|
3087
3316
|
}) {
|
|
3088
3317
|
const state = react.useEditorCommand(command);
|
|
3089
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3318
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: `table-${testId}`, label, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3090
3319
|
react.DocxEditor.Toolbar.Action,
|
|
3091
3320
|
{
|
|
3092
3321
|
label,
|
|
@@ -3097,7 +3326,7 @@ function CommandAction({
|
|
|
3097
3326
|
onSelect: () => void state.execute(),
|
|
3098
3327
|
className: `native-docx-table-${testId}`
|
|
3099
3328
|
}
|
|
3100
|
-
);
|
|
3329
|
+
) });
|
|
3101
3330
|
}
|
|
3102
3331
|
function TableButtons() {
|
|
3103
3332
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -3197,11 +3426,11 @@ function TableButtons() {
|
|
|
3197
3426
|
]
|
|
3198
3427
|
}
|
|
3199
3428
|
),
|
|
3200
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableBorderTarget, {}),
|
|
3201
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableBorderStyle, {}),
|
|
3202
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableBorderWidth, {}),
|
|
3203
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableBorderColor, {}),
|
|
3204
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableCellFill, {})
|
|
3429
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "table-border-target", label: "Borders", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableBorderTarget, {}) }),
|
|
3430
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "table-border-style", label: "Border style", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableBorderStyle, {}) }),
|
|
3431
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "table-border-width", label: "Border width", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableBorderWidth, {}) }),
|
|
3432
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "table-border-color", label: "Border color", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableBorderColor, {}) }),
|
|
3433
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "table-cell-fill", label: "Shading", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableCellFill, {}) })
|
|
3205
3434
|
] });
|
|
3206
3435
|
}
|
|
3207
3436
|
var CAPTION_LABELS = ["Figure", "Table", "Equation"];
|
|
@@ -3264,7 +3493,7 @@ function TransformAction({
|
|
|
3264
3493
|
icon
|
|
3265
3494
|
}) {
|
|
3266
3495
|
const state = react.useEditorCommand(TRANSFORMS[action]);
|
|
3267
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3496
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: `picture-${action}`, label, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3268
3497
|
react.DocxEditor.Toolbar.Action,
|
|
3269
3498
|
{
|
|
3270
3499
|
label,
|
|
@@ -3274,7 +3503,7 @@ function TransformAction({
|
|
|
3274
3503
|
onSelect: () => void state.execute(),
|
|
3275
3504
|
className: `native-docx-picture-${action}`
|
|
3276
3505
|
}
|
|
3277
|
-
);
|
|
3506
|
+
) });
|
|
3278
3507
|
}
|
|
3279
3508
|
function insertCaption(editor, label, text, track) {
|
|
3280
3509
|
const surface = editor.surface;
|
|
@@ -3372,9 +3601,9 @@ function CaptionButton({ defaultLabel = "Figure" }) {
|
|
|
3372
3601
|
}
|
|
3373
3602
|
function PictureButtons() {
|
|
3374
3603
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3375
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.ImageWrap, {}),
|
|
3376
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.ImageProperties, {}),
|
|
3377
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.ImageAltText, {}),
|
|
3604
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "picture-wrap", label: "Wrap text", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.ImageWrap, {}) }),
|
|
3605
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "picture-properties", label: "Size and position", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.ImageProperties, {}) }),
|
|
3606
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "picture-alt-text", label: "Alt text", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.ImageAltText, {}) }),
|
|
3378
3607
|
/* @__PURE__ */ jsxRuntime.jsx(TransformAction, { action: "rotateCW", label: "Rotate right 90\xB0", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCw, { size: 16 }) }),
|
|
3379
3608
|
/* @__PURE__ */ jsxRuntime.jsx(TransformAction, { action: "rotateCCW", label: "Rotate left 90\xB0", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { size: 16 }) }),
|
|
3380
3609
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3386,7 +3615,7 @@ function PictureButtons() {
|
|
|
3386
3615
|
}
|
|
3387
3616
|
),
|
|
3388
3617
|
/* @__PURE__ */ jsxRuntime.jsx(TransformAction, { action: "flipV", label: "Flip vertical", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FlipVertical2, { size: 16 }) }),
|
|
3389
|
-
/* @__PURE__ */ jsxRuntime.jsx(CaptionButton, {})
|
|
3618
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "picture-caption", label: "Insert caption", children: /* @__PURE__ */ jsxRuntime.jsx(CaptionButton, {}) })
|
|
3390
3619
|
] });
|
|
3391
3620
|
}
|
|
3392
3621
|
var LAYOUT_TAB = "Layout";
|
|
@@ -3649,46 +3878,48 @@ function DocxRibbon({
|
|
|
3649
3878
|
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Undo, {}),
|
|
3650
3879
|
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Redo, {}),
|
|
3651
3880
|
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Save, {}),
|
|
3652
|
-
|
|
3653
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3881
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RibbonOverflow, { tab, children: [
|
|
3882
|
+
tab === "Home" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3883
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "home-style", label: "Styles", priority: 80, children: /* @__PURE__ */ jsxRuntime.jsx(StyleGallery, {}) }),
|
|
3884
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "home-bold", label: "Bold", priority: 100, children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Bold, {}) }),
|
|
3885
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "home-italic", label: "Italic", priority: 95, children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Italic, {}) }),
|
|
3886
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "home-underline", label: "Underline", priority: 90, children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Underline, {}) }),
|
|
3887
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "home-font", label: "Font", priority: 60, children: /* @__PURE__ */ jsxRuntime.jsxs(RibbonMenu, { label: "Font", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, { size: 16 }), children: [
|
|
3888
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.FontFamily, {}),
|
|
3889
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.FontSize, {}),
|
|
3890
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.FontColor, {}),
|
|
3891
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Highlight, {})
|
|
3892
|
+
] }) }),
|
|
3893
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "home-more-formatting", label: "More formatting", priority: 50, children: /* @__PURE__ */ jsxRuntime.jsxs(RibbonMenu, { label: "More formatting", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pilcrow, { size: 16 }), children: [
|
|
3894
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Alignment, {}),
|
|
3895
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.BulletList, {}),
|
|
3896
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.NumberedList, {}),
|
|
3897
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.LineSpacing, {}),
|
|
3898
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Indent, {}),
|
|
3899
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Outdent, {}),
|
|
3900
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Strike, {}),
|
|
3901
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.ClearFormatting, {})
|
|
3902
|
+
] }) })
|
|
3903
|
+
] }),
|
|
3904
|
+
tab === "Insert" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3905
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "insert-table", label: "Table", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableInsert, {}) }),
|
|
3906
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "insert-picture", label: "Picture", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.ImageInsert, {}) }),
|
|
3907
|
+
imageGeneration && /* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "insert-generate-image", label: "Generate image", children: /* @__PURE__ */ jsxRuntime.jsx(GenerateImageButton, { generation: imageGeneration }) }),
|
|
3908
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "insert-page-break", label: "Page break", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Button, { slotId: "insert.pageBreak" }) }),
|
|
3909
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "insert-link", label: "Link", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Link, {}) }),
|
|
3910
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "insert-defined-term", label: "Defined term", children: /* @__PURE__ */ jsxRuntime.jsx(DefinedTermButtons, {}) }),
|
|
3911
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "insert-quick-parts", label: "Quick Parts", children: /* @__PURE__ */ jsxRuntime.jsx(QuickParts, {}) })
|
|
3662
3912
|
] }),
|
|
3663
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.
|
|
3668
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.
|
|
3669
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.
|
|
3670
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Strike, {}),
|
|
3671
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.ClearFormatting, {})
|
|
3913
|
+
/* @__PURE__ */ jsxRuntime.jsx(LayoutTabContent, { tab }),
|
|
3914
|
+
tab === "Design" && /* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "design-house-template", label: "House template", children: /* @__PURE__ */ jsxRuntime.jsx(HouseTemplatePanel, {}) }),
|
|
3915
|
+
tab === "References" && /* @__PURE__ */ jsxRuntime.jsx(NoteButtons, {}),
|
|
3916
|
+
tab === "Review" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3917
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "review-editing-mode", label: "Editing mode", priority: 10, children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.EditingMode, {}) }),
|
|
3918
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "review-comments", label: "Comments", children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Comments, {}) }),
|
|
3919
|
+
/* @__PURE__ */ jsxRuntime.jsx(RibbonItem, { id: "review-options", label: "Review options", children: /* @__PURE__ */ jsxRuntime.jsx(RibbonMenu, { label: "Review options", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UsersRound, { size: 16 }), children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Reviewers, {}) }) })
|
|
3672
3920
|
] })
|
|
3673
3921
|
] }),
|
|
3674
|
-
|
|
3675
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableInsert, {}),
|
|
3676
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.ImageInsert, {}),
|
|
3677
|
-
imageGeneration && /* @__PURE__ */ jsxRuntime.jsx(GenerateImageButton, { generation: imageGeneration }),
|
|
3678
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Button, { slotId: "insert.pageBreak" }),
|
|
3679
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Link, {}),
|
|
3680
|
-
/* @__PURE__ */ jsxRuntime.jsx(DefinedTermButtons, {}),
|
|
3681
|
-
/* @__PURE__ */ jsxRuntime.jsx(QuickParts, {})
|
|
3682
|
-
] }),
|
|
3683
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableCellFill, { hidden: true }),
|
|
3684
|
-
/* @__PURE__ */ jsxRuntime.jsx(LayoutTabContent, { tab }),
|
|
3685
|
-
tab === "Design" && /* @__PURE__ */ jsxRuntime.jsx(HouseTemplatePanel, {}),
|
|
3686
|
-
tab === "References" && /* @__PURE__ */ jsxRuntime.jsx(NoteButtons, {}),
|
|
3687
|
-
tab === "Review" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3688
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.EditingMode, {}),
|
|
3689
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Comments, {}),
|
|
3690
|
-
/* @__PURE__ */ jsxRuntime.jsx(RibbonMenu, { label: "Review options", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Ellipsis, { size: 16 }), children: /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.Reviewers, {}) })
|
|
3691
|
-
] })
|
|
3922
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.Toolbar.TableCellFill, { hidden: true })
|
|
3692
3923
|
] }),
|
|
3693
3924
|
badge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "native-docx-ribbon-badge", "data-testid": "docx-ribbon-badge", children: badge })
|
|
3694
3925
|
] });
|
|
@@ -4232,5 +4463,5 @@ exports.useReview = useReview;
|
|
|
4232
4463
|
exports.useReviewItem = useReviewItem;
|
|
4233
4464
|
exports.useTrackedOrNoted = useTrackedOrNoted;
|
|
4234
4465
|
exports.withDirectEditing = withDirectEditing;
|
|
4235
|
-
//# sourceMappingURL=chunk-
|
|
4236
|
-
//# sourceMappingURL=chunk-
|
|
4466
|
+
//# sourceMappingURL=chunk-O33EBMIX.cjs.map
|
|
4467
|
+
//# sourceMappingURL=chunk-O33EBMIX.cjs.map
|