@harbour-enterprises/superdoc 1.3.0 → 1.3.1-next.1
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/chunks/{PdfViewer-DnMzmTRw.cjs → PdfViewer-B1rqV4Hp.cjs} +2 -2
- package/dist/chunks/{PdfViewer-DfR5FJ1X.es.js → PdfViewer-BVvi-ZEK.es.js} +2 -2
- package/dist/chunks/{SuperConverter-z20LprsX.es.js → SuperConverter-AxPNFosS.es.js} +1 -1
- package/dist/chunks/{SuperConverter-BJ-tba6U.cjs → SuperConverter-rwP6nlvC.cjs} +1 -1
- package/dist/chunks/{index-EMK5q5lA.cjs → index-BmwaXglr.cjs} +4 -4
- package/dist/chunks/{index-CL5NVKmk.cjs → index-Ccw24rQt.cjs} +194 -116
- package/dist/chunks/{index-BEA-hKnM.es.js → index-DZF2SDeC.es.js} +194 -116
- package/dist/chunks/{index-BrCOOZsx.es.js → index-IUXq0EQx.es.js} +4 -4
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +195 -117
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B as Buffer$2 } from "./jszip-B1fkPkPJ.es.js";
|
|
2
2
|
import { t as twipsToInches, i as inchesToTwips, p as ptToTwips, l as linesToTwips, a as twipsToLines, b as pixelsToTwips, h as halfPointToPoints, c as twipsToPixels$2, d as convertSizeToCSS, e as inchesToPixels } from "./helpers-C8e9wR5l.es.js";
|
|
3
|
-
import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-
|
|
3
|
+
import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-AxPNFosS.es.js";
|
|
4
4
|
import { p as process$1, r as ref, C as global$1, c as computed, E as createElementBlock, F as Fragment$1, S as renderList, O as withModifiers, G as openBlock, P as normalizeClass, M as createCommentVNode, H as toDisplayString, K as createBaseVNode, U as createApp, f as onMounted, X as onUnmounted, R as withDirectives, v as unref, Y as vModelText, y as nextTick, L as normalizeStyle, u as watch, Z as withKeys, _ as createTextVNode, I as createVNode, h, $ as readonly, s as getCurrentInstance, o as onBeforeUnmount, j as reactive, b as onBeforeMount, i as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, a as provide, g as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, D as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, m as markRaw, N as createBlock, J as withCtx, a9 as useCssVars, V as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-BnBKJwCW.es.js";
|
|
5
5
|
import "./jszip.min-DCl8qkFO.es.js";
|
|
6
6
|
import { E as EventEmitter$1 } from "./eventemitter3-CwrdEv8r.es.js";
|
|
@@ -15434,7 +15434,7 @@ const canUseDOM = () => {
|
|
|
15434
15434
|
return false;
|
|
15435
15435
|
}
|
|
15436
15436
|
};
|
|
15437
|
-
const summaryVersion = "1.3.
|
|
15437
|
+
const summaryVersion = "1.3.1-next.1";
|
|
15438
15438
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
15439
15439
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
15440
15440
|
function mapAttributes(attrs) {
|
|
@@ -18066,7 +18066,7 @@ class Editor extends EventEmitter {
|
|
|
18066
18066
|
* Process collaboration migrations
|
|
18067
18067
|
*/
|
|
18068
18068
|
processCollaborationMigrations() {
|
|
18069
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.3.
|
|
18069
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.3.1-next.1");
|
|
18070
18070
|
if (!this.options.ydoc) return;
|
|
18071
18071
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
18072
18072
|
let docVersion = metaMap.get("version");
|
|
@@ -24929,7 +24929,7 @@ function isMinimalWordLayout(value) {
|
|
|
24929
24929
|
return true;
|
|
24930
24930
|
}
|
|
24931
24931
|
const LIST_MARKER_GAP$2 = 8;
|
|
24932
|
-
const DEFAULT_TAB_INTERVAL_PX$
|
|
24932
|
+
const DEFAULT_TAB_INTERVAL_PX$1 = 48;
|
|
24933
24933
|
const DEFAULT_PAGE_HEIGHT_PX = 1056;
|
|
24934
24934
|
const DEFAULT_VIRTUALIZED_PAGE_GAP$1 = 72;
|
|
24935
24935
|
const COMMENT_EXTERNAL_COLOR = "#B1124B";
|
|
@@ -25963,7 +25963,7 @@ class DomPainter {
|
|
|
25963
25963
|
const textStart = paraIndentLeft + firstLine;
|
|
25964
25964
|
tabWidth = textStart - currentPos;
|
|
25965
25965
|
if (tabWidth <= 0) {
|
|
25966
|
-
tabWidth = DEFAULT_TAB_INTERVAL_PX$
|
|
25966
|
+
tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
|
|
25967
25967
|
} else if (tabWidth < LIST_MARKER_GAP$2) {
|
|
25968
25968
|
tabWidth = LIST_MARKER_GAP$2;
|
|
25969
25969
|
}
|
|
@@ -26115,7 +26115,7 @@ class DomPainter {
|
|
|
26115
26115
|
const textStart = paraIndentLeft + firstLine;
|
|
26116
26116
|
tabWidth = textStart - currentPos;
|
|
26117
26117
|
if (tabWidth <= 0) {
|
|
26118
|
-
tabWidth = DEFAULT_TAB_INTERVAL_PX$
|
|
26118
|
+
tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
|
|
26119
26119
|
} else if (tabWidth < LIST_MARKER_GAP$2) {
|
|
26120
26120
|
tabWidth = LIST_MARKER_GAP$2;
|
|
26121
26121
|
}
|
|
@@ -27463,6 +27463,13 @@ class DomPainter {
|
|
|
27463
27463
|
const trackedConfig = this.resolveTrackedChangesConfig(block);
|
|
27464
27464
|
if (runsForLine.length === 0) {
|
|
27465
27465
|
const span = this.doc.createElement("span");
|
|
27466
|
+
span.classList.add("superdoc-empty-run");
|
|
27467
|
+
if (lineRange.pmStart != null) {
|
|
27468
|
+
span.dataset.pmStart = String(lineRange.pmStart);
|
|
27469
|
+
}
|
|
27470
|
+
if (lineRange.pmEnd != null) {
|
|
27471
|
+
span.dataset.pmEnd = String(lineRange.pmEnd);
|
|
27472
|
+
}
|
|
27466
27473
|
span.innerHTML = " ";
|
|
27467
27474
|
el.appendChild(span);
|
|
27468
27475
|
}
|
|
@@ -30709,7 +30716,6 @@ const DEFAULT_LIST_INDENT_BASE_PX = 24;
|
|
|
30709
30716
|
const DEFAULT_LIST_INDENT_STEP_PX = 24;
|
|
30710
30717
|
const DEFAULT_LIST_HANGING_PX$1 = 18;
|
|
30711
30718
|
const SPACE_SUFFIX_GAP_PX = 4;
|
|
30712
|
-
const DEFAULT_TAB_INTERVAL_PX$1 = 48;
|
|
30713
30719
|
function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, measureMarkerText) {
|
|
30714
30720
|
const marker = wordLayout?.marker;
|
|
30715
30721
|
if (!marker) {
|
|
@@ -30743,9 +30749,13 @@ function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, meas
|
|
|
30743
30749
|
return markerStartPos + finalMarkerTextWidth;
|
|
30744
30750
|
}
|
|
30745
30751
|
const markerJustification = marker.justification ?? "left";
|
|
30752
|
+
const markerWidthEffective = Math.max(
|
|
30753
|
+
typeof marker.markerBoxWidthPx === "number" && Number.isFinite(marker.markerBoxWidthPx) ? marker.markerBoxWidthPx : 0,
|
|
30754
|
+
finalMarkerTextWidth
|
|
30755
|
+
);
|
|
30746
30756
|
if (markerJustification !== "left") {
|
|
30747
|
-
const
|
|
30748
|
-
return markerStartPos + finalMarkerTextWidth + Math.max(
|
|
30757
|
+
const gutterWidth2 = typeof marker.gutterWidthPx === "number" && Number.isFinite(marker.gutterWidthPx) && marker.gutterWidthPx > 0 ? marker.gutterWidthPx : LIST_MARKER_GAP$1;
|
|
30758
|
+
return markerStartPos + finalMarkerTextWidth + Math.max(gutterWidth2, LIST_MARKER_GAP$1);
|
|
30749
30759
|
}
|
|
30750
30760
|
if (wordLayout?.firstLineIndentMode === true) {
|
|
30751
30761
|
let targetTabStop;
|
|
@@ -30757,12 +30767,12 @@ function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, meas
|
|
|
30757
30767
|
}
|
|
30758
30768
|
}
|
|
30759
30769
|
}
|
|
30760
|
-
const
|
|
30770
|
+
const textStartTarget2 = typeof marker.textStartX === "number" && Number.isFinite(marker.textStartX) ? marker.textStartX : wordLayout.textStartPx;
|
|
30761
30771
|
let tabWidth2;
|
|
30762
30772
|
if (targetTabStop !== void 0) {
|
|
30763
30773
|
tabWidth2 = targetTabStop - currentPos;
|
|
30764
|
-
} else if (
|
|
30765
|
-
tabWidth2 =
|
|
30774
|
+
} else if (textStartTarget2 !== void 0 && Number.isFinite(textStartTarget2) && textStartTarget2 > currentPos) {
|
|
30775
|
+
tabWidth2 = textStartTarget2 - currentPos;
|
|
30766
30776
|
} else {
|
|
30767
30777
|
tabWidth2 = LIST_MARKER_GAP$1;
|
|
30768
30778
|
}
|
|
@@ -30771,14 +30781,21 @@ function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, meas
|
|
|
30771
30781
|
}
|
|
30772
30782
|
return markerStartPos + finalMarkerTextWidth + tabWidth2;
|
|
30773
30783
|
}
|
|
30784
|
+
const textStartTarget = typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : void 0;
|
|
30785
|
+
const gutterWidth = typeof marker.gutterWidthPx === "number" && Number.isFinite(marker.gutterWidthPx) && marker.gutterWidthPx > 0 ? marker.gutterWidthPx : LIST_MARKER_GAP$1;
|
|
30786
|
+
const currentPosStandard = markerStartPos + markerWidthEffective;
|
|
30787
|
+
if (textStartTarget !== void 0) {
|
|
30788
|
+
const gap = Math.max(textStartTarget - currentPosStandard, gutterWidth);
|
|
30789
|
+
return currentPosStandard + gap;
|
|
30790
|
+
}
|
|
30774
30791
|
const textStart = indentLeft + firstLine;
|
|
30775
|
-
let tabWidth = textStart -
|
|
30792
|
+
let tabWidth = textStart - currentPosStandard;
|
|
30776
30793
|
if (tabWidth <= 0) {
|
|
30777
|
-
tabWidth =
|
|
30794
|
+
tabWidth = gutterWidth;
|
|
30778
30795
|
} else if (tabWidth < LIST_MARKER_GAP$1) {
|
|
30779
|
-
tabWidth =
|
|
30796
|
+
tabWidth = Math.max(tabWidth, gutterWidth);
|
|
30780
30797
|
}
|
|
30781
|
-
return
|
|
30798
|
+
return currentPosStandard + tabWidth;
|
|
30782
30799
|
}
|
|
30783
30800
|
function getWordLayoutConfig(block) {
|
|
30784
30801
|
if (!block || block.kind !== "paragraph") {
|
|
@@ -30807,21 +30824,45 @@ function isListItem(markerWidth, block) {
|
|
|
30807
30824
|
return hasHangingIndentPattern;
|
|
30808
30825
|
}
|
|
30809
30826
|
function calculateTextStartIndent(params2) {
|
|
30810
|
-
const {
|
|
30827
|
+
const {
|
|
30828
|
+
isFirstLine,
|
|
30829
|
+
isListItem: isListItem2,
|
|
30830
|
+
markerWidth,
|
|
30831
|
+
markerTextWidth,
|
|
30832
|
+
paraIndentLeft,
|
|
30833
|
+
firstLineIndent,
|
|
30834
|
+
hangingIndent,
|
|
30835
|
+
wordLayout
|
|
30836
|
+
} = params2;
|
|
30811
30837
|
const firstLineOffset = firstLineIndent - hangingIndent;
|
|
30812
|
-
const
|
|
30838
|
+
const effectiveMarkerTextWidth = typeof markerTextWidth === "number" && Number.isFinite(markerTextWidth) && markerTextWidth > 0 ? markerTextWidth : markerWidth;
|
|
30813
30839
|
let indentAdjust = paraIndentLeft;
|
|
30814
|
-
if (isListItem2 && isFirstLine
|
|
30840
|
+
if (isListItem2 && isFirstLine) {
|
|
30815
30841
|
const resolvedTextStart = resolveListTextStartPx(
|
|
30816
30842
|
wordLayout,
|
|
30817
30843
|
paraIndentLeft,
|
|
30818
30844
|
Math.max(firstLineIndent, 0),
|
|
30819
30845
|
Math.max(hangingIndent, 0),
|
|
30820
|
-
() =>
|
|
30821
|
-
// Use
|
|
30846
|
+
() => effectiveMarkerTextWidth
|
|
30847
|
+
// Use measured marker text width when available
|
|
30822
30848
|
);
|
|
30823
|
-
|
|
30824
|
-
|
|
30849
|
+
if (typeof resolvedTextStart === "number" && Number.isFinite(resolvedTextStart)) {
|
|
30850
|
+
indentAdjust = resolvedTextStart;
|
|
30851
|
+
} else {
|
|
30852
|
+
const explicitTextStart = wordLayout?.marker?.textStartX ?? wordLayout?.textStartPx;
|
|
30853
|
+
const isStandardHangingList = hangingIndent > 0 && wordLayout?.firstLineIndentMode !== true;
|
|
30854
|
+
const textStartLooksValid = typeof explicitTextStart === "number" && Number.isFinite(explicitTextStart) && (!isStandardHangingList || explicitTextStart > paraIndentLeft);
|
|
30855
|
+
if (textStartLooksValid) {
|
|
30856
|
+
indentAdjust = explicitTextStart;
|
|
30857
|
+
} else if (wordLayout?.firstLineIndentMode === true) {
|
|
30858
|
+
indentAdjust = paraIndentLeft + Math.max(firstLineIndent, 0) + markerWidth;
|
|
30859
|
+
} else if (isStandardHangingList && effectiveMarkerTextWidth > 0) {
|
|
30860
|
+
const markerStartPos = Math.max(0, paraIndentLeft - hangingIndent + firstLineIndent);
|
|
30861
|
+
const gutterWidthCandidate = wordLayout?.gutterWidthPx;
|
|
30862
|
+
const gutterWidth = typeof gutterWidthCandidate === "number" && Number.isFinite(gutterWidthCandidate) ? gutterWidthCandidate : wordLayout?.marker?.gutterWidthPx ?? LIST_MARKER_GAP$1;
|
|
30863
|
+
indentAdjust = markerStartPos + effectiveMarkerTextWidth + gutterWidth;
|
|
30864
|
+
}
|
|
30865
|
+
}
|
|
30825
30866
|
} else if (isFirstLine && !isListItem2) {
|
|
30826
30867
|
indentAdjust += firstLineOffset;
|
|
30827
30868
|
}
|
|
@@ -31672,12 +31713,16 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
31672
31713
|
const negativeRightIndent = indentRight < 0 ? indentRight : 0;
|
|
31673
31714
|
const remeasureWidth = Math.max(1, columnWidth - indentLeft - indentRight);
|
|
31674
31715
|
let didRemeasureForColumnWidth = false;
|
|
31716
|
+
let remeasuredMarkerInfo;
|
|
31675
31717
|
if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
|
|
31676
31718
|
const firstLineIndent = calculateFirstLineIndent(block, measure);
|
|
31677
31719
|
const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
|
|
31678
31720
|
const newLines = normalizeLines(newMeasure);
|
|
31679
31721
|
lines = newLines;
|
|
31680
31722
|
didRemeasureForColumnWidth = true;
|
|
31723
|
+
if (newMeasure.marker) {
|
|
31724
|
+
remeasuredMarkerInfo = newMeasure.marker;
|
|
31725
|
+
}
|
|
31681
31726
|
}
|
|
31682
31727
|
let fromLine = 0;
|
|
31683
31728
|
const attrs = getParagraphAttrs(block);
|
|
@@ -31716,10 +31761,12 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
31716
31761
|
width: fragmentWidth,
|
|
31717
31762
|
...computeFragmentPmRange(block, lines, 0, lines.length)
|
|
31718
31763
|
};
|
|
31719
|
-
if (measure.marker) {
|
|
31720
|
-
|
|
31721
|
-
|
|
31722
|
-
|
|
31764
|
+
if (measure.marker || remeasuredMarkerInfo) {
|
|
31765
|
+
const effectiveMarkerInfo = remeasuredMarkerInfo ?? measure.marker;
|
|
31766
|
+
fragment.markerWidth = effectiveMarkerInfo?.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
31767
|
+
const markerTextWidth = remeasuredMarkerInfo?.markerTextWidth ?? measure.marker?.markerTextWidth;
|
|
31768
|
+
if (markerTextWidth != null) {
|
|
31769
|
+
fragment.markerTextWidth = markerTextWidth;
|
|
31723
31770
|
}
|
|
31724
31771
|
}
|
|
31725
31772
|
state.page.fragments.push(fragment);
|
|
@@ -31761,6 +31808,9 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
31761
31808
|
const newLines = normalizeLines(newMeasure);
|
|
31762
31809
|
lines = newLines;
|
|
31763
31810
|
didRemeasureForFloats = true;
|
|
31811
|
+
if (newMeasure.marker) {
|
|
31812
|
+
remeasuredMarkerInfo = newMeasure.marker;
|
|
31813
|
+
}
|
|
31764
31814
|
}
|
|
31765
31815
|
}
|
|
31766
31816
|
while (fromLine < lines.length) {
|
|
@@ -31832,13 +31882,16 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
31832
31882
|
if (didRemeasureForColumnWidth) {
|
|
31833
31883
|
fragment.lines = lines.slice(fromLine, slice2.toLine);
|
|
31834
31884
|
}
|
|
31835
|
-
if (measure.marker && fromLine === 0) {
|
|
31836
|
-
|
|
31837
|
-
|
|
31838
|
-
|
|
31885
|
+
if ((measure.marker || remeasuredMarkerInfo) && fromLine === 0) {
|
|
31886
|
+
const effectiveMarkerInfo = remeasuredMarkerInfo ?? measure.marker;
|
|
31887
|
+
fragment.markerWidth = effectiveMarkerInfo?.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
31888
|
+
const markerTextWidth = remeasuredMarkerInfo?.markerTextWidth ?? measure.marker?.markerTextWidth;
|
|
31889
|
+
if (markerTextWidth != null) {
|
|
31890
|
+
fragment.markerTextWidth = markerTextWidth;
|
|
31839
31891
|
}
|
|
31840
|
-
|
|
31841
|
-
|
|
31892
|
+
const gutterWidth = remeasuredMarkerInfo?.gutterWidth ?? measure.marker?.gutterWidth;
|
|
31893
|
+
if (gutterWidth != null) {
|
|
31894
|
+
fragment.markerGutter = gutterWidth;
|
|
31842
31895
|
}
|
|
31843
31896
|
}
|
|
31844
31897
|
if (fromLine > 0) fragment.continuesFromPrev = true;
|
|
@@ -35279,16 +35332,19 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
35279
35332
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
35280
35333
|
const markerTextStartX = wordLayout?.marker?.textStartX;
|
|
35281
35334
|
const textStartPx = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : void 0;
|
|
35335
|
+
let measuredMarkerTextWidth;
|
|
35282
35336
|
const resolvedTextStartPx = resolveListTextStartPx(
|
|
35283
35337
|
wordLayout,
|
|
35284
35338
|
indentLeft,
|
|
35285
35339
|
indentFirstLine,
|
|
35286
35340
|
indentHanging,
|
|
35287
|
-
(markerText,
|
|
35341
|
+
(markerText, marker2) => {
|
|
35288
35342
|
const context = getCtx();
|
|
35289
35343
|
if (!context) return 0;
|
|
35290
|
-
context.font = markerFontString(
|
|
35291
|
-
|
|
35344
|
+
context.font = markerFontString(marker2.run);
|
|
35345
|
+
const width = context.measureText(markerText).width;
|
|
35346
|
+
measuredMarkerTextWidth = width;
|
|
35347
|
+
return width;
|
|
35292
35348
|
}
|
|
35293
35349
|
);
|
|
35294
35350
|
const effectiveTextStartPx = resolvedTextStartPx ?? textStartPx;
|
|
@@ -35379,7 +35435,14 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
35379
35435
|
}
|
|
35380
35436
|
}
|
|
35381
35437
|
const totalHeight = lines.reduce((s2, l) => s2 + l.lineHeight, 0);
|
|
35382
|
-
|
|
35438
|
+
const marker = wordLayout?.marker;
|
|
35439
|
+
const markerInfo = marker ? {
|
|
35440
|
+
markerWidth: marker.markerBoxWidthPx ?? indentHanging ?? 0,
|
|
35441
|
+
markerTextWidth: measuredMarkerTextWidth ?? 0,
|
|
35442
|
+
indentLeft,
|
|
35443
|
+
gutterWidth: marker.gutterWidthPx
|
|
35444
|
+
} : void 0;
|
|
35445
|
+
return { kind: "paragraph", lines, totalHeight, marker: markerInfo };
|
|
35383
35446
|
}
|
|
35384
35447
|
function hasComments(run) {
|
|
35385
35448
|
return "comments" in run && Array.isArray(run.comments) && run.comments.length > 0;
|
|
@@ -37430,6 +37493,7 @@ function selectionToRects(layout, blocks, measures, from3, to, geometryHelper) {
|
|
|
37430
37493
|
isFirstLine,
|
|
37431
37494
|
isListItem: isListItemFlag,
|
|
37432
37495
|
markerWidth,
|
|
37496
|
+
markerTextWidth: fragment.markerTextWidth ?? measure.marker?.markerTextWidth ?? void 0,
|
|
37433
37497
|
paraIndentLeft: indent.left,
|
|
37434
37498
|
firstLineIndent: indent.firstLine,
|
|
37435
37499
|
hangingIndent: indent.hanging,
|
|
@@ -37567,6 +37631,7 @@ function selectionToRects(layout, blocks, measures, from3, to, geometryHelper) {
|
|
|
37567
37631
|
isFirstLine,
|
|
37568
37632
|
isListItem: cellIsListItem,
|
|
37569
37633
|
markerWidth: paragraphMarkerWidth,
|
|
37634
|
+
markerTextWidth: info.measure?.marker?.markerTextWidth ?? void 0,
|
|
37570
37635
|
paraIndentLeft: cellIndent.left,
|
|
37571
37636
|
firstLineIndent: cellIndent.firstLine,
|
|
37572
37637
|
hangingIndent: cellIndent.hanging,
|
|
@@ -37818,25 +37883,36 @@ const mapPointToPm = (block, line, x, isRTL, availableWidthOverride, alignmentOv
|
|
|
37818
37883
|
const range = computeLinePmRange(block, line);
|
|
37819
37884
|
if (range.pmStart == null || range.pmEnd == null) return null;
|
|
37820
37885
|
const result = findCharacterAtX(block, line, x, range.pmStart, availableWidthOverride, alignmentOverride);
|
|
37886
|
+
let pmPosition = result.pmPosition;
|
|
37821
37887
|
if (isRTL) {
|
|
37822
37888
|
const charOffset = result.charOffset;
|
|
37823
37889
|
const charsInLine = Math.max(1, line.toChar - line.fromChar);
|
|
37824
37890
|
const reversedOffset = Math.max(0, Math.min(charsInLine, charsInLine - charOffset));
|
|
37825
|
-
|
|
37891
|
+
pmPosition = charOffsetToPm(block, line, reversedOffset, range.pmStart);
|
|
37826
37892
|
}
|
|
37827
|
-
return
|
|
37893
|
+
return pmPosition;
|
|
37828
37894
|
};
|
|
37829
37895
|
const mapPmToX = (block, line, offset2, fragmentWidth, alignmentOverride) => {
|
|
37830
37896
|
if (fragmentWidth <= 0 || line.width <= 0) return 0;
|
|
37831
37897
|
let paraIndentLeft = 0;
|
|
37832
37898
|
let paraIndentRight = 0;
|
|
37899
|
+
let effectiveLeft = 0;
|
|
37833
37900
|
if (block.kind === "paragraph") {
|
|
37834
37901
|
const indentLeft = typeof block.attrs?.indent?.left === "number" ? block.attrs.indent.left : 0;
|
|
37835
37902
|
const indentRight = typeof block.attrs?.indent?.right === "number" ? block.attrs.indent.right : 0;
|
|
37836
37903
|
paraIndentLeft = Number.isFinite(indentLeft) ? indentLeft : 0;
|
|
37837
37904
|
paraIndentRight = Number.isFinite(indentRight) ? indentRight : 0;
|
|
37905
|
+
effectiveLeft = paraIndentLeft;
|
|
37906
|
+
const wl = getWordLayoutConfig(block);
|
|
37907
|
+
const isListParagraph = Boolean(block.attrs?.numberingProperties) || Boolean(wl?.marker);
|
|
37908
|
+
if (isListParagraph) {
|
|
37909
|
+
const explicitTextStart = typeof wl?.marker?.textStartX === "number" && Number.isFinite(wl.marker.textStartX) ? wl.marker.textStartX : typeof wl?.textStartPx === "number" && Number.isFinite(wl.textStartPx) ? wl.textStartPx : void 0;
|
|
37910
|
+
if (typeof explicitTextStart === "number" && explicitTextStart > paraIndentLeft) {
|
|
37911
|
+
effectiveLeft = explicitTextStart;
|
|
37912
|
+
}
|
|
37913
|
+
}
|
|
37838
37914
|
}
|
|
37839
|
-
const totalIndent =
|
|
37915
|
+
const totalIndent = effectiveLeft + paraIndentRight;
|
|
37840
37916
|
const availableWidth = Math.max(0, fragmentWidth - totalIndent);
|
|
37841
37917
|
if (totalIndent > fragmentWidth) {
|
|
37842
37918
|
console.warn(
|
|
@@ -39174,16 +39250,26 @@ function lineHeightBeforeIndex(lines, fromLine, targetIndex) {
|
|
|
39174
39250
|
}
|
|
39175
39251
|
function computeCaretLayoutRectGeometry({ layout, blocks, measures, painterHost, viewportHost, visibleHost, zoom }, pos, includeDomFallback = true) {
|
|
39176
39252
|
if (!layout) return null;
|
|
39177
|
-
|
|
39253
|
+
let effectivePos = pos;
|
|
39254
|
+
let hit = getFragmentAtPosition(layout, blocks, measures, pos);
|
|
39178
39255
|
if (!hit) {
|
|
39179
|
-
|
|
39256
|
+
const fallbackCandidates = [pos - 1, pos + 1, pos - 2, pos + 2].filter((candidate) => candidate >= 0);
|
|
39257
|
+
for (const candidate of fallbackCandidates) {
|
|
39258
|
+
const fallbackHit = getFragmentAtPosition(layout, blocks, measures, candidate);
|
|
39259
|
+
if (fallbackHit) {
|
|
39260
|
+
hit = fallbackHit;
|
|
39261
|
+
effectivePos = candidate;
|
|
39262
|
+
break;
|
|
39263
|
+
}
|
|
39264
|
+
}
|
|
39265
|
+
if (!hit) return null;
|
|
39180
39266
|
}
|
|
39181
39267
|
const block = hit.block;
|
|
39182
39268
|
const measure = hit.measure;
|
|
39183
39269
|
if (hit.fragment.kind === "table" && block?.kind === "table" && measure?.kind === "table") {
|
|
39184
39270
|
return computeTableCaretLayoutRectFromDom(
|
|
39185
39271
|
{ viewportHost, visibleHost, zoom },
|
|
39186
|
-
|
|
39272
|
+
effectivePos,
|
|
39187
39273
|
hit.fragment,
|
|
39188
39274
|
block,
|
|
39189
39275
|
measure,
|
|
@@ -39191,92 +39277,32 @@ function computeCaretLayoutRectGeometry({ layout, blocks, measures, painterHost,
|
|
|
39191
39277
|
);
|
|
39192
39278
|
}
|
|
39193
39279
|
if (!block || block.kind !== "paragraph" || measure?.kind !== "paragraph") return null;
|
|
39194
|
-
if (hit.fragment.kind !== "para")
|
|
39195
|
-
return null;
|
|
39196
|
-
}
|
|
39280
|
+
if (hit.fragment.kind !== "para") return null;
|
|
39197
39281
|
const fragment = hit.fragment;
|
|
39198
|
-
const lineInfo = findLineContainingPos(block, measure, fragment.fromLine, fragment.toLine,
|
|
39199
|
-
if (!lineInfo)
|
|
39200
|
-
return null;
|
|
39201
|
-
}
|
|
39282
|
+
const lineInfo = findLineContainingPos(block, measure, fragment.fromLine, fragment.toLine, effectivePos);
|
|
39283
|
+
if (!lineInfo) return null;
|
|
39202
39284
|
const { line, index: index2 } = lineInfo;
|
|
39203
39285
|
const range = computeLinePmRange(block, line);
|
|
39204
39286
|
if (range.pmStart == null || range.pmEnd == null) return null;
|
|
39205
|
-
const pmOffset = pmPosToCharOffset(block, line,
|
|
39287
|
+
const pmOffset = pmPosToCharOffset(block, line, effectivePos);
|
|
39206
39288
|
const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
39207
|
-
const
|
|
39208
|
-
const availableWidth = Math.max(0, fragment.width - (indent.left + indent.right));
|
|
39209
|
-
const charX = measureCharacterX(block, line, pmOffset, availableWidth);
|
|
39289
|
+
const markerTextWidth = fragment.markerTextWidth ?? measure.marker?.markerTextWidth ?? void 0;
|
|
39210
39290
|
const isFirstLine = index2 === fragment.fromLine;
|
|
39211
39291
|
const isListItemFlag = isListItem(markerWidth, block);
|
|
39212
|
-
const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && isListItemFlag;
|
|
39213
39292
|
const wordLayout = getWordLayoutConfig(block);
|
|
39214
|
-
const
|
|
39215
|
-
if (isListFirstLine && isFirstLineIndentMode) {
|
|
39216
|
-
const textStartPx = calculateTextStartIndent({
|
|
39217
|
-
isFirstLine,
|
|
39218
|
-
isListItem: isListItemFlag,
|
|
39219
|
-
markerWidth,
|
|
39220
|
-
paraIndentLeft: indent.left,
|
|
39221
|
-
firstLineIndent: indent.firstLine,
|
|
39222
|
-
hangingIndent: indent.hanging,
|
|
39223
|
-
wordLayout
|
|
39224
|
-
});
|
|
39225
|
-
const localX2 = fragment.x + textStartPx + charX;
|
|
39226
|
-
const lineOffset2 = lineHeightBeforeIndex(measure.lines, fragment.fromLine, index2);
|
|
39227
|
-
const localY2 = fragment.y + lineOffset2;
|
|
39228
|
-
const result2 = {
|
|
39229
|
-
pageIndex: hit.pageIndex,
|
|
39230
|
-
x: localX2,
|
|
39231
|
-
y: localY2,
|
|
39232
|
-
height: line.lineHeight
|
|
39233
|
-
};
|
|
39234
|
-
const pageEl2 = painterHost?.querySelector(
|
|
39235
|
-
`.superdoc-page[data-page-index="${hit.pageIndex}"]`
|
|
39236
|
-
);
|
|
39237
|
-
const pageRect2 = pageEl2?.getBoundingClientRect();
|
|
39238
|
-
let domCaretX2 = null;
|
|
39239
|
-
let domCaretY2 = null;
|
|
39240
|
-
const spanEls2 = pageEl2?.querySelectorAll("span[data-pm-start][data-pm-end]");
|
|
39241
|
-
for (const spanEl of Array.from(spanEls2 ?? [])) {
|
|
39242
|
-
const pmStart = Number(spanEl.dataset.pmStart);
|
|
39243
|
-
const pmEnd = Number(spanEl.dataset.pmEnd);
|
|
39244
|
-
if (pos >= pmStart && pos <= pmEnd && spanEl.firstChild?.nodeType === Node.TEXT_NODE) {
|
|
39245
|
-
const textNode = spanEl.firstChild;
|
|
39246
|
-
const charIndex = Math.min(pos - pmStart, textNode.length);
|
|
39247
|
-
const rangeObj = document.createRange();
|
|
39248
|
-
rangeObj.setStart(textNode, charIndex);
|
|
39249
|
-
rangeObj.setEnd(textNode, charIndex);
|
|
39250
|
-
if (typeof rangeObj.getBoundingClientRect !== "function") {
|
|
39251
|
-
break;
|
|
39252
|
-
}
|
|
39253
|
-
const rangeRect = rangeObj.getBoundingClientRect();
|
|
39254
|
-
if (pageRect2) {
|
|
39255
|
-
domCaretX2 = (rangeRect.left - pageRect2.left) / zoom;
|
|
39256
|
-
domCaretY2 = (rangeRect.top - pageRect2.top) / zoom;
|
|
39257
|
-
}
|
|
39258
|
-
break;
|
|
39259
|
-
}
|
|
39260
|
-
}
|
|
39261
|
-
if (includeDomFallback && domCaretX2 != null && domCaretY2 != null) {
|
|
39262
|
-
return {
|
|
39263
|
-
pageIndex: hit.pageIndex,
|
|
39264
|
-
x: domCaretX2,
|
|
39265
|
-
y: domCaretY2,
|
|
39266
|
-
height: line.lineHeight
|
|
39267
|
-
};
|
|
39268
|
-
}
|
|
39269
|
-
return result2;
|
|
39270
|
-
}
|
|
39293
|
+
const indent = extractParagraphIndent(block.attrs?.indent);
|
|
39271
39294
|
const indentAdjust = calculateTextStartIndent({
|
|
39272
39295
|
isFirstLine,
|
|
39273
39296
|
isListItem: isListItemFlag,
|
|
39274
39297
|
markerWidth,
|
|
39298
|
+
markerTextWidth,
|
|
39275
39299
|
paraIndentLeft: indent.left,
|
|
39276
39300
|
firstLineIndent: indent.firstLine,
|
|
39277
39301
|
hangingIndent: indent.hanging,
|
|
39278
39302
|
wordLayout
|
|
39279
39303
|
});
|
|
39304
|
+
const availableWidth = Math.max(0, fragment.width - (indentAdjust + indent.right));
|
|
39305
|
+
const charX = measureCharacterX(block, line, pmOffset, availableWidth);
|
|
39280
39306
|
const localX = fragment.x + indentAdjust + charX;
|
|
39281
39307
|
const lineOffset = lineHeightBeforeIndex(measure.lines, fragment.fromLine, index2);
|
|
39282
39308
|
const localY = fragment.y + lineOffset;
|
|
@@ -39294,9 +39320,9 @@ function computeCaretLayoutRectGeometry({ layout, blocks, measures, painterHost,
|
|
|
39294
39320
|
for (const spanEl of Array.from(spanEls ?? [])) {
|
|
39295
39321
|
const pmStart = Number(spanEl.dataset.pmStart);
|
|
39296
39322
|
const pmEnd = Number(spanEl.dataset.pmEnd);
|
|
39297
|
-
if (
|
|
39323
|
+
if (effectivePos >= pmStart && effectivePos <= pmEnd && spanEl.firstChild?.nodeType === Node.TEXT_NODE) {
|
|
39298
39324
|
const textNode = spanEl.firstChild;
|
|
39299
|
-
const charIndex = Math.min(
|
|
39325
|
+
const charIndex = Math.min(effectivePos - pmStart, textNode.length);
|
|
39300
39326
|
const rangeObj = document.createRange();
|
|
39301
39327
|
rangeObj.setStart(textNode, charIndex);
|
|
39302
39328
|
rangeObj.setEnd(textNode, charIndex);
|
|
@@ -52520,7 +52546,12 @@ class PresentationEditor extends EventEmitter {
|
|
|
52520
52546
|
}
|
|
52521
52547
|
if (!handledByDepth) {
|
|
52522
52548
|
try {
|
|
52523
|
-
const
|
|
52549
|
+
const doc22 = this.#editor.state.doc;
|
|
52550
|
+
let nextSelection = TextSelection$1.create(doc22, hit.pos);
|
|
52551
|
+
if (!nextSelection.$from.parent.inlineContent) {
|
|
52552
|
+
nextSelection = Selection.near(doc22.resolve(hit.pos), 1);
|
|
52553
|
+
}
|
|
52554
|
+
const tr = this.#editor.state.tr.setSelection(nextSelection);
|
|
52524
52555
|
this.#editor.view?.dispatch(tr);
|
|
52525
52556
|
} catch {
|
|
52526
52557
|
}
|
|
@@ -53510,6 +53541,7 @@ class PresentationEditor extends EventEmitter {
|
|
|
53510
53541
|
if (!layout) {
|
|
53511
53542
|
return;
|
|
53512
53543
|
}
|
|
53544
|
+
const { from: from3, to } = selection;
|
|
53513
53545
|
const docEpoch = this.#epochMapper.getCurrentEpoch();
|
|
53514
53546
|
if (this.#layoutEpoch < docEpoch) {
|
|
53515
53547
|
return;
|
|
@@ -53524,7 +53556,6 @@ class PresentationEditor extends EventEmitter {
|
|
|
53524
53556
|
}
|
|
53525
53557
|
return;
|
|
53526
53558
|
}
|
|
53527
|
-
const { from: from3, to } = selection;
|
|
53528
53559
|
if (from3 === to) {
|
|
53529
53560
|
const caretLayout = this.#computeCaretLayoutRect(from3);
|
|
53530
53561
|
if (!caretLayout) {
|
|
@@ -58123,6 +58154,28 @@ const createMarkDefsFromStyleRunProps = (styleRunProps) => {
|
|
|
58123
58154
|
}
|
|
58124
58155
|
return markDefs;
|
|
58125
58156
|
};
|
|
58157
|
+
const normalizeSelectionIntoRun = (tr, runType) => {
|
|
58158
|
+
const selection = tr.selection;
|
|
58159
|
+
if (!(selection instanceof TextSelection$1)) return;
|
|
58160
|
+
if (selection.from !== selection.to) return;
|
|
58161
|
+
const $pos = tr.doc.resolve(selection.from);
|
|
58162
|
+
if ($pos.parent.type === runType) return;
|
|
58163
|
+
const nodeAfter = $pos.nodeAfter;
|
|
58164
|
+
if (nodeAfter?.type === runType && nodeAfter.content.size > 0) {
|
|
58165
|
+
const nextPos = selection.from + 1;
|
|
58166
|
+
if (nextPos <= tr.doc.content.size) {
|
|
58167
|
+
tr.setSelection(TextSelection$1.create(tr.doc, nextPos));
|
|
58168
|
+
}
|
|
58169
|
+
return;
|
|
58170
|
+
}
|
|
58171
|
+
const nodeBefore = $pos.nodeBefore;
|
|
58172
|
+
if (nodeBefore?.type === runType && nodeBefore.content.size > 0) {
|
|
58173
|
+
const prevPos = selection.from - 1;
|
|
58174
|
+
if (prevPos >= 0) {
|
|
58175
|
+
tr.setSelection(TextSelection$1.create(tr.doc, prevPos));
|
|
58176
|
+
}
|
|
58177
|
+
}
|
|
58178
|
+
};
|
|
58126
58179
|
const buildWrapTransaction = (state, ranges, runType, editor, markDefsFromMeta = []) => {
|
|
58127
58180
|
if (!ranges.length) return null;
|
|
58128
58181
|
const replacements = [];
|
|
@@ -58156,6 +58209,7 @@ const buildWrapTransaction = (state, ranges, runType, editor, markDefsFromMeta =
|
|
|
58156
58209
|
if (!replacements.length) return null;
|
|
58157
58210
|
const tr = state.tr;
|
|
58158
58211
|
replacements.sort((a, b) => b.from - a.from).forEach(({ from: from3, to, runNode }) => tr.replaceWith(from3, to, runNode));
|
|
58212
|
+
normalizeSelectionIntoRun(tr, runType);
|
|
58159
58213
|
return tr.docChanged ? tr : null;
|
|
58160
58214
|
};
|
|
58161
58215
|
const wrapTextInRunsPlugin = (editor) => {
|
|
@@ -73063,6 +73117,7 @@ const useToolbarItem = (options) => {
|
|
|
73063
73117
|
const parentItem = ref(null);
|
|
73064
73118
|
const iconColor = ref(options.iconColor);
|
|
73065
73119
|
const hasCaret = ref(options.hasCaret);
|
|
73120
|
+
const restoreEditorFocus = Boolean(options.restoreEditorFocus);
|
|
73066
73121
|
const dropdownStyles = ref(options.dropdownStyles);
|
|
73067
73122
|
const tooltip = ref(options.tooltip);
|
|
73068
73123
|
const tooltipVisible = ref(options.tooltipVisible);
|
|
@@ -73138,6 +73193,7 @@ const useToolbarItem = (options) => {
|
|
|
73138
73193
|
hideLabel,
|
|
73139
73194
|
inlineTextInputVisible,
|
|
73140
73195
|
hasInlineTextInput,
|
|
73196
|
+
restoreEditorFocus,
|
|
73141
73197
|
markName,
|
|
73142
73198
|
labelAttr,
|
|
73143
73199
|
childItem,
|
|
@@ -75451,6 +75507,7 @@ const makeDefaultItems = ({
|
|
|
75451
75507
|
command: "toggleBulletList",
|
|
75452
75508
|
icon: toolbarIcons2.bulletList,
|
|
75453
75509
|
tooltip: toolbarTexts2.bulletList,
|
|
75510
|
+
restoreEditorFocus: true,
|
|
75454
75511
|
attributes: {
|
|
75455
75512
|
ariaLabel: "Bullet list"
|
|
75456
75513
|
}
|
|
@@ -75461,6 +75518,7 @@ const makeDefaultItems = ({
|
|
|
75461
75518
|
command: "toggleOrderedList",
|
|
75462
75519
|
icon: toolbarIcons2.numberedList,
|
|
75463
75520
|
tooltip: toolbarTexts2.numberedList,
|
|
75521
|
+
restoreEditorFocus: true,
|
|
75464
75522
|
attributes: {
|
|
75465
75523
|
ariaLabel: "Numbered list"
|
|
75466
75524
|
}
|
|
@@ -86331,6 +86389,7 @@ class SuperToolbar extends EventEmitter$1 {
|
|
|
86331
86389
|
selectionUpdate: null,
|
|
86332
86390
|
focus: null
|
|
86333
86391
|
};
|
|
86392
|
+
this._restoreFocusTimeoutId = null;
|
|
86334
86393
|
if (!this.config.selector && this.config.element) {
|
|
86335
86394
|
this.config.selector = this.config.element;
|
|
86336
86395
|
}
|
|
@@ -86996,6 +87055,7 @@ class SuperToolbar extends EventEmitter$1 {
|
|
|
86996
87055
|
const wasFocused = Boolean(typeof hasFocusFn === "function" && hasFocusFn.call(this.activeEditor.view));
|
|
86997
87056
|
const { command: command2 } = item;
|
|
86998
87057
|
const isMarkToggle = this.isMarkToggle(item);
|
|
87058
|
+
const shouldRestoreFocus = Boolean(item?.restoreEditorFocus);
|
|
86999
87059
|
if (!wasFocused && isMarkToggle) {
|
|
87000
87060
|
this.pendingMarkCommands.push({ command: command2, argument, item });
|
|
87001
87061
|
item?.activate?.();
|
|
@@ -87026,6 +87086,13 @@ class SuperToolbar extends EventEmitter$1 {
|
|
|
87026
87086
|
}
|
|
87027
87087
|
if (isMarkToggle) this.#syncStickyMarksFromState();
|
|
87028
87088
|
this.updateToolbarState();
|
|
87089
|
+
if (shouldRestoreFocus && this.activeEditor && !this.activeEditor.options.isHeaderOrFooter) {
|
|
87090
|
+
this._restoreFocusTimeoutId = setTimeout(() => {
|
|
87091
|
+
this._restoreFocusTimeoutId = null;
|
|
87092
|
+
if (!this.activeEditor || this.activeEditor.options.isHeaderOrFooter) return;
|
|
87093
|
+
this.activeEditor.focus();
|
|
87094
|
+
}, 0);
|
|
87095
|
+
}
|
|
87029
87096
|
}
|
|
87030
87097
|
/**
|
|
87031
87098
|
* Processes and executes pending mark commands when editor selection updates.
|
|
@@ -87168,6 +87235,17 @@ class SuperToolbar extends EventEmitter$1 {
|
|
|
87168
87235
|
const tr = state.tr.setStoredMarks([mark]);
|
|
87169
87236
|
view.dispatch(tr);
|
|
87170
87237
|
}
|
|
87238
|
+
/**
|
|
87239
|
+
* Cleans up resources when the toolbar is destroyed.
|
|
87240
|
+
* Clears any pending timeouts to prevent callbacks firing after unmount.
|
|
87241
|
+
* @returns {void}
|
|
87242
|
+
*/
|
|
87243
|
+
destroy() {
|
|
87244
|
+
if (this._restoreFocusTimeoutId !== null) {
|
|
87245
|
+
clearTimeout(this._restoreFocusTimeoutId);
|
|
87246
|
+
this._restoreFocusTimeoutId = null;
|
|
87247
|
+
}
|
|
87248
|
+
}
|
|
87171
87249
|
}
|
|
87172
87250
|
const onMarginClickCursorChange = (event, editor) => {
|
|
87173
87251
|
const y = event.clientY;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-
|
|
2
|
-
import "./SuperConverter-
|
|
1
|
+
import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-DZF2SDeC.es.js";
|
|
2
|
+
import "./SuperConverter-AxPNFosS.es.js";
|
|
3
3
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
4
4
|
import { E as EventEmitter } from "./eventemitter3-CwrdEv8r.es.js";
|
|
5
5
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
@@ -7448,7 +7448,7 @@ const _sfc_main = {
|
|
|
7448
7448
|
__name: "SuperDoc",
|
|
7449
7449
|
emits: ["selection-update"],
|
|
7450
7450
|
setup(__props, { emit: __emit }) {
|
|
7451
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
7451
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BVvi-ZEK.es.js"));
|
|
7452
7452
|
const superdocStore = useSuperdocStore();
|
|
7453
7453
|
const commentsStore = useCommentsStore();
|
|
7454
7454
|
const {
|
|
@@ -8377,7 +8377,7 @@ class SuperDoc extends EventEmitter {
|
|
|
8377
8377
|
this.config.colors = shuffleArray(this.config.colors);
|
|
8378
8378
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
8379
8379
|
this.colorIndex = 0;
|
|
8380
|
-
this.version = "1.3.
|
|
8380
|
+
this.version = "1.3.1-next.1";
|
|
8381
8381
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
8382
8382
|
this.superdocId = config.superdocId || v4();
|
|
8383
8383
|
this.colors = this.config.colors;
|