@harbour-enterprises/superdoc 0.27.0-next.1 → 0.27.0-next.3
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-Caa3ZJY4.cjs → PdfViewer-C7U0afIq.cjs} +1 -1
- package/dist/chunks/{PdfViewer-CegNKOLN.es.js → PdfViewer-CymzL6pA.es.js} +1 -1
- package/dist/chunks/{index-DP1njdRr.es.js → index-CCotbgzR.es.js} +2 -2
- package/dist/chunks/{index-BXLDmCzi.cjs → index-FmOItkm6.cjs} +2 -2
- package/dist/chunks/{super-editor.es-ihBKB9j_.cjs → super-editor.es-C4b8Qz1U.cjs} +61 -27
- package/dist/chunks/{super-editor.es-DLyAUJ56.es.js → super-editor.es-DiNNVR7Q.es.js} +61 -27
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BupPKWvT.js → converter-Bnmt0bNT.js} +5 -5
- package/dist/super-editor/chunks/{docx-zipper-B_zB1qvo.js → docx-zipper-B1_YD3fF.js} +1 -1
- package/dist/super-editor/chunks/{editor-Chw_8G5O.js → editor-BHtGMc-u.js} +58 -24
- package/dist/super-editor/chunks/{toolbar-D8p5YzRz.js → toolbar-Cgj3meLH.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +4 -3
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +61 -27
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("./vue-DKMj1I9B.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
4
|
+
const superdoc = require("./index-FmOItkm6.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-ZWZLQtoU.es.js";
|
|
2
|
-
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-
|
|
2
|
+
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-CCotbgzR.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-
|
|
1
|
+
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-DiNNVR7Q.es.js";
|
|
2
2
|
import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-ZWZLQtoU.es.js";
|
|
3
3
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
4
4
|
import { E as EventEmitter } from "./eventemitter3-BWEnUdTY.es.js";
|
|
@@ -17145,7 +17145,7 @@ const _sfc_main = {
|
|
|
17145
17145
|
__name: "SuperDoc",
|
|
17146
17146
|
emits: ["selection-update"],
|
|
17147
17147
|
setup(__props, { emit: __emit }) {
|
|
17148
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17148
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CymzL6pA.es.js"));
|
|
17149
17149
|
const superdocStore = useSuperdocStore();
|
|
17150
17150
|
const commentsStore = useCommentsStore();
|
|
17151
17151
|
const {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-C4b8Qz1U.cjs");
|
|
3
3
|
const vue = require("./vue-DKMj1I9B.cjs");
|
|
4
4
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
5
5
|
const eventemitter3 = require("./eventemitter3-DkXkH2rT.cjs");
|
|
@@ -17162,7 +17162,7 @@ const _sfc_main = {
|
|
|
17162
17162
|
__name: "SuperDoc",
|
|
17163
17163
|
emits: ["selection-update"],
|
|
17164
17164
|
setup(__props, { emit: __emit }) {
|
|
17165
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17165
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-C7U0afIq.cjs")));
|
|
17166
17166
|
const superdocStore = useSuperdocStore();
|
|
17167
17167
|
const commentsStore = useCommentsStore();
|
|
17168
17168
|
const {
|
|
@@ -28886,9 +28886,9 @@ function applyColorModifier(hexColor, modifier, value) {
|
|
|
28886
28886
|
newG = g * percent2;
|
|
28887
28887
|
newB = b2 * percent2;
|
|
28888
28888
|
} else if (modifier === "tint") {
|
|
28889
|
-
newR = r2 + (255 - r2) *
|
|
28890
|
-
newG = g + (255 - g) *
|
|
28891
|
-
newB = b2 + (255 - b2) *
|
|
28889
|
+
newR = r2 + (255 - r2) * percent2;
|
|
28890
|
+
newG = g + (255 - g) * percent2;
|
|
28891
|
+
newB = b2 + (255 - b2) * percent2;
|
|
28892
28892
|
} else if (modifier === "lumOff") {
|
|
28893
28893
|
const offset2 = 255 * percent2;
|
|
28894
28894
|
newR = r2 + offset2;
|
|
@@ -29646,11 +29646,11 @@ function translateVectorShape(params2) {
|
|
|
29646
29646
|
attributes: { Requires: "wps" },
|
|
29647
29647
|
elements: [drawing]
|
|
29648
29648
|
};
|
|
29649
|
-
const
|
|
29649
|
+
const alternateContent = {
|
|
29650
29650
|
name: "mc:AlternateContent",
|
|
29651
29651
|
elements: [choice]
|
|
29652
29652
|
};
|
|
29653
|
-
return
|
|
29653
|
+
return wrapTextInRun(alternateContent);
|
|
29654
29654
|
}
|
|
29655
29655
|
function translateAnchorNode(params2) {
|
|
29656
29656
|
const { attrs } = params2.node;
|
|
@@ -59286,6 +59286,8 @@ const defaultLineLength = 816;
|
|
|
59286
59286
|
const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
59287
59287
|
const decorations = [];
|
|
59288
59288
|
const paragraphCache = /* @__PURE__ */ new Map();
|
|
59289
|
+
const coordCache = /* @__PURE__ */ new Map();
|
|
59290
|
+
const domPosCache = /* @__PURE__ */ new Map();
|
|
59289
59291
|
const end2 = to ?? doc2.content.size;
|
|
59290
59292
|
doc2.nodesBetween(from2, end2, (node, pos) => {
|
|
59291
59293
|
if (node.type.name !== "tab") return;
|
|
@@ -59297,9 +59299,9 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
|
59297
59299
|
const { tabStops, flattened, startPos } = paragraphContext;
|
|
59298
59300
|
const entryIndex = flattened.findIndex((entry) => entry.pos === pos);
|
|
59299
59301
|
if (entryIndex === -1) return;
|
|
59300
|
-
const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent);
|
|
59302
|
+
const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
|
|
59301
59303
|
const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
|
|
59302
|
-
const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos) + accumulatedTabWidth;
|
|
59304
|
+
const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
|
|
59303
59305
|
let tabWidth;
|
|
59304
59306
|
if (tabStops.length) {
|
|
59305
59307
|
const tabStop = tabStops.find((stop) => stop.pos > currentWidth && stop.val !== "clear");
|
|
@@ -59309,12 +59311,18 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
|
59309
59311
|
const nextTabIndex = findNextTabIndex(flattened, entryIndex + 1);
|
|
59310
59312
|
const segmentStartPos = pos + node.nodeSize;
|
|
59311
59313
|
const segmentEndPos = nextTabIndex === -1 ? startPos + paragraphContext.paragraph.nodeSize - 1 : flattened[nextTabIndex].pos;
|
|
59312
|
-
const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos);
|
|
59314
|
+
const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos, coordCache, domPosCache);
|
|
59313
59315
|
tabWidth -= tabStop.val === "center" ? segmentWidth / 2 : segmentWidth;
|
|
59314
59316
|
} else if (tabStop.val === "decimal" || tabStop.val === "num") {
|
|
59315
59317
|
const breakChar = tabStop.decimalChar || ".";
|
|
59316
59318
|
const decimalPos = findDecimalBreakPos(flattened, entryIndex + 1, breakChar);
|
|
59317
|
-
const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos) : measureRangeWidth(
|
|
59319
|
+
const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos, coordCache, domPosCache) : measureRangeWidth(
|
|
59320
|
+
view,
|
|
59321
|
+
pos + node.nodeSize,
|
|
59322
|
+
startPos + paragraphContext.paragraph.nodeSize - 1,
|
|
59323
|
+
coordCache,
|
|
59324
|
+
domPosCache
|
|
59325
|
+
);
|
|
59318
59326
|
tabWidth -= integralWidth;
|
|
59319
59327
|
}
|
|
59320
59328
|
if (tabStop.leader) {
|
|
@@ -59417,27 +59425,27 @@ function findDecimalBreakPos(flattened, startIndex, breakChar) {
|
|
|
59417
59425
|
}
|
|
59418
59426
|
return null;
|
|
59419
59427
|
}
|
|
59420
|
-
function measureRangeWidth(view, from2, to) {
|
|
59428
|
+
function measureRangeWidth(view, from2, to, coordCache = null, domPosCache = null) {
|
|
59421
59429
|
if (!Number.isFinite(from2) || !Number.isFinite(to) || to <= from2) return 0;
|
|
59422
59430
|
try {
|
|
59423
59431
|
const range2 = document.createRange();
|
|
59424
|
-
const fromRef = view
|
|
59425
|
-
const toRef = view
|
|
59432
|
+
const fromRef = getCachedDomAtPos(view, from2, domPosCache);
|
|
59433
|
+
const toRef = getCachedDomAtPos(view, to, domPosCache);
|
|
59426
59434
|
range2.setStart(fromRef.node, fromRef.offset);
|
|
59427
59435
|
range2.setEnd(toRef.node, toRef.offset);
|
|
59428
59436
|
const rect = range2.getBoundingClientRect();
|
|
59429
59437
|
range2.detach?.();
|
|
59430
59438
|
return rect.width || 0;
|
|
59431
59439
|
} catch {
|
|
59432
|
-
const startLeft = getLeftCoord(view, from2);
|
|
59433
|
-
const endLeft = getLeftCoord(view, to);
|
|
59440
|
+
const startLeft = getLeftCoord(view, from2, coordCache, domPosCache);
|
|
59441
|
+
const endLeft = getLeftCoord(view, to, coordCache, domPosCache);
|
|
59434
59442
|
if (startLeft == null || endLeft == null) return 0;
|
|
59435
59443
|
return Math.max(0, endLeft - startLeft);
|
|
59436
59444
|
}
|
|
59437
59445
|
}
|
|
59438
|
-
function getIndentWidth(view, paragraphStartPos, indentAttrs = {}) {
|
|
59439
|
-
const marginLeft = getLeftCoord(view, paragraphStartPos);
|
|
59440
|
-
const lineLeft = getLeftCoord(view, paragraphStartPos + 1);
|
|
59446
|
+
function getIndentWidth(view, paragraphStartPos, indentAttrs = {}, coordCache = null, domPosCache = null) {
|
|
59447
|
+
const marginLeft = getLeftCoord(view, paragraphStartPos, coordCache, domPosCache);
|
|
59448
|
+
const lineLeft = getLeftCoord(view, paragraphStartPos + 1, coordCache, domPosCache);
|
|
59441
59449
|
if (marginLeft != null && lineLeft != null) {
|
|
59442
59450
|
const diff = lineLeft - marginLeft;
|
|
59443
59451
|
if (!Number.isNaN(diff) && Math.abs(diff) > 0.5) {
|
|
@@ -59468,23 +59476,41 @@ function calculateIndentFallback(indentAttrs = {}) {
|
|
|
59468
59476
|
if (left2) return left2;
|
|
59469
59477
|
return 0;
|
|
59470
59478
|
}
|
|
59471
|
-
function getLeftCoord(view, pos) {
|
|
59479
|
+
function getLeftCoord(view, pos, coordCache = null, domPosCache = null) {
|
|
59472
59480
|
if (!Number.isFinite(pos)) return null;
|
|
59481
|
+
if (coordCache && coordCache.has(pos)) {
|
|
59482
|
+
return coordCache.get(pos);
|
|
59483
|
+
}
|
|
59484
|
+
let result = null;
|
|
59473
59485
|
try {
|
|
59474
|
-
|
|
59486
|
+
result = view.coordsAtPos(pos).left;
|
|
59475
59487
|
} catch {
|
|
59476
59488
|
try {
|
|
59477
|
-
const ref2 = view
|
|
59489
|
+
const ref2 = getCachedDomAtPos(view, pos, domPosCache);
|
|
59478
59490
|
const range2 = document.createRange();
|
|
59479
59491
|
range2.setStart(ref2.node, ref2.offset);
|
|
59480
59492
|
range2.setEnd(ref2.node, ref2.offset);
|
|
59481
59493
|
const rect = range2.getBoundingClientRect();
|
|
59482
59494
|
range2.detach?.();
|
|
59483
|
-
|
|
59495
|
+
result = rect.left;
|
|
59484
59496
|
} catch {
|
|
59485
|
-
|
|
59497
|
+
result = null;
|
|
59486
59498
|
}
|
|
59487
59499
|
}
|
|
59500
|
+
if (coordCache) {
|
|
59501
|
+
coordCache.set(pos, result);
|
|
59502
|
+
}
|
|
59503
|
+
return result;
|
|
59504
|
+
}
|
|
59505
|
+
function getCachedDomAtPos(view, pos, domPosCache = null) {
|
|
59506
|
+
if (domPosCache && domPosCache.has(pos)) {
|
|
59507
|
+
return domPosCache.get(pos);
|
|
59508
|
+
}
|
|
59509
|
+
const result = view.domAtPos(pos);
|
|
59510
|
+
if (domPosCache) {
|
|
59511
|
+
domPosCache.set(pos, result);
|
|
59512
|
+
}
|
|
59513
|
+
return result;
|
|
59488
59514
|
}
|
|
59489
59515
|
function calcTabHeight(pos) {
|
|
59490
59516
|
const ptToPxRatio = 1.333;
|
|
@@ -59544,7 +59570,7 @@ const TabNode = Node$1.create({
|
|
|
59544
59570
|
if (!decorations) {
|
|
59545
59571
|
decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
|
|
59546
59572
|
}
|
|
59547
|
-
if (!tr.docChanged) {
|
|
59573
|
+
if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate") === true) {
|
|
59548
59574
|
return { decorations };
|
|
59549
59575
|
}
|
|
59550
59576
|
decorations = decorations.map(tr.mapping, tr.doc);
|
|
@@ -66909,13 +66935,20 @@ const BlockNode = Extension.create({
|
|
|
66909
66935
|
return [
|
|
66910
66936
|
new Plugin({
|
|
66911
66937
|
key: BlockNodePluginKey,
|
|
66912
|
-
appendTransaction: (transactions,
|
|
66913
|
-
|
|
66914
|
-
if (hasInitialized && !
|
|
66938
|
+
appendTransaction: (transactions, oldState, newState) => {
|
|
66939
|
+
let docChanges = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
|
|
66940
|
+
if (hasInitialized && !docChanges) {
|
|
66941
|
+
return;
|
|
66942
|
+
}
|
|
66943
|
+
if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) {
|
|
66944
|
+
return;
|
|
66945
|
+
}
|
|
66915
66946
|
const { tr } = newState;
|
|
66916
66947
|
let changed = false;
|
|
66917
66948
|
newState.doc.descendants((node, pos) => {
|
|
66918
|
-
if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node))
|
|
66949
|
+
if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node)) {
|
|
66950
|
+
return;
|
|
66951
|
+
}
|
|
66919
66952
|
tr.setNodeMarkup(
|
|
66920
66953
|
pos,
|
|
66921
66954
|
void 0,
|
|
@@ -66929,6 +66962,7 @@ const BlockNode = Extension.create({
|
|
|
66929
66962
|
});
|
|
66930
66963
|
if (changed && !hasInitialized) {
|
|
66931
66964
|
hasInitialized = true;
|
|
66965
|
+
tr.setMeta("blockNodeInitialUpdate", true);
|
|
66932
66966
|
}
|
|
66933
66967
|
tr.setStoredMarks(newState.tr.storedMarks);
|
|
66934
66968
|
return changed ? tr : null;
|
|
@@ -28869,9 +28869,9 @@ function applyColorModifier(hexColor, modifier, value) {
|
|
|
28869
28869
|
newG = g * percent2;
|
|
28870
28870
|
newB = b2 * percent2;
|
|
28871
28871
|
} else if (modifier === "tint") {
|
|
28872
|
-
newR = r2 + (255 - r2) *
|
|
28873
|
-
newG = g + (255 - g) *
|
|
28874
|
-
newB = b2 + (255 - b2) *
|
|
28872
|
+
newR = r2 + (255 - r2) * percent2;
|
|
28873
|
+
newG = g + (255 - g) * percent2;
|
|
28874
|
+
newB = b2 + (255 - b2) * percent2;
|
|
28875
28875
|
} else if (modifier === "lumOff") {
|
|
28876
28876
|
const offset2 = 255 * percent2;
|
|
28877
28877
|
newR = r2 + offset2;
|
|
@@ -29629,11 +29629,11 @@ function translateVectorShape(params2) {
|
|
|
29629
29629
|
attributes: { Requires: "wps" },
|
|
29630
29630
|
elements: [drawing]
|
|
29631
29631
|
};
|
|
29632
|
-
const
|
|
29632
|
+
const alternateContent = {
|
|
29633
29633
|
name: "mc:AlternateContent",
|
|
29634
29634
|
elements: [choice]
|
|
29635
29635
|
};
|
|
29636
|
-
return
|
|
29636
|
+
return wrapTextInRun(alternateContent);
|
|
29637
29637
|
}
|
|
29638
29638
|
function translateAnchorNode(params2) {
|
|
29639
29639
|
const { attrs } = params2.node;
|
|
@@ -59269,6 +59269,8 @@ const defaultLineLength = 816;
|
|
|
59269
59269
|
const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
59270
59270
|
const decorations = [];
|
|
59271
59271
|
const paragraphCache = /* @__PURE__ */ new Map();
|
|
59272
|
+
const coordCache = /* @__PURE__ */ new Map();
|
|
59273
|
+
const domPosCache = /* @__PURE__ */ new Map();
|
|
59272
59274
|
const end2 = to ?? doc2.content.size;
|
|
59273
59275
|
doc2.nodesBetween(from2, end2, (node, pos) => {
|
|
59274
59276
|
if (node.type.name !== "tab") return;
|
|
@@ -59280,9 +59282,9 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
|
59280
59282
|
const { tabStops, flattened, startPos } = paragraphContext;
|
|
59281
59283
|
const entryIndex = flattened.findIndex((entry) => entry.pos === pos);
|
|
59282
59284
|
if (entryIndex === -1) return;
|
|
59283
|
-
const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent);
|
|
59285
|
+
const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
|
|
59284
59286
|
const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
|
|
59285
|
-
const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos) + accumulatedTabWidth;
|
|
59287
|
+
const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
|
|
59286
59288
|
let tabWidth;
|
|
59287
59289
|
if (tabStops.length) {
|
|
59288
59290
|
const tabStop = tabStops.find((stop) => stop.pos > currentWidth && stop.val !== "clear");
|
|
@@ -59292,12 +59294,18 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
|
59292
59294
|
const nextTabIndex = findNextTabIndex(flattened, entryIndex + 1);
|
|
59293
59295
|
const segmentStartPos = pos + node.nodeSize;
|
|
59294
59296
|
const segmentEndPos = nextTabIndex === -1 ? startPos + paragraphContext.paragraph.nodeSize - 1 : flattened[nextTabIndex].pos;
|
|
59295
|
-
const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos);
|
|
59297
|
+
const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos, coordCache, domPosCache);
|
|
59296
59298
|
tabWidth -= tabStop.val === "center" ? segmentWidth / 2 : segmentWidth;
|
|
59297
59299
|
} else if (tabStop.val === "decimal" || tabStop.val === "num") {
|
|
59298
59300
|
const breakChar = tabStop.decimalChar || ".";
|
|
59299
59301
|
const decimalPos = findDecimalBreakPos(flattened, entryIndex + 1, breakChar);
|
|
59300
|
-
const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos) : measureRangeWidth(
|
|
59302
|
+
const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos, coordCache, domPosCache) : measureRangeWidth(
|
|
59303
|
+
view,
|
|
59304
|
+
pos + node.nodeSize,
|
|
59305
|
+
startPos + paragraphContext.paragraph.nodeSize - 1,
|
|
59306
|
+
coordCache,
|
|
59307
|
+
domPosCache
|
|
59308
|
+
);
|
|
59301
59309
|
tabWidth -= integralWidth;
|
|
59302
59310
|
}
|
|
59303
59311
|
if (tabStop.leader) {
|
|
@@ -59400,27 +59408,27 @@ function findDecimalBreakPos(flattened, startIndex, breakChar) {
|
|
|
59400
59408
|
}
|
|
59401
59409
|
return null;
|
|
59402
59410
|
}
|
|
59403
|
-
function measureRangeWidth(view, from2, to) {
|
|
59411
|
+
function measureRangeWidth(view, from2, to, coordCache = null, domPosCache = null) {
|
|
59404
59412
|
if (!Number.isFinite(from2) || !Number.isFinite(to) || to <= from2) return 0;
|
|
59405
59413
|
try {
|
|
59406
59414
|
const range2 = document.createRange();
|
|
59407
|
-
const fromRef = view
|
|
59408
|
-
const toRef2 = view
|
|
59415
|
+
const fromRef = getCachedDomAtPos(view, from2, domPosCache);
|
|
59416
|
+
const toRef2 = getCachedDomAtPos(view, to, domPosCache);
|
|
59409
59417
|
range2.setStart(fromRef.node, fromRef.offset);
|
|
59410
59418
|
range2.setEnd(toRef2.node, toRef2.offset);
|
|
59411
59419
|
const rect = range2.getBoundingClientRect();
|
|
59412
59420
|
range2.detach?.();
|
|
59413
59421
|
return rect.width || 0;
|
|
59414
59422
|
} catch {
|
|
59415
|
-
const startLeft = getLeftCoord(view, from2);
|
|
59416
|
-
const endLeft = getLeftCoord(view, to);
|
|
59423
|
+
const startLeft = getLeftCoord(view, from2, coordCache, domPosCache);
|
|
59424
|
+
const endLeft = getLeftCoord(view, to, coordCache, domPosCache);
|
|
59417
59425
|
if (startLeft == null || endLeft == null) return 0;
|
|
59418
59426
|
return Math.max(0, endLeft - startLeft);
|
|
59419
59427
|
}
|
|
59420
59428
|
}
|
|
59421
|
-
function getIndentWidth(view, paragraphStartPos, indentAttrs = {}) {
|
|
59422
|
-
const marginLeft = getLeftCoord(view, paragraphStartPos);
|
|
59423
|
-
const lineLeft = getLeftCoord(view, paragraphStartPos + 1);
|
|
59429
|
+
function getIndentWidth(view, paragraphStartPos, indentAttrs = {}, coordCache = null, domPosCache = null) {
|
|
59430
|
+
const marginLeft = getLeftCoord(view, paragraphStartPos, coordCache, domPosCache);
|
|
59431
|
+
const lineLeft = getLeftCoord(view, paragraphStartPos + 1, coordCache, domPosCache);
|
|
59424
59432
|
if (marginLeft != null && lineLeft != null) {
|
|
59425
59433
|
const diff = lineLeft - marginLeft;
|
|
59426
59434
|
if (!Number.isNaN(diff) && Math.abs(diff) > 0.5) {
|
|
@@ -59451,23 +59459,41 @@ function calculateIndentFallback(indentAttrs = {}) {
|
|
|
59451
59459
|
if (left2) return left2;
|
|
59452
59460
|
return 0;
|
|
59453
59461
|
}
|
|
59454
|
-
function getLeftCoord(view, pos) {
|
|
59462
|
+
function getLeftCoord(view, pos, coordCache = null, domPosCache = null) {
|
|
59455
59463
|
if (!Number.isFinite(pos)) return null;
|
|
59464
|
+
if (coordCache && coordCache.has(pos)) {
|
|
59465
|
+
return coordCache.get(pos);
|
|
59466
|
+
}
|
|
59467
|
+
let result = null;
|
|
59456
59468
|
try {
|
|
59457
|
-
|
|
59469
|
+
result = view.coordsAtPos(pos).left;
|
|
59458
59470
|
} catch {
|
|
59459
59471
|
try {
|
|
59460
|
-
const ref2 = view
|
|
59472
|
+
const ref2 = getCachedDomAtPos(view, pos, domPosCache);
|
|
59461
59473
|
const range2 = document.createRange();
|
|
59462
59474
|
range2.setStart(ref2.node, ref2.offset);
|
|
59463
59475
|
range2.setEnd(ref2.node, ref2.offset);
|
|
59464
59476
|
const rect = range2.getBoundingClientRect();
|
|
59465
59477
|
range2.detach?.();
|
|
59466
|
-
|
|
59478
|
+
result = rect.left;
|
|
59467
59479
|
} catch {
|
|
59468
|
-
|
|
59480
|
+
result = null;
|
|
59469
59481
|
}
|
|
59470
59482
|
}
|
|
59483
|
+
if (coordCache) {
|
|
59484
|
+
coordCache.set(pos, result);
|
|
59485
|
+
}
|
|
59486
|
+
return result;
|
|
59487
|
+
}
|
|
59488
|
+
function getCachedDomAtPos(view, pos, domPosCache = null) {
|
|
59489
|
+
if (domPosCache && domPosCache.has(pos)) {
|
|
59490
|
+
return domPosCache.get(pos);
|
|
59491
|
+
}
|
|
59492
|
+
const result = view.domAtPos(pos);
|
|
59493
|
+
if (domPosCache) {
|
|
59494
|
+
domPosCache.set(pos, result);
|
|
59495
|
+
}
|
|
59496
|
+
return result;
|
|
59471
59497
|
}
|
|
59472
59498
|
function calcTabHeight(pos) {
|
|
59473
59499
|
const ptToPxRatio = 1.333;
|
|
@@ -59527,7 +59553,7 @@ const TabNode = Node$1.create({
|
|
|
59527
59553
|
if (!decorations) {
|
|
59528
59554
|
decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
|
|
59529
59555
|
}
|
|
59530
|
-
if (!tr.docChanged) {
|
|
59556
|
+
if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate") === true) {
|
|
59531
59557
|
return { decorations };
|
|
59532
59558
|
}
|
|
59533
59559
|
decorations = decorations.map(tr.mapping, tr.doc);
|
|
@@ -66892,13 +66918,20 @@ const BlockNode = Extension.create({
|
|
|
66892
66918
|
return [
|
|
66893
66919
|
new Plugin({
|
|
66894
66920
|
key: BlockNodePluginKey,
|
|
66895
|
-
appendTransaction: (transactions,
|
|
66896
|
-
|
|
66897
|
-
if (hasInitialized && !
|
|
66921
|
+
appendTransaction: (transactions, oldState, newState) => {
|
|
66922
|
+
let docChanges = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
|
|
66923
|
+
if (hasInitialized && !docChanges) {
|
|
66924
|
+
return;
|
|
66925
|
+
}
|
|
66926
|
+
if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) {
|
|
66927
|
+
return;
|
|
66928
|
+
}
|
|
66898
66929
|
const { tr } = newState;
|
|
66899
66930
|
let changed = false;
|
|
66900
66931
|
newState.doc.descendants((node, pos) => {
|
|
66901
|
-
if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node))
|
|
66932
|
+
if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node)) {
|
|
66933
|
+
return;
|
|
66934
|
+
}
|
|
66902
66935
|
tr.setNodeMarkup(
|
|
66903
66936
|
pos,
|
|
66904
66937
|
void 0,
|
|
@@ -66912,6 +66945,7 @@ const BlockNode = Extension.create({
|
|
|
66912
66945
|
});
|
|
66913
66946
|
if (changed && !hasInitialized) {
|
|
66914
66947
|
hasInitialized = true;
|
|
66948
|
+
tr.setMeta("blockNodeInitialUpdate", true);
|
|
66915
66949
|
}
|
|
66916
66950
|
tr.setStoredMarks(newState.tr.storedMarks);
|
|
66917
66951
|
return changed ? tr : null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
|
|
2
|
-
import { T as TextSelection } from "./chunks/converter-
|
|
3
|
-
import { _ as _export_sfc } from "./chunks/editor-
|
|
2
|
+
import { T as TextSelection } from "./chunks/converter-Bnmt0bNT.js";
|
|
3
|
+
import { _ as _export_sfc } from "./chunks/editor-BHtGMc-u.js";
|
|
4
4
|
const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
|
|
5
5
|
const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
|
|
6
6
|
async function baseInsightsFetch(payload, options = {}) {
|
|
@@ -28876,9 +28876,9 @@ function applyColorModifier(hexColor, modifier, value) {
|
|
|
28876
28876
|
newG = g * percent;
|
|
28877
28877
|
newB = b2 * percent;
|
|
28878
28878
|
} else if (modifier === "tint") {
|
|
28879
|
-
newR = r + (255 - r) *
|
|
28880
|
-
newG = g + (255 - g) *
|
|
28881
|
-
newB = b2 + (255 - b2) *
|
|
28879
|
+
newR = r + (255 - r) * percent;
|
|
28880
|
+
newG = g + (255 - g) * percent;
|
|
28881
|
+
newB = b2 + (255 - b2) * percent;
|
|
28882
28882
|
} else if (modifier === "lumOff") {
|
|
28883
28883
|
const offset = 255 * percent;
|
|
28884
28884
|
newR = r + offset;
|
|
@@ -29636,11 +29636,11 @@ function translateVectorShape(params) {
|
|
|
29636
29636
|
attributes: { Requires: "wps" },
|
|
29637
29637
|
elements: [drawing]
|
|
29638
29638
|
};
|
|
29639
|
-
const
|
|
29639
|
+
const alternateContent = {
|
|
29640
29640
|
name: "mc:AlternateContent",
|
|
29641
29641
|
elements: [choice]
|
|
29642
29642
|
};
|
|
29643
|
-
return
|
|
29643
|
+
return wrapTextInRun(alternateContent);
|
|
29644
29644
|
}
|
|
29645
29645
|
function translateAnchorNode(params) {
|
|
29646
29646
|
const { attrs } = params.node;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-
|
|
1
|
+
import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-Bnmt0bNT.js";
|
|
2
2
|
function commonjsRequire(path) {
|
|
3
3
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
4
4
|
}
|