@arbidocs/blocks 0.4.111 → 0.4.112
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-AQKRZBIU.cjs → NativeDocxEditor-AQZSUGET.cjs} +8 -8
- package/dist/{NativeDocxEditor-AQKRZBIU.cjs.map → NativeDocxEditor-AQZSUGET.cjs.map} +1 -1
- package/dist/{NativeDocxEditor-IN2HEO5I.js → NativeDocxEditor-MBCBXYDZ.js} +4 -4
- package/dist/{NativeDocxEditor-IN2HEO5I.js.map → NativeDocxEditor-MBCBXYDZ.js.map} +1 -1
- package/dist/agents/index.cjs +208 -208
- package/dist/agents/index.js +3 -3
- package/dist/{chunk-2C7TCVQZ.js → chunk-3OT37I24.js} +30 -297
- package/dist/chunk-3OT37I24.js.map +1 -0
- package/dist/{chunk-XIGWUDOD.cjs → chunk-ETBB5KMN.cjs} +61 -316
- package/dist/chunk-ETBB5KMN.cjs.map +1 -0
- package/dist/{chunk-Q6B77ZWZ.js → chunk-GIBRZ54P.js} +3 -3
- package/dist/{chunk-Q6B77ZWZ.js.map → chunk-GIBRZ54P.js.map} +1 -1
- package/dist/{chunk-2WO5L7YT.cjs → chunk-HF4PAYBM.cjs} +5 -5
- package/dist/{chunk-2WO5L7YT.cjs.map → chunk-HF4PAYBM.cjs.map} +1 -1
- package/dist/chunk-I2QSDQQV.cjs +126 -0
- package/dist/chunk-I2QSDQQV.cjs.map +1 -0
- package/dist/chunk-QXMR5YHC.js +80 -0
- package/dist/chunk-QXMR5YHC.js.map +1 -0
- package/dist/{chunk-TF47ATYS.cjs → chunk-RUFNJRLW.cjs} +4 -4
- package/dist/{chunk-TF47ATYS.cjs.map → chunk-RUFNJRLW.cjs.map} +1 -1
- package/dist/{chunk-WTM65ZNG.js → chunk-TKJSCHSX.js} +3 -3
- package/dist/{chunk-WTM65ZNG.js.map → chunk-TKJSCHSX.js.map} +1 -1
- package/dist/{chunk-WPVIOGDG.cjs → chunk-US5ASM4G.cjs} +22 -22
- package/dist/{chunk-WPVIOGDG.cjs.map → chunk-US5ASM4G.cjs.map} +1 -1
- package/dist/{chunk-CECWAIHL.js → chunk-XFZ7HNPG.js} +3 -3
- package/dist/{chunk-CECWAIHL.js.map → chunk-XFZ7HNPG.js.map} +1 -1
- package/dist/{chunk-FXUQZFAN.cjs → chunk-Z2NSU7D5.cjs} +4 -4
- package/dist/{chunk-FXUQZFAN.cjs.map → chunk-Z2NSU7D5.cjs.map} +1 -1
- package/dist/{chunk-6Z7DLJU2.js → chunk-ZP4IFW2E.js} +4 -4
- package/dist/{chunk-6Z7DLJU2.js.map → chunk-ZP4IFW2E.js.map} +1 -1
- package/dist/collaboration/index.cjs +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/connect/docx.cjs +7 -7
- package/dist/connect/docx.js +5 -5
- package/dist/connect/index.cjs +16 -16
- package/dist/connect/index.js +9 -9
- package/dist/docx/definitions/commands.d.ts +3 -52
- package/dist/docx/definitions/fragment.d.ts +5 -31
- package/dist/docx/definitions/port.d.ts +2 -22
- package/dist/docx/index.cjs +47 -47
- package/dist/docx/index.js +4 -4
- package/dist/docx/references/commands.d.ts +3 -89
- package/dist/docx/references/port.d.ts +2 -11
- package/dist/facts/index.cjs +1 -1
- package/dist/facts/index.js +1 -1
- package/dist/files/index.cjs +1 -1
- package/dist/files/index.js +1 -1
- package/dist/index.cjs +388 -388
- package/dist/index.js +10 -10
- package/dist/settings/index.cjs +1 -1
- package/dist/settings/index.js +1 -1
- package/dist/shell/index.cjs +9 -9
- package/dist/shell/index.js +1 -1
- package/dist/tags/definitions.d.ts +4 -25
- package/dist/tags/ooxml.d.ts +1 -19
- package/dist/workflow-canvas/index.cjs +10 -10
- package/dist/workflow-canvas/index.js +3 -3
- package/node_modules/@arbidocs/coedit/dist/commands.cjs +687 -0
- package/node_modules/@arbidocs/coedit/dist/commands.cjs.map +1 -1
- package/node_modules/@arbidocs/coedit/dist/commands.d.cts +263 -157
- package/node_modules/@arbidocs/coedit/dist/commands.d.ts +263 -157
- package/node_modules/@arbidocs/coedit/dist/commands.js +646 -2
- package/node_modules/@arbidocs/coedit/dist/commands.js.map +1 -1
- package/node_modules/@arbidocs/coedit/dist/port-ip7WByvH.d.cts +188 -0
- package/node_modules/@arbidocs/coedit/dist/port-ip7WByvH.d.ts +188 -0
- package/node_modules/@arbidocs/coedit/dist/server.cjs +675 -65
- package/node_modules/@arbidocs/coedit/dist/server.cjs.map +1 -1
- package/node_modules/@arbidocs/coedit/dist/server.d.cts +15 -4
- package/node_modules/@arbidocs/coedit/dist/server.d.ts +15 -4
- package/node_modules/@arbidocs/coedit/dist/server.js +676 -67
- package/node_modules/@arbidocs/coedit/dist/server.js.map +1 -1
- package/node_modules/@arbidocs/coedit/dist/template.d.cts +3 -17
- package/node_modules/@arbidocs/coedit/dist/template.d.ts +3 -17
- package/node_modules/@arbidocs/coedit/dist/track-eYC94jTp.d.cts +17 -0
- package/node_modules/@arbidocs/coedit/dist/track-eYC94jTp.d.ts +17 -0
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +4 -4
- package/dist/chunk-2A4MDHJR.cjs +0 -198
- package/dist/chunk-2A4MDHJR.cjs.map +0 -1
- package/dist/chunk-2C7TCVQZ.js.map +0 -1
- package/dist/chunk-EPHGD4YV.js +0 -174
- package/dist/chunk-EPHGD4YV.js.map +0 -1
- package/dist/chunk-XIGWUDOD.cjs.map +0 -1
package/dist/agents/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { AgentAvatarField, AgentBar, AgentBarIconButton, AgentBarMenu, AgentBarNotes, AgentBarProbeAnswer, AgentBarQueuedNote, AgentBarStatus, AgentCard, AgentCreateView, AgentCreatedView, AgentCreator, AgentEditView, AgentGallery, AgentMainView, AgentSelect, AgentTypeSelector, CapabilityGrid, CapabilityTile, ConfigField, ConfigForm, ConsentActions, ConsentBulletList, ConsentCard, ConsentFootnote, ConsentHeader, ConsentMessage, ConsentNotice, ConsentPage, ConsentPermissionList, ConsentSection, ConsentStrong, ConsentText, ConversationListView, ConversationTurnSpeaker, CopyableUrl, DEFAULT_AGENT_AVATAR_FIELD_LABELS, DEFAULT_AGENT_BAR_LABELS, DEFAULT_AGENT_CARD_LABELS, DEFAULT_AGENT_CREATOR_LABELS, DEFAULT_AGENT_GALLERY_LABELS, DEFAULT_AGENT_SELECT_LABELS, DEFAULT_AGENT_STEPS_LABELS, DEFAULT_AGENT_TYPE_SELECTOR_LABELS, DEFAULT_AUTHORIZE_AGENT_LABELS, DEFAULT_CONFIG_FIELD_LABELS, DEFAULT_CONFIG_FORM_LABELS, DEFAULT_CONSENT_ACTIONS_LABELS, DEFAULT_COPYABLE_URL_LABELS, DEFAULT_NEW_THREAD_DIALOG_LABELS, DEFAULT_PILL_SELECT_LABELS, DEFAULT_RECURRENCE, DEFAULT_RECURRENCE_BUILDER_LABELS, DEFAULT_SKILL_CARD_LABELS, DEFAULT_SKILL_EDIT_FORM_LABELS, DEFAULT_SKILL_GENERATE_FORM_LABELS, DEFAULT_SKILL_GLOBAL_BADGE_LABELS, DEFAULT_SKILL_ROW_LABELS, DEFAULT_SKILL_VIEW_TOGGLE_LABELS, DEFAULT_SUBAGENT_ROSTER_LABELS, DEFAULT_TASKS_CHROME_LABELS, DEFAULT_TASK_COMPOSER_LABELS, DEFAULT_TASK_LIST_LABELS, DEFAULT_TASK_OUTPUTS_CELL_LABELS, DEFAULT_TASK_PLAN_LABELS, DEFAULT_TASK_RUNS_DIALOG_LABELS, DEFAULT_TASK_STATUS_PILL_LABELS, DEFAULT_TASK_THREAD_CHIP_LABELS, DEFAULT_TASK_TRIGGER_CHIP_LABELS, DEFAULT_TUPLE_ARRAY_FIELD_LABELS, DEFAULT_UPLOAD_TASK_ITEM_LABELS, DEFAULT_UPLOAD_TASK_LIST_LABELS, DEFAULT_WORKFLOWS_CHROME_LABELS, DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, DEFAULT_WORKFLOW_LIST_LABELS, DEFAULT_WORKFLOW_THREAD_STRIP_LABELS, DERIVED_NAME_WORDS, EMPTY_NEW_THREAD, GoalCriteria, MAX_TASK_DEPTH, NewThreadDialog, PersonPill, PillSelect, RecurrenceBuilder, STATUS_LABELS, STATUS_ORDER, STATUS_TONE, SkillActionButton, SkillCard, SkillDetail, SkillDetailSection, SkillEditForm, SkillFilterChips, SkillGenerateForm, SkillGlobalBadge, SkillRow, SkillTile, SkillTypeBadge, SkillViewToggle, StepDetail, StepNarration, StepOutcome, StepParams, StepRow, StepSummary, StepTrace, StepTraceSummary, SubAgentLane, SubStepGroup, SubagentRoster, TASK_COLUMN_ORDER, TRIGGER_LABELS, TaskActivityDialog, TaskComposer, TaskFlow, TaskInbox, TaskMoveDialog, TaskOutputsCell, TaskPlan, TaskRunsDialog, TaskStartDialog, TaskStatusPill, TaskTable, TaskThreadChip, TaskTriggerChip, TasksToolbar, ThreadActivity, ThreadNotifyDialog, TupleArrayField, UploadTaskItem, UploadTaskList, WEEKDAYS, WORKFLOW_COLUMN_ORDER, WorkflowConfigDialog, WorkflowDocumentsField, WorkflowLauncher, WorkflowThreadStartedBy, WorkflowThreadStrip, WorkflowsTable, WorkflowsToolbar, agentConfigSectionToValues, agentCreatorToConfigSection, asTaskStatus, authModeFor, buildRRule, buildTaskRows, buildWorkflowScopeSource, compactThreadActivity, composePersona, composerToTaskQuery, composerToWorkRequest, composerToWorkflowRequest, composerToWorkflowUpdate, createTaskColumns, createWorkflowColumns, createsWork, defaultScopeRenderer, defaultTaskComposerValues, deriveAgentName, deriveWorkflowName, descendantIds, describeRRule, filterConversationRows, firstWords, formatElapsed, goalProgress, groupThreadActivity, hasTaskFields, hasTrigger, humanizeSection, indexTasks, inferType, inputDocumentIds, isAgenticWorkflow, isOutOfBounds, isPlainTodo, isSkillRow, isValidAgentName, isoToLocalInput, linkedRunsFromActivity, localInputToIso, matchWorkflowScope, moveTargets, newThreadToRequest, nextCriterionId, ownerExtId, parseRRule, prettifyKey, resolveScopeInputs, skillSlug, stripPersonaPreamble, summarizeAgent, summarizeCapabilities, taskComposerToCreateRequest, taskComposerToUpdateRequest, taskNeedsAccess, taskToComposerValues, useWorkflowPreview, workflowFromSkillMarkdown, workflowStatus, workflowTaskFields, workflowToComposerValues, workflowToSkillMarkdown, workflowTriggerType, workflowWhen } from '../chunk-
|
|
2
|
+
export { AgentAvatarField, AgentBar, AgentBarIconButton, AgentBarMenu, AgentBarNotes, AgentBarProbeAnswer, AgentBarQueuedNote, AgentBarStatus, AgentCard, AgentCreateView, AgentCreatedView, AgentCreator, AgentEditView, AgentGallery, AgentMainView, AgentSelect, AgentTypeSelector, CapabilityGrid, CapabilityTile, ConfigField, ConfigForm, ConsentActions, ConsentBulletList, ConsentCard, ConsentFootnote, ConsentHeader, ConsentMessage, ConsentNotice, ConsentPage, ConsentPermissionList, ConsentSection, ConsentStrong, ConsentText, ConversationListView, ConversationTurnSpeaker, CopyableUrl, DEFAULT_AGENT_AVATAR_FIELD_LABELS, DEFAULT_AGENT_BAR_LABELS, DEFAULT_AGENT_CARD_LABELS, DEFAULT_AGENT_CREATOR_LABELS, DEFAULT_AGENT_GALLERY_LABELS, DEFAULT_AGENT_SELECT_LABELS, DEFAULT_AGENT_STEPS_LABELS, DEFAULT_AGENT_TYPE_SELECTOR_LABELS, DEFAULT_AUTHORIZE_AGENT_LABELS, DEFAULT_CONFIG_FIELD_LABELS, DEFAULT_CONFIG_FORM_LABELS, DEFAULT_CONSENT_ACTIONS_LABELS, DEFAULT_COPYABLE_URL_LABELS, DEFAULT_NEW_THREAD_DIALOG_LABELS, DEFAULT_PILL_SELECT_LABELS, DEFAULT_RECURRENCE, DEFAULT_RECURRENCE_BUILDER_LABELS, DEFAULT_SKILL_CARD_LABELS, DEFAULT_SKILL_EDIT_FORM_LABELS, DEFAULT_SKILL_GENERATE_FORM_LABELS, DEFAULT_SKILL_GLOBAL_BADGE_LABELS, DEFAULT_SKILL_ROW_LABELS, DEFAULT_SKILL_VIEW_TOGGLE_LABELS, DEFAULT_SUBAGENT_ROSTER_LABELS, DEFAULT_TASKS_CHROME_LABELS, DEFAULT_TASK_COMPOSER_LABELS, DEFAULT_TASK_LIST_LABELS, DEFAULT_TASK_OUTPUTS_CELL_LABELS, DEFAULT_TASK_PLAN_LABELS, DEFAULT_TASK_RUNS_DIALOG_LABELS, DEFAULT_TASK_STATUS_PILL_LABELS, DEFAULT_TASK_THREAD_CHIP_LABELS, DEFAULT_TASK_TRIGGER_CHIP_LABELS, DEFAULT_TUPLE_ARRAY_FIELD_LABELS, DEFAULT_UPLOAD_TASK_ITEM_LABELS, DEFAULT_UPLOAD_TASK_LIST_LABELS, DEFAULT_WORKFLOWS_CHROME_LABELS, DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, DEFAULT_WORKFLOW_LIST_LABELS, DEFAULT_WORKFLOW_THREAD_STRIP_LABELS, DERIVED_NAME_WORDS, EMPTY_NEW_THREAD, GoalCriteria, MAX_TASK_DEPTH, NewThreadDialog, PersonPill, PillSelect, RecurrenceBuilder, STATUS_LABELS, STATUS_ORDER, STATUS_TONE, SkillActionButton, SkillCard, SkillDetail, SkillDetailSection, SkillEditForm, SkillFilterChips, SkillGenerateForm, SkillGlobalBadge, SkillRow, SkillTile, SkillTypeBadge, SkillViewToggle, StepDetail, StepNarration, StepOutcome, StepParams, StepRow, StepSummary, StepTrace, StepTraceSummary, SubAgentLane, SubStepGroup, SubagentRoster, TASK_COLUMN_ORDER, TRIGGER_LABELS, TaskActivityDialog, TaskComposer, TaskFlow, TaskInbox, TaskMoveDialog, TaskOutputsCell, TaskPlan, TaskRunsDialog, TaskStartDialog, TaskStatusPill, TaskTable, TaskThreadChip, TaskTriggerChip, TasksToolbar, ThreadActivity, ThreadNotifyDialog, TupleArrayField, UploadTaskItem, UploadTaskList, WEEKDAYS, WORKFLOW_COLUMN_ORDER, WorkflowConfigDialog, WorkflowDocumentsField, WorkflowLauncher, WorkflowThreadStartedBy, WorkflowThreadStrip, WorkflowsTable, WorkflowsToolbar, agentConfigSectionToValues, agentCreatorToConfigSection, asTaskStatus, authModeFor, buildRRule, buildTaskRows, buildWorkflowScopeSource, compactThreadActivity, composePersona, composerToTaskQuery, composerToWorkRequest, composerToWorkflowRequest, composerToWorkflowUpdate, createTaskColumns, createWorkflowColumns, createsWork, defaultScopeRenderer, defaultTaskComposerValues, deriveAgentName, deriveWorkflowName, descendantIds, describeRRule, filterConversationRows, firstWords, formatElapsed, goalProgress, groupThreadActivity, hasTaskFields, hasTrigger, humanizeSection, indexTasks, inferType, inputDocumentIds, isAgenticWorkflow, isOutOfBounds, isPlainTodo, isSkillRow, isValidAgentName, isoToLocalInput, linkedRunsFromActivity, localInputToIso, matchWorkflowScope, moveTargets, newThreadToRequest, nextCriterionId, ownerExtId, parseRRule, prettifyKey, resolveScopeInputs, skillSlug, stripPersonaPreamble, summarizeAgent, summarizeCapabilities, taskComposerToCreateRequest, taskComposerToUpdateRequest, taskNeedsAccess, taskToComposerValues, useWorkflowPreview, workflowFromSkillMarkdown, workflowStatus, workflowTaskFields, workflowToComposerValues, workflowToSkillMarkdown, workflowTriggerType, workflowWhen } from '../chunk-ZP4IFW2E.js';
|
|
3
3
|
import '../chunk-P5ST47VY.js';
|
|
4
4
|
import '../chunk-4XJZ6AAY.js';
|
|
5
5
|
import '../chunk-P6GHJSLR.js';
|
|
@@ -14,11 +14,11 @@ import '../chunk-AUS3KBHJ.js';
|
|
|
14
14
|
import '../chunk-NUNKSZKU.js';
|
|
15
15
|
import '../chunk-YU2KUMGE.js';
|
|
16
16
|
import '../chunk-N5YEF3LC.js';
|
|
17
|
-
import '../chunk-4WWM3GQ5.js';
|
|
18
|
-
import '../chunk-TX2ZICS7.js';
|
|
19
17
|
import '../chunk-HOXKR26S.js';
|
|
20
18
|
import '../chunk-AA3PT6KR.js';
|
|
21
19
|
import '../chunk-SLSBJRWW.js';
|
|
20
|
+
import '../chunk-4WWM3GQ5.js';
|
|
21
|
+
import '../chunk-TX2ZICS7.js';
|
|
22
22
|
import '../chunk-NPLYHR2E.js';
|
|
23
23
|
import '../chunk-7F6CBP3Z.js';
|
|
24
24
|
import '../chunk-76JDDMSP.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { FactPassageItem } from './chunk-HFZ45FD3.js';
|
|
3
|
-
import { stylesXml,
|
|
3
|
+
import { stylesXml, groupDefinitions, definitionLabels, filterTermGroups, docxPackage, documentXml, esc } from './chunk-QXMR5YHC.js';
|
|
4
4
|
import { filterMentionCandidates, MentionMenu, findMentionQuery, listOptionId, extractMentions, useListKeyNav } from './chunk-AA3PT6KR.js';
|
|
5
5
|
import { unzipSync, strFromU8, strToU8, zipSync } from 'fflate';
|
|
6
6
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
@@ -14,8 +14,8 @@ import { MessageSquarePlus, MessageSquare, PencilLine, ChevronLeft, ChevronRight
|
|
|
14
14
|
import * as Y from 'yjs';
|
|
15
15
|
import { DOCUMENT_COLLABORATION_VERSIONS, collaborationModule } from '@arbidocs/coedit';
|
|
16
16
|
import { createHocuspocusCollaboration } from '@arbidocs/coedit/hocuspocus';
|
|
17
|
-
import { readParagraphs, documentNumbering, listTargets,
|
|
18
|
-
export { listTargets, paragraphNumber } from '@arbidocs/coedit/commands';
|
|
17
|
+
import { documentStyleIds, stylesUsed, readParagraphs, insertDefinedTerm, definitionOfAnchor, documentNumbering, paragraphRunsXml, listTargets, refreshCrossReferences, REF_BOOKMARK_PREFIX, insertDocumentReference, refResult, markCrossReferenceTarget, insertCrossReferenceField, filterTargets, paragraphNumber, fragmentPackage, AGENT_UNDO_MAP, undoOps } from '@arbidocs/coedit/commands';
|
|
18
|
+
export { findDefinitionsSection, insertCrossReference, insertDefinedTerm, insertDocumentReference, listTargets, paragraphNumber } from '@arbidocs/coedit/commands';
|
|
19
19
|
import { defaultLegalTemplate, listBuildingBlocks, attachedTemplateOf, linkedLevelStyles, styleDivergence, buildingBlockFragment, fragmentClipboardHtml, trackInsertion, newFromTemplate } from '@arbidocs/coedit/template';
|
|
20
20
|
import { executeImageCommand } from '@docx-editor.dev/core/editor';
|
|
21
21
|
|
|
@@ -986,7 +986,7 @@ function DocxCommentActivity() {
|
|
|
986
986
|
const thread = review.items.filter(
|
|
987
987
|
(entry) => entry.kind === "comment" && (entry.item.id === commentId || entry.parentId === commentId)
|
|
988
988
|
);
|
|
989
|
-
const statuses = Object.entries(activity).filter(([,
|
|
989
|
+
const statuses = Object.entries(activity).filter(([, run]) => run.commentId === commentId);
|
|
990
990
|
const labels = {
|
|
991
991
|
delivering: "Delivering mention\u2026",
|
|
992
992
|
queued: "Queued\u2026",
|
|
@@ -998,18 +998,18 @@ function DocxCommentActivity() {
|
|
|
998
998
|
unknown: "Status unavailable"
|
|
999
999
|
};
|
|
1000
1000
|
return /* @__PURE__ */ jsxs("div", { className: "native-docx-comment-extra", "data-review-selectable": "", children: [
|
|
1001
|
-
statuses.map(([id,
|
|
1001
|
+
statuses.map(([id, run]) => /* @__PURE__ */ jsxs(
|
|
1002
1002
|
"div",
|
|
1003
1003
|
{
|
|
1004
1004
|
role: "status",
|
|
1005
1005
|
"data-testid": "docx-comment-agent-status",
|
|
1006
|
-
"data-status":
|
|
1006
|
+
"data-status": run.status,
|
|
1007
1007
|
className: "native-docx-comment-activity",
|
|
1008
1008
|
children: [
|
|
1009
|
-
["delivering", "queued", "in_progress"].includes(
|
|
1010
|
-
|
|
1009
|
+
["delivering", "queued", "in_progress"].includes(run.status) && /* @__PURE__ */ jsx("span", { className: "native-docx-agent-spinner", "aria-hidden": "true" }),
|
|
1010
|
+
run.label,
|
|
1011
1011
|
": ",
|
|
1012
|
-
labels[
|
|
1012
|
+
labels[run.status]
|
|
1013
1013
|
]
|
|
1014
1014
|
},
|
|
1015
1015
|
id
|
|
@@ -1037,10 +1037,10 @@ function DocxCommentActivity() {
|
|
|
1037
1037
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: entry.author || "Reviewer" }),
|
|
1038
1038
|
/* @__PURE__ */ jsx("div", { "data-testid": "docx-full-comment-text", children: /* @__PURE__ */ jsx(AiMarkdown, { allowHtml: false, children: commentText(entry) }) })
|
|
1039
1039
|
] }, entry.key)),
|
|
1040
|
-
statuses.map(([id,
|
|
1041
|
-
|
|
1040
|
+
statuses.map(([id, run]) => /* @__PURE__ */ jsxs("p", { role: "status", className: "text-sm", children: [
|
|
1041
|
+
run.label,
|
|
1042
1042
|
": ",
|
|
1043
|
-
labels[
|
|
1043
|
+
labels[run.status]
|
|
1044
1044
|
] }, id))
|
|
1045
1045
|
]
|
|
1046
1046
|
}
|
|
@@ -1351,67 +1351,14 @@ function DocxMentions({
|
|
|
1351
1351
|
}
|
|
1352
1352
|
) });
|
|
1353
1353
|
}
|
|
1354
|
-
var CHARACTER_STYLES = {
|
|
1355
|
-
[DEFINED_TERM_STYLE]: `<w:style w:type="character" w:customStyle="1" w:styleId="${DEFINED_TERM_STYLE}"><w:name w:val="Defined Term"/><w:rPr><w:u w:val="dotted" w:color="7F7F7F"/></w:rPr></w:style>`,
|
|
1356
|
-
[CROSS_REFERENCE_STYLE]: `<w:style w:type="character" w:customStyle="1" w:styleId="${CROSS_REFERENCE_STYLE}"><w:name w:val="Cross Reference"/><w:rPr><w:color w:val="1F4E79"/><w:u w:val="dotted" w:color="8EA9C1"/></w:rPr></w:style>`,
|
|
1357
|
-
[BROKEN_CROSS_REFERENCE_STYLE]: `<w:style w:type="character" w:customStyle="1" w:styleId="${BROKEN_CROSS_REFERENCE_STYLE}"><w:name w:val="Cross Reference Broken"/><w:basedOn w:val="${CROSS_REFERENCE_STYLE}"/><w:rPr><w:color w:val="C00000"/><w:u w:val="wave" w:color="C00000"/></w:rPr></w:style>`
|
|
1358
|
-
};
|
|
1359
|
-
function stylesUsed(body) {
|
|
1360
|
-
return [...new Set([...body.matchAll(/<w:rStyle w:val="([^"]+)"/g)].map((m) => m[1]))];
|
|
1361
|
-
}
|
|
1362
|
-
var fragmentStyles = (ids) => stylesXml(
|
|
1363
|
-
"",
|
|
1364
|
-
`<w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/></w:style>${ids.map((id) => CHARACTER_STYLES[id] ?? "").join("")}`
|
|
1365
|
-
);
|
|
1366
|
-
var textRun = (text, props = "") => `<w:r>${props ? `<w:rPr>${props}</w:rPr>` : ""}<w:t xml:space="preserve">${esc(text)}</w:t></w:r>`;
|
|
1367
|
-
function definitionTooltip(definition) {
|
|
1368
|
-
const line = `\u201C${definition.term}\u201D${definition.rest}`.replace(/\s+/g, " ").trim();
|
|
1369
|
-
return line.length > 255 ? `${line.slice(0, 254)}\u2026` : line;
|
|
1370
|
-
}
|
|
1371
|
-
function definitionParagraphXml(definition, bookmark, id = 0) {
|
|
1372
|
-
return `<w:p><w:bookmarkStart w:id="${id}" w:name="${esc(bookmark)}"/>${textRun("\u201C")}${textRun(
|
|
1373
|
-
definition.term,
|
|
1374
|
-
"<w:b/>"
|
|
1375
|
-
)}${textRun("\u201D")}<w:bookmarkEnd w:id="${id}"/>${textRun(definition.rest)}</w:p>`;
|
|
1376
|
-
}
|
|
1377
|
-
function headingParagraphXml(text, styleId) {
|
|
1378
|
-
return styleId ? `<w:p><w:pPr><w:pStyle w:val="${esc(styleId)}"/></w:pPr>${textRun(text)}</w:p>` : `<w:p><w:pPr><w:keepNext/></w:pPr>${textRun(text, "<w:b/>")}</w:p>`;
|
|
1379
|
-
}
|
|
1380
|
-
function termLinkXml(term, bookmark, tooltip) {
|
|
1381
|
-
return `<w:p><w:hyperlink w:anchor="${esc(bookmark)}" w:tooltip="${esc(tooltip)}" w:history="1">${textRun(
|
|
1382
|
-
term,
|
|
1383
|
-
`<w:rStyle w:val="${DEFINED_TERM_STYLE}"/>`
|
|
1384
|
-
)}</w:hyperlink></w:p>`;
|
|
1385
|
-
}
|
|
1386
1354
|
function base64(bytes) {
|
|
1387
1355
|
let binary = "";
|
|
1388
1356
|
for (let i = 0; i < bytes.length; i += 32768)
|
|
1389
1357
|
binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
|
|
1390
1358
|
return btoa(binary);
|
|
1391
1359
|
}
|
|
1392
|
-
function fragmentHtml(body, covered2, {
|
|
1393
|
-
|
|
1394
|
-
relationships,
|
|
1395
|
-
styles = stylesUsed(body)
|
|
1396
|
-
} = {}) {
|
|
1397
|
-
const untracked = docxPackage({
|
|
1398
|
-
document: documentXml(body),
|
|
1399
|
-
styles: fragmentStyles(styles),
|
|
1400
|
-
title: "Defined terms",
|
|
1401
|
-
relationships
|
|
1402
|
-
});
|
|
1403
|
-
const bytes = revision ? trackInsertion(untracked, revision, covered2) : untracked;
|
|
1404
|
-
return `<div data-docx-fragment="${base64(bytes)}" data-docx-fragment-end="${covered2 ? "covered" : "open"}"></div>`;
|
|
1405
|
-
}
|
|
1406
|
-
var attr = (node, name) => node.attributes?.find((a) => a.localName === name)?.value;
|
|
1407
|
-
function documentStyleIds(root) {
|
|
1408
|
-
const ids = /* @__PURE__ */ new Set();
|
|
1409
|
-
for (const style of root?.children ?? [])
|
|
1410
|
-
if (style.localName === "style") {
|
|
1411
|
-
const id = attr(style, "styleId");
|
|
1412
|
-
if (id) ids.add(id);
|
|
1413
|
-
}
|
|
1414
|
-
return ids;
|
|
1360
|
+
function fragmentHtml(body, covered2, options = {}) {
|
|
1361
|
+
return `<div data-docx-fragment="${base64(fragmentPackage(body, covered2, options))}" data-docx-fragment-end="${covered2 ? "covered" : "open"}"></div>`;
|
|
1415
1362
|
}
|
|
1416
1363
|
function editorPort(editor, revision) {
|
|
1417
1364
|
const surface = () => {
|
|
@@ -1566,100 +1513,6 @@ function AgentUndo() {
|
|
|
1566
1513
|
error && /* @__PURE__ */ jsx("p", { role: "status", className: "native-docx-comment-activity", children: error })
|
|
1567
1514
|
] });
|
|
1568
1515
|
}
|
|
1569
|
-
|
|
1570
|
-
// src/docx/definitions/commands.ts
|
|
1571
|
-
var DEFINITIONS_HEADING = "Definitions";
|
|
1572
|
-
var SECTION_TITLE = /^(definitions?(\s*(and|&)\s*interpretations?)?|interpretations?(\s*(and|&)\s*definitions?)?|defined\s+terms|glossary)$/i;
|
|
1573
|
-
var NUMBERING = /^(?:(?:clause|section|article|schedule|part)\s+)?(?:[0-9]+(?:\.[0-9]+)*|[A-Z]|[ivxlc]+)[.):]?\s+(?:[-–—]\s*)?/i;
|
|
1574
|
-
function isDefinitionsTitle(paragraph) {
|
|
1575
|
-
if (!paragraph.topLevel) return false;
|
|
1576
|
-
const title = paragraph.text.trim().replace(NUMBERING, "").replace(/[.:]+$/, "").trim();
|
|
1577
|
-
return SECTION_TITLE.test(title) && (paragraph.heading || title.length <= 40);
|
|
1578
|
-
}
|
|
1579
|
-
function findDefinitionsSection(paragraphs) {
|
|
1580
|
-
const title = paragraphs.findIndex(isDefinitionsTitle);
|
|
1581
|
-
if (title < 0) return null;
|
|
1582
|
-
let end = title + 1;
|
|
1583
|
-
while (end < paragraphs.length && paragraphs[end].topLevel && !paragraphs[end].heading) end++;
|
|
1584
|
-
return { title, start: title + 1, end };
|
|
1585
|
-
}
|
|
1586
|
-
var termOf = (paragraph) => parseDefinition(paragraph.text)?.term ?? null;
|
|
1587
|
-
function insertionIndex(paragraphs, section, term, skip = /* @__PURE__ */ new Set()) {
|
|
1588
|
-
let afterLast = section.start;
|
|
1589
|
-
for (let i = section.start; i < section.end; i++) {
|
|
1590
|
-
if (skip.has(paragraphs[i].id)) continue;
|
|
1591
|
-
const other = termOf(paragraphs[i]);
|
|
1592
|
-
if (other === null) continue;
|
|
1593
|
-
if (compareTerms(other, term) > 0) return i;
|
|
1594
|
-
afterLast = i + 1;
|
|
1595
|
-
}
|
|
1596
|
-
return afterLast;
|
|
1597
|
-
}
|
|
1598
|
-
var headingStyle = (paragraphs) => paragraphs.find((p) => p.topLevel && p.heading && p.styleId)?.styleId;
|
|
1599
|
-
function insertParagraphs(port, index, body, count, keep) {
|
|
1600
|
-
const before = port.paragraphs();
|
|
1601
|
-
const kept = keep ? before.findIndex((p) => p.id === keep.paragraphId) : -1;
|
|
1602
|
-
if (index < before.length) {
|
|
1603
|
-
port.setCaret({ paragraphId: before[index].id, offset: 0 });
|
|
1604
|
-
} else {
|
|
1605
|
-
const last = before[before.length - 1];
|
|
1606
|
-
port.setCaret({ paragraphId: last.id, offset: last.text.length });
|
|
1607
|
-
port.splitParagraph();
|
|
1608
|
-
const opened = port.paragraphs();
|
|
1609
|
-
port.setCaret({ paragraphId: opened[opened.length - 1].id, offset: 0 });
|
|
1610
|
-
}
|
|
1611
|
-
if (!port.paste(body, "", true)) throw new Error("The definition could not be added.");
|
|
1612
|
-
if (!keep || kept < 0) return keep;
|
|
1613
|
-
const after = port.paragraphs();
|
|
1614
|
-
const moved = index <= kept ? kept + count : kept;
|
|
1615
|
-
return { paragraphId: after[moved]?.id ?? keep.paragraphId, offset: keep.offset };
|
|
1616
|
-
}
|
|
1617
|
-
function addDefinition(port, definition, keep) {
|
|
1618
|
-
const paragraphs = port.paragraphs();
|
|
1619
|
-
const section = findDefinitionsSection(paragraphs);
|
|
1620
|
-
const paragraph = definitionParagraphXml(definition, definitionBookmark(definition.id));
|
|
1621
|
-
if (section)
|
|
1622
|
-
return insertParagraphs(
|
|
1623
|
-
port,
|
|
1624
|
-
insertionIndex(paragraphs, section, definition.term),
|
|
1625
|
-
paragraph,
|
|
1626
|
-
1,
|
|
1627
|
-
keep
|
|
1628
|
-
);
|
|
1629
|
-
return insertParagraphs(
|
|
1630
|
-
port,
|
|
1631
|
-
paragraphs.length,
|
|
1632
|
-
headingParagraphXml(DEFINITIONS_HEADING, headingStyle(paragraphs)) + paragraph,
|
|
1633
|
-
2,
|
|
1634
|
-
keep
|
|
1635
|
-
);
|
|
1636
|
-
}
|
|
1637
|
-
var hasBookmark = (paragraphs, name) => paragraphs.some((p) => p.bookmarks.includes(name));
|
|
1638
|
-
function insertDefinedTerm(port, definition, options = {}) {
|
|
1639
|
-
const start = port.caret();
|
|
1640
|
-
if (!start) throw new Error("Place the cursor where the term should go.");
|
|
1641
|
-
let caret = start;
|
|
1642
|
-
if (options.replace) {
|
|
1643
|
-
caret = { paragraphId: start.paragraphId, offset: Math.max(0, start.offset - options.replace) };
|
|
1644
|
-
port.deleteRange(caret, start);
|
|
1645
|
-
}
|
|
1646
|
-
const bookmark = definitionBookmark(definition.id);
|
|
1647
|
-
const addedDefinition = !hasBookmark(port.paragraphs(), bookmark);
|
|
1648
|
-
if (addedDefinition) caret = addDefinition(port, definition, caret) ?? caret;
|
|
1649
|
-
port.setCaret(caret);
|
|
1650
|
-
if (!port.paste(
|
|
1651
|
-
termLinkXml(definition.term, bookmark, definitionTooltip(definition)),
|
|
1652
|
-
definition.term,
|
|
1653
|
-
false
|
|
1654
|
-
))
|
|
1655
|
-
throw new Error("The term could not be inserted.");
|
|
1656
|
-
port.setCaret({ paragraphId: caret.paragraphId, offset: caret.offset + definition.term.length });
|
|
1657
|
-
return { addedDefinition };
|
|
1658
|
-
}
|
|
1659
|
-
function definitionOfAnchor(anchor, definitions) {
|
|
1660
|
-
const id = definitionIdOfBookmark(anchor.replace(/^#/, ""));
|
|
1661
|
-
return id ? definitions.get(id) : void 0;
|
|
1662
|
-
}
|
|
1663
1516
|
function LinkHoverCard({
|
|
1664
1517
|
root,
|
|
1665
1518
|
matches,
|
|
@@ -1765,7 +1618,7 @@ function trackedOrNoted(port, { label, author, insert, inserted = Boolean }) {
|
|
|
1765
1618
|
if (before && after && port.comment(before, after, label)) return { result, how: "noted" };
|
|
1766
1619
|
return { result, how: "direct" };
|
|
1767
1620
|
}
|
|
1768
|
-
var
|
|
1621
|
+
var attr = (node, name) => node.attributes?.find((a) => a.localName === name)?.value;
|
|
1769
1622
|
function structuralPort(editor) {
|
|
1770
1623
|
return {
|
|
1771
1624
|
mode: () => editor.getEditingMode(),
|
|
@@ -1780,7 +1633,7 @@ function structuralPort(editor) {
|
|
|
1780
1633
|
const root = editor.surface?.session.part().root;
|
|
1781
1634
|
let count = 0;
|
|
1782
1635
|
const visit = (node) => {
|
|
1783
|
-
if (node.localName === "ins" &&
|
|
1636
|
+
if (node.localName === "ins" && attr(node, "author") === author && attr(node, "date") === date)
|
|
1784
1637
|
count++;
|
|
1785
1638
|
node.children?.forEach(visit);
|
|
1786
1639
|
};
|
|
@@ -1906,7 +1759,7 @@ function DefinedTermsProvider({
|
|
|
1906
1759
|
},
|
|
1907
1760
|
[notify]
|
|
1908
1761
|
);
|
|
1909
|
-
const
|
|
1762
|
+
const run = useCallback(
|
|
1910
1763
|
(fn) => editor ? attempt(() => withDirectEditing(editor, fn)) : void 0,
|
|
1911
1764
|
[editor, attempt]
|
|
1912
1765
|
);
|
|
@@ -1921,7 +1774,7 @@ function DefinedTermsProvider({
|
|
|
1921
1774
|
(row) => {
|
|
1922
1775
|
if (!editor || !picker || !row) return;
|
|
1923
1776
|
const port = editorPort(editor);
|
|
1924
|
-
const placed =
|
|
1777
|
+
const placed = run(() => {
|
|
1925
1778
|
if (picker.mode === "search" && picker.caret) port.setCaret(picker.caret);
|
|
1926
1779
|
const caret = port.caret();
|
|
1927
1780
|
if (!caret) throw new Error("Place the cursor where the term should go.");
|
|
@@ -1941,7 +1794,7 @@ function DefinedTermsProvider({
|
|
|
1941
1794
|
if (result?.addedDefinition)
|
|
1942
1795
|
notify?.(`\u201C${row.definition.term}\u201D added to the Definitions section.`, "success");
|
|
1943
1796
|
},
|
|
1944
|
-
[editor, picker,
|
|
1797
|
+
[editor, picker, run, attempt, track, notify]
|
|
1945
1798
|
);
|
|
1946
1799
|
const openPicker = useCallback(
|
|
1947
1800
|
(anchor) => {
|
|
@@ -2904,107 +2757,6 @@ function runBeforeSave(editor) {
|
|
|
2904
2757
|
} catch {
|
|
2905
2758
|
}
|
|
2906
2759
|
}
|
|
2907
|
-
function newRefBookmark(taken, random = Math.random) {
|
|
2908
|
-
for (; ; ) {
|
|
2909
|
-
const name = `${REF_BOOKMARK_PREFIX}${String(Math.floor(random() * 9e8) + 1e8)}`;
|
|
2910
|
-
if (!taken.has(name)) return name;
|
|
2911
|
-
}
|
|
2912
|
-
}
|
|
2913
|
-
var styled = (style) => style ? `<w:rPr><w:rStyle w:val="${style}"/></w:rPr>` : "";
|
|
2914
|
-
var run = (text, style) => `<w:r>${styled(style)}<w:t xml:space="preserve">${esc(text)}</w:t></w:r>`;
|
|
2915
|
-
function refFieldXml(instruction, cached) {
|
|
2916
|
-
const r = (inner) => `<w:r>${styled(CROSS_REFERENCE_STYLE)}${inner}</w:r>`;
|
|
2917
|
-
return `${r('<w:fldChar w:fldCharType="begin"/>')}${r(
|
|
2918
|
-
`<w:instrText xml:space="preserve"> ${esc(instruction)} </w:instrText>`
|
|
2919
|
-
)}${r('<w:fldChar w:fldCharType="separate"/>')}${run(cached, CROSS_REFERENCE_STYLE)}${r(
|
|
2920
|
-
'<w:fldChar w:fldCharType="end"/>'
|
|
2921
|
-
)}`;
|
|
2922
|
-
}
|
|
2923
|
-
var refTooltip = (value, mode) => mode === "number" ? `Cross-reference to clause ${value}` : `Cross-reference to \u201C${value}\u201D`;
|
|
2924
|
-
function crossReferenceXml(bookmark, mode, value) {
|
|
2925
|
-
return `<w:hyperlink w:anchor="${esc(bookmark)}" w:tooltip="${esc(
|
|
2926
|
-
refTooltip(value, mode)
|
|
2927
|
-
)}" w:history="1">${refFieldXml(refInstruction(bookmark, mode), value)}</w:hyperlink>`;
|
|
2928
|
-
}
|
|
2929
|
-
var refInstruction = (bookmark, mode) => mode === "number" ? `REF ${bookmark} \\r \\h` : `REF ${bookmark} \\h`;
|
|
2930
|
-
var refResult = (target, mode) => mode === "number" && target.number ? target.number : target.text;
|
|
2931
|
-
var allBookmarks = (port) => new Set(port.paragraphs().flatMap((p) => p.bookmarks));
|
|
2932
|
-
function ensureTargetBookmark(port, target, mode) {
|
|
2933
|
-
const paragraph = port.paragraphs().find((p) => p.id === target.paragraphId);
|
|
2934
|
-
if (!paragraph) throw new Error("That clause is no longer in the document.");
|
|
2935
|
-
const existing = paragraph.bookmarks.find((b) => b.startsWith(REF_BOOKMARK_PREFIX));
|
|
2936
|
-
if (existing && mode === "number") return existing;
|
|
2937
|
-
const name = newRefBookmark(allBookmarks(port));
|
|
2938
|
-
const start = `<w:bookmarkStart w:id="0" w:name="${name}"/>`;
|
|
2939
|
-
const end = '<w:bookmarkEnd w:id="0"/>';
|
|
2940
|
-
if (mode === "number") {
|
|
2941
|
-
port.setCaret({ paragraphId: paragraph.id, offset: 0 });
|
|
2942
|
-
if (!port.paste(`<w:p>${start}${end}</w:p>`, "", false))
|
|
2943
|
-
throw new Error("The cross-reference target could not be marked.");
|
|
2944
|
-
return name;
|
|
2945
|
-
}
|
|
2946
|
-
const runs = port.runsXml(paragraph.id);
|
|
2947
|
-
if (!runs) throw new Error("This heading cannot be referred to by its text; use its number.");
|
|
2948
|
-
port.deleteRange(
|
|
2949
|
-
{ paragraphId: paragraph.id, offset: 0 },
|
|
2950
|
-
{ paragraphId: paragraph.id, offset: paragraph.text.length }
|
|
2951
|
-
);
|
|
2952
|
-
if (!port.paste(`<w:p>${start}${runs}${end}</w:p>`, paragraph.text, false))
|
|
2953
|
-
throw new Error("The cross-reference target could not be marked.");
|
|
2954
|
-
return name;
|
|
2955
|
-
}
|
|
2956
|
-
function pastePoint(port, caret) {
|
|
2957
|
-
const paragraph = port.paragraphs().find((p) => p.id === caret.paragraphId);
|
|
2958
|
-
if (paragraph?.text[caret.offset - 1] !== FIELD_ATOM) return caret;
|
|
2959
|
-
port.setCaret(caret);
|
|
2960
|
-
port.typeText(" ");
|
|
2961
|
-
return { paragraphId: caret.paragraphId, offset: caret.offset + 1 };
|
|
2962
|
-
}
|
|
2963
|
-
function markCrossReferenceTarget(port, target, mode) {
|
|
2964
|
-
if (mode === "number" && !target.number) mode = "text";
|
|
2965
|
-
const bookmark = ensureTargetBookmark(port, target, mode);
|
|
2966
|
-
return { bookmark, mode, value: refResult(target, mode) };
|
|
2967
|
-
}
|
|
2968
|
-
function insertCrossReferenceField(port, { bookmark, mode, value }, caret) {
|
|
2969
|
-
caret = pastePoint(port, caret);
|
|
2970
|
-
port.setCaret(caret);
|
|
2971
|
-
if (!port.paste(`<w:p>${crossReferenceXml(bookmark, mode, value)}</w:p>`, value, false))
|
|
2972
|
-
throw new Error("The cross-reference could not be inserted.");
|
|
2973
|
-
port.setCaret({ paragraphId: caret.paragraphId, offset: caret.offset + 1 });
|
|
2974
|
-
return { bookmark };
|
|
2975
|
-
}
|
|
2976
|
-
function insertCrossReference(port, target, mode, caret) {
|
|
2977
|
-
return insertCrossReferenceField(port, markCrossReferenceTarget(port, target, mode), caret);
|
|
2978
|
-
}
|
|
2979
|
-
var documentReferenceTooltip = (text, appName = "ARBI") => `Cross-reference: ${text} \u2014 opens in ${appName}`;
|
|
2980
|
-
function insertDocumentReference(port, reference, caret) {
|
|
2981
|
-
const text = reference.text.trim();
|
|
2982
|
-
if (!text) throw new Error("Enter the reference text.");
|
|
2983
|
-
const tooltip = documentReferenceTooltip(text, reference.appName).slice(0, 255);
|
|
2984
|
-
caret = pastePoint(port, caret);
|
|
2985
|
-
port.setCaret(caret);
|
|
2986
|
-
const link = `<w:p><w:hyperlink r:id="rIdRef1"${tooltip ? ` w:tooltip="${esc(tooltip)}"` : ""} w:history="1">${run(text, CROSS_REFERENCE_STYLE)}</w:hyperlink></w:p>`;
|
|
2987
|
-
if (!port.paste(link, text, false, hyperlinkRelationship("rIdRef1", reference.url)))
|
|
2988
|
-
throw new Error("The reference could not be inserted.");
|
|
2989
|
-
port.setCaret({ paragraphId: caret.paragraphId, offset: caret.offset + text.length });
|
|
2990
|
-
}
|
|
2991
|
-
function refreshCrossReferences(port) {
|
|
2992
|
-
const stale = staleCrossReferences(port).sort(
|
|
2993
|
-
(a, b) => a.paragraphId === b.paragraphId ? b.offset - a.offset : 0
|
|
2994
|
-
);
|
|
2995
|
-
let refreshed = 0;
|
|
2996
|
-
for (const ref of stale) {
|
|
2997
|
-
const paragraph = port.paragraphs().find((p) => p.id === ref.paragraphId);
|
|
2998
|
-
if (!paragraph || paragraph.text[ref.offset - 1] === FIELD_ATOM) continue;
|
|
2999
|
-
const at = { paragraphId: ref.paragraphId, offset: ref.offset };
|
|
3000
|
-
port.deleteRange(at, { paragraphId: ref.paragraphId, offset: ref.offset + 1 });
|
|
3001
|
-
port.setCaret(at);
|
|
3002
|
-
const text = ref.value ?? (ref.cached.trim() || ref.bookmark);
|
|
3003
|
-
const body = ref.value === null ? run(text, BROKEN_CROSS_REFERENCE_STYLE) : crossReferenceXml(ref.bookmark, ref.mode, ref.value);
|
|
3004
|
-
if (port.paste(`<w:p>${body}</w:p>`, text, false) && ref.value !== null) refreshed++;
|
|
3005
|
-
}
|
|
3006
|
-
return { refreshed, broken: brokenCrossReferences(port) };
|
|
3007
|
-
}
|
|
3008
2760
|
|
|
3009
2761
|
// src/docx/references/passages.ts
|
|
3010
2762
|
function shortTitle(title) {
|
|
@@ -3034,25 +2786,6 @@ function filterPassages(passages, query) {
|
|
|
3034
2786
|
const q = query.trim().toLowerCase();
|
|
3035
2787
|
return q ? passages.filter((p) => p.text.toLowerCase().includes(q)) : [...passages];
|
|
3036
2788
|
}
|
|
3037
|
-
var RUN_PARTS = /* @__PURE__ */ new Set(["rPr", "t", "tab", "br", "lastRenderedPageBreak"]);
|
|
3038
|
-
var SKIPPED = /* @__PURE__ */ new Set(["pPr", "bookmarkStart", "bookmarkEnd", "proofErr", "permStart", "permEnd"]);
|
|
3039
|
-
function serialize(node) {
|
|
3040
|
-
if (node.kind === "textValue") return esc(node.value ?? "");
|
|
3041
|
-
const name = `${node.prefix ?? "w"}:${node.localName}`;
|
|
3042
|
-
const attrs = (node.attributes ?? []).map((a) => ` ${a.prefix ? `${a.prefix}:` : ""}${a.localName}="${esc(a.value)}"`).join("");
|
|
3043
|
-
const children = (node.children ?? []).map((c) => serialize(c)).join("");
|
|
3044
|
-
return children ? `<${name}${attrs}>${children}</${name}>` : `<${name}${attrs}/>`;
|
|
3045
|
-
}
|
|
3046
|
-
function paragraphRunsXml(paragraph) {
|
|
3047
|
-
const runs = [];
|
|
3048
|
-
for (const child of paragraph.children ?? []) {
|
|
3049
|
-
if (child.localName && SKIPPED.has(child.localName)) continue;
|
|
3050
|
-
if (child.localName !== "r") return null;
|
|
3051
|
-
if ((child.children ?? []).some((c) => !c.localName || !RUN_PARTS.has(c.localName))) return null;
|
|
3052
|
-
runs.push(serialize(child));
|
|
3053
|
-
}
|
|
3054
|
-
return runs.length ? runs.join("") : null;
|
|
3055
|
-
}
|
|
3056
2789
|
function findNode2(node, id) {
|
|
3057
2790
|
if (node.id === id) return node;
|
|
3058
2791
|
for (const child of node.children ?? []) {
|
|
@@ -3146,7 +2879,7 @@ function CrossReferencesProvider({
|
|
|
3146
2879
|
notify?.(error instanceof Error ? error.message : "Could not read the document.", "error");
|
|
3147
2880
|
}
|
|
3148
2881
|
}, [editor, editable, notify]);
|
|
3149
|
-
const
|
|
2882
|
+
const run = useCallback(
|
|
3150
2883
|
(label, prepare, insert) => {
|
|
3151
2884
|
if (!editor) return;
|
|
3152
2885
|
try {
|
|
@@ -3299,12 +3032,12 @@ function CrossReferencesProvider({
|
|
|
3299
3032
|
labels: l,
|
|
3300
3033
|
onCancel: () => setDialog(null),
|
|
3301
3034
|
onClosed: () => editor?.surface?.focus(),
|
|
3302
|
-
onInsertTarget: (target, mode) =>
|
|
3035
|
+
onInsertTarget: (target, mode) => run(
|
|
3303
3036
|
`Inserted cross-reference: ${refResult(target, mode)}`,
|
|
3304
3037
|
() => markCrossReferenceTarget(referencesPort(editor), target, mode),
|
|
3305
3038
|
(marked, revision) => insertCrossReferenceField(referencesPort(editor, revision), marked, dialog.caret)
|
|
3306
3039
|
),
|
|
3307
|
-
onInsertPassage: (target, text) =>
|
|
3040
|
+
onInsertPassage: (target, text) => run(
|
|
3308
3041
|
`Inserted cross-reference: ${text}`,
|
|
3309
3042
|
() => void 0,
|
|
3310
3043
|
(_, revision) => insertDocumentReference(
|
|
@@ -4069,9 +3802,9 @@ function countSeqFields(root, label, throughId) {
|
|
|
4069
3802
|
return count;
|
|
4070
3803
|
}
|
|
4071
3804
|
function captionParagraphXml(label, number, text) {
|
|
4072
|
-
const
|
|
3805
|
+
const run = (value) => `<w:r><w:t xml:space="preserve">${esc(value)}</w:t></w:r>`;
|
|
4073
3806
|
const rest = text.trim() ? `: ${text.trim()}` : "";
|
|
4074
|
-
return `<w:p><w:pPr><w:pStyle w:val="Caption"/></w:pPr>${
|
|
3807
|
+
return `<w:p><w:pPr><w:pStyle w:val="Caption"/></w:pPr>${run(`${label} `)}<w:fldSimple w:instr=" SEQ ${esc(label)} \\* ARABIC "><w:r><w:t>${number}</w:t></w:r></w:fldSimple>${rest ? run(rest) : ""}</w:p>`;
|
|
4075
3808
|
}
|
|
4076
3809
|
function base642(bytes) {
|
|
4077
3810
|
let binary = "";
|
|
@@ -4321,7 +4054,7 @@ function GenerateImageButton({ generation }) {
|
|
|
4321
4054
|
});
|
|
4322
4055
|
const editable = useEditorState((snapshot) => snapshot.editable);
|
|
4323
4056
|
const generating = useSyncExternalStore(subscribe, () => running > 0);
|
|
4324
|
-
async function
|
|
4057
|
+
async function run() {
|
|
4325
4058
|
if (!editor || !prompt.trim() || busy) return;
|
|
4326
4059
|
const caret = rememberCaret(editor);
|
|
4327
4060
|
const controller = new AbortController();
|
|
@@ -4367,7 +4100,7 @@ function GenerateImageButton({ generation }) {
|
|
|
4367
4100
|
className: "native-docx-form native-docx-generate-image",
|
|
4368
4101
|
onSubmit: (event) => {
|
|
4369
4102
|
event.preventDefault();
|
|
4370
|
-
void
|
|
4103
|
+
void run();
|
|
4371
4104
|
},
|
|
4372
4105
|
children: [
|
|
4373
4106
|
/* @__PURE__ */ jsxs("label", { children: [
|
|
@@ -4383,7 +4116,7 @@ function GenerateImageButton({ generation }) {
|
|
|
4383
4116
|
"data-testid": "docx-generate-image-prompt",
|
|
4384
4117
|
onChange: (event) => setPrompt(event.target.value),
|
|
4385
4118
|
onKeyDown: (event) => {
|
|
4386
|
-
if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) void
|
|
4119
|
+
if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) void run();
|
|
4387
4120
|
}
|
|
4388
4121
|
}
|
|
4389
4122
|
)
|
|
@@ -5207,6 +4940,6 @@ function NativeDocxEditor({
|
|
|
5207
4940
|
);
|
|
5208
4941
|
}
|
|
5209
4942
|
|
|
5210
|
-
export { BUILTIN_TEMPLATE_NAME, CrossReferenceDialog, CrossReferencesProvider, DEFAULT_CROSS_REFERENCES_LABELS, DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxAuthorContext, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, GenerateImageButton, HouseTemplateProvider, LinkHoverCard, NativeDocxEditor, builtinHouseTemplate, contentPath, editorPort,
|
|
5211
|
-
//# sourceMappingURL=chunk-
|
|
5212
|
-
//# sourceMappingURL=chunk-
|
|
4943
|
+
export { BUILTIN_TEMPLATE_NAME, CrossReferenceDialog, CrossReferencesProvider, DEFAULT_CROSS_REFERENCES_LABELS, DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxAuthorContext, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, GenerateImageButton, HouseTemplateProvider, LinkHoverCard, NativeDocxEditor, builtinHouseTemplate, contentPath, editorPort, normalizeDocxExport, referenceText, referencesPort, resolveHouseTemplate, reviewModule, shortTitle, structuralPort, templateFileName, trackedOrNoted, useCrossReferences, useDefinedTerms, useHouseTemplate, useReview, useReviewItem, useTrackedOrNoted, withDirectEditing };
|
|
4944
|
+
//# sourceMappingURL=chunk-3OT37I24.js.map
|
|
4945
|
+
//# sourceMappingURL=chunk-3OT37I24.js.map
|