@harbour-enterprises/superdoc 0.27.0-next.1 → 0.27.0-next.2
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-CegNKOLN.es.js → PdfViewer-BYzQ-Z8r.es.js} +1 -1
- package/dist/chunks/{PdfViewer-Caa3ZJY4.cjs → PdfViewer-CaR2rmuW.cjs} +1 -1
- package/dist/chunks/{index-DP1njdRr.es.js → index-DATrA3lt.es.js} +2 -2
- package/dist/chunks/{index-BXLDmCzi.cjs → index-EIErxDyE.cjs} +2 -2
- package/dist/chunks/{super-editor.es-ihBKB9j_.cjs → super-editor.es-DXEbSokY.cjs} +43 -17
- package/dist/chunks/{super-editor.es-DLyAUJ56.es.js → super-editor.es-DtgJu0CH.es.js} +43 -17
- package/dist/super-editor/ai-writer.es.js +1 -1
- package/dist/super-editor/chunks/{editor-Chw_8G5O.js → editor-ByRd7RN8.js} +43 -17
- package/dist/super-editor/chunks/{toolbar-D8p5YzRz.js → toolbar-BOxA8SfG.js} +1 -1
- package/dist/super-editor/editor.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 +3 -3
- 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 +43 -17
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -66984,6 +66984,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
66984
66984
|
const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
66985
66985
|
const decorations = [];
|
|
66986
66986
|
const paragraphCache = /* @__PURE__ */ new Map();
|
|
66987
|
+
const coordCache = /* @__PURE__ */ new Map();
|
|
66988
|
+
const domPosCache = /* @__PURE__ */ new Map();
|
|
66987
66989
|
const end2 = to ?? doc2.content.size;
|
|
66988
66990
|
doc2.nodesBetween(from2, end2, (node, pos) => {
|
|
66989
66991
|
if (node.type.name !== "tab") return;
|
|
@@ -66995,9 +66997,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
66995
66997
|
const { tabStops, flattened, startPos } = paragraphContext;
|
|
66996
66998
|
const entryIndex = flattened.findIndex((entry) => entry.pos === pos);
|
|
66997
66999
|
if (entryIndex === -1) return;
|
|
66998
|
-
const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent);
|
|
67000
|
+
const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
|
|
66999
67001
|
const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
|
|
67000
|
-
const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos) + accumulatedTabWidth;
|
|
67002
|
+
const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
|
|
67001
67003
|
let tabWidth;
|
|
67002
67004
|
if (tabStops.length) {
|
|
67003
67005
|
const tabStop = tabStops.find((stop) => stop.pos > currentWidth && stop.val !== "clear");
|
|
@@ -67007,12 +67009,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67007
67009
|
const nextTabIndex = findNextTabIndex(flattened, entryIndex + 1);
|
|
67008
67010
|
const segmentStartPos = pos + node.nodeSize;
|
|
67009
67011
|
const segmentEndPos = nextTabIndex === -1 ? startPos + paragraphContext.paragraph.nodeSize - 1 : flattened[nextTabIndex].pos;
|
|
67010
|
-
const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos);
|
|
67012
|
+
const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos, coordCache, domPosCache);
|
|
67011
67013
|
tabWidth -= tabStop.val === "center" ? segmentWidth / 2 : segmentWidth;
|
|
67012
67014
|
} else if (tabStop.val === "decimal" || tabStop.val === "num") {
|
|
67013
67015
|
const breakChar = tabStop.decimalChar || ".";
|
|
67014
67016
|
const decimalPos = findDecimalBreakPos(flattened, entryIndex + 1, breakChar);
|
|
67015
|
-
const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos) : measureRangeWidth(
|
|
67017
|
+
const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos, coordCache, domPosCache) : measureRangeWidth(
|
|
67018
|
+
view,
|
|
67019
|
+
pos + node.nodeSize,
|
|
67020
|
+
startPos + paragraphContext.paragraph.nodeSize - 1,
|
|
67021
|
+
coordCache,
|
|
67022
|
+
domPosCache
|
|
67023
|
+
);
|
|
67016
67024
|
tabWidth -= integralWidth;
|
|
67017
67025
|
}
|
|
67018
67026
|
if (tabStop.leader) {
|
|
@@ -67115,27 +67123,27 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67115
67123
|
}
|
|
67116
67124
|
return null;
|
|
67117
67125
|
}
|
|
67118
|
-
function measureRangeWidth(view, from2, to) {
|
|
67126
|
+
function measureRangeWidth(view, from2, to, coordCache = null, domPosCache = null) {
|
|
67119
67127
|
if (!Number.isFinite(from2) || !Number.isFinite(to) || to <= from2) return 0;
|
|
67120
67128
|
try {
|
|
67121
67129
|
const range2 = document.createRange();
|
|
67122
|
-
const fromRef = view
|
|
67123
|
-
const toRef2 = view
|
|
67130
|
+
const fromRef = getCachedDomAtPos(view, from2, domPosCache);
|
|
67131
|
+
const toRef2 = getCachedDomAtPos(view, to, domPosCache);
|
|
67124
67132
|
range2.setStart(fromRef.node, fromRef.offset);
|
|
67125
67133
|
range2.setEnd(toRef2.node, toRef2.offset);
|
|
67126
67134
|
const rect = range2.getBoundingClientRect();
|
|
67127
67135
|
range2.detach?.();
|
|
67128
67136
|
return rect.width || 0;
|
|
67129
67137
|
} catch {
|
|
67130
|
-
const startLeft = getLeftCoord(view, from2);
|
|
67131
|
-
const endLeft = getLeftCoord(view, to);
|
|
67138
|
+
const startLeft = getLeftCoord(view, from2, coordCache, domPosCache);
|
|
67139
|
+
const endLeft = getLeftCoord(view, to, coordCache, domPosCache);
|
|
67132
67140
|
if (startLeft == null || endLeft == null) return 0;
|
|
67133
67141
|
return Math.max(0, endLeft - startLeft);
|
|
67134
67142
|
}
|
|
67135
67143
|
}
|
|
67136
|
-
function getIndentWidth(view, paragraphStartPos, indentAttrs = {}) {
|
|
67137
|
-
const marginLeft = getLeftCoord(view, paragraphStartPos);
|
|
67138
|
-
const lineLeft = getLeftCoord(view, paragraphStartPos + 1);
|
|
67144
|
+
function getIndentWidth(view, paragraphStartPos, indentAttrs = {}, coordCache = null, domPosCache = null) {
|
|
67145
|
+
const marginLeft = getLeftCoord(view, paragraphStartPos, coordCache, domPosCache);
|
|
67146
|
+
const lineLeft = getLeftCoord(view, paragraphStartPos + 1, coordCache, domPosCache);
|
|
67139
67147
|
if (marginLeft != null && lineLeft != null) {
|
|
67140
67148
|
const diff = lineLeft - marginLeft;
|
|
67141
67149
|
if (!Number.isNaN(diff) && Math.abs(diff) > 0.5) {
|
|
@@ -67166,23 +67174,41 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67166
67174
|
if (left2) return left2;
|
|
67167
67175
|
return 0;
|
|
67168
67176
|
}
|
|
67169
|
-
function getLeftCoord(view, pos) {
|
|
67177
|
+
function getLeftCoord(view, pos, coordCache = null, domPosCache = null) {
|
|
67170
67178
|
if (!Number.isFinite(pos)) return null;
|
|
67179
|
+
if (coordCache && coordCache.has(pos)) {
|
|
67180
|
+
return coordCache.get(pos);
|
|
67181
|
+
}
|
|
67182
|
+
let result = null;
|
|
67171
67183
|
try {
|
|
67172
|
-
|
|
67184
|
+
result = view.coordsAtPos(pos).left;
|
|
67173
67185
|
} catch {
|
|
67174
67186
|
try {
|
|
67175
|
-
const ref2 = view
|
|
67187
|
+
const ref2 = getCachedDomAtPos(view, pos, domPosCache);
|
|
67176
67188
|
const range2 = document.createRange();
|
|
67177
67189
|
range2.setStart(ref2.node, ref2.offset);
|
|
67178
67190
|
range2.setEnd(ref2.node, ref2.offset);
|
|
67179
67191
|
const rect = range2.getBoundingClientRect();
|
|
67180
67192
|
range2.detach?.();
|
|
67181
|
-
|
|
67193
|
+
result = rect.left;
|
|
67182
67194
|
} catch {
|
|
67183
|
-
|
|
67195
|
+
result = null;
|
|
67184
67196
|
}
|
|
67185
67197
|
}
|
|
67198
|
+
if (coordCache) {
|
|
67199
|
+
coordCache.set(pos, result);
|
|
67200
|
+
}
|
|
67201
|
+
return result;
|
|
67202
|
+
}
|
|
67203
|
+
function getCachedDomAtPos(view, pos, domPosCache = null) {
|
|
67204
|
+
if (domPosCache && domPosCache.has(pos)) {
|
|
67205
|
+
return domPosCache.get(pos);
|
|
67206
|
+
}
|
|
67207
|
+
const result = view.domAtPos(pos);
|
|
67208
|
+
if (domPosCache) {
|
|
67209
|
+
domPosCache.set(pos, result);
|
|
67210
|
+
}
|
|
67211
|
+
return result;
|
|
67186
67212
|
}
|
|
67187
67213
|
function calcTabHeight(pos) {
|
|
67188
67214
|
const ptToPxRatio = 1.333;
|