superdoc 1.3.0-next.13 → 1.3.0-next.14
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-DebfKi_n.es.js → PdfViewer-CMc0iPaz.es.js} +2 -2
- package/dist/chunks/{PdfViewer-z2obaZHa.cjs → PdfViewer-DLGmNBgc.cjs} +2 -2
- package/dist/chunks/{SuperConverter-Dh27SFeK.es.js → SuperConverter-CD9khdbr.es.js} +1 -1
- package/dist/chunks/{SuperConverter-Dxl1uYvz.cjs → SuperConverter-kUELrLda.cjs} +1 -1
- package/dist/chunks/{index-OlLDoLS-.es.js → index-B1GscRFR.es.js} +174 -34
- package/dist/chunks/{index-DNdp0AxW.cjs → index-CyFX6QZq.cjs} +174 -34
- package/dist/chunks/{index-DOsTLvRQ.es.js → index-DVRukmH6.es.js} +4 -4
- package/dist/chunks/{index-C7p34V06.cjs → index-DgWw6KLR.cjs} +4 -4
- package/dist/style.css +12 -6
- 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 +175 -35
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, c as computed, r as ref, f as onMounted, X as onUnmounted, E as createElementBlock, G as openBlock, K as createBaseVNode, M as createCommentVNode, I as createVNode, v as unref } from "./vue-BnBKJwCW.es.js";
|
|
2
|
-
import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-
|
|
3
|
-
import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-
|
|
2
|
+
import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-DVRukmH6.es.js";
|
|
3
|
+
import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-B1GscRFR.es.js";
|
|
4
4
|
function self(vars) {
|
|
5
5
|
const {
|
|
6
6
|
opacityDisabled,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("./vue-De9wkgLl.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
5
|
-
const index = require("./index-
|
|
4
|
+
const superdoc = require("./index-DgWw6KLR.cjs");
|
|
5
|
+
const index = require("./index-CyFX6QZq.cjs");
|
|
6
6
|
function self(vars) {
|
|
7
7
|
const {
|
|
8
8
|
opacityDisabled,
|
|
@@ -31007,7 +31007,7 @@ class SuperConverter {
|
|
|
31007
31007
|
static getStoredSuperdocVersion(docx) {
|
|
31008
31008
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
31009
31009
|
}
|
|
31010
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.0-next.
|
|
31010
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.0-next.14") {
|
|
31011
31011
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
31012
31012
|
}
|
|
31013
31013
|
/**
|
|
@@ -31008,7 +31008,7 @@ class SuperConverter {
|
|
|
31008
31008
|
static getStoredSuperdocVersion(docx) {
|
|
31009
31009
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
31010
31010
|
}
|
|
31011
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.0-next.
|
|
31011
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.0-next.14") {
|
|
31012
31012
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
31013
31013
|
}
|
|
31014
31014
|
/**
|
|
@@ -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-CD9khdbr.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.0-next.
|
|
15437
|
+
const summaryVersion = "1.3.0-next.14";
|
|
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.0-next.
|
|
18069
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.14");
|
|
18070
18070
|
if (!this.options.ydoc) return;
|
|
18071
18071
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
18072
18072
|
let docVersion = metaMap.get("version");
|
|
@@ -48725,10 +48725,13 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48725
48725
|
};
|
|
48726
48726
|
}
|
|
48727
48727
|
const originX = currentLine.width;
|
|
48728
|
-
const
|
|
48728
|
+
const effectiveIndent = lines.length === 0 ? indentLeft + rawFirstLineOffset : indentLeft;
|
|
48729
|
+
const absCurrentX = currentLine.width + effectiveIndent;
|
|
48730
|
+
const { target, nextIndex, stop } = getNextTabStopPx(absCurrentX, tabStops, tabStopCursor);
|
|
48729
48731
|
tabStopCursor = nextIndex;
|
|
48730
|
-
const
|
|
48731
|
-
const
|
|
48732
|
+
const maxAbsWidth = currentLine.maxWidth + effectiveIndent;
|
|
48733
|
+
const clampedTarget = Math.min(target, maxAbsWidth);
|
|
48734
|
+
const tabAdvance = Math.max(0, clampedTarget - absCurrentX);
|
|
48732
48735
|
currentLine.width = roundValue(currentLine.width + tabAdvance);
|
|
48733
48736
|
run.width = tabAdvance;
|
|
48734
48737
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, 12);
|
|
@@ -48736,8 +48739,9 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48736
48739
|
currentLine.toChar = 1;
|
|
48737
48740
|
if (stop && stop.leader && stop.leader !== "none") {
|
|
48738
48741
|
const leaderStyle = stop.leader;
|
|
48739
|
-
const
|
|
48740
|
-
const
|
|
48742
|
+
const relativeTarget = clampedTarget - effectiveIndent;
|
|
48743
|
+
const from3 = Math.min(originX, relativeTarget);
|
|
48744
|
+
const to = Math.max(originX, relativeTarget);
|
|
48741
48745
|
if (!currentLine.leaders) currentLine.leaders = [];
|
|
48742
48746
|
currentLine.leaders.push({ from: from3, to, style: leaderStyle });
|
|
48743
48747
|
}
|
|
@@ -48746,27 +48750,28 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48746
48750
|
if (stop.val === "end" || stop.val === "center" || stop.val === "decimal") {
|
|
48747
48751
|
const groupMeasure = measureTabAlignmentGroup(runIndex + 1, runsToProcess, ctx2, decimalSeparator);
|
|
48748
48752
|
if (groupMeasure.totalWidth > 0) {
|
|
48753
|
+
const relativeTarget = clampedTarget - effectiveIndent;
|
|
48749
48754
|
let groupStartX;
|
|
48750
48755
|
if (stop.val === "end") {
|
|
48751
|
-
groupStartX = Math.max(0,
|
|
48756
|
+
groupStartX = Math.max(0, relativeTarget - groupMeasure.totalWidth);
|
|
48752
48757
|
} else if (stop.val === "center") {
|
|
48753
|
-
groupStartX = Math.max(0,
|
|
48758
|
+
groupStartX = Math.max(0, relativeTarget - groupMeasure.totalWidth / 2);
|
|
48754
48759
|
} else {
|
|
48755
48760
|
const beforeDecimal = groupMeasure.beforeDecimalWidth ?? groupMeasure.totalWidth;
|
|
48756
|
-
groupStartX = Math.max(0,
|
|
48761
|
+
groupStartX = Math.max(0, relativeTarget - beforeDecimal);
|
|
48757
48762
|
}
|
|
48758
48763
|
activeTabGroup = {
|
|
48759
48764
|
measure: groupMeasure,
|
|
48760
48765
|
startX: groupStartX,
|
|
48761
48766
|
currentX: groupStartX,
|
|
48762
|
-
target:
|
|
48767
|
+
target: relativeTarget,
|
|
48763
48768
|
val: stop.val
|
|
48764
48769
|
};
|
|
48765
48770
|
currentLine.width = roundValue(groupStartX);
|
|
48766
48771
|
}
|
|
48767
48772
|
pendingTabAlignment = null;
|
|
48768
48773
|
} else {
|
|
48769
|
-
pendingTabAlignment = { target: clampedTarget, val: stop.val };
|
|
48774
|
+
pendingTabAlignment = { target: clampedTarget - effectiveIndent, val: stop.val };
|
|
48770
48775
|
}
|
|
48771
48776
|
} else {
|
|
48772
48777
|
pendingTabAlignment = null;
|
|
@@ -49407,10 +49412,13 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
49407
49412
|
};
|
|
49408
49413
|
}
|
|
49409
49414
|
const originX = currentLine.width;
|
|
49410
|
-
const
|
|
49415
|
+
const effectiveIndent = lines.length === 0 ? indentLeft + rawFirstLineOffset : indentLeft;
|
|
49416
|
+
const absCurrentX = currentLine.width + effectiveIndent;
|
|
49417
|
+
const { target, nextIndex, stop } = getNextTabStopPx(absCurrentX, tabStops, tabStopCursor);
|
|
49411
49418
|
tabStopCursor = nextIndex;
|
|
49412
|
-
const
|
|
49413
|
-
const
|
|
49419
|
+
const maxAbsWidth = currentLine.maxWidth + effectiveIndent;
|
|
49420
|
+
const clampedTarget = Math.min(target, maxAbsWidth);
|
|
49421
|
+
const tabAdvance = Math.max(0, clampedTarget - absCurrentX);
|
|
49414
49422
|
currentLine.width = roundValue(currentLine.width + tabAdvance);
|
|
49415
49423
|
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run);
|
|
49416
49424
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run.fontSize);
|
|
@@ -49419,14 +49427,15 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
49419
49427
|
charPosInRun += 1;
|
|
49420
49428
|
if (stop) {
|
|
49421
49429
|
validateTabStopVal(stop);
|
|
49422
|
-
pendingTabAlignment = { target: clampedTarget, val: stop.val };
|
|
49430
|
+
pendingTabAlignment = { target: clampedTarget - effectiveIndent, val: stop.val };
|
|
49423
49431
|
} else {
|
|
49424
49432
|
pendingTabAlignment = null;
|
|
49425
49433
|
}
|
|
49426
49434
|
if (stop && stop.leader && stop.leader !== "none" && stop.leader !== "middleDot") {
|
|
49427
49435
|
const leaderStyle = stop.leader;
|
|
49428
|
-
const
|
|
49429
|
-
const
|
|
49436
|
+
const relativeTarget = clampedTarget - effectiveIndent;
|
|
49437
|
+
const from3 = Math.min(originX, relativeTarget);
|
|
49438
|
+
const to = Math.max(originX, relativeTarget);
|
|
49430
49439
|
if (!currentLine.leaders) currentLine.leaders = [];
|
|
49431
49440
|
currentLine.leaders.push({ from: from3, to, style: leaderStyle });
|
|
49432
49441
|
}
|
|
@@ -58596,12 +58605,18 @@ function findParagraphContext($pos, cache2, helpers2) {
|
|
|
58596
58605
|
return null;
|
|
58597
58606
|
}
|
|
58598
58607
|
function extractParagraphContext(node, startPos, helpers2, depth = 0) {
|
|
58599
|
-
const paragraphProperties = getResolvedParagraphProperties(node) ?? {};
|
|
58608
|
+
const paragraphProperties = getResolvedParagraphProperties(node) ?? node.attrs?.paragraphProperties ?? {};
|
|
58600
58609
|
const alignmentAliases = { left: "start", right: "end" };
|
|
58601
58610
|
let tabStops = [];
|
|
58602
58611
|
if (Array.isArray(paragraphProperties.tabStops)) {
|
|
58603
58612
|
tabStops = paragraphProperties.tabStops.map((stop) => {
|
|
58604
58613
|
const ref2 = stop?.tab;
|
|
58614
|
+
if (!ref2 && stop?.pos != null) {
|
|
58615
|
+
return {
|
|
58616
|
+
...stop,
|
|
58617
|
+
pos: twipsToPixels(Number(stop.pos) || 0)
|
|
58618
|
+
};
|
|
58619
|
+
}
|
|
58605
58620
|
if (!ref2) return stop || null;
|
|
58606
58621
|
const rawType = ref2.tabType || "start";
|
|
58607
58622
|
const mappedVal = alignmentAliases[rawType] || rawType;
|
|
@@ -59867,6 +59882,13 @@ function createLayoutRequest(doc2, paragraphPos, view, helpers2, revision, parag
|
|
|
59867
59882
|
pos: entry.pos,
|
|
59868
59883
|
nodeSize: node.nodeSize
|
|
59869
59884
|
});
|
|
59885
|
+
} else if (node.type.name === "lineBreak" || node.type.name === "hardBreak") {
|
|
59886
|
+
spans.push({
|
|
59887
|
+
type: node.type.name,
|
|
59888
|
+
spanId,
|
|
59889
|
+
pos: entry.pos,
|
|
59890
|
+
nodeSize: node.nodeSize
|
|
59891
|
+
});
|
|
59870
59892
|
} else if (node.type.name === "text") {
|
|
59871
59893
|
spans.push({
|
|
59872
59894
|
type: "text",
|
|
@@ -59916,6 +59938,7 @@ function calculateTabLayout(request, measurement, view) {
|
|
|
59916
59938
|
paragraphNode
|
|
59917
59939
|
} = request;
|
|
59918
59940
|
const tabs = {};
|
|
59941
|
+
const leftIndentPx = request.indents?.left ?? 0;
|
|
59919
59942
|
let currentX = indentWidth;
|
|
59920
59943
|
const measureText2 = (span) => {
|
|
59921
59944
|
if (view && typeof span.from === "number" && typeof span.to === "number") {
|
|
@@ -59928,6 +59951,8 @@ function calculateTabLayout(request, measurement, view) {
|
|
|
59928
59951
|
const span = spans[i];
|
|
59929
59952
|
if (span.type === "text") {
|
|
59930
59953
|
currentX += measureText2(span);
|
|
59954
|
+
} else if (span.type === "lineBreak" || span.type === "hardBreak") {
|
|
59955
|
+
currentX = leftIndentPx;
|
|
59931
59956
|
} else if (span.type === "tab") {
|
|
59932
59957
|
const followingText = collectFollowingText(spans, i + 1);
|
|
59933
59958
|
let measureTextCallback;
|
|
@@ -60023,7 +60048,7 @@ function collectFollowingText(spans, startIndex) {
|
|
|
60023
60048
|
let text = "";
|
|
60024
60049
|
for (let i = startIndex; i < spans.length; i++) {
|
|
60025
60050
|
const span = spans[i];
|
|
60026
|
-
if (span.type === "tab") break;
|
|
60051
|
+
if (span.type === "tab" || span.type === "lineBreak" || span.type === "hardBreak") break;
|
|
60027
60052
|
if (span.type === "text") text += span.text || "";
|
|
60028
60053
|
}
|
|
60029
60054
|
return text;
|
|
@@ -60033,7 +60058,7 @@ function getFollowingTextRange(spans, startIndex) {
|
|
|
60033
60058
|
let to = null;
|
|
60034
60059
|
for (let i = startIndex; i < spans.length; i++) {
|
|
60035
60060
|
const span = spans[i];
|
|
60036
|
-
if (span.type === "tab") break;
|
|
60061
|
+
if (span.type === "tab" || span.type === "lineBreak" || span.type === "hardBreak") break;
|
|
60037
60062
|
if (span.type === "text" && typeof span.from === "number" && typeof span.to === "number") {
|
|
60038
60063
|
if (from3 === null) from3 = span.from;
|
|
60039
60064
|
to = span.to;
|
|
@@ -78987,7 +79012,7 @@ var ResizeObserverController = (function() {
|
|
|
78987
79012
|
};
|
|
78988
79013
|
return ResizeObserverController2;
|
|
78989
79014
|
})();
|
|
78990
|
-
var ResizeObserver = (function() {
|
|
79015
|
+
var ResizeObserver$1 = (function() {
|
|
78991
79016
|
function ResizeObserver2(callback) {
|
|
78992
79017
|
if (arguments.length === 0) {
|
|
78993
79018
|
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
@@ -79026,7 +79051,7 @@ var ResizeObserver = (function() {
|
|
|
79026
79051
|
class ResizeObserverDelegate {
|
|
79027
79052
|
constructor() {
|
|
79028
79053
|
this.handleResize = this.handleResize.bind(this);
|
|
79029
|
-
this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver)(this.handleResize);
|
|
79054
|
+
this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver$1)(this.handleResize);
|
|
79030
79055
|
this.elHandlersMap = /* @__PURE__ */ new Map();
|
|
79031
79056
|
}
|
|
79032
79057
|
handleResize(entries) {
|
|
@@ -89895,6 +89920,31 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
89895
89920
|
},
|
|
89896
89921
|
{ immediate: true, deep: true }
|
|
89897
89922
|
);
|
|
89923
|
+
watch(
|
|
89924
|
+
() => props.options?.rulerContainer,
|
|
89925
|
+
() => {
|
|
89926
|
+
nextTick(() => {
|
|
89927
|
+
syncRulerOffset();
|
|
89928
|
+
setupRulerObservers();
|
|
89929
|
+
});
|
|
89930
|
+
},
|
|
89931
|
+
{ immediate: true }
|
|
89932
|
+
);
|
|
89933
|
+
watch(
|
|
89934
|
+
rulersVisible,
|
|
89935
|
+
(visible) => {
|
|
89936
|
+
nextTick(() => {
|
|
89937
|
+
if (visible) {
|
|
89938
|
+
syncRulerOffset();
|
|
89939
|
+
setupRulerObservers();
|
|
89940
|
+
} else {
|
|
89941
|
+
rulerHostStyle.value = {};
|
|
89942
|
+
cleanupRulerObservers();
|
|
89943
|
+
}
|
|
89944
|
+
});
|
|
89945
|
+
},
|
|
89946
|
+
{ immediate: true }
|
|
89947
|
+
);
|
|
89898
89948
|
const containerStyle = computed(() => {
|
|
89899
89949
|
let maxWidth = 8.5 * 96;
|
|
89900
89950
|
const ed = editor.value;
|
|
@@ -89919,6 +89969,71 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
89919
89969
|
minWidth: `${scaledWidth}px`
|
|
89920
89970
|
};
|
|
89921
89971
|
});
|
|
89972
|
+
const rulerHostStyle = ref({});
|
|
89973
|
+
const rulerContainerEl = ref(null);
|
|
89974
|
+
let editorResizeObserver = null;
|
|
89975
|
+
let rulerContainerResizeObserver = null;
|
|
89976
|
+
let layoutUpdatedHandler = null;
|
|
89977
|
+
const resolveRulerContainer = () => {
|
|
89978
|
+
const container = props.options?.rulerContainer;
|
|
89979
|
+
if (!container) return null;
|
|
89980
|
+
if (typeof container === "string") {
|
|
89981
|
+
const doc2 = editorWrapper.value?.ownerDocument ?? document;
|
|
89982
|
+
return doc2.querySelector(container);
|
|
89983
|
+
}
|
|
89984
|
+
return container instanceof HTMLElement ? container : null;
|
|
89985
|
+
};
|
|
89986
|
+
const getViewportRect2 = () => {
|
|
89987
|
+
const host = editorWrapper.value;
|
|
89988
|
+
if (!host) return null;
|
|
89989
|
+
const viewport2 = host.querySelector(".presentation-editor__viewport");
|
|
89990
|
+
const target = viewport2 ?? host;
|
|
89991
|
+
return target.getBoundingClientRect();
|
|
89992
|
+
};
|
|
89993
|
+
const syncRulerOffset = () => {
|
|
89994
|
+
if (!rulersVisible.value) {
|
|
89995
|
+
rulerHostStyle.value = {};
|
|
89996
|
+
return;
|
|
89997
|
+
}
|
|
89998
|
+
rulerContainerEl.value = resolveRulerContainer();
|
|
89999
|
+
if (!rulerContainerEl.value) {
|
|
90000
|
+
rulerHostStyle.value = {};
|
|
90001
|
+
return;
|
|
90002
|
+
}
|
|
90003
|
+
const viewportRect = getViewportRect2();
|
|
90004
|
+
if (!viewportRect) return;
|
|
90005
|
+
const hostRect = rulerContainerEl.value.getBoundingClientRect();
|
|
90006
|
+
const paddingLeft = Math.max(0, viewportRect.left - hostRect.left);
|
|
90007
|
+
const paddingRight = Math.max(0, hostRect.right - viewportRect.right);
|
|
90008
|
+
rulerHostStyle.value = {
|
|
90009
|
+
paddingLeft: `${paddingLeft}px`,
|
|
90010
|
+
paddingRight: `${paddingRight}px`
|
|
90011
|
+
};
|
|
90012
|
+
};
|
|
90013
|
+
const cleanupRulerObservers = () => {
|
|
90014
|
+
if (editorResizeObserver) {
|
|
90015
|
+
editorResizeObserver.disconnect();
|
|
90016
|
+
editorResizeObserver = null;
|
|
90017
|
+
}
|
|
90018
|
+
if (rulerContainerResizeObserver) {
|
|
90019
|
+
rulerContainerResizeObserver.disconnect();
|
|
90020
|
+
rulerContainerResizeObserver = null;
|
|
90021
|
+
}
|
|
90022
|
+
};
|
|
90023
|
+
const setupRulerObservers = () => {
|
|
90024
|
+
cleanupRulerObservers();
|
|
90025
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
90026
|
+
const viewportHost = editorWrapper.value;
|
|
90027
|
+
const rulerHost = resolveRulerContainer();
|
|
90028
|
+
if (viewportHost) {
|
|
90029
|
+
editorResizeObserver = new ResizeObserver(() => syncRulerOffset());
|
|
90030
|
+
editorResizeObserver.observe(viewportHost);
|
|
90031
|
+
}
|
|
90032
|
+
if (rulerHost) {
|
|
90033
|
+
rulerContainerResizeObserver = new ResizeObserver(() => syncRulerOffset());
|
|
90034
|
+
rulerContainerResizeObserver.observe(rulerHost);
|
|
90035
|
+
}
|
|
90036
|
+
};
|
|
89922
90037
|
const message = useMessage();
|
|
89923
90038
|
const editorWrapper = ref(null);
|
|
89924
90039
|
const editorElem = ref(null);
|
|
@@ -90230,7 +90345,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
90230
90345
|
presentationEditor.on("imageDeselected", () => {
|
|
90231
90346
|
clearSelectedImage();
|
|
90232
90347
|
});
|
|
90233
|
-
|
|
90348
|
+
layoutUpdatedHandler = () => {
|
|
90234
90349
|
if (imageResizeState.visible && imageResizeState.blockId) {
|
|
90235
90350
|
const escapedBlockId = CSS.escape(imageResizeState.blockId);
|
|
90236
90351
|
const newElement = editorElem.value?.querySelector(
|
|
@@ -90263,13 +90378,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
90263
90378
|
clearSelectedImage();
|
|
90264
90379
|
}
|
|
90265
90380
|
}
|
|
90266
|
-
|
|
90381
|
+
nextTick(() => syncRulerOffset());
|
|
90382
|
+
};
|
|
90383
|
+
presentationEditor.on("layoutUpdated", layoutUpdatedHandler);
|
|
90267
90384
|
zoomChangeHandler = ({ zoom }) => {
|
|
90268
90385
|
currentZoom.value = zoom;
|
|
90386
|
+
nextTick(() => syncRulerOffset());
|
|
90269
90387
|
};
|
|
90270
90388
|
presentationEditor.on("zoomChange", zoomChangeHandler);
|
|
90271
90389
|
if (typeof presentationEditor.zoom === "number") {
|
|
90272
90390
|
currentZoom.value = presentationEditor.zoom;
|
|
90391
|
+
nextTick(() => syncRulerOffset());
|
|
90273
90392
|
}
|
|
90274
90393
|
}
|
|
90275
90394
|
editor.value.on("paginationUpdate", () => {
|
|
@@ -90329,6 +90448,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
90329
90448
|
onMounted(() => {
|
|
90330
90449
|
initializeData();
|
|
90331
90450
|
if (props.options?.suppressSkeletonLoader || !props.options?.collaborationProvider) editorReady.value = true;
|
|
90451
|
+
window.addEventListener("resize", syncRulerOffset, { passive: true });
|
|
90452
|
+
nextTick(() => {
|
|
90453
|
+
syncRulerOffset();
|
|
90454
|
+
setupRulerObservers();
|
|
90455
|
+
});
|
|
90332
90456
|
});
|
|
90333
90457
|
const handleMarginClick = (event) => {
|
|
90334
90458
|
if (event.button !== 0) {
|
|
@@ -90359,6 +90483,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
90359
90483
|
editor.value.off("zoomChange", zoomChangeHandler);
|
|
90360
90484
|
zoomChangeHandler = null;
|
|
90361
90485
|
}
|
|
90486
|
+
if (editor.value instanceof PresentationEditor && layoutUpdatedHandler) {
|
|
90487
|
+
editor.value.off("layoutUpdated", layoutUpdatedHandler);
|
|
90488
|
+
layoutUpdatedHandler = null;
|
|
90489
|
+
}
|
|
90490
|
+
cleanupRulerObservers();
|
|
90491
|
+
window.removeEventListener("resize", syncRulerOffset);
|
|
90362
90492
|
editor.value?.destroy();
|
|
90363
90493
|
editor.value = null;
|
|
90364
90494
|
});
|
|
@@ -90370,18 +90500,28 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
90370
90500
|
__props.options.rulerContainer && rulersVisible.value && !!activeEditor.value ? (openBlock(), createBlock(Teleport, {
|
|
90371
90501
|
key: 0,
|
|
90372
90502
|
to: __props.options.rulerContainer
|
|
90503
|
+
}, [
|
|
90504
|
+
createBaseVNode("div", {
|
|
90505
|
+
class: "ruler-host",
|
|
90506
|
+
style: normalizeStyle(rulerHostStyle.value)
|
|
90507
|
+
}, [
|
|
90508
|
+
createVNode(Ruler, {
|
|
90509
|
+
class: "ruler superdoc-ruler",
|
|
90510
|
+
editor: activeEditor.value,
|
|
90511
|
+
onMarginChange: handleMarginChange
|
|
90512
|
+
}, null, 8, ["editor"])
|
|
90513
|
+
], 4)
|
|
90514
|
+
], 8, ["to"])) : rulersVisible.value && !!activeEditor.value ? (openBlock(), createElementBlock("div", {
|
|
90515
|
+
key: 1,
|
|
90516
|
+
class: "ruler-host",
|
|
90517
|
+
style: normalizeStyle(rulerHostStyle.value)
|
|
90373
90518
|
}, [
|
|
90374
90519
|
createVNode(Ruler, {
|
|
90375
|
-
class: "ruler
|
|
90520
|
+
class: "ruler",
|
|
90376
90521
|
editor: activeEditor.value,
|
|
90377
90522
|
onMarginChange: handleMarginChange
|
|
90378
90523
|
}, null, 8, ["editor"])
|
|
90379
|
-
],
|
|
90380
|
-
key: 1,
|
|
90381
|
-
class: "ruler",
|
|
90382
|
-
editor: activeEditor.value,
|
|
90383
|
-
onMarginChange: handleMarginChange
|
|
90384
|
-
}, null, 8, ["editor"])) : createCommentVNode("", true),
|
|
90524
|
+
], 4)) : createCommentVNode("", true),
|
|
90385
90525
|
createBaseVNode("div", {
|
|
90386
90526
|
class: "super-editor",
|
|
90387
90527
|
ref_key: "editorWrapper",
|
|
@@ -90486,7 +90626,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
90486
90626
|
};
|
|
90487
90627
|
}
|
|
90488
90628
|
});
|
|
90489
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
90629
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-f5c4f915"]]);
|
|
90490
90630
|
const _hoisted_1 = ["innerHTML"];
|
|
90491
90631
|
const _sfc_main = {
|
|
90492
90632
|
__name: "SuperInput",
|