@arbidocs/blocks 0.4.109 → 0.4.111
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/{NativeDocxEditor-WODZAURG.cjs → NativeDocxEditor-AQKRZBIU.cjs} +7 -7
- package/dist/{NativeDocxEditor-WODZAURG.cjs.map → NativeDocxEditor-AQKRZBIU.cjs.map} +1 -1
- package/dist/{NativeDocxEditor-4PY4YZYC.js → NativeDocxEditor-IN2HEO5I.js} +3 -3
- package/dist/{NativeDocxEditor-4PY4YZYC.js.map → NativeDocxEditor-IN2HEO5I.js.map} +1 -1
- package/dist/agents/index.cjs +286 -286
- package/dist/agents/index.js +10 -10
- package/dist/agents/tasks/ConversationListView.d.ts +5 -1
- package/dist/agents/tasks/TaskActivityTimeline.d.ts +5 -1
- package/dist/calendar/EventDetails.d.ts +1 -1
- package/dist/calendar/EventEditor.d.ts +1 -1
- package/dist/calendar/draft.d.ts +7 -1
- package/dist/calendar/index.cjs +71 -10
- package/dist/calendar/index.cjs.map +1 -1
- package/dist/calendar/index.d.ts +1 -1
- package/dist/calendar/index.js +69 -11
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/types.d.ts +23 -0
- package/dist/calls/CallSidePanel.d.ts +32 -0
- package/dist/calls/CallStage.d.ts +57 -0
- package/dist/calls/ControlBar.d.ts +113 -0
- package/dist/calls/ControlButton.d.ts +44 -0
- package/dist/calls/PreJoin.d.ts +35 -0
- package/dist/calls/cards.d.ts +58 -0
- package/dist/calls/hooks.d.ts +20 -0
- package/dist/calls/index.cjs +2884 -0
- package/dist/calls/index.cjs.map +1 -0
- package/dist/calls/index.d.ts +21 -0
- package/dist/calls/index.js +2753 -0
- package/dist/calls/index.js.map +1 -0
- package/dist/calls/join-choices.d.ts +11 -0
- package/dist/calls/layout.d.ts +106 -0
- package/dist/calls/panels.d.ts +66 -0
- package/dist/calls/status.d.ts +69 -0
- package/dist/calls/tiles.d.ts +59 -0
- package/dist/calls/webinar/ChatPermissionSetting.d.ts +18 -0
- package/dist/calls/webinar/OnStageCheck.d.ts +23 -0
- package/dist/calls/webinar/QAPanel.d.ts +56 -0
- package/dist/calls/webinar/RaiseHandButton.d.ts +14 -0
- package/dist/calls/webinar/WebinarAudiencePanel.d.ts +23 -0
- package/dist/calls/webinar/WebinarViewer.d.ts +39 -0
- package/dist/calls/webinar/WebinarWaiting.d.ts +19 -0
- package/dist/calls/webinar/hooks.d.ts +13 -0
- package/dist/calls/webinar/index.d.ts +14 -0
- package/dist/calls/webinar/live.d.ts +43 -0
- package/dist/calls/webinar/types.d.ts +49 -0
- package/dist/chat/Message.d.ts +17 -2
- package/dist/chat/TranscriptLine.d.ts +50 -0
- package/dist/chat/index.cjs +147 -126
- package/dist/chat/index.d.ts +3 -1
- package/dist/chat/index.js +5 -4
- package/dist/chat/transcript-runs.d.ts +6 -0
- package/dist/{chunk-GKDWQLVU.js → chunk-2C7TCVQZ.js} +172 -121
- package/dist/chunk-2C7TCVQZ.js.map +1 -0
- package/dist/{chunk-QKWQMOHN.cjs → chunk-2UAJVK3C.cjs} +4 -4
- package/dist/{chunk-QKWQMOHN.cjs.map → chunk-2UAJVK3C.cjs.map} +1 -1
- package/dist/{chunk-54WBIVHV.cjs → chunk-2WO5L7YT.cjs} +5 -5
- package/dist/{chunk-54WBIVHV.cjs.map → chunk-2WO5L7YT.cjs.map} +1 -1
- package/dist/{chunk-7C35WXYB.js → chunk-5HFPRI3W.js} +5 -5
- package/dist/chunk-5HFPRI3W.js.map +1 -0
- package/dist/{chunk-ZSV2NQQP.js → chunk-6RHHMBZ5.js} +158 -5
- package/dist/chunk-6RHHMBZ5.js.map +1 -0
- package/dist/{chunk-FQX6N5G6.js → chunk-6Z7DLJU2.js} +35 -18
- package/dist/chunk-6Z7DLJU2.js.map +1 -0
- package/dist/{chunk-PGDL26TQ.js → chunk-AY32GGKU.js} +10 -4
- package/dist/{chunk-PGDL26TQ.js.map → chunk-AY32GGKU.js.map} +1 -1
- package/dist/{chunk-S55VDTX3.js → chunk-CECWAIHL.js} +3 -3
- package/dist/{chunk-S55VDTX3.js.map → chunk-CECWAIHL.js.map} +1 -1
- package/dist/{chunk-UABPHZWZ.js → chunk-CXZ7FPTQ.js} +3 -3
- package/dist/{chunk-UABPHZWZ.js.map → chunk-CXZ7FPTQ.js.map} +1 -1
- package/dist/{chunk-C2HRZSAT.cjs → chunk-DJM7DLCT.cjs} +5 -5
- package/dist/chunk-DJM7DLCT.cjs.map +1 -0
- package/dist/{chunk-GBYY3PIC.cjs → chunk-FXUQZFAN.cjs} +79 -62
- package/dist/chunk-FXUQZFAN.cjs.map +1 -0
- package/dist/{chunk-W7NZRZ54.js → chunk-GFYGYME3.js} +3 -3
- package/dist/{chunk-W7NZRZ54.js.map → chunk-GFYGYME3.js.map} +1 -1
- package/dist/chunk-GICUGQNN.cjs +76 -0
- package/dist/chunk-GICUGQNN.cjs.map +1 -0
- package/dist/{chunk-I4XQCE6U.cjs → chunk-HBBJYRGI.cjs} +162 -5
- package/dist/{chunk-ZSV2NQQP.js.map → chunk-HBBJYRGI.cjs.map} +1 -1
- package/dist/chunk-JJLMCV3T.js +73 -0
- package/dist/chunk-JJLMCV3T.js.map +1 -0
- package/dist/chunk-MWDW5UBW.cjs +199 -0
- package/dist/chunk-MWDW5UBW.cjs.map +1 -0
- package/dist/{chunk-NUTLXVPX.js → chunk-NRUPUDWB.js} +16 -7
- package/dist/chunk-NRUPUDWB.js.map +1 -0
- package/dist/{chunk-5YXG342J.cjs → chunk-OR4CO743.cjs} +3 -3
- package/dist/{chunk-5YXG342J.cjs.map → chunk-OR4CO743.cjs.map} +1 -1
- package/dist/{chunk-DDF5GPIJ.js → chunk-P5ST47VY.js} +3 -3
- package/dist/{chunk-DDF5GPIJ.js.map → chunk-P5ST47VY.js.map} +1 -1
- package/dist/{chunk-PEHLUB52.js → chunk-Q6B77ZWZ.js} +3 -3
- package/dist/{chunk-PEHLUB52.js.map → chunk-Q6B77ZWZ.js.map} +1 -1
- package/dist/{chunk-ELDUWTRR.cjs → chunk-TF47ATYS.cjs} +4 -4
- package/dist/{chunk-ELDUWTRR.cjs.map → chunk-TF47ATYS.cjs.map} +1 -1
- package/dist/{chunk-PDRYGPZB.cjs → chunk-VP4KJ4LK.cjs} +16 -6
- package/dist/chunk-VP4KJ4LK.cjs.map +1 -0
- package/dist/{chunk-SKSE4OT6.cjs → chunk-WPVIOGDG.cjs} +5 -5
- package/dist/{chunk-SKSE4OT6.cjs.map → chunk-WPVIOGDG.cjs.map} +1 -1
- package/dist/{chunk-JB32KYAH.js → chunk-WTM65ZNG.js} +3 -3
- package/dist/{chunk-JB32KYAH.js.map → chunk-WTM65ZNG.js.map} +1 -1
- package/dist/{chunk-2NIL2ASF.cjs → chunk-XIGWUDOD.cjs} +170 -119
- package/dist/chunk-XIGWUDOD.cjs.map +1 -0
- package/dist/{chunk-3US5OIDQ.cjs → chunk-XSUOEJB3.cjs} +9 -3
- package/dist/chunk-XSUOEJB3.cjs.map +1 -0
- package/dist/chunk-Z3AZ7Q5X.js +177 -0
- package/dist/chunk-Z3AZ7Q5X.js.map +1 -0
- package/dist/{chunk-Z5VUZ6YD.cjs → chunk-ZV3BKLFY.cjs} +3 -3
- package/dist/{chunk-Z5VUZ6YD.cjs.map → chunk-ZV3BKLFY.cjs.map} +1 -1
- package/dist/collaboration/index.cjs +42 -42
- package/dist/collaboration/index.js +2 -2
- package/dist/connect/docx.cjs +6 -6
- package/dist/connect/docx.js +4 -4
- package/dist/connect/index.cjs +72 -72
- package/dist/connect/index.js +18 -18
- package/dist/docx/AgentUndo.d.ts +4 -0
- package/dist/docx/index.cjs +46 -46
- package/dist/docx/index.js +3 -3
- package/dist/facts/index.cjs +4 -4
- package/dist/facts/index.js +4 -4
- package/dist/files/index.cjs +6 -6
- package/dist/files/index.js +6 -6
- package/dist/home/index.cjs +17 -17
- package/dist/home/index.js +3 -3
- package/dist/index.cjs +958 -937
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -23
- package/dist/index.js.map +1 -1
- package/dist/retrieval/index.cjs +1 -1
- package/dist/retrieval/index.js +1 -1
- package/dist/settings/index.cjs +50 -104
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.js +12 -72
- package/dist/settings/index.js.map +1 -1
- package/dist/shell/index.cjs +12 -12
- package/dist/shell/index.js +4 -4
- package/dist/site/index.cjs +5 -5
- package/dist/site/index.js +1 -1
- package/dist/studio/index.cjs +5 -5
- package/dist/studio/index.js +4 -4
- package/dist/workflow-canvas/index.cjs +53 -53
- package/dist/workflow-canvas/index.js +10 -10
- package/dist/workspaces/index.cjs +2 -2
- package/dist/workspaces/index.js +2 -2
- package/node_modules/@arbidocs/coedit/dist/commands.cjs +179 -9
- package/node_modules/@arbidocs/coedit/dist/commands.cjs.map +1 -1
- package/node_modules/@arbidocs/coedit/dist/commands.d.cts +81 -1
- package/node_modules/@arbidocs/coedit/dist/commands.d.ts +81 -1
- package/node_modules/@arbidocs/coedit/dist/commands.js +173 -11
- package/node_modules/@arbidocs/coedit/dist/commands.js.map +1 -1
- package/node_modules/@arbidocs/coedit/dist/server.cjs +58 -2
- package/node_modules/@arbidocs/coedit/dist/server.cjs.map +1 -1
- package/node_modules/@arbidocs/coedit/dist/server.d.cts +29 -1
- package/node_modules/@arbidocs/coedit/dist/server.d.ts +29 -1
- package/node_modules/@arbidocs/coedit/dist/server.js +58 -3
- package/node_modules/@arbidocs/coedit/dist/server.js.map +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +15 -5
- package/src/calls/calls.css +157 -0
- package/dist/chunk-2NIL2ASF.cjs.map +0 -1
- package/dist/chunk-3US5OIDQ.cjs.map +0 -1
- package/dist/chunk-7C35WXYB.js.map +0 -1
- package/dist/chunk-C2HRZSAT.cjs.map +0 -1
- package/dist/chunk-FQX6N5G6.js.map +0 -1
- package/dist/chunk-GBYY3PIC.cjs.map +0 -1
- package/dist/chunk-GKDWQLVU.js.map +0 -1
- package/dist/chunk-I4XQCE6U.cjs.map +0 -1
- package/dist/chunk-NUTLXVPX.js.map +0 -1
- package/dist/chunk-PDRYGPZB.cjs.map +0 -1
|
@@ -16,8 +16,8 @@ var lucideReact = require('lucide-react');
|
|
|
16
16
|
var Y = require('yjs');
|
|
17
17
|
var coedit = require('@arbidocs/coedit');
|
|
18
18
|
var hocuspocus = require('@arbidocs/coedit/hocuspocus');
|
|
19
|
-
var template = require('@arbidocs/coedit/template');
|
|
20
19
|
var commands = require('@arbidocs/coedit/commands');
|
|
20
|
+
var template = require('@arbidocs/coedit/template');
|
|
21
21
|
var editor = require('@docx-editor.dev/core/editor');
|
|
22
22
|
|
|
23
23
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1427,6 +1427,169 @@ function fragmentHtml(body, covered2, {
|
|
|
1427
1427
|
const bytes = revision ? template.trackInsertion(untracked, revision, covered2) : untracked;
|
|
1428
1428
|
return `<div data-docx-fragment="${base64(bytes)}" data-docx-fragment-end="${covered2 ? "covered" : "open"}"></div>`;
|
|
1429
1429
|
}
|
|
1430
|
+
var attr = (node, name) => node.attributes?.find((a) => a.localName === name)?.value;
|
|
1431
|
+
function documentStyleIds(root) {
|
|
1432
|
+
const ids = /* @__PURE__ */ new Set();
|
|
1433
|
+
for (const style of root?.children ?? [])
|
|
1434
|
+
if (style.localName === "style") {
|
|
1435
|
+
const id = attr(style, "styleId");
|
|
1436
|
+
if (id) ids.add(id);
|
|
1437
|
+
}
|
|
1438
|
+
return ids;
|
|
1439
|
+
}
|
|
1440
|
+
function editorPort(editor, revision) {
|
|
1441
|
+
const surface = () => {
|
|
1442
|
+
const s = editor.surface;
|
|
1443
|
+
if (!s) throw new Error("The document is not open.");
|
|
1444
|
+
return s;
|
|
1445
|
+
};
|
|
1446
|
+
return {
|
|
1447
|
+
paragraphs: () => commands.readParagraphs(surface().session.part().root),
|
|
1448
|
+
caret: () => {
|
|
1449
|
+
const selection = surface().state().selection;
|
|
1450
|
+
if (!selection) return null;
|
|
1451
|
+
const { anchor, head } = selection;
|
|
1452
|
+
return anchor.paragraphId === head.paragraphId && anchor.offset === head.offset ? { paragraphId: anchor.paragraphId, offset: anchor.offset } : null;
|
|
1453
|
+
},
|
|
1454
|
+
setCaret: (point) => surface().setSelection({ anchor: point, head: point }),
|
|
1455
|
+
deleteRange: (from, to) => {
|
|
1456
|
+
surface().setSelection({ anchor: from, head: to });
|
|
1457
|
+
surface().deleteSelection();
|
|
1458
|
+
},
|
|
1459
|
+
paste: (body, text, covered2, relationships) => {
|
|
1460
|
+
const defined = documentStyleIds(surface().session.stylesRoot());
|
|
1461
|
+
const styles = stylesUsed(body).filter((id) => !defined.has(id));
|
|
1462
|
+
return editor.exec({
|
|
1463
|
+
type: "paste",
|
|
1464
|
+
text,
|
|
1465
|
+
html: fragmentHtml(body, covered2, { revision, relationships, styles })
|
|
1466
|
+
}).ok;
|
|
1467
|
+
},
|
|
1468
|
+
splitParagraph: () => surface().splitParagraph(),
|
|
1469
|
+
typeText: (text) => surface().insertPlainText(text)
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
function withDirectEditing(editor, fn) {
|
|
1473
|
+
const mode = editor.getEditingMode();
|
|
1474
|
+
if (mode === "viewing") throw new Error("This document is read only.");
|
|
1475
|
+
if (mode === "suggesting") editor.setEditingMode("editing");
|
|
1476
|
+
try {
|
|
1477
|
+
return fn();
|
|
1478
|
+
} finally {
|
|
1479
|
+
if (mode === "suggesting") editor.setEditingMode("suggesting");
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
function holdCaret(editor, { settleMs = 600, maxMs = 2e3 } = {}) {
|
|
1483
|
+
const surface = editor.surface;
|
|
1484
|
+
const selection = surface?.state().selection;
|
|
1485
|
+
if (!surface || !selection) return;
|
|
1486
|
+
const { offset } = selection.head;
|
|
1487
|
+
const paraId = surface.session.paraIdOf(selection.head.paragraphId);
|
|
1488
|
+
if (!paraId) return;
|
|
1489
|
+
let typed = "";
|
|
1490
|
+
let done = false;
|
|
1491
|
+
let settle;
|
|
1492
|
+
const stop = () => {
|
|
1493
|
+
done = true;
|
|
1494
|
+
offChange();
|
|
1495
|
+
clearTimeout(settle);
|
|
1496
|
+
clearTimeout(limit);
|
|
1497
|
+
window.removeEventListener("keydown", key, true);
|
|
1498
|
+
window.removeEventListener("pointerdown", click, true);
|
|
1499
|
+
};
|
|
1500
|
+
const finish = () => {
|
|
1501
|
+
if (done) return;
|
|
1502
|
+
stop();
|
|
1503
|
+
const node = surface.session.nodeIdOf(paraId);
|
|
1504
|
+
if (!node) return;
|
|
1505
|
+
const point = { paragraphId: node, offset };
|
|
1506
|
+
surface.setSelection({ anchor: point, head: point });
|
|
1507
|
+
if (typed) surface.insertPlainText(typed);
|
|
1508
|
+
};
|
|
1509
|
+
const key = (event) => {
|
|
1510
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
1511
|
+
event.preventDefault();
|
|
1512
|
+
event.stopPropagation();
|
|
1513
|
+
typed += event.key;
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
finish();
|
|
1517
|
+
};
|
|
1518
|
+
const click = () => {
|
|
1519
|
+
if (typed) finish();
|
|
1520
|
+
else stop();
|
|
1521
|
+
};
|
|
1522
|
+
const quiet = () => {
|
|
1523
|
+
clearTimeout(settle);
|
|
1524
|
+
settle = setTimeout(finish, settleMs);
|
|
1525
|
+
};
|
|
1526
|
+
const offChange = editor.on("change", quiet);
|
|
1527
|
+
window.addEventListener("keydown", key, true);
|
|
1528
|
+
window.addEventListener("pointerdown", click, true);
|
|
1529
|
+
settle = setTimeout(finish, settleMs);
|
|
1530
|
+
const limit = setTimeout(finish, maxMs);
|
|
1531
|
+
}
|
|
1532
|
+
function preservingCaret(editor, fn) {
|
|
1533
|
+
const surface = editor.surface;
|
|
1534
|
+
const before = surface?.state().selection?.head;
|
|
1535
|
+
const paraId = before && surface?.session.paraIdOf(before.paragraphId);
|
|
1536
|
+
const result = fn();
|
|
1537
|
+
const node = paraId && surface?.session.nodeIdOf(paraId);
|
|
1538
|
+
if (before && node) {
|
|
1539
|
+
const point = { paragraphId: node, offset: before.offset };
|
|
1540
|
+
surface.setSelection({ anchor: point, head: point });
|
|
1541
|
+
holdCaret(editor);
|
|
1542
|
+
}
|
|
1543
|
+
return result;
|
|
1544
|
+
}
|
|
1545
|
+
var AgentUndoRoom = React4.createContext(null);
|
|
1546
|
+
function AgentUndo() {
|
|
1547
|
+
const item = useReviewItem();
|
|
1548
|
+
const review = useReview();
|
|
1549
|
+
const editor = react.useDocxEditor();
|
|
1550
|
+
const room = React4.useContext(AgentUndoRoom);
|
|
1551
|
+
const records = room?.getMap(commands.AGENT_UNDO_MAP);
|
|
1552
|
+
const [, changed] = React4.useReducer((n) => n + 1, 0);
|
|
1553
|
+
const [error, setError] = React4.useState("");
|
|
1554
|
+
React4.useEffect(() => {
|
|
1555
|
+
if (!records) return;
|
|
1556
|
+
records.observe(changed);
|
|
1557
|
+
return () => records.unobserve(changed);
|
|
1558
|
+
}, [records]);
|
|
1559
|
+
if (!item || item.kind !== "comment" || item.parentId || !records) return null;
|
|
1560
|
+
const id = item.item.id;
|
|
1561
|
+
const record = records.get(id);
|
|
1562
|
+
if (!record) return null;
|
|
1563
|
+
const undo = () => {
|
|
1564
|
+
const surface = editor?.surface;
|
|
1565
|
+
if (!editor || !surface) return;
|
|
1566
|
+
const ops = commands.undoOps(surface.session.part().root, record);
|
|
1567
|
+
if (!ops) return setError("What this changed is no longer in the document.");
|
|
1568
|
+
let applied = false;
|
|
1569
|
+
try {
|
|
1570
|
+
applied = withDirectEditing(editor, () => surface.applyAutomationOps(() => ops)).committed;
|
|
1571
|
+
} catch {
|
|
1572
|
+
}
|
|
1573
|
+
if (!applied) return setError("This change could not be undone.");
|
|
1574
|
+
records.delete(id);
|
|
1575
|
+
review.resolve(item, true);
|
|
1576
|
+
};
|
|
1577
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "native-docx-comment-extra", "data-review-selectable": "", children: [
|
|
1578
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1579
|
+
"button",
|
|
1580
|
+
{
|
|
1581
|
+
type: "button",
|
|
1582
|
+
"data-testid": "docx-agent-undo",
|
|
1583
|
+
onClick: (event) => {
|
|
1584
|
+
event.stopPropagation();
|
|
1585
|
+
undo();
|
|
1586
|
+
},
|
|
1587
|
+
children: "Undo"
|
|
1588
|
+
}
|
|
1589
|
+
),
|
|
1590
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "status", className: "native-docx-comment-activity", children: error })
|
|
1591
|
+
] });
|
|
1592
|
+
}
|
|
1430
1593
|
|
|
1431
1594
|
// src/docx/definitions/commands.ts
|
|
1432
1595
|
var DEFINITIONS_HEADING = "Definitions";
|
|
@@ -1603,121 +1766,6 @@ function LinkHoverCard({
|
|
|
1603
1766
|
document.body
|
|
1604
1767
|
);
|
|
1605
1768
|
}
|
|
1606
|
-
var attr = (node, name) => node.attributes?.find((a) => a.localName === name)?.value;
|
|
1607
|
-
function documentStyleIds(root) {
|
|
1608
|
-
const ids = /* @__PURE__ */ new Set();
|
|
1609
|
-
for (const style of root?.children ?? [])
|
|
1610
|
-
if (style.localName === "style") {
|
|
1611
|
-
const id = attr(style, "styleId");
|
|
1612
|
-
if (id) ids.add(id);
|
|
1613
|
-
}
|
|
1614
|
-
return ids;
|
|
1615
|
-
}
|
|
1616
|
-
function editorPort(editor, revision) {
|
|
1617
|
-
const surface = () => {
|
|
1618
|
-
const s = editor.surface;
|
|
1619
|
-
if (!s) throw new Error("The document is not open.");
|
|
1620
|
-
return s;
|
|
1621
|
-
};
|
|
1622
|
-
return {
|
|
1623
|
-
paragraphs: () => commands.readParagraphs(surface().session.part().root),
|
|
1624
|
-
caret: () => {
|
|
1625
|
-
const selection = surface().state().selection;
|
|
1626
|
-
if (!selection) return null;
|
|
1627
|
-
const { anchor, head } = selection;
|
|
1628
|
-
return anchor.paragraphId === head.paragraphId && anchor.offset === head.offset ? { paragraphId: anchor.paragraphId, offset: anchor.offset } : null;
|
|
1629
|
-
},
|
|
1630
|
-
setCaret: (point) => surface().setSelection({ anchor: point, head: point }),
|
|
1631
|
-
deleteRange: (from, to) => {
|
|
1632
|
-
surface().setSelection({ anchor: from, head: to });
|
|
1633
|
-
surface().deleteSelection();
|
|
1634
|
-
},
|
|
1635
|
-
paste: (body, text, covered2, relationships) => {
|
|
1636
|
-
const defined = documentStyleIds(surface().session.stylesRoot());
|
|
1637
|
-
const styles = stylesUsed(body).filter((id) => !defined.has(id));
|
|
1638
|
-
return editor.exec({
|
|
1639
|
-
type: "paste",
|
|
1640
|
-
text,
|
|
1641
|
-
html: fragmentHtml(body, covered2, { revision, relationships, styles })
|
|
1642
|
-
}).ok;
|
|
1643
|
-
},
|
|
1644
|
-
splitParagraph: () => surface().splitParagraph(),
|
|
1645
|
-
typeText: (text) => surface().insertPlainText(text)
|
|
1646
|
-
};
|
|
1647
|
-
}
|
|
1648
|
-
function withDirectEditing(editor, fn) {
|
|
1649
|
-
const mode = editor.getEditingMode();
|
|
1650
|
-
if (mode === "viewing") throw new Error("This document is read only.");
|
|
1651
|
-
if (mode === "suggesting") editor.setEditingMode("editing");
|
|
1652
|
-
try {
|
|
1653
|
-
return fn();
|
|
1654
|
-
} finally {
|
|
1655
|
-
if (mode === "suggesting") editor.setEditingMode("suggesting");
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
function holdCaret(editor, { settleMs = 600, maxMs = 2e3 } = {}) {
|
|
1659
|
-
const surface = editor.surface;
|
|
1660
|
-
const selection = surface?.state().selection;
|
|
1661
|
-
if (!surface || !selection) return;
|
|
1662
|
-
const { offset } = selection.head;
|
|
1663
|
-
const paraId = surface.session.paraIdOf(selection.head.paragraphId);
|
|
1664
|
-
if (!paraId) return;
|
|
1665
|
-
let typed = "";
|
|
1666
|
-
let done = false;
|
|
1667
|
-
let settle;
|
|
1668
|
-
const stop = () => {
|
|
1669
|
-
done = true;
|
|
1670
|
-
offChange();
|
|
1671
|
-
clearTimeout(settle);
|
|
1672
|
-
clearTimeout(limit);
|
|
1673
|
-
window.removeEventListener("keydown", key, true);
|
|
1674
|
-
window.removeEventListener("pointerdown", click, true);
|
|
1675
|
-
};
|
|
1676
|
-
const finish = () => {
|
|
1677
|
-
if (done) return;
|
|
1678
|
-
stop();
|
|
1679
|
-
const node = surface.session.nodeIdOf(paraId);
|
|
1680
|
-
if (!node) return;
|
|
1681
|
-
const point = { paragraphId: node, offset };
|
|
1682
|
-
surface.setSelection({ anchor: point, head: point });
|
|
1683
|
-
if (typed) surface.insertPlainText(typed);
|
|
1684
|
-
};
|
|
1685
|
-
const key = (event) => {
|
|
1686
|
-
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
1687
|
-
event.preventDefault();
|
|
1688
|
-
event.stopPropagation();
|
|
1689
|
-
typed += event.key;
|
|
1690
|
-
return;
|
|
1691
|
-
}
|
|
1692
|
-
finish();
|
|
1693
|
-
};
|
|
1694
|
-
const click = () => {
|
|
1695
|
-
if (typed) finish();
|
|
1696
|
-
else stop();
|
|
1697
|
-
};
|
|
1698
|
-
const quiet = () => {
|
|
1699
|
-
clearTimeout(settle);
|
|
1700
|
-
settle = setTimeout(finish, settleMs);
|
|
1701
|
-
};
|
|
1702
|
-
const offChange = editor.on("change", quiet);
|
|
1703
|
-
window.addEventListener("keydown", key, true);
|
|
1704
|
-
window.addEventListener("pointerdown", click, true);
|
|
1705
|
-
settle = setTimeout(finish, settleMs);
|
|
1706
|
-
const limit = setTimeout(finish, maxMs);
|
|
1707
|
-
}
|
|
1708
|
-
function preservingCaret(editor, fn) {
|
|
1709
|
-
const surface = editor.surface;
|
|
1710
|
-
const before = surface?.state().selection?.head;
|
|
1711
|
-
const paraId = before && surface?.session.paraIdOf(before.paragraphId);
|
|
1712
|
-
const result = fn();
|
|
1713
|
-
const node = paraId && surface?.session.nodeIdOf(paraId);
|
|
1714
|
-
if (before && node) {
|
|
1715
|
-
const point = { paragraphId: node, offset: before.offset };
|
|
1716
|
-
surface.setSelection({ anchor: point, head: point });
|
|
1717
|
-
holdCaret(editor);
|
|
1718
|
-
}
|
|
1719
|
-
return result;
|
|
1720
|
-
}
|
|
1721
1769
|
|
|
1722
1770
|
// src/docx/structural/trackedOrNoted.ts
|
|
1723
1771
|
var revisionDate = (at = /* @__PURE__ */ new Date()) => at.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
@@ -5121,7 +5169,10 @@ function NativeDocxEditor({
|
|
|
5121
5169
|
notify: adapter.notify,
|
|
5122
5170
|
getAgentStatus: adapter.getAgentStatus,
|
|
5123
5171
|
requestAgent: adapter.requestAgent ? (request) => adapter.requestAgent(documentId, request) : void 0,
|
|
5124
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5172
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(AgentUndoRoom.Provider, { value: ready.room?.ydoc ?? null, children: /* @__PURE__ */ jsxRuntime.jsx(DocxEditorReview, { children: () => /* @__PURE__ */ jsxRuntime.jsxs(DocxEditorReview.Card, { children: [
|
|
5173
|
+
/* @__PURE__ */ jsxRuntime.jsx(DocxCommentActivity, {}),
|
|
5174
|
+
/* @__PURE__ */ jsxRuntime.jsx(AgentUndo, {})
|
|
5175
|
+
] }) }) })
|
|
5125
5176
|
}
|
|
5126
5177
|
),
|
|
5127
5178
|
!compact && /* @__PURE__ */ jsxRuntime.jsx(react.DocxEditor.HeaderFooterChrome, {}),
|
|
@@ -5228,5 +5279,5 @@ exports.useReview = useReview;
|
|
|
5228
5279
|
exports.useReviewItem = useReviewItem;
|
|
5229
5280
|
exports.useTrackedOrNoted = useTrackedOrNoted;
|
|
5230
5281
|
exports.withDirectEditing = withDirectEditing;
|
|
5231
|
-
//# sourceMappingURL=chunk-
|
|
5232
|
-
//# sourceMappingURL=chunk-
|
|
5282
|
+
//# sourceMappingURL=chunk-XIGWUDOD.cjs.map
|
|
5283
|
+
//# sourceMappingURL=chunk-XIGWUDOD.cjs.map
|