oasis-editor 0.0.82 → 0.0.84
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/{OasisEditorApp-DnKmTPKR.js → OasisEditorApp-lNYRC99y.js} +343 -285
- package/dist/app/controllers/documentIO/ImageInsertionService.d.ts +2 -1
- package/dist/app/controllers/tableOpsSelectionAwareCommands.d.ts +2 -1
- package/dist/app/controllers/useEditorDocumentIO.d.ts +2 -1
- package/dist/app/controllers/useEditorFindReplace.d.ts +2 -1
- package/dist/app/controllers/useEditorHistoryActions.d.ts +2 -1
- package/dist/app/controllers/useEditorImageOperations.d.ts +6 -2
- package/dist/app/controllers/useEditorTableOperations.d.ts +2 -1
- package/dist/app/controllers/useEditorTextDrag.d.ts +2 -1
- package/dist/app/controllers/useEditorTextInput.d.ts +2 -1
- package/dist/assets/{importDocxWorker-CmygfpkG.js → importDocxWorker-8fivvDCX.js} +1 -1
- package/dist/core/model/index.d.ts +3 -3
- package/dist/core/model/runKind.d.ts +33 -28
- package/dist/core/model/types/nodes.d.ts +63 -28
- package/dist/core/transactionMergeKeys.d.ts +35 -0
- package/dist/{index-BNz5Hsd-.js → index-9_ibx79n.js} +375 -312
- package/dist/oasis-editor.js +54 -54
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/app/createEditorChrome.d.ts +2 -1
- package/dist/ui/app/createEditorEssentialsPlugin.d.ts +2 -1
- package/dist/ui/app/createEditorInteractionRuntime.d.ts +4 -1
- package/dist/ui/app/createEditorLayoutOptionsController.d.ts +2 -1
- package/dist/ui/app/createEditorTableContextMenuActions.d.ts +2 -1
- package/dist/ui/app/useEditorContextMenuClipboard.d.ts +2 -1
- package/dist/ui/app/useFontDialogBridge.d.ts +2 -1
- package/dist/ui/app/useParagraphDialogBridge.d.ts +2 -1
- package/dist/ui/app/useTablePropertiesDialogBridge.d.ts +2 -1
- package/dist/ui/editorHistory.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,21 +1,148 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { a as assertNever, c as createSignal, b as createEditorStateFromDocument, d as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, f as fontSizePxToPt, p as probeLocalFontFamilies, e as createEditorParagraphFromRuns, i as isInlineObjectRun, g as createEditorStyledRun, h as getParagraphLength, j as getParagraphText, k as getActiveZone, l as getDocumentSections, m as getActiveSectionIndex, n as getParagraphs, o as normalizeSelection, q as positionToParagraphOffset, r as paragraphOffsetToPosition, s as clampPosition, t as findParagraphIndex, u as createCollapsedSelection,
|
|
4
|
+
import { v as visitRun, a as assertNever, c as createSignal, b as createEditorStateFromDocument, d as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, f as fontSizePxToPt, p as probeLocalFontFamilies, e as createEditorParagraphFromRuns, i as isInlineObjectRun, g as createEditorStyledRun, h as getParagraphLength, j as getParagraphText, k as getActiveZone, l as getDocumentSections, m as getActiveSectionIndex, n as getParagraphs, o as normalizeSelection, q as positionToParagraphOffset, r as paragraphOffsetToPosition, s as clampPosition, t as findParagraphIndex, u as createCollapsedSelection, w as isSelectionCollapsed, x as parseFontSizePtToPx, y as formatFontSizePt, z as createEditorParagraph, A as getBlockParagraphs, B as findParagraphTableLocation, C as buildTableCellLayout, P as PT_PER_PX, D as createEditorTableCell, E as createEditorTableRow, F as createEditorTable, G as underlineStyleToCssDecorationStyle, H as resolveImageSrc, I as listKindForTag, J as isParagraphTag, K as collectInlineRuns, L as parseParagraphStyle, M as getRunImage, N as InlineShell, O as BalloonShell, Q as DocumentShell, R as createMemo, T as buildCanvasLayoutSnapshot, U as getCaretRectFromSnapshot, V as getParagraphRectFromSnapshot, W as createComponent, X as CaretOverlay, Y as Show, Z as createRenderEffect, _ as style, $ as setAttribute, a0 as setStyleProperty, a1 as memo, a2 as template, a3 as useI18n, a4 as createEffect, a5 as insert, a6 as use, a7 as addEventListener, a8 as Dialog, a9 as delegateEvents, aa as className, ab as For, ac as UNDERLINE_STYLE_OPTIONS, ad as Tabs, ae as onMount, af as onCleanup, ag as PluginUiHost, ah as OasisEditorEditor, ai as OasisBrandMark, aj as setPreciseFontPreference, ak as setWelcomeSeen, al as enablePreciseFontMode, am as TWIPS_PER_POINT, an as PX_PER_INCH, ao as TWIPS_PER_INCH, ap as resolveEffectiveParagraphStyle, aq as resolveEffectiveTextStyleForParagraph, ar as EMU_PER_PX, as as EMU_PER_PT, at as getRunFootnoteReference, au as getRunEndnoteReference, av as iterateFootnoteReferenceRuns, aw as iterateEndnoteReferenceRuns, ax as imageContentTypeDefaults, ay as getRunFieldChar, az as getRunFieldInstruction, aA as createEditorRun, aB as JSZip, aC as imageExtensionFromMime, aD as pxToPt$1, aE as resolveFloatingObjectRect, aF as getTextBoxFloatingGeometry, aG as getPresetPathSegments, aH as projectBlocksLayout, aI as buildListLabels, aJ as textStyleToFontSizePt, aK as PX_PER_POINT, aL as DEFAULT_FONT_SIZE_PX, aM as isDoubleUnderlineStyle, aN as isWavyUnderlineStyle, aO as underlineStyleLineWidthPx, aP as underlineStyleDashArray, aQ as resolveListLabel, aR as getListLabelInset, aS as getAlignedListLabelInset, aT as getParagraphBorderInsets, aU as buildSegmentTable, aV as buildCanvasTableLayout, aW as normalizeFamily, aX as ROBOTO_FONT_FILES, aY as loadFontAsset, aZ as OFFICE_COMPAT_FONT_FAMILIES, a_ as buildSfnt, a$ as defaultFontDecoderRegistry, b0 as SfntFontProgram, b1 as collectPdfFontFamilies, b2 as projectDocumentLayout, b3 as getPageContentWidth, b4 as getPageHeaderZoneTop, b5 as getPageBodyTop, b6 as getPageColumnRects, b7 as findFootnoteReference, b8 as FOOTNOTE_MARKER_GUTTER_PX, b9 as resolveImporterForFile, ba as getDocumentSectionsCanonical, bb as getDocumentParagraphsCanonical, bc as getDocumentParagraphs, bd as getDocumentPageSettings, be as getTableCellContentWidthForParagraph, bf as on, bg as debounce, bh as unwrap, bi as perfTimer, bj as getRunTextBox, bk as createEditorDocument, bl as resolveResizedDimensions, bm as resolveTextBoxRenderHeight, bn as getToolbarStyleState, bo as getCachedCanvasImage, bp as measureParagraphMinContentWidthPx, bq as getEditableBlocksForZone, br as findParagraphLocation, bs as createSectionBoundaryParagraph, bt as normalizePageSettings, bu as DEFAULT_EDITOR_PAGE_SETTINGS, bv as markStart, bw as markEnd, bx as getParagraphEntries, by as getParagraphById, bz as createEditorFootnote, bA as createFootnoteReferenceRun, bB as renumberFootnotes, bC as getFootnoteDisplayMarker, bD as getHeadingLevel, bE as preciseFontModeVersion, bF as isPreciseFontModeEnabled, bG as togglePreciseFontMode, bH as nextFontSizePt, bI as previousFontSizePt, bJ as fontSizePtToPx, bK as createDefaultToolbarPreset, bL as MenuRegistry, bM as createToolbarRegistry, bN as Editor, bO as resolveCommandRef, bP as commandRefName, bQ as createOasisEditorClient, bR as createEditorZoom, bS as startLongTaskObserver, bT as installGlobalReport, bU as applyStoredPreciseFontPreference, bV as getWelcomeSeen, bW as isLocalFontAccessSupported, bX as EDITOR_SCROLL_PADDING_PX, bY as Toolbar, bZ as OasisEditorLoading, b_ as I18nProvider, b$ as createTranslator, c0 as createEditorLogger, c1 as registerDomStatsSurface } from "./index-9_ibx79n.js";
|
|
5
|
+
function cloneStyle(style2) {
|
|
6
|
+
return style2 ? { ...style2 } : void 0;
|
|
7
|
+
}
|
|
8
|
+
function stylesEqual(left, right) {
|
|
9
|
+
return JSON.stringify(left ?? null) === JSON.stringify(right ?? null);
|
|
10
|
+
}
|
|
11
|
+
function setBooleanStyle(style2, key, enabled) {
|
|
12
|
+
const next = { ...style2 ?? {} };
|
|
13
|
+
if (enabled) {
|
|
14
|
+
next[key] = true;
|
|
15
|
+
} else {
|
|
16
|
+
delete next[key];
|
|
17
|
+
}
|
|
18
|
+
return Object.keys(next).length > 0 ? next : void 0;
|
|
19
|
+
}
|
|
20
|
+
function setValueStyle(style2, key, value) {
|
|
21
|
+
const next = { ...style2 ?? {} };
|
|
22
|
+
if (value === null || value === void 0 || value === "") {
|
|
23
|
+
delete next[key];
|
|
24
|
+
} else {
|
|
25
|
+
next[key] = value;
|
|
26
|
+
}
|
|
27
|
+
return Object.keys(next).length > 0 ? next : void 0;
|
|
28
|
+
}
|
|
29
|
+
function setParagraphStyleValue(style2, key, value) {
|
|
30
|
+
const next = { ...style2 ?? {} };
|
|
31
|
+
if (value === null || value === void 0) {
|
|
32
|
+
delete next[key];
|
|
33
|
+
} else {
|
|
34
|
+
next[key] = value;
|
|
35
|
+
}
|
|
36
|
+
return Object.keys(next).length > 0 ? next : void 0;
|
|
37
|
+
}
|
|
38
|
+
function cloneTextBox(textBox) {
|
|
39
|
+
return {
|
|
40
|
+
...textBox,
|
|
41
|
+
floating: textBox.floating ? {
|
|
42
|
+
...textBox.floating,
|
|
43
|
+
positionH: textBox.floating.positionH ? { ...textBox.floating.positionH } : void 0,
|
|
44
|
+
positionV: textBox.floating.positionV ? { ...textBox.floating.positionV } : void 0
|
|
45
|
+
} : void 0,
|
|
46
|
+
shape: textBox.shape ? { ...textBox.shape } : void 0,
|
|
47
|
+
body: textBox.body ? { ...textBox.body } : void 0,
|
|
48
|
+
blocks: cloneBlocks(textBox.blocks)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function cloneRun(run) {
|
|
52
|
+
const base = {
|
|
53
|
+
id: run.id,
|
|
54
|
+
text: run.text,
|
|
55
|
+
styles: cloneStyle(run.styles),
|
|
56
|
+
revision: run.revision ? { ...run.revision } : void 0
|
|
57
|
+
};
|
|
58
|
+
return visitRun(run, {
|
|
59
|
+
text: () => ({ ...base, kind: "text" }),
|
|
60
|
+
image: (r) => ({ ...base, kind: "image", image: { ...r.image } }),
|
|
61
|
+
textBox: (r) => ({
|
|
62
|
+
...base,
|
|
63
|
+
kind: "textBox",
|
|
64
|
+
textBox: cloneTextBox(r.textBox)
|
|
65
|
+
}),
|
|
66
|
+
field: (r) => ({ ...base, kind: "field", field: { ...r.field } }),
|
|
67
|
+
fieldChar: (r) => ({
|
|
68
|
+
...base,
|
|
69
|
+
kind: "fieldChar",
|
|
70
|
+
fieldChar: { ...r.fieldChar }
|
|
71
|
+
}),
|
|
72
|
+
fieldInstruction: (r) => ({
|
|
73
|
+
...base,
|
|
74
|
+
kind: "fieldInstruction",
|
|
75
|
+
fieldInstruction: r.fieldInstruction
|
|
76
|
+
}),
|
|
77
|
+
footnoteReference: (r) => ({
|
|
78
|
+
...base,
|
|
79
|
+
kind: "footnoteReference",
|
|
80
|
+
footnoteReference: { ...r.footnoteReference }
|
|
81
|
+
}),
|
|
82
|
+
endnoteReference: (r) => ({
|
|
83
|
+
...base,
|
|
84
|
+
kind: "endnoteReference",
|
|
85
|
+
endnoteReference: { ...r.endnoteReference }
|
|
86
|
+
}),
|
|
87
|
+
sym: (r) => ({ ...base, kind: "sym", sym: { ...r.sym } })
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function cloneParagraph(paragraph) {
|
|
91
|
+
return {
|
|
92
|
+
...paragraph,
|
|
93
|
+
runs: paragraph.runs.map(cloneRun),
|
|
94
|
+
style: paragraph.style ? { ...paragraph.style } : void 0,
|
|
95
|
+
list: paragraph.list ? { ...paragraph.list } : void 0
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function cloneParagraphList(list) {
|
|
99
|
+
return list ? { ...list } : void 0;
|
|
100
|
+
}
|
|
101
|
+
function cloneParagraphs(paragraphs) {
|
|
102
|
+
return paragraphs.map(cloneParagraph);
|
|
103
|
+
}
|
|
104
|
+
function cloneBlocks(blocks) {
|
|
105
|
+
return blocks.map((block) => {
|
|
106
|
+
switch (block.type) {
|
|
107
|
+
case "paragraph":
|
|
108
|
+
return cloneParagraph(block);
|
|
109
|
+
case "table":
|
|
110
|
+
return {
|
|
111
|
+
...block,
|
|
112
|
+
style: block.style ? {
|
|
113
|
+
...block.style,
|
|
114
|
+
defaultCellMargins: block.style.defaultCellMargins ? { ...block.style.defaultCellMargins } : void 0,
|
|
115
|
+
floating: block.style.floating ? { ...block.style.floating } : void 0,
|
|
116
|
+
revisionXml: block.style.revisionXml ? [...block.style.revisionXml] : void 0
|
|
117
|
+
} : void 0,
|
|
118
|
+
tblGridChangeXml: block.tblGridChangeXml,
|
|
119
|
+
rows: block.rows.map((row) => ({
|
|
120
|
+
...row,
|
|
121
|
+
style: row.style ? {
|
|
122
|
+
...row.style,
|
|
123
|
+
revisionXml: row.style.revisionXml ? [...row.style.revisionXml] : void 0
|
|
124
|
+
} : void 0,
|
|
125
|
+
cells: row.cells.map((cell) => ({
|
|
126
|
+
...cell,
|
|
127
|
+
style: cell.style ? {
|
|
128
|
+
...cell.style,
|
|
129
|
+
revisionXml: cell.style.revisionXml ? [...cell.style.revisionXml] : void 0
|
|
130
|
+
} : void 0,
|
|
131
|
+
blocks: cloneParagraphs(cell.blocks)
|
|
132
|
+
}))
|
|
133
|
+
}))
|
|
134
|
+
};
|
|
135
|
+
default:
|
|
136
|
+
return assertNever(block, "block");
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
5
140
|
function cloneBlock(block) {
|
|
6
141
|
switch (block.type) {
|
|
7
142
|
case "paragraph":
|
|
8
143
|
return {
|
|
9
144
|
...block,
|
|
10
|
-
runs: block.runs.map(
|
|
11
|
-
...run,
|
|
12
|
-
styles: run.styles ? { ...run.styles } : void 0,
|
|
13
|
-
image: run.image ? { ...run.image } : void 0,
|
|
14
|
-
field: run.field ? { ...run.field } : void 0,
|
|
15
|
-
revision: run.revision ? { ...run.revision } : void 0,
|
|
16
|
-
footnoteReference: run.footnoteReference ? { ...run.footnoteReference } : void 0,
|
|
17
|
-
endnoteReference: run.endnoteReference ? { ...run.endnoteReference } : void 0
|
|
18
|
-
})),
|
|
145
|
+
runs: block.runs.map(cloneRun),
|
|
19
146
|
style: block.style ? { ...block.style } : void 0,
|
|
20
147
|
list: block.list ? { ...block.list } : void 0
|
|
21
148
|
};
|
|
@@ -46,15 +173,7 @@ function cloneBlock(block) {
|
|
|
46
173
|
} : void 0,
|
|
47
174
|
blocks: cell.blocks.map((paragraph) => ({
|
|
48
175
|
...paragraph,
|
|
49
|
-
runs: paragraph.runs.map(
|
|
50
|
-
...run,
|
|
51
|
-
styles: run.styles ? { ...run.styles } : void 0,
|
|
52
|
-
image: run.image ? { ...run.image } : void 0,
|
|
53
|
-
field: run.field ? { ...run.field } : void 0,
|
|
54
|
-
revision: run.revision ? { ...run.revision } : void 0,
|
|
55
|
-
footnoteReference: run.footnoteReference ? { ...run.footnoteReference } : void 0,
|
|
56
|
-
endnoteReference: run.endnoteReference ? { ...run.endnoteReference } : void 0
|
|
57
|
-
})),
|
|
176
|
+
runs: paragraph.runs.map(cloneRun),
|
|
58
177
|
style: paragraph.style ? { ...paragraph.style } : void 0,
|
|
59
178
|
list: paragraph.list ? { ...paragraph.list } : void 0
|
|
60
179
|
}))
|
|
@@ -26643,115 +26762,40 @@ function createEditorFontOptions(ctx) {
|
|
|
26643
26762
|
loadLocalFontFamilyOptions
|
|
26644
26763
|
};
|
|
26645
26764
|
}
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
26656
|
-
|
|
26657
|
-
|
|
26658
|
-
|
|
26659
|
-
|
|
26660
|
-
|
|
26661
|
-
|
|
26662
|
-
|
|
26663
|
-
|
|
26664
|
-
|
|
26665
|
-
|
|
26666
|
-
|
|
26667
|
-
|
|
26668
|
-
|
|
26669
|
-
|
|
26670
|
-
|
|
26671
|
-
|
|
26672
|
-
|
|
26673
|
-
|
|
26674
|
-
|
|
26675
|
-
|
|
26676
|
-
|
|
26677
|
-
|
|
26678
|
-
|
|
26679
|
-
|
|
26680
|
-
return {
|
|
26681
|
-
...textBox,
|
|
26682
|
-
floating: textBox.floating ? {
|
|
26683
|
-
...textBox.floating,
|
|
26684
|
-
positionH: textBox.floating.positionH ? { ...textBox.floating.positionH } : void 0,
|
|
26685
|
-
positionV: textBox.floating.positionV ? { ...textBox.floating.positionV } : void 0
|
|
26686
|
-
} : void 0,
|
|
26687
|
-
shape: textBox.shape ? { ...textBox.shape } : void 0,
|
|
26688
|
-
body: textBox.body ? { ...textBox.body } : void 0,
|
|
26689
|
-
blocks: cloneBlocks(textBox.blocks)
|
|
26690
|
-
};
|
|
26691
|
-
}
|
|
26692
|
-
function cloneRun(run) {
|
|
26693
|
-
return {
|
|
26694
|
-
...run,
|
|
26695
|
-
styles: cloneStyle(run.styles),
|
|
26696
|
-
image: run.image ? { ...run.image } : void 0,
|
|
26697
|
-
textBox: run.textBox ? cloneTextBox(run.textBox) : void 0,
|
|
26698
|
-
field: run.field ? { ...run.field } : void 0,
|
|
26699
|
-
fieldChar: run.fieldChar ? { ...run.fieldChar } : void 0,
|
|
26700
|
-
revision: run.revision ? { ...run.revision } : void 0,
|
|
26701
|
-
footnoteReference: run.footnoteReference ? { ...run.footnoteReference } : void 0,
|
|
26702
|
-
endnoteReference: run.endnoteReference ? { ...run.endnoteReference } : void 0
|
|
26703
|
-
};
|
|
26704
|
-
}
|
|
26705
|
-
function cloneParagraph(paragraph) {
|
|
26706
|
-
return {
|
|
26707
|
-
...paragraph,
|
|
26708
|
-
runs: paragraph.runs.map(cloneRun),
|
|
26709
|
-
style: paragraph.style ? { ...paragraph.style } : void 0,
|
|
26710
|
-
list: paragraph.list ? { ...paragraph.list } : void 0
|
|
26711
|
-
};
|
|
26712
|
-
}
|
|
26713
|
-
function cloneParagraphList(list) {
|
|
26714
|
-
return list ? { ...list } : void 0;
|
|
26715
|
-
}
|
|
26716
|
-
function cloneParagraphs(paragraphs) {
|
|
26717
|
-
return paragraphs.map(cloneParagraph);
|
|
26718
|
-
}
|
|
26719
|
-
function cloneBlocks(blocks) {
|
|
26720
|
-
return blocks.map((block) => {
|
|
26721
|
-
switch (block.type) {
|
|
26722
|
-
case "paragraph":
|
|
26723
|
-
return cloneParagraph(block);
|
|
26724
|
-
case "table":
|
|
26725
|
-
return {
|
|
26726
|
-
...block,
|
|
26727
|
-
style: block.style ? {
|
|
26728
|
-
...block.style,
|
|
26729
|
-
defaultCellMargins: block.style.defaultCellMargins ? { ...block.style.defaultCellMargins } : void 0,
|
|
26730
|
-
floating: block.style.floating ? { ...block.style.floating } : void 0,
|
|
26731
|
-
revisionXml: block.style.revisionXml ? [...block.style.revisionXml] : void 0
|
|
26732
|
-
} : void 0,
|
|
26733
|
-
tblGridChangeXml: block.tblGridChangeXml,
|
|
26734
|
-
rows: block.rows.map((row) => ({
|
|
26735
|
-
...row,
|
|
26736
|
-
style: row.style ? {
|
|
26737
|
-
...row.style,
|
|
26738
|
-
revisionXml: row.style.revisionXml ? [...row.style.revisionXml] : void 0
|
|
26739
|
-
} : void 0,
|
|
26740
|
-
cells: row.cells.map((cell) => ({
|
|
26741
|
-
...cell,
|
|
26742
|
-
style: cell.style ? {
|
|
26743
|
-
...cell.style,
|
|
26744
|
-
revisionXml: cell.style.revisionXml ? [...cell.style.revisionXml] : void 0
|
|
26745
|
-
} : void 0,
|
|
26746
|
-
blocks: cloneParagraphs(cell.blocks)
|
|
26747
|
-
}))
|
|
26748
|
-
}))
|
|
26749
|
-
};
|
|
26750
|
-
default:
|
|
26751
|
-
return assertNever(block, "block");
|
|
26752
|
-
}
|
|
26753
|
-
});
|
|
26754
|
-
}
|
|
26765
|
+
const MERGE_KEYS = {
|
|
26766
|
+
insertText: "insertText",
|
|
26767
|
+
insertImage: "insertImage",
|
|
26768
|
+
insertTable: "insertTable",
|
|
26769
|
+
moveImage: "moveImage",
|
|
26770
|
+
splitListItem: "splitListItem",
|
|
26771
|
+
link: "link",
|
|
26772
|
+
imageAlt: "imageAlt",
|
|
26773
|
+
imageCaption: "imageCaption",
|
|
26774
|
+
layoutWrapPolygon: "layoutWrapPolygon",
|
|
26775
|
+
specialIndent: "specialIndent",
|
|
26776
|
+
paraBorders: "paraBorders",
|
|
26777
|
+
findReplace: "findReplace",
|
|
26778
|
+
findReplaceAll: "findReplaceAll",
|
|
26779
|
+
tableProperties: "tableProperties",
|
|
26780
|
+
paragraphDialog: "paragraph-dialog",
|
|
26781
|
+
fontDialog: "font-dialog",
|
|
26782
|
+
copyTextByDrag: "copyTextByDrag",
|
|
26783
|
+
moveTextByDrag: "moveTextByDrag",
|
|
26784
|
+
collapseSelectionByClick: "collapseSelectionByClick",
|
|
26785
|
+
mergeTable: "mergeTable",
|
|
26786
|
+
splitTable: "splitTable",
|
|
26787
|
+
insertTableColumn: "insertTableColumn",
|
|
26788
|
+
deleteTableColumn: "deleteTableColumn",
|
|
26789
|
+
insertTableRow: "insertTableRow",
|
|
26790
|
+
deleteTableRow: "deleteTableRow",
|
|
26791
|
+
tableShading: "tableShading",
|
|
26792
|
+
tableBorders: "tableBorders",
|
|
26793
|
+
tableWidth: "tableWidth",
|
|
26794
|
+
tableAlign: "tableAlign",
|
|
26795
|
+
tableCellWidth: "tableCellWidth",
|
|
26796
|
+
layoutWrapPreset: "layoutWrapPreset",
|
|
26797
|
+
layoutFixedPosition: "layoutFixedPosition"
|
|
26798
|
+
};
|
|
26755
26799
|
function normalizeRuns(runs, fallbackStyles) {
|
|
26756
26800
|
const merged = [];
|
|
26757
26801
|
for (const run of runs) {
|
|
@@ -26859,7 +26903,7 @@ function expandLinkRangeInParagraph(paragraph, offset) {
|
|
|
26859
26903
|
var _a, _b, _c;
|
|
26860
26904
|
const resolved = getRunAtOffset(paragraph, offset);
|
|
26861
26905
|
const href = (_a = resolved == null ? void 0 : resolved.run.styles) == null ? void 0 : _a.link;
|
|
26862
|
-
if (!resolved || !href || resolved.run.image) {
|
|
26906
|
+
if (!resolved || !href || resolved.run.kind === "image") {
|
|
26863
26907
|
return null;
|
|
26864
26908
|
}
|
|
26865
26909
|
let startOffset = resolved.startOffset;
|
|
@@ -26877,14 +26921,14 @@ function expandLinkRangeInParagraph(paragraph, offset) {
|
|
|
26877
26921
|
endOffset = consumed + resolved.run.text.length;
|
|
26878
26922
|
for (let index = runIndex - 1; index >= 0; index -= 1) {
|
|
26879
26923
|
const run = runs[index];
|
|
26880
|
-
if (run.image || ((_b = run.styles) == null ? void 0 : _b.link) !== href) {
|
|
26924
|
+
if (run.kind === "image" || ((_b = run.styles) == null ? void 0 : _b.link) !== href) {
|
|
26881
26925
|
break;
|
|
26882
26926
|
}
|
|
26883
26927
|
startOffset -= run.text.length;
|
|
26884
26928
|
}
|
|
26885
26929
|
for (let index = runIndex + 1; index < runs.length; index += 1) {
|
|
26886
26930
|
const run = runs[index];
|
|
26887
|
-
if (run.image || ((_c = run.styles) == null ? void 0 : _c.link) !== href) {
|
|
26931
|
+
if (run.kind === "image" || ((_c = run.styles) == null ? void 0 : _c.link) !== href) {
|
|
26888
26932
|
break;
|
|
26889
26933
|
}
|
|
26890
26934
|
endOffset += run.text.length;
|
|
@@ -26908,31 +26952,13 @@ function sliceRuns(paragraph, startOffset, endOffset) {
|
|
|
26908
26952
|
const overlapStart = Math.max(start, runStart);
|
|
26909
26953
|
const overlapEnd = Math.min(end, runEnd);
|
|
26910
26954
|
if (overlapStart < overlapEnd) {
|
|
26911
|
-
const
|
|
26912
|
-
|
|
26913
|
-
|
|
26914
|
-
text
|
|
26915
|
-
|
|
26916
|
-
|
|
26917
|
-
|
|
26918
|
-
}
|
|
26919
|
-
if (run.image) {
|
|
26920
|
-
piece.image = { ...run.image };
|
|
26921
|
-
}
|
|
26922
|
-
if (run.textBox) {
|
|
26923
|
-
piece.textBox = cloneTextBox(run.textBox);
|
|
26924
|
-
}
|
|
26925
|
-
if (run.revision) {
|
|
26926
|
-
piece.revision = { ...run.revision };
|
|
26927
|
-
}
|
|
26928
|
-
if (run.field) {
|
|
26929
|
-
piece.field = { ...run.field };
|
|
26930
|
-
}
|
|
26931
|
-
if (run.footnoteReference) {
|
|
26932
|
-
piece.footnoteReference = { ...run.footnoteReference };
|
|
26933
|
-
}
|
|
26934
|
-
if (run.endnoteReference) {
|
|
26935
|
-
piece.endnoteReference = { ...run.endnoteReference };
|
|
26955
|
+
const piece = cloneRun(run);
|
|
26956
|
+
piece.id = `run:${Math.random().toString(36).slice(2, 9)}`;
|
|
26957
|
+
if (!isInlineObjectRun(run)) {
|
|
26958
|
+
piece.text = run.text.slice(
|
|
26959
|
+
overlapStart - runStart,
|
|
26960
|
+
overlapEnd - runStart
|
|
26961
|
+
);
|
|
26936
26962
|
}
|
|
26937
26963
|
pieces.push(piece);
|
|
26938
26964
|
}
|
|
@@ -27503,7 +27529,8 @@ function insertTextAtSelection(state, text, styleOverride) {
|
|
|
27503
27529
|
const insertedRun = {
|
|
27504
27530
|
id: `run:${Math.random().toString(36).slice(2, 9)}`,
|
|
27505
27531
|
text,
|
|
27506
|
-
styles
|
|
27532
|
+
styles,
|
|
27533
|
+
kind: "text"
|
|
27507
27534
|
};
|
|
27508
27535
|
if (collapsedState.trackChangesEnabled) {
|
|
27509
27536
|
insertedRun.revision = {
|
|
@@ -27611,6 +27638,7 @@ function deleteBackward(state) {
|
|
|
27611
27638
|
const deletionRun = {
|
|
27612
27639
|
id: `run:${Math.random().toString(36).slice(2, 9)}`,
|
|
27613
27640
|
text: charToDelete,
|
|
27641
|
+
kind: "text",
|
|
27614
27642
|
styles: { ...targetRun.styles },
|
|
27615
27643
|
revision: {
|
|
27616
27644
|
id: `rev:${Math.random().toString(36).slice(2, 9)}`,
|
|
@@ -27719,6 +27747,7 @@ function deleteForward(state) {
|
|
|
27719
27747
|
const deletionRun = {
|
|
27720
27748
|
id: `run:${Math.random().toString(36).slice(2, 9)}`,
|
|
27721
27749
|
text: charToDelete,
|
|
27750
|
+
kind: "text",
|
|
27722
27751
|
styles: { ...targetRun.styles },
|
|
27723
27752
|
revision: {
|
|
27724
27753
|
id: `rev:${Math.random().toString(36).slice(2, 9)}`,
|
|
@@ -28126,7 +28155,7 @@ function createFontDialogBridge(deps) {
|
|
|
28126
28155
|
}
|
|
28127
28156
|
return next;
|
|
28128
28157
|
},
|
|
28129
|
-
{ mergeKey:
|
|
28158
|
+
{ mergeKey: MERGE_KEYS.fontDialog }
|
|
28130
28159
|
);
|
|
28131
28160
|
deps.focusInput();
|
|
28132
28161
|
};
|
|
@@ -28508,7 +28537,7 @@ function createParagraphDialogBridge(deps) {
|
|
|
28508
28537
|
}
|
|
28509
28538
|
return next;
|
|
28510
28539
|
},
|
|
28511
|
-
{ mergeKey:
|
|
28540
|
+
{ mergeKey: MERGE_KEYS.paragraphDialog }
|
|
28512
28541
|
);
|
|
28513
28542
|
deps.focusInput();
|
|
28514
28543
|
};
|
|
@@ -29211,7 +29240,7 @@ function createTablePropertiesDialogBridge(deps) {
|
|
|
29211
29240
|
deps.resetTransactionGrouping();
|
|
29212
29241
|
deps.applyTransactionalState(
|
|
29213
29242
|
(current) => applyTableProperties(current, values),
|
|
29214
|
-
{ mergeKey:
|
|
29243
|
+
{ mergeKey: MERGE_KEYS.tableProperties }
|
|
29215
29244
|
);
|
|
29216
29245
|
deps.focusInput();
|
|
29217
29246
|
};
|
|
@@ -29406,7 +29435,7 @@ function textLanguageToHtmlAttributes(language) {
|
|
|
29406
29435
|
}
|
|
29407
29436
|
function serializeImageRunToHtml(run, document2) {
|
|
29408
29437
|
var _a;
|
|
29409
|
-
if (
|
|
29438
|
+
if (run.kind !== "image") {
|
|
29410
29439
|
return "";
|
|
29411
29440
|
}
|
|
29412
29441
|
const resolvedSrc = resolveImageSrc(document2, run.image.src);
|
|
@@ -29418,7 +29447,7 @@ function serializeImageRunToHtml(run, document2) {
|
|
|
29418
29447
|
return img;
|
|
29419
29448
|
}
|
|
29420
29449
|
function serializeTextRunToHtml(run, document2) {
|
|
29421
|
-
if (run.image) {
|
|
29450
|
+
if (run.kind === "image") {
|
|
29422
29451
|
return serializeImageRunToHtml(run, document2);
|
|
29423
29452
|
}
|
|
29424
29453
|
const text = escapeHtml(run.text).replace(/\n/g, "<br>");
|
|
@@ -29786,11 +29815,14 @@ function parseEditorClipboardHtmlWithDom(html) {
|
|
|
29786
29815
|
const appendParagraph = (element, runs, list) => {
|
|
29787
29816
|
const fallbackRuns = runs.length > 0 ? runs : [createEditorStyledRun("")];
|
|
29788
29817
|
paragraphs.push({
|
|
29789
|
-
runs: fallbackRuns.map((run) =>
|
|
29790
|
-
|
|
29791
|
-
|
|
29792
|
-
|
|
29793
|
-
|
|
29818
|
+
runs: fallbackRuns.map((run) => {
|
|
29819
|
+
const image = getRunImage(run);
|
|
29820
|
+
return {
|
|
29821
|
+
text: run.text,
|
|
29822
|
+
styles: cloneStyle(run.styles),
|
|
29823
|
+
image: image ? { ...image } : void 0
|
|
29824
|
+
};
|
|
29825
|
+
}),
|
|
29794
29826
|
style: element ? parseParagraphStyle(element) : void 0,
|
|
29795
29827
|
list
|
|
29796
29828
|
});
|
|
@@ -30113,35 +30145,35 @@ function createEditorTableContextMenuActions(deps) {
|
|
|
30113
30145
|
openBordersAndShading: () => deps.openTablePropertiesDialog("cell"),
|
|
30114
30146
|
merge: () => applyTableContextCommand(
|
|
30115
30147
|
(current) => tableOps.mergeSelectedTable(current),
|
|
30116
|
-
|
|
30148
|
+
MERGE_KEYS.mergeTable
|
|
30117
30149
|
),
|
|
30118
30150
|
split: () => applyTableContextCommand(
|
|
30119
30151
|
(current) => tableOps.splitSelectedTable(current),
|
|
30120
|
-
|
|
30152
|
+
MERGE_KEYS.splitTable
|
|
30121
30153
|
),
|
|
30122
30154
|
insertColumnBefore: () => applyTableContextCommand(
|
|
30123
30155
|
(current) => tableOps.insertSelectedTableColumn(current, -1),
|
|
30124
|
-
|
|
30156
|
+
MERGE_KEYS.insertTableColumn
|
|
30125
30157
|
),
|
|
30126
30158
|
insertColumnAfter: () => applyTableContextCommand(
|
|
30127
30159
|
(current) => tableOps.insertSelectedTableColumn(current, 1),
|
|
30128
|
-
|
|
30160
|
+
MERGE_KEYS.insertTableColumn
|
|
30129
30161
|
),
|
|
30130
30162
|
deleteColumn: () => applyTableContextCommand(
|
|
30131
30163
|
(current) => tableOps.deleteSelectedTableColumn(current),
|
|
30132
|
-
|
|
30164
|
+
MERGE_KEYS.deleteTableColumn
|
|
30133
30165
|
),
|
|
30134
30166
|
insertRowBefore: () => applyTableContextCommand(
|
|
30135
30167
|
(current) => tableOps.insertSelectedTableRow(current, -1),
|
|
30136
|
-
|
|
30168
|
+
MERGE_KEYS.insertTableRow
|
|
30137
30169
|
),
|
|
30138
30170
|
insertRowAfter: () => applyTableContextCommand(
|
|
30139
30171
|
(current) => tableOps.insertSelectedTableRow(current, 1),
|
|
30140
|
-
|
|
30172
|
+
MERGE_KEYS.insertTableRow
|
|
30141
30173
|
),
|
|
30142
30174
|
deleteRow: () => applyTableContextCommand(
|
|
30143
30175
|
(current) => tableOps.deleteSelectedTableRow(current),
|
|
30144
|
-
|
|
30176
|
+
MERGE_KEYS.deleteTableRow
|
|
30145
30177
|
)
|
|
30146
30178
|
};
|
|
30147
30179
|
}
|
|
@@ -33086,7 +33118,7 @@ function serializeTableXml(table, serializeParagraphXml2) {
|
|
|
33086
33118
|
{
|
|
33087
33119
|
id: "",
|
|
33088
33120
|
type: "paragraph",
|
|
33089
|
-
runs: [{ id: "", text: "" }]
|
|
33121
|
+
runs: [{ id: "", text: "", kind: "text" }]
|
|
33090
33122
|
}
|
|
33091
33123
|
];
|
|
33092
33124
|
const paragraphsXml = paragraphs.map((paragraph) => serializeParagraphXml2(paragraph, cell)).join("");
|
|
@@ -33817,7 +33849,7 @@ function serializeFootnoteRefMarker() {
|
|
|
33817
33849
|
return serializeNoteRefMarker("footnote");
|
|
33818
33850
|
}
|
|
33819
33851
|
function serializeFootnoteReference(run, materializedRunStyle, context) {
|
|
33820
|
-
const ref = run
|
|
33852
|
+
const ref = getRunFootnoteReference(run);
|
|
33821
33853
|
return serializeNoteReference(
|
|
33822
33854
|
"footnote",
|
|
33823
33855
|
ref ? { noteId: ref.footnoteId, customMark: ref.customMark } : void 0,
|
|
@@ -33829,7 +33861,7 @@ function serializeEndnoteRefMarker() {
|
|
|
33829
33861
|
return serializeNoteRefMarker("endnote");
|
|
33830
33862
|
}
|
|
33831
33863
|
function serializeEndnoteReference(run, materializedRunStyle, context) {
|
|
33832
|
-
const ref = run
|
|
33864
|
+
const ref = getRunEndnoteReference(run);
|
|
33833
33865
|
return serializeNoteReference(
|
|
33834
33866
|
"endnote",
|
|
33835
33867
|
ref ? { noteId: ref.endnoteId, customMark: ref.customMark } : void 0,
|
|
@@ -33914,7 +33946,7 @@ function stripRpr(rPr) {
|
|
|
33914
33946
|
return rPr.replace(/^<w:rPr>/, "").replace(/<\/w:rPr>$/, "");
|
|
33915
33947
|
}
|
|
33916
33948
|
function isSplittableTextRun(run) {
|
|
33917
|
-
return
|
|
33949
|
+
return run.kind === "text" || run.kind === "sym";
|
|
33918
33950
|
}
|
|
33919
33951
|
function serializeRunsWithBoundaries(runs, tokens, context, paragraphStyleId, styles) {
|
|
33920
33952
|
const sorted = [...tokens].sort(
|
|
@@ -34001,7 +34033,7 @@ function serializeBlocksXml(blocks, context, styles) {
|
|
|
34001
34033
|
}
|
|
34002
34034
|
function serializeParagraphXml(paragraph, context, styles, overrides) {
|
|
34003
34035
|
var _a, _b, _c;
|
|
34004
|
-
const runs = paragraph.runs.length > 0 ? paragraph.runs : [{ id: "", text: "" }];
|
|
34036
|
+
const runs = paragraph.runs.length > 0 ? paragraph.runs : [{ id: "", text: "", kind: "text" }];
|
|
34005
34037
|
const dropCapFrame = paragraph.dropCap ? serializeDropCapFrameParagraph(paragraph.dropCap) : "";
|
|
34006
34038
|
const bookmarkEvents = (_a = context.bookmarkEventsByParagraph) == null ? void 0 : _a.get(paragraph.id);
|
|
34007
34039
|
const commentEvents = (_b = context.commentEventsByParagraph) == null ? void 0 : _b.get(paragraph.id);
|
|
@@ -34050,7 +34082,7 @@ function collectReferencedFootnotesForExport(document2) {
|
|
|
34050
34082
|
const seen = /* @__PURE__ */ new Map();
|
|
34051
34083
|
let nextDocxId = FIRST_FOOTNOTE_DOCX_ID;
|
|
34052
34084
|
for (const { run } of iterateFootnoteReferenceRuns(document2)) {
|
|
34053
|
-
const ref = run
|
|
34085
|
+
const ref = getRunFootnoteReference(run);
|
|
34054
34086
|
if (!ref) continue;
|
|
34055
34087
|
if (seen.has(ref.footnoteId)) continue;
|
|
34056
34088
|
const footnote = items[ref.footnoteId];
|
|
@@ -34087,7 +34119,7 @@ function createEmptyFootnoteBodyParagraph(withMarker = true) {
|
|
|
34087
34119
|
type: "paragraph",
|
|
34088
34120
|
runs: [
|
|
34089
34121
|
...withMarker ? [makeFootnoteRefMarkerRun()] : [],
|
|
34090
|
-
{ id: "synthetic:footnote-body-empty-text", text: "" }
|
|
34122
|
+
{ id: "synthetic:footnote-body-empty-text", text: "", kind: "text" }
|
|
34091
34123
|
],
|
|
34092
34124
|
style: { styleId: "FootnoteText" }
|
|
34093
34125
|
};
|
|
@@ -34104,6 +34136,7 @@ function makeFootnoteRefMarkerRun() {
|
|
|
34104
34136
|
return {
|
|
34105
34137
|
id: "synthetic:footnoteRef",
|
|
34106
34138
|
text: "",
|
|
34139
|
+
kind: "text",
|
|
34107
34140
|
styles: { styleId: "FootnoteReference", superscript: true },
|
|
34108
34141
|
// Tag the run so the special serializer below can intercept it.
|
|
34109
34142
|
__isFootnoteRefMarker: true
|
|
@@ -34145,7 +34178,7 @@ function collectReferencedEndnotesForExport(document2) {
|
|
|
34145
34178
|
const seen = /* @__PURE__ */ new Map();
|
|
34146
34179
|
let nextDocxId = FIRST_ENDNOTE_DOCX_ID;
|
|
34147
34180
|
for (const { run } of iterateEndnoteReferenceRuns(document2)) {
|
|
34148
|
-
const ref = run
|
|
34181
|
+
const ref = getRunEndnoteReference(run);
|
|
34149
34182
|
if (!ref) continue;
|
|
34150
34183
|
if (seen.has(ref.endnoteId)) continue;
|
|
34151
34184
|
const endnote = items[ref.endnoteId];
|
|
@@ -34182,7 +34215,7 @@ function createEmptyEndnoteBodyParagraph(withMarker = true) {
|
|
|
34182
34215
|
type: "paragraph",
|
|
34183
34216
|
runs: [
|
|
34184
34217
|
...withMarker ? [makeEndnoteRefMarkerRun()] : [],
|
|
34185
|
-
{ id: "synthetic:endnote-body-empty-text", text: "" }
|
|
34218
|
+
{ id: "synthetic:endnote-body-empty-text", text: "", kind: "text" }
|
|
34186
34219
|
],
|
|
34187
34220
|
style: { styleId: "EndnoteText" }
|
|
34188
34221
|
};
|
|
@@ -34199,6 +34232,7 @@ function makeEndnoteRefMarkerRun() {
|
|
|
34199
34232
|
return {
|
|
34200
34233
|
id: "synthetic:endnoteRef",
|
|
34201
34234
|
text: "",
|
|
34235
|
+
kind: "text",
|
|
34202
34236
|
styles: { styleId: "EndnoteReference", superscript: true },
|
|
34203
34237
|
__isEndnoteRefMarker: true
|
|
34204
34238
|
};
|
|
@@ -34446,7 +34480,7 @@ function buildPartRelationshipsXml(images, hyperlinks) {
|
|
|
34446
34480
|
function visitParagraphDeep(paragraph, callback) {
|
|
34447
34481
|
callback(paragraph);
|
|
34448
34482
|
for (const run of paragraph.runs) {
|
|
34449
|
-
if (run.textBox) {
|
|
34483
|
+
if (run.kind === "textBox") {
|
|
34450
34484
|
visitBlocks(run.textBox.blocks, callback);
|
|
34451
34485
|
}
|
|
34452
34486
|
}
|
|
@@ -34621,14 +34655,20 @@ const IMAGE_CAPTION_STYLE_ID = "Caption";
|
|
|
34621
34655
|
const IMAGE_CAPTION_FIELD_IDENTIFIER = "Figure";
|
|
34622
34656
|
const IMAGE_CAPTION_FIELD_INSTRUCTION = " SEQ Figure \\* ARABIC ";
|
|
34623
34657
|
function createFieldCharRun(kind) {
|
|
34624
|
-
|
|
34625
|
-
|
|
34626
|
-
|
|
34658
|
+
return {
|
|
34659
|
+
id: createEditorRun("").id,
|
|
34660
|
+
text: "",
|
|
34661
|
+
kind: "fieldChar",
|
|
34662
|
+
fieldChar: { kind }
|
|
34663
|
+
};
|
|
34627
34664
|
}
|
|
34628
34665
|
function createFieldInstructionRun(instruction) {
|
|
34629
|
-
|
|
34630
|
-
|
|
34631
|
-
|
|
34666
|
+
return {
|
|
34667
|
+
id: createEditorRun("").id,
|
|
34668
|
+
text: "",
|
|
34669
|
+
kind: "fieldInstruction",
|
|
34670
|
+
fieldInstruction: instruction
|
|
34671
|
+
};
|
|
34632
34672
|
}
|
|
34633
34673
|
function createImageCaptionParagraph(captionText, label, sequenceNumber) {
|
|
34634
34674
|
const paragraph = createEditorParagraphFromRuns([
|
|
@@ -34657,11 +34697,12 @@ function isImageCaptionParagraph(paragraph) {
|
|
|
34657
34697
|
if (styleId !== "caption") {
|
|
34658
34698
|
return false;
|
|
34659
34699
|
}
|
|
34660
|
-
return paragraph.runs.some(
|
|
34661
|
-
|
|
34662
|
-
|
|
34663
|
-
|
|
34664
|
-
|
|
34700
|
+
return paragraph.runs.some((run) => {
|
|
34701
|
+
const instruction = getRunFieldInstruction(run);
|
|
34702
|
+
return instruction !== void 0 && new RegExp(`\\bSEQ\\s+${IMAGE_CAPTION_FIELD_IDENTIFIER}\\b`, "i").test(
|
|
34703
|
+
instruction
|
|
34704
|
+
);
|
|
34705
|
+
});
|
|
34665
34706
|
}
|
|
34666
34707
|
function getImageCaptionText(paragraph) {
|
|
34667
34708
|
var _a;
|
|
@@ -34675,7 +34716,7 @@ function getImageCaptionText(paragraph) {
|
|
|
34675
34716
|
value += run.text;
|
|
34676
34717
|
continue;
|
|
34677
34718
|
}
|
|
34678
|
-
if (((_a = run
|
|
34719
|
+
if (((_a = getRunFieldChar(run)) == null ? void 0 : _a.kind) === "end") {
|
|
34679
34720
|
afterField = true;
|
|
34680
34721
|
}
|
|
34681
34722
|
}
|
|
@@ -34699,12 +34740,11 @@ function renumberCaptionParagraph(paragraph, sequenceNumber) {
|
|
|
34699
34740
|
let insideSeqResult = false;
|
|
34700
34741
|
let changed = false;
|
|
34701
34742
|
const nextRuns = paragraph.runs.map((run) => {
|
|
34702
|
-
|
|
34703
|
-
if (((_a = run.fieldChar) == null ? void 0 : _a.kind) === "separate") {
|
|
34743
|
+
if (run.kind === "fieldChar" && run.fieldChar.kind === "separate") {
|
|
34704
34744
|
insideSeqResult = true;
|
|
34705
34745
|
return { ...run, fieldChar: { ...run.fieldChar } };
|
|
34706
34746
|
}
|
|
34707
|
-
if (
|
|
34747
|
+
if (run.kind === "fieldChar" && run.fieldChar.kind === "end") {
|
|
34708
34748
|
insideSeqResult = false;
|
|
34709
34749
|
return { ...run, fieldChar: { ...run.fieldChar } };
|
|
34710
34750
|
}
|
|
@@ -34791,11 +34831,11 @@ function buildPartContext(blocks, numberingContext, state, document2) {
|
|
|
34791
34831
|
hyperlinkMap.set(link, rId2);
|
|
34792
34832
|
hyperlinks.push({ rId: rId2, href: link });
|
|
34793
34833
|
}
|
|
34794
|
-
if (run.textBox && !textBoxDocPrIds.has(run.id)) {
|
|
34834
|
+
if (run.kind === "textBox" && !textBoxDocPrIds.has(run.id)) {
|
|
34795
34835
|
textBoxDocPrIds.set(run.id, state.nextTextBoxDocPrId);
|
|
34796
34836
|
state.nextTextBoxDocPrId += 1;
|
|
34797
34837
|
}
|
|
34798
|
-
if (
|
|
34838
|
+
if (run.kind !== "image") {
|
|
34799
34839
|
continue;
|
|
34800
34840
|
}
|
|
34801
34841
|
const imageNumber = state.nextImageId;
|
|
@@ -37743,7 +37783,7 @@ function isFloatingFixedPosition(floating) {
|
|
|
37743
37783
|
return ((_a = floating == null ? void 0 : floating.positionV) == null ? void 0 : _a.relativeFrom) === "page";
|
|
37744
37784
|
}
|
|
37745
37785
|
function getSelectedImageRun(state) {
|
|
37746
|
-
return getSelectedObjectRun(state, (run) =>
|
|
37786
|
+
return getSelectedObjectRun(state, (run) => run.kind === "image");
|
|
37747
37787
|
}
|
|
37748
37788
|
function insertImageAtSelection(state, image) {
|
|
37749
37789
|
const collapsedState = isSelectionCollapsed(state.selection) ? state : deleteSelectionRange(state);
|
|
@@ -37778,7 +37818,7 @@ function resizeSelectedImage(state, width, height) {
|
|
|
37778
37818
|
return {
|
|
37779
37819
|
...cloneParagraph(candidate),
|
|
37780
37820
|
runs: candidate.runs.map(
|
|
37781
|
-
(run) => run.id === targetRun.id && run.image ? {
|
|
37821
|
+
(run) => run.id === targetRun.id && run.kind === "image" ? {
|
|
37782
37822
|
...run,
|
|
37783
37823
|
image: {
|
|
37784
37824
|
...run.image,
|
|
@@ -37820,7 +37860,7 @@ function rotateSelectedImage(state, rotation) {
|
|
|
37820
37860
|
return {
|
|
37821
37861
|
...cloneParagraph(candidate),
|
|
37822
37862
|
runs: candidate.runs.map(
|
|
37823
|
-
(run) => run.id === targetRun.id && run.image ? {
|
|
37863
|
+
(run) => run.id === targetRun.id && run.kind === "image" ? {
|
|
37824
37864
|
...run,
|
|
37825
37865
|
image: {
|
|
37826
37866
|
...run.image,
|
|
@@ -37841,19 +37881,20 @@ function rotateSelectedImage(state, rotation) {
|
|
|
37841
37881
|
}
|
|
37842
37882
|
function getSelectedImageWrapPreset(state) {
|
|
37843
37883
|
const selectedImage = getSelectedImageRun(state);
|
|
37844
|
-
|
|
37884
|
+
const image = selectedImage && getRunImage(selectedImage.run);
|
|
37885
|
+
if (!image) {
|
|
37845
37886
|
return null;
|
|
37846
37887
|
}
|
|
37847
|
-
return floatingToWrapPreset(
|
|
37888
|
+
return floatingToWrapPreset(image.floating);
|
|
37848
37889
|
}
|
|
37849
37890
|
function isSelectedImageFixedPosition(state) {
|
|
37850
|
-
var _a;
|
|
37851
37891
|
const selectedImage = getSelectedImageRun(state);
|
|
37852
|
-
|
|
37892
|
+
const image = selectedImage && getRunImage(selectedImage.run);
|
|
37893
|
+
return isFloatingFixedPosition(image == null ? void 0 : image.floating);
|
|
37853
37894
|
}
|
|
37854
37895
|
function patchSelectedImageFloating(state, next) {
|
|
37855
37896
|
const selectedImage = getSelectedImageRun(state);
|
|
37856
|
-
if (!
|
|
37897
|
+
if (!selectedImage || !getRunImage(selectedImage.run)) {
|
|
37857
37898
|
return state;
|
|
37858
37899
|
}
|
|
37859
37900
|
const paragraphs = getParagraphs(state);
|
|
@@ -37865,7 +37906,7 @@ function patchSelectedImageFloating(state, next) {
|
|
|
37865
37906
|
return {
|
|
37866
37907
|
...cloneParagraph(candidate),
|
|
37867
37908
|
runs: candidate.runs.map((run) => {
|
|
37868
|
-
if (run.id !== targetRun.id ||
|
|
37909
|
+
if (run.id !== targetRun.id || run.kind !== "image") {
|
|
37869
37910
|
return cloneRun(run);
|
|
37870
37911
|
}
|
|
37871
37912
|
const floating = next(run.image.floating);
|
|
@@ -37904,13 +37945,13 @@ function setImageWrapPolygon(state, runId, polygon) {
|
|
|
37904
37945
|
const paragraphs = getParagraphs(state);
|
|
37905
37946
|
let matched = false;
|
|
37906
37947
|
const nextParagraphs = paragraphs.map((candidate) => {
|
|
37907
|
-
if (!candidate.runs.some((run) => run.id === runId && run.image)) {
|
|
37948
|
+
if (!candidate.runs.some((run) => run.id === runId && run.kind === "image")) {
|
|
37908
37949
|
return cloneParagraph(candidate);
|
|
37909
37950
|
}
|
|
37910
37951
|
return {
|
|
37911
37952
|
...cloneParagraph(candidate),
|
|
37912
37953
|
runs: candidate.runs.map((run) => {
|
|
37913
|
-
if (run.id !== runId ||
|
|
37954
|
+
if (run.id !== runId || run.kind !== "image") {
|
|
37914
37955
|
return cloneRun(run);
|
|
37915
37956
|
}
|
|
37916
37957
|
matched = true;
|
|
@@ -37938,7 +37979,7 @@ function setImageWrapPolygon(state, runId, polygon) {
|
|
|
37938
37979
|
}
|
|
37939
37980
|
function setSelectedImageAlt(state, alt) {
|
|
37940
37981
|
const selectedImage = getSelectedImageRun(state);
|
|
37941
|
-
if (!
|
|
37982
|
+
if (!selectedImage || !getRunImage(selectedImage.run)) {
|
|
37942
37983
|
return state;
|
|
37943
37984
|
}
|
|
37944
37985
|
const paragraphs = getParagraphs(state);
|
|
@@ -37949,7 +37990,7 @@ function setSelectedImageAlt(state, alt) {
|
|
|
37949
37990
|
return {
|
|
37950
37991
|
...cloneParagraph(candidate),
|
|
37951
37992
|
runs: candidate.runs.map(
|
|
37952
|
-
(run) => run.id === selectedImage.run.id && run.image ? {
|
|
37993
|
+
(run) => run.id === selectedImage.run.id && run.kind === "image" ? {
|
|
37953
37994
|
...run,
|
|
37954
37995
|
image: {
|
|
37955
37996
|
...run.image,
|
|
@@ -37970,7 +38011,7 @@ function setSelectedImageAlt(state, alt) {
|
|
|
37970
38011
|
}
|
|
37971
38012
|
function getSelectedImageCaption(state) {
|
|
37972
38013
|
const selectedImage = getSelectedImageRun(state);
|
|
37973
|
-
if (!
|
|
38014
|
+
if (!selectedImage || !getRunImage(selectedImage.run)) {
|
|
37974
38015
|
return null;
|
|
37975
38016
|
}
|
|
37976
38017
|
const paragraphs = getParagraphs(state);
|
|
@@ -37978,7 +38019,7 @@ function getSelectedImageCaption(state) {
|
|
|
37978
38019
|
}
|
|
37979
38020
|
function setSelectedImageCaption(state, captionText, label) {
|
|
37980
38021
|
const selectedImage = getSelectedImageRun(state);
|
|
37981
|
-
if (!
|
|
38022
|
+
if (!selectedImage || !getRunImage(selectedImage.run)) {
|
|
37982
38023
|
return state;
|
|
37983
38024
|
}
|
|
37984
38025
|
const paragraphs = getParagraphs(state);
|
|
@@ -38048,7 +38089,7 @@ function moveSelectedImageToPosition(state, targetPosition) {
|
|
|
38048
38089
|
createEditorStyledRun(
|
|
38049
38090
|
"",
|
|
38050
38091
|
getStyleAtOffset(paragraph, offset),
|
|
38051
|
-
imageRun
|
|
38092
|
+
getRunImage(imageRun)
|
|
38052
38093
|
)
|
|
38053
38094
|
]
|
|
38054
38095
|
);
|
|
@@ -38135,7 +38176,7 @@ function createImageInsertionService(deps) {
|
|
|
38135
38176
|
const targetState = position ? setSelection(current, { anchor: position, focus: position }) : current;
|
|
38136
38177
|
return insertImageAtSelection(targetState, { src, width, height });
|
|
38137
38178
|
},
|
|
38138
|
-
{ mergeKey:
|
|
38179
|
+
{ mergeKey: MERGE_KEYS.insertImage }
|
|
38139
38180
|
);
|
|
38140
38181
|
};
|
|
38141
38182
|
return {
|
|
@@ -38940,7 +38981,7 @@ function createEditorHistoryActions(deps) {
|
|
|
38940
38981
|
deps.applyTransactionalState(
|
|
38941
38982
|
() => moveSelectedImageToPosition(nextState, targetPosition),
|
|
38942
38983
|
{
|
|
38943
|
-
mergeKey:
|
|
38984
|
+
mergeKey: MERGE_KEYS.moveImage
|
|
38944
38985
|
}
|
|
38945
38986
|
);
|
|
38946
38987
|
deps.focusInput();
|
|
@@ -38953,7 +38994,7 @@ function createEditorHistoryActions(deps) {
|
|
|
38953
38994
|
current,
|
|
38954
38995
|
paragraphOffsetToPosition(targetParagraph, targetOffset)
|
|
38955
38996
|
),
|
|
38956
|
-
{ mergeKey:
|
|
38997
|
+
{ mergeKey: MERGE_KEYS.moveImage }
|
|
38957
38998
|
);
|
|
38958
38999
|
deps.focusInput();
|
|
38959
39000
|
return true;
|
|
@@ -39105,7 +39146,7 @@ function createIndexedDbPersistence(options = {}) {
|
|
|
39105
39146
|
};
|
|
39106
39147
|
}
|
|
39107
39148
|
function computeLayoutInvalidationFromTransaction(prev, next) {
|
|
39108
|
-
var _a, _b, _c, _d, _e, _f
|
|
39149
|
+
var _a, _b, _c, _d, _e, _f;
|
|
39109
39150
|
if (prev === next || prev.document === next.document) {
|
|
39110
39151
|
return {};
|
|
39111
39152
|
}
|
|
@@ -39147,7 +39188,9 @@ function computeLayoutInvalidationFromTransaction(prev, next) {
|
|
|
39147
39188
|
changed = true;
|
|
39148
39189
|
break;
|
|
39149
39190
|
}
|
|
39150
|
-
|
|
39191
|
+
const aImage = getRunImage(a);
|
|
39192
|
+
const bImage = getRunImage(b);
|
|
39193
|
+
if (Boolean(aImage) !== Boolean(bImage) || ((aImage == null ? void 0 : aImage.width) ?? -1) !== ((bImage == null ? void 0 : bImage.width) ?? -1) || ((aImage == null ? void 0 : aImage.height) ?? -1) !== ((bImage == null ? void 0 : bImage.height) ?? -1) || (((_a = aImage == null ? void 0 : aImage.floating) == null ? void 0 : _a.wrap) ?? "") !== (((_b = bImage == null ? void 0 : bImage.floating) == null ? void 0 : _b.wrap) ?? "") || Boolean((_c = aImage == null ? void 0 : aImage.floating) == null ? void 0 : _c.behindDoc) !== Boolean((_d = bImage == null ? void 0 : bImage.floating) == null ? void 0 : _d.behindDoc) || (((_e = aImage == null ? void 0 : aImage.wrapPolygon) == null ? void 0 : _e.length) ?? -1) !== (((_f = bImage == null ? void 0 : bImage.wrapPolygon) == null ? void 0 : _f.length) ?? -1)) {
|
|
39151
39194
|
changed = true;
|
|
39152
39195
|
break;
|
|
39153
39196
|
}
|
|
@@ -39381,7 +39424,7 @@ function createEditorDocumentRuntime(deps) {
|
|
|
39381
39424
|
}
|
|
39382
39425
|
const MIN_TEXT_BOX_SIZE_PX = 24;
|
|
39383
39426
|
function getSelectedTextBoxRun(state) {
|
|
39384
|
-
return getSelectedObjectRun(state, (run) =>
|
|
39427
|
+
return getSelectedObjectRun(state, (run) => run.kind === "textBox");
|
|
39385
39428
|
}
|
|
39386
39429
|
function shiftFloatingForResize(floating, widthDelta, heightDelta, growsFromWest, growsFromNorth) {
|
|
39387
39430
|
let next = floating;
|
|
@@ -39420,7 +39463,7 @@ function normalizeRotation(rotation) {
|
|
|
39420
39463
|
}
|
|
39421
39464
|
function rotateSelectedTextBox(state, rotation) {
|
|
39422
39465
|
const selected = getSelectedTextBoxRun(state);
|
|
39423
|
-
if (!selected || !selected.run
|
|
39466
|
+
if (!selected || !getRunTextBox(selected.run)) {
|
|
39424
39467
|
return state;
|
|
39425
39468
|
}
|
|
39426
39469
|
const nextRotation = normalizeRotation(rotation);
|
|
@@ -39433,7 +39476,7 @@ function rotateSelectedTextBox(state, rotation) {
|
|
|
39433
39476
|
return {
|
|
39434
39477
|
...cloneParagraph(candidate),
|
|
39435
39478
|
runs: candidate.runs.map(
|
|
39436
|
-
(run) => run.id === targetRun.id && run.textBox ? {
|
|
39479
|
+
(run) => run.id === targetRun.id && run.kind === "textBox" ? {
|
|
39437
39480
|
...run,
|
|
39438
39481
|
textBox: { ...run.textBox, rotation: nextRotation }
|
|
39439
39482
|
} : cloneRun(run)
|
|
@@ -39451,19 +39494,20 @@ function rotateSelectedTextBox(state, rotation) {
|
|
|
39451
39494
|
}
|
|
39452
39495
|
function getSelectedTextBoxWrapPreset(state) {
|
|
39453
39496
|
const selected = getSelectedTextBoxRun(state);
|
|
39454
|
-
|
|
39497
|
+
const textBox = selected && getRunTextBox(selected.run);
|
|
39498
|
+
if (!textBox) {
|
|
39455
39499
|
return null;
|
|
39456
39500
|
}
|
|
39457
|
-
return floatingToWrapPreset(
|
|
39501
|
+
return floatingToWrapPreset(textBox.floating);
|
|
39458
39502
|
}
|
|
39459
39503
|
function isSelectedTextBoxFixedPosition(state) {
|
|
39460
|
-
var _a;
|
|
39461
39504
|
const selected = getSelectedTextBoxRun(state);
|
|
39462
|
-
|
|
39505
|
+
const textBox = selected && getRunTextBox(selected.run);
|
|
39506
|
+
return isFloatingFixedPosition(textBox == null ? void 0 : textBox.floating);
|
|
39463
39507
|
}
|
|
39464
39508
|
function patchSelectedTextBoxFloating(state, next) {
|
|
39465
39509
|
const selected = getSelectedTextBoxRun(state);
|
|
39466
|
-
if (!
|
|
39510
|
+
if (!selected || !getRunTextBox(selected.run)) {
|
|
39467
39511
|
return state;
|
|
39468
39512
|
}
|
|
39469
39513
|
const { paragraphIndex, run: targetRun } = selected;
|
|
@@ -39475,7 +39519,7 @@ function patchSelectedTextBoxFloating(state, next) {
|
|
|
39475
39519
|
return {
|
|
39476
39520
|
...cloneParagraph(candidate),
|
|
39477
39521
|
runs: candidate.runs.map((run) => {
|
|
39478
|
-
if (run.id !== targetRun.id ||
|
|
39522
|
+
if (run.id !== targetRun.id || run.kind !== "textBox") {
|
|
39479
39523
|
return cloneRun(run);
|
|
39480
39524
|
}
|
|
39481
39525
|
const floating = next(run.textBox.floating);
|
|
@@ -39512,7 +39556,8 @@ function setSelectedTextBoxFixedPosition(state, fixed) {
|
|
|
39512
39556
|
}
|
|
39513
39557
|
function resizeSelectedTextBox(state, width, height, options = {}) {
|
|
39514
39558
|
const selected = getSelectedTextBoxRun(state);
|
|
39515
|
-
|
|
39559
|
+
const selectedTextBox = selected && getRunTextBox(selected.run);
|
|
39560
|
+
if (!selected || !selectedTextBox) {
|
|
39516
39561
|
return state;
|
|
39517
39562
|
}
|
|
39518
39563
|
const direction = options.handleDirection ?? "se";
|
|
@@ -39522,8 +39567,8 @@ function resizeSelectedTextBox(state, width, height, options = {}) {
|
|
|
39522
39567
|
const nextWidth = Math.max(MIN_TEXT_BOX_SIZE_PX, Math.round(width));
|
|
39523
39568
|
const nextHeight = Math.max(MIN_TEXT_BOX_SIZE_PX, Math.round(height));
|
|
39524
39569
|
const { paragraphIndex, run: targetRun } = selected;
|
|
39525
|
-
const widthDelta = nextWidth -
|
|
39526
|
-
const heightDelta = nextHeight -
|
|
39570
|
+
const widthDelta = nextWidth - selectedTextBox.width;
|
|
39571
|
+
const heightDelta = nextHeight - selectedTextBox.height;
|
|
39527
39572
|
const paragraphs = getParagraphs(state);
|
|
39528
39573
|
const nextParagraphs = paragraphs.map((candidate, candidateIndex) => {
|
|
39529
39574
|
if (candidateIndex !== paragraphIndex) {
|
|
@@ -39533,7 +39578,7 @@ function resizeSelectedTextBox(state, width, height, options = {}) {
|
|
|
39533
39578
|
...cloneParagraph(candidate),
|
|
39534
39579
|
runs: candidate.runs.map((run) => {
|
|
39535
39580
|
var _a;
|
|
39536
|
-
if (run.id !== targetRun.id ||
|
|
39581
|
+
if (run.id !== targetRun.id || run.kind !== "textBox") {
|
|
39537
39582
|
return cloneRun(run);
|
|
39538
39583
|
}
|
|
39539
39584
|
const textBox = run.textBox;
|
|
@@ -40806,7 +40851,7 @@ function createEditorTableOperations(deps) {
|
|
|
40806
40851
|
deps.applyTransactionalState(
|
|
40807
40852
|
(current) => insertTableAtSelection(current, rows, cols),
|
|
40808
40853
|
{
|
|
40809
|
-
mergeKey:
|
|
40854
|
+
mergeKey: MERGE_KEYS.insertTable
|
|
40810
40855
|
}
|
|
40811
40856
|
);
|
|
40812
40857
|
deps.focusInput();
|
|
@@ -41054,7 +41099,7 @@ function createEditorImageOperations(deps) {
|
|
|
41054
41099
|
for (const run of paragraph.runs) {
|
|
41055
41100
|
const startOffset = offset;
|
|
41056
41101
|
offset += run.text.length;
|
|
41057
|
-
if (run.image && run.text.length === 1 && startOffset === normalized.startParagraphOffset) {
|
|
41102
|
+
if (run.kind === "image" && run.text.length === 1 && startOffset === normalized.startParagraphOffset) {
|
|
41058
41103
|
return {
|
|
41059
41104
|
paragraph,
|
|
41060
41105
|
run,
|
|
@@ -41188,7 +41233,7 @@ function createEditorImageOperations(deps) {
|
|
|
41188
41233
|
);
|
|
41189
41234
|
deps.applyTransactionalState(
|
|
41190
41235
|
(current) => moveSelectedImageToPosition(current, position),
|
|
41191
|
-
{ mergeKey:
|
|
41236
|
+
{ mergeKey: MERGE_KEYS.moveImage }
|
|
41192
41237
|
);
|
|
41193
41238
|
} else {
|
|
41194
41239
|
deps.logger.warn(
|
|
@@ -41281,15 +41326,16 @@ function createEditorImageOperations(deps) {
|
|
|
41281
41326
|
function createEditorTextBoxOperations(deps) {
|
|
41282
41327
|
const getSelectedTextBoxSize = (current) => {
|
|
41283
41328
|
const selected = getSelectedTextBoxRun(current);
|
|
41284
|
-
|
|
41329
|
+
const textBox = selected && getRunTextBox(selected.run);
|
|
41330
|
+
if (!textBox) {
|
|
41285
41331
|
return null;
|
|
41286
41332
|
}
|
|
41287
41333
|
return {
|
|
41288
|
-
width:
|
|
41334
|
+
width: textBox.width,
|
|
41289
41335
|
// Start the drag from the height actually painted on screen. For an
|
|
41290
41336
|
// auto-fit box that is its content height, not the stored height, so the
|
|
41291
41337
|
// box doesn't jump on the first pointer move.
|
|
41292
|
-
height: resolveTextBoxRenderHeight(
|
|
41338
|
+
height: resolveTextBoxRenderHeight(textBox, current, 0)
|
|
41293
41339
|
};
|
|
41294
41340
|
};
|
|
41295
41341
|
const resizeSession = createResizeSession(
|
|
@@ -41540,7 +41586,7 @@ function useEditorFindReplace(deps) {
|
|
|
41540
41586
|
});
|
|
41541
41587
|
return insertTextAtSelection(stateWithSelection, replaceTerm());
|
|
41542
41588
|
},
|
|
41543
|
-
{ mergeKey:
|
|
41589
|
+
{ mergeKey: MERGE_KEYS.findReplace }
|
|
41544
41590
|
);
|
|
41545
41591
|
};
|
|
41546
41592
|
const replaceAll = () => {
|
|
@@ -41559,7 +41605,7 @@ function useEditorFindReplace(deps) {
|
|
|
41559
41605
|
}
|
|
41560
41606
|
return workingState;
|
|
41561
41607
|
},
|
|
41562
|
-
{ mergeKey:
|
|
41608
|
+
{ mergeKey: MERGE_KEYS.findReplaceAll }
|
|
41563
41609
|
);
|
|
41564
41610
|
setIsOpen(false);
|
|
41565
41611
|
deps.focusInput();
|
|
@@ -42183,7 +42229,7 @@ function createEditorLayoutOptionsController(deps) {
|
|
|
42183
42229
|
const polygon = traceImageAlphaContour(img2);
|
|
42184
42230
|
applyTransactionalState(
|
|
42185
42231
|
(current) => setImageWrapPolygon(current, runId, polygon),
|
|
42186
|
-
{ mergeKey:
|
|
42232
|
+
{ mergeKey: MERGE_KEYS.layoutWrapPolygon }
|
|
42187
42233
|
);
|
|
42188
42234
|
};
|
|
42189
42235
|
const img = getCachedCanvasImage(resolved, () => {
|
|
@@ -42209,19 +42255,19 @@ function createEditorLayoutOptionsController(deps) {
|
|
|
42209
42255
|
},
|
|
42210
42256
|
setPreset: (preset) => {
|
|
42211
42257
|
applyLayoutOptionPatch(
|
|
42212
|
-
|
|
42258
|
+
MERGE_KEYS.layoutWrapPreset,
|
|
42213
42259
|
(current, target) => target === "image" ? setSelectedImageWrapPreset(current, preset) : setSelectedTextBoxWrapPreset(current, preset)
|
|
42214
42260
|
);
|
|
42215
42261
|
if (preset === "tight" || preset === "through") {
|
|
42216
42262
|
const selected = getSelectedImageRun(state());
|
|
42217
|
-
const image = selected
|
|
42263
|
+
const image = selected && getRunImage(selected.run);
|
|
42218
42264
|
if (image && !image.wrapPolygon) {
|
|
42219
42265
|
ensureImageWrapContour(selected.run.id, image.src);
|
|
42220
42266
|
}
|
|
42221
42267
|
}
|
|
42222
42268
|
},
|
|
42223
42269
|
setFixedPosition: (fixed) => applyLayoutOptionPatch(
|
|
42224
|
-
|
|
42270
|
+
MERGE_KEYS.layoutFixedPosition,
|
|
42225
42271
|
(current, target) => target === "image" ? setSelectedImageFixedPosition(current, fixed) : setSelectedTextBoxFixedPosition(current, fixed)
|
|
42226
42272
|
)
|
|
42227
42273
|
};
|
|
@@ -43626,7 +43672,7 @@ function createEditorTextInput(deps) {
|
|
|
43626
43672
|
(temp) => insertTextAtSelection(temp, text, pendingStyle)
|
|
43627
43673
|
),
|
|
43628
43674
|
{
|
|
43629
|
-
mergeKey:
|
|
43675
|
+
mergeKey: MERGE_KEYS.insertText
|
|
43630
43676
|
}
|
|
43631
43677
|
);
|
|
43632
43678
|
event.currentTarget.value = "";
|
|
@@ -43663,7 +43709,7 @@ function createEditorTextInput(deps) {
|
|
|
43663
43709
|
(temp) => insertTextAtSelection(temp, text, pendingStyle)
|
|
43664
43710
|
),
|
|
43665
43711
|
{
|
|
43666
|
-
mergeKey:
|
|
43712
|
+
mergeKey: MERGE_KEYS.insertText
|
|
43667
43713
|
}
|
|
43668
43714
|
);
|
|
43669
43715
|
event.currentTarget.value = "";
|
|
@@ -43815,7 +43861,7 @@ function createEditorTextDrag(deps) {
|
|
|
43815
43861
|
current,
|
|
43816
43862
|
(temp) => moveOrCopySelectionToPosition(temp, destination, { copy })
|
|
43817
43863
|
),
|
|
43818
|
-
{ mergeKey: copy ?
|
|
43864
|
+
{ mergeKey: copy ? MERGE_KEYS.copyTextByDrag : MERGE_KEYS.moveTextByDrag }
|
|
43819
43865
|
);
|
|
43820
43866
|
(_b = deps.logger) == null ? void 0 : _b.info("text-drag:apply", {
|
|
43821
43867
|
mode: copy ? "copy" : "move",
|
|
@@ -43833,7 +43879,7 @@ function createEditorTextDrag(deps) {
|
|
|
43833
43879
|
focus: startPosition
|
|
43834
43880
|
});
|
|
43835
43881
|
},
|
|
43836
|
-
{ mergeKey:
|
|
43882
|
+
{ mergeKey: MERGE_KEYS.collapseSelectionByClick }
|
|
43837
43883
|
);
|
|
43838
43884
|
(_c = deps.logger) == null ? void 0 : _c.info("text-drag:collapse", {
|
|
43839
43885
|
at: `${startPosition.paragraphId}:${startPosition.runId}[${startPosition.offset}]`
|
|
@@ -44411,7 +44457,7 @@ function nextAutoMarker(document2) {
|
|
|
44411
44457
|
let autoCount = startAt - 1;
|
|
44412
44458
|
const seen = /* @__PURE__ */ new Set();
|
|
44413
44459
|
for (const { run } of iterateFootnoteReferenceRuns(document2)) {
|
|
44414
|
-
const ref = run
|
|
44460
|
+
const ref = getRunFootnoteReference(run);
|
|
44415
44461
|
if (!ref || ref.customMark) continue;
|
|
44416
44462
|
if (seen.has(ref.footnoteId)) continue;
|
|
44417
44463
|
seen.add(ref.footnoteId);
|
|
@@ -44602,7 +44648,7 @@ function getLinkAtSelection(state) {
|
|
|
44602
44648
|
const startOffset = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
|
|
44603
44649
|
const endOffset = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
|
|
44604
44650
|
return sliceRuns(paragraph, startOffset, endOffset);
|
|
44605
|
-
}).filter((run) => run.text.length > 0 &&
|
|
44651
|
+
}).filter((run) => run.text.length > 0 && run.kind !== "image");
|
|
44606
44652
|
if (touchedRuns.length === 0) {
|
|
44607
44653
|
return null;
|
|
44608
44654
|
}
|
|
@@ -44891,7 +44937,7 @@ function createEditorCommandsController(deps) {
|
|
|
44891
44937
|
current,
|
|
44892
44938
|
(temp) => splitListItemAtSelection(temp)
|
|
44893
44939
|
),
|
|
44894
|
-
{ mergeKey:
|
|
44940
|
+
{ mergeKey: MERGE_KEYS.splitListItem }
|
|
44895
44941
|
);
|
|
44896
44942
|
}
|
|
44897
44943
|
focusInput();
|
|
@@ -45097,7 +45143,7 @@ function createEditorCommandsController(deps) {
|
|
|
45097
45143
|
clearPreferredColumn();
|
|
45098
45144
|
resetTransactionGrouping();
|
|
45099
45145
|
applyTransactionalState((current) => setLinkAtSelection(current, href), {
|
|
45100
|
-
mergeKey:
|
|
45146
|
+
mergeKey: MERGE_KEYS.link
|
|
45101
45147
|
});
|
|
45102
45148
|
focusInput();
|
|
45103
45149
|
};
|
|
@@ -45119,7 +45165,7 @@ function createEditorCommandsController(deps) {
|
|
|
45119
45165
|
clearPreferredColumn();
|
|
45120
45166
|
resetTransactionGrouping();
|
|
45121
45167
|
applyTransactionalState((current) => setSelectedImageAlt(current, alt), {
|
|
45122
|
-
mergeKey:
|
|
45168
|
+
mergeKey: MERGE_KEYS.imageAlt
|
|
45123
45169
|
});
|
|
45124
45170
|
focusInput();
|
|
45125
45171
|
};
|
|
@@ -45129,7 +45175,7 @@ function createEditorCommandsController(deps) {
|
|
|
45129
45175
|
if (!run) {
|
|
45130
45176
|
return;
|
|
45131
45177
|
}
|
|
45132
|
-
const currentAlt = ((_a = run.run
|
|
45178
|
+
const currentAlt = ((_a = getRunImage(run.run)) == null ? void 0 : _a.alt) ?? "";
|
|
45133
45179
|
deps.openImageAltDialog(currentAlt);
|
|
45134
45180
|
};
|
|
45135
45181
|
const applyImageCaptionCommand = (caption) => {
|
|
@@ -45141,7 +45187,7 @@ function createEditorCommandsController(deps) {
|
|
|
45141
45187
|
resetTransactionGrouping();
|
|
45142
45188
|
applyTransactionalState(
|
|
45143
45189
|
(current) => setSelectedImageCaption(current, caption, deps.imageCaptionLabel()),
|
|
45144
|
-
{ mergeKey:
|
|
45190
|
+
{ mergeKey: MERGE_KEYS.imageCaption }
|
|
45145
45191
|
);
|
|
45146
45192
|
focusInput();
|
|
45147
45193
|
};
|
|
@@ -45929,8 +45975,19 @@ function collectTocHeadings(state, maxLevel = DEFAULT_TOC_MAX_LEVEL) {
|
|
|
45929
45975
|
return headings;
|
|
45930
45976
|
}
|
|
45931
45977
|
function makeRun(partial) {
|
|
45932
|
-
const
|
|
45933
|
-
|
|
45978
|
+
const id = createEditorRun(partial.text).id;
|
|
45979
|
+
if (partial.fieldChar) {
|
|
45980
|
+
return { id, text: partial.text, kind: "fieldChar", fieldChar: partial.fieldChar };
|
|
45981
|
+
}
|
|
45982
|
+
if (partial.fieldInstruction !== void 0) {
|
|
45983
|
+
return {
|
|
45984
|
+
id,
|
|
45985
|
+
text: partial.text,
|
|
45986
|
+
kind: "fieldInstruction",
|
|
45987
|
+
fieldInstruction: partial.fieldInstruction
|
|
45988
|
+
};
|
|
45989
|
+
}
|
|
45990
|
+
return { id, text: partial.text, kind: "text" };
|
|
45934
45991
|
}
|
|
45935
45992
|
function makeParagraph(runs, style2) {
|
|
45936
45993
|
const paragraph = createEditorParagraph("");
|
|
@@ -46009,7 +46066,6 @@ function insertTableOfContents(state, resolvePage = () => void 0, maxLevel = DEF
|
|
|
46009
46066
|
return replaceSectionBlocks(state, sectionIndex, nextBlocks, tocBlocks[0]);
|
|
46010
46067
|
}
|
|
46011
46068
|
function findTocRegion(blocks) {
|
|
46012
|
-
var _a, _b, _c;
|
|
46013
46069
|
let depth = 0;
|
|
46014
46070
|
let instruction = "";
|
|
46015
46071
|
let separateBlockIndex = -1;
|
|
@@ -46019,7 +46075,9 @@ function findTocRegion(blocks) {
|
|
|
46019
46075
|
const block = blocks[i];
|
|
46020
46076
|
if (block.type !== "paragraph") continue;
|
|
46021
46077
|
for (const run of block.runs) {
|
|
46022
|
-
|
|
46078
|
+
const fieldChar = getRunFieldChar(run);
|
|
46079
|
+
const fieldInstruction = getRunFieldInstruction(run);
|
|
46080
|
+
if ((fieldChar == null ? void 0 : fieldChar.kind) === "begin") {
|
|
46023
46081
|
depth += 1;
|
|
46024
46082
|
if (depth === 1) {
|
|
46025
46083
|
beginBlockIndex = i;
|
|
@@ -46027,12 +46085,12 @@ function findTocRegion(blocks) {
|
|
|
46027
46085
|
isToc = false;
|
|
46028
46086
|
separateBlockIndex = -1;
|
|
46029
46087
|
}
|
|
46030
|
-
} else if (depth === 1 &&
|
|
46031
|
-
instruction +=
|
|
46088
|
+
} else if (depth === 1 && fieldInstruction !== void 0) {
|
|
46089
|
+
instruction += fieldInstruction;
|
|
46032
46090
|
if (/\bTOC\b/i.test(instruction)) isToc = true;
|
|
46033
|
-
} else if ((
|
|
46091
|
+
} else if ((fieldChar == null ? void 0 : fieldChar.kind) === "separate") {
|
|
46034
46092
|
if (depth === 1) separateBlockIndex = i;
|
|
46035
|
-
} else if ((
|
|
46093
|
+
} else if ((fieldChar == null ? void 0 : fieldChar.kind) === "end") {
|
|
46036
46094
|
if (depth === 1) {
|
|
46037
46095
|
if (isToc) {
|
|
46038
46096
|
return {
|
|
@@ -46827,7 +46885,7 @@ function createEditorEssentialsRuntimePlugin(options) {
|
|
|
46827
46885
|
}
|
|
46828
46886
|
return next;
|
|
46829
46887
|
},
|
|
46830
|
-
{ mergeKey:
|
|
46888
|
+
{ mergeKey: MERGE_KEYS.specialIndent }
|
|
46831
46889
|
);
|
|
46832
46890
|
options.focusInput();
|
|
46833
46891
|
},
|
|
@@ -46846,7 +46904,7 @@ function createEditorEssentialsRuntimePlugin(options) {
|
|
|
46846
46904
|
next = setParagraphStyle(next, "borderLeft", border);
|
|
46847
46905
|
return next;
|
|
46848
46906
|
},
|
|
46849
|
-
{ mergeKey:
|
|
46907
|
+
{ mergeKey: MERGE_KEYS.paraBorders }
|
|
46850
46908
|
);
|
|
46851
46909
|
options.focusInput();
|
|
46852
46910
|
},
|
|
@@ -46956,39 +47014,39 @@ function createEditorEssentialsRuntimePlugin(options) {
|
|
|
46956
47014
|
canEditRow: () => options.tableOps.canEditSelectedTableRow(options.state()),
|
|
46957
47015
|
merge: () => apply(
|
|
46958
47016
|
(current) => options.tableOps.mergeSelectedTable(current),
|
|
46959
|
-
|
|
47017
|
+
MERGE_KEYS.mergeTable
|
|
46960
47018
|
),
|
|
46961
47019
|
split: () => apply(
|
|
46962
47020
|
(current) => options.tableOps.splitSelectedTable(current),
|
|
46963
|
-
|
|
47021
|
+
MERGE_KEYS.splitTable
|
|
46964
47022
|
),
|
|
46965
47023
|
insertColumnBefore: () => apply(
|
|
46966
47024
|
(current) => options.tableOps.insertSelectedTableColumn(current, -1),
|
|
46967
|
-
|
|
47025
|
+
MERGE_KEYS.insertTableColumn
|
|
46968
47026
|
),
|
|
46969
47027
|
insertColumnAfter: () => apply(
|
|
46970
47028
|
(current) => options.tableOps.insertSelectedTableColumn(current, 1),
|
|
46971
|
-
|
|
47029
|
+
MERGE_KEYS.insertTableColumn
|
|
46972
47030
|
),
|
|
46973
47031
|
deleteColumn: () => apply(
|
|
46974
47032
|
(current) => options.tableOps.deleteSelectedTableColumn(current),
|
|
46975
|
-
|
|
47033
|
+
MERGE_KEYS.deleteTableColumn
|
|
46976
47034
|
),
|
|
46977
47035
|
insertRowBefore: () => apply(
|
|
46978
47036
|
(current) => options.tableOps.insertSelectedTableRow(current, -1),
|
|
46979
|
-
|
|
47037
|
+
MERGE_KEYS.insertTableRow
|
|
46980
47038
|
),
|
|
46981
47039
|
insertRowAfter: () => apply(
|
|
46982
47040
|
(current) => options.tableOps.insertSelectedTableRow(current, 1),
|
|
46983
|
-
|
|
47041
|
+
MERGE_KEYS.insertTableRow
|
|
46984
47042
|
),
|
|
46985
47043
|
deleteRow: () => apply(
|
|
46986
47044
|
(current) => options.tableOps.deleteSelectedTableRow(current),
|
|
46987
|
-
|
|
47045
|
+
MERGE_KEYS.deleteTableRow
|
|
46988
47046
|
),
|
|
46989
47047
|
cellShading: (color) => apply(
|
|
46990
47048
|
(current) => setTableCellStyleValue(current, "shading", color || null),
|
|
46991
|
-
|
|
47049
|
+
MERGE_KEYS.tableShading
|
|
46992
47050
|
),
|
|
46993
47051
|
cellBorders: () => apply(
|
|
46994
47052
|
(current) => setTableCellBorders(current, {
|
|
@@ -46996,7 +47054,7 @@ function createEditorEssentialsRuntimePlugin(options) {
|
|
|
46996
47054
|
type: "solid",
|
|
46997
47055
|
color: "#64748b"
|
|
46998
47056
|
}),
|
|
46999
|
-
|
|
47057
|
+
MERGE_KEYS.tableBorders
|
|
47000
47058
|
),
|
|
47001
47059
|
cellNoBorders: () => apply(
|
|
47002
47060
|
(current) => setTableCellBorders(current, {
|
|
@@ -47004,25 +47062,25 @@ function createEditorEssentialsRuntimePlugin(options) {
|
|
|
47004
47062
|
type: "none",
|
|
47005
47063
|
color: "transparent"
|
|
47006
47064
|
}),
|
|
47007
|
-
|
|
47065
|
+
MERGE_KEYS.tableBorders
|
|
47008
47066
|
),
|
|
47009
47067
|
width100: () => apply(
|
|
47010
47068
|
(current) => setTableStyleValue(current, "width", "100%"),
|
|
47011
|
-
|
|
47069
|
+
MERGE_KEYS.tableWidth
|
|
47012
47070
|
),
|
|
47013
47071
|
alignLeft: () => apply(
|
|
47014
47072
|
(current) => setTableCellStyleValue(current, "horizontalAlign", "left"),
|
|
47015
|
-
|
|
47073
|
+
MERGE_KEYS.tableAlign
|
|
47016
47074
|
),
|
|
47017
47075
|
alignCenter: () => apply(
|
|
47018
47076
|
(current) => setTableCellStyleValue(current, "horizontalAlign", "center"),
|
|
47019
|
-
|
|
47077
|
+
MERGE_KEYS.tableAlign
|
|
47020
47078
|
),
|
|
47021
47079
|
alignRight: () => apply(
|
|
47022
47080
|
(current) => setTableCellStyleValue(current, "horizontalAlign", "right"),
|
|
47023
|
-
|
|
47081
|
+
MERGE_KEYS.tableAlign
|
|
47024
47082
|
),
|
|
47025
|
-
setCellWidth: (width) => apply((current) => setTableCellWidth(current, width),
|
|
47083
|
+
setCellWidth: (width) => apply((current) => setTableCellWidth(current, width), MERGE_KEYS.tableCellWidth),
|
|
47026
47084
|
insert: (rows, cols) => options.tableOps.insertTableCommand(rows, cols)
|
|
47027
47085
|
};
|
|
47028
47086
|
})();
|