@harbour-enterprises/superdoc 1.0.0-next.2 → 1.0.0-next.4
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-B-xTd4XY.cjs → PdfViewer-CtSTAdvv.cjs} +1 -1
- package/dist/chunks/{PdfViewer-eykNsWyi.es.js → PdfViewer-DtdN17V4.es.js} +2 -2
- package/dist/chunks/{eventemitter3-CcXAdeql.es.js → eventemitter3-44XulWQe.es.js} +1 -1
- package/dist/chunks/{index-rF5HExWB.cjs → index-Bj1kFbYe.cjs} +465 -228
- package/dist/chunks/{index-DpQ8ZYM0.es.js → index-Cxv7dMYN.es.js} +468 -231
- package/dist/chunks/{index-BDVXUeCy-7mwhYeJ7.es.js → index-D_KE9gpD-aIqhxcuF.es.js} +1 -1
- package/dist/chunks/{index-BDVXUeCy-Di6ozaOM.cjs → index-D_KE9gpD-radGpP4I.cjs} +1 -1
- package/dist/chunks/{jszip-5vvIqAEE.es.js → jszip-VP334ufO.es.js} +1 -1
- package/dist/chunks/{super-editor.es-CxajnL9u.es.js → super-editor.es-B2fSLkzN.es.js} +1033 -493
- package/dist/chunks/{super-editor.es-CcKbh84I.cjs → super-editor.es-BhQu31e4.cjs} +1032 -492
- package/dist/chunks/{vue-Dysv_7z5.es.js → vue-BuPTonTJ.es.js} +27 -27
- package/dist/chunks/xml-js-LkEmUa9-.es.js +2 -0
- package/dist/packages/superdoc/src/composables/useUiFontFamily.d.ts +42 -0
- package/dist/packages/superdoc/src/composables/useUiFontFamily.d.ts.map +1 -0
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts +3 -3
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/packages/superdoc/src/core/types/index.d.ts +4 -167
- package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
- package/dist/style.css +88 -86
- package/dist/super-editor/ai-writer.es.js +3 -3
- package/dist/super-editor/chunks/{converter-DN_dhslo.js → converter-CVqUjX24.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-Bhl_yBjL.js → docx-zipper-CsWjoVKD.js} +1 -1
- package/dist/super-editor/chunks/{editor-3klx7hyV.js → editor-Cc8nus2C.js} +429 -129
- package/dist/super-editor/chunks/{index-BDVXUeCy.js → index-D_KE9gpD.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-8YA9ltNC.js → toolbar-CoOpR1xE.js} +804 -568
- 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/style.css +22 -21
- package/dist/super-editor/super-editor.es.js +10 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +1495 -718
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/xml-js-ClO_jHnq.es.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as getCurrentInstance, p as onDeactivated, q as nextTick, s as
|
|
1
|
+
import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as getCurrentInstance, p as onDeactivated, q as nextTick, s as createVNode, u as withCtx, v as createBlock, x as unref, y as defineComponent, z as normalizeStyle, A as h, B as mergeProps, C as shallowRef, D as markRaw, E as provide, G as createTextVNode, H as toRef, I as cloneVNode, T as Text$2, J as withDirectives, K as watchEffect, L as vModelText, M as withKeys, N as reactive, O as readonly, P as Transition, Q as vShow, R as Comment, S as renderSlot, U as onActivated, V as Teleport, W as isVNode, X as onUnmounted, Y as resolveDynamicComponent, Z as normalizeProps, _ as guardReactiveProps, $ as useCssVars } from "./vue-BuPTonTJ.es.js";
|
|
2
2
|
import * as Y from "yjs";
|
|
3
3
|
import { UndoManager, Item as Item$2, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
4
4
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -42410,7 +42410,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
42410
42410
|
static getStoredSuperdocVersion(docx) {
|
|
42411
42411
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42412
42412
|
}
|
|
42413
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.
|
|
42413
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.4") {
|
|
42414
42414
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42415
42415
|
}
|
|
42416
42416
|
/**
|
|
@@ -58549,28 +58549,28 @@ const setImageNodeSelection = (view, pos) => {
|
|
|
58549
58549
|
}
|
|
58550
58550
|
return false;
|
|
58551
58551
|
};
|
|
58552
|
-
function canRenderFont(fontName,
|
|
58553
|
-
const _canRenderFont = (fontName2,
|
|
58552
|
+
function canRenderFont(fontName, uiDisplayFallbackFont = "sans-serif") {
|
|
58553
|
+
const _canRenderFont = (fontName2, uiDisplayFallbackFont2) => {
|
|
58554
58554
|
const canvas2 = document.createElement("canvas");
|
|
58555
58555
|
const ctx2 = canvas2.getContext("2d");
|
|
58556
58556
|
ctx2.textBaseline = "top";
|
|
58557
58557
|
const text = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
58558
|
-
ctx2.font = `72px ${
|
|
58558
|
+
ctx2.font = `72px ${uiDisplayFallbackFont2}`;
|
|
58559
58559
|
const initialTextMeasurement = ctx2.measureText(text);
|
|
58560
58560
|
const fallbackWidth = initialTextMeasurement.width;
|
|
58561
58561
|
const fallbackHeight = initialTextMeasurement.actualBoundingBoxDescent;
|
|
58562
|
-
ctx2.font = `72px "${fontName2}", ${
|
|
58562
|
+
ctx2.font = `72px "${fontName2}", ${uiDisplayFallbackFont2}`;
|
|
58563
58563
|
const customTextMeasurement = ctx2.measureText(text);
|
|
58564
58564
|
const customFontWidth = customTextMeasurement.width;
|
|
58565
58565
|
const customFontHeight = customTextMeasurement.actualBoundingBoxDescent;
|
|
58566
58566
|
const isAvailable = customFontWidth !== fallbackWidth || customFontHeight !== fallbackHeight;
|
|
58567
58567
|
return isAvailable;
|
|
58568
58568
|
};
|
|
58569
|
-
if (_canRenderFont(fontName,
|
|
58569
|
+
if (_canRenderFont(fontName, uiDisplayFallbackFont)) {
|
|
58570
58570
|
return true;
|
|
58571
58571
|
}
|
|
58572
|
-
const
|
|
58573
|
-
return _canRenderFont(fontName,
|
|
58572
|
+
const oppositeUiDisplayFallbackFont = uiDisplayFallbackFont === "sans-serif" ? "serif" : "sans-serif";
|
|
58573
|
+
return _canRenderFont(fontName, oppositeUiDisplayFallbackFont);
|
|
58574
58574
|
}
|
|
58575
58575
|
const { findChildren: findChildren$3 } = helpers;
|
|
58576
58576
|
function getAllFieldAnnotations(state2) {
|
|
@@ -59638,7 +59638,7 @@ const isHeadless = (editor) => {
|
|
|
59638
59638
|
const shouldSkipNodeView = (editor) => {
|
|
59639
59639
|
return isHeadless(editor);
|
|
59640
59640
|
};
|
|
59641
|
-
const summaryVersion = "1.0.0-next.
|
|
59641
|
+
const summaryVersion = "1.0.0-next.4";
|
|
59642
59642
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59643
59643
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59644
59644
|
function mapAttributes(attrs) {
|
|
@@ -60427,7 +60427,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60427
60427
|
{ default: remarkStringify },
|
|
60428
60428
|
{ default: remarkGfm }
|
|
60429
60429
|
] = await Promise.all([
|
|
60430
|
-
import("./index-
|
|
60430
|
+
import("./index-D_KE9gpD-aIqhxcuF.es.js"),
|
|
60431
60431
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
60432
60432
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
60433
60433
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -60632,7 +60632,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60632
60632
|
* Process collaboration migrations
|
|
60633
60633
|
*/
|
|
60634
60634
|
processCollaborationMigrations() {
|
|
60635
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.
|
|
60635
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.4");
|
|
60636
60636
|
if (!this.options.ydoc) return;
|
|
60637
60637
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60638
60638
|
let docVersion = metaMap.get("version");
|
|
@@ -66237,6 +66237,34 @@ function calculateTabWidth(params2) {
|
|
|
66237
66237
|
tabStopPosUsed: nextStop.pos
|
|
66238
66238
|
};
|
|
66239
66239
|
}
|
|
66240
|
+
const SPACE_CHARS$1 = /* @__PURE__ */ new Set([" ", " "]);
|
|
66241
|
+
function shouldApplyJustify(params2) {
|
|
66242
|
+
const { alignment: alignment2, hasExplicitPositioning, isLastLineOfParagraph, paragraphEndsWithLineBreak, skipJustifyOverride } = params2;
|
|
66243
|
+
if (alignment2 !== "justify" && alignment2 !== "both") {
|
|
66244
|
+
return false;
|
|
66245
|
+
}
|
|
66246
|
+
if (skipJustifyOverride === true) {
|
|
66247
|
+
return false;
|
|
66248
|
+
}
|
|
66249
|
+
if (hasExplicitPositioning) {
|
|
66250
|
+
return false;
|
|
66251
|
+
}
|
|
66252
|
+
if (isLastLineOfParagraph && !paragraphEndsWithLineBreak) {
|
|
66253
|
+
return false;
|
|
66254
|
+
}
|
|
66255
|
+
return true;
|
|
66256
|
+
}
|
|
66257
|
+
function calculateJustifySpacing(params2) {
|
|
66258
|
+
const { lineWidth, availableWidth, spaceCount, shouldJustify } = params2;
|
|
66259
|
+
if (!shouldJustify) {
|
|
66260
|
+
return 0;
|
|
66261
|
+
}
|
|
66262
|
+
if (spaceCount <= 0) {
|
|
66263
|
+
return 0;
|
|
66264
|
+
}
|
|
66265
|
+
const slack = availableWidth - lineWidth;
|
|
66266
|
+
return slack / spaceCount;
|
|
66267
|
+
}
|
|
66240
66268
|
function resolveSpacingIndent$1(style2, numbering) {
|
|
66241
66269
|
const spacing = {
|
|
66242
66270
|
before: style2.spacing?.before ?? 0,
|
|
@@ -66503,13 +66531,14 @@ const hydrateParagraphStyleAttrs = (para, context, preResolved) => {
|
|
|
66503
66531
|
};
|
|
66504
66532
|
}
|
|
66505
66533
|
}
|
|
66534
|
+
const normalizedAlign = normalizeAlignment(resolvedExtended.justification);
|
|
66506
66535
|
const hydrated = {
|
|
66507
66536
|
resolved,
|
|
66508
66537
|
spacing: resolvedSpacing,
|
|
66509
66538
|
indent: resolvedIndent,
|
|
66510
66539
|
borders: cloneIfObject(resolvedExtended.borders),
|
|
66511
66540
|
shading: cloneIfObject(resolvedExtended.shading),
|
|
66512
|
-
alignment:
|
|
66541
|
+
alignment: normalizedAlign,
|
|
66513
66542
|
tabStops: cloneIfObject(resolvedExtended.tabStops),
|
|
66514
66543
|
keepLines: resolvedExtended.keepLines,
|
|
66515
66544
|
keepNext: resolvedExtended.keepNext,
|
|
@@ -67210,7 +67239,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
67210
67239
|
} else if (styleAlignment) {
|
|
67211
67240
|
paragraphAttrs.alignment = styleAlignment;
|
|
67212
67241
|
} else if (computed2.paragraph.alignment) {
|
|
67213
|
-
paragraphAttrs.alignment = computed2.paragraph.alignment;
|
|
67242
|
+
paragraphAttrs.alignment = normalizeAlignment(computed2.paragraph.alignment);
|
|
67214
67243
|
}
|
|
67215
67244
|
const spacingPx = spacingPtToPx(spacing, normalizedSpacing);
|
|
67216
67245
|
if (spacingPx) paragraphAttrs.spacing = spacingPx;
|
|
@@ -68362,9 +68391,9 @@ const extractFirstTextRunFont = (para) => {
|
|
|
68362
68391
|
const font = findFirstTextFont(para.content);
|
|
68363
68392
|
return font;
|
|
68364
68393
|
};
|
|
68365
|
-
const applyBaseRunDefaults = (run2, defaults,
|
|
68394
|
+
const applyBaseRunDefaults = (run2, defaults, uiDisplayFallbackFont, fallbackSize) => {
|
|
68366
68395
|
if (!run2) return;
|
|
68367
|
-
if (defaults.fontFamily && run2.fontFamily ===
|
|
68396
|
+
if (defaults.fontFamily && run2.fontFamily === uiDisplayFallbackFont) {
|
|
68368
68397
|
run2.fontFamily = defaults.fontFamily;
|
|
68369
68398
|
}
|
|
68370
68399
|
if (defaults.fontSizePx != null && run2.fontSize === fallbackSize) {
|
|
@@ -70167,7 +70196,7 @@ function tableNodeToBlock(node, nextBlockId, positions, defaultFont, defaultSize
|
|
|
70167
70196
|
let measurementCanvas = null;
|
|
70168
70197
|
let measurementCtx = null;
|
|
70169
70198
|
const TAB_CHAR_LENGTH = 1;
|
|
70170
|
-
const SPACE_CHARS =
|
|
70199
|
+
const SPACE_CHARS = SPACE_CHARS$1;
|
|
70171
70200
|
const isTabRun$1 = (run2) => run2?.kind === "tab";
|
|
70172
70201
|
function getMeasurementContext() {
|
|
70173
70202
|
if (measurementCtx) return measurementCtx;
|
|
@@ -70193,29 +70222,50 @@ const countSpaces = (text) => {
|
|
|
70193
70222
|
}
|
|
70194
70223
|
return spaces;
|
|
70195
70224
|
};
|
|
70196
|
-
const getJustifyAdjustment = (block, line, availableWidthOverride, alignmentOverride) => {
|
|
70225
|
+
const getJustifyAdjustment = (block, line, availableWidthOverride, alignmentOverride, isLastLineOfParagraph, paragraphEndsWithLineBreak, skipJustifyOverride) => {
|
|
70197
70226
|
if (block.kind !== "paragraph") {
|
|
70198
70227
|
return { extraPerSpace: 0, totalSpaces: 0 };
|
|
70199
70228
|
}
|
|
70200
|
-
|
|
70201
|
-
const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
70202
|
-
const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
|
|
70203
|
-
const slack = Math.max(0, availableWidth - line.width);
|
|
70204
|
-
if (alignment2 !== "justify" || hasExplicitPositioning || slack <= 0) {
|
|
70229
|
+
if (block.runs.length === 0) {
|
|
70205
70230
|
return { extraPerSpace: 0, totalSpaces: 0 };
|
|
70206
70231
|
}
|
|
70207
|
-
const
|
|
70208
|
-
const
|
|
70209
|
-
|
|
70210
|
-
|
|
70211
|
-
|
|
70212
|
-
|
|
70213
|
-
|
|
70214
|
-
|
|
70232
|
+
const alignment2 = alignmentOverride ?? block.attrs?.alignment;
|
|
70233
|
+
const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0) ?? false;
|
|
70234
|
+
const lastRunIndex = block.runs.length - 1;
|
|
70235
|
+
const lastRun = block.runs[lastRunIndex];
|
|
70236
|
+
const derivedIsLastLine = line.toRun >= lastRunIndex;
|
|
70237
|
+
const derivedEndsWithLineBreak = lastRun ? lastRun.kind === "lineBreak" : false;
|
|
70238
|
+
const shouldJustify = shouldApplyJustify({
|
|
70239
|
+
alignment: alignment2,
|
|
70240
|
+
hasExplicitPositioning,
|
|
70241
|
+
isLastLineOfParagraph: derivedIsLastLine,
|
|
70242
|
+
paragraphEndsWithLineBreak: derivedEndsWithLineBreak,
|
|
70243
|
+
skipJustifyOverride
|
|
70244
|
+
});
|
|
70245
|
+
if (!shouldJustify) {
|
|
70215
70246
|
return { extraPerSpace: 0, totalSpaces: 0 };
|
|
70216
70247
|
}
|
|
70248
|
+
let totalSpaces = line.spaceCount ?? 0;
|
|
70249
|
+
if (totalSpaces === 0) {
|
|
70250
|
+
const runs = sliceRunsForLine$1(block, line);
|
|
70251
|
+
totalSpaces = runs.reduce((sum, run2) => {
|
|
70252
|
+
if (isTabRun$1(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation") {
|
|
70253
|
+
return sum;
|
|
70254
|
+
}
|
|
70255
|
+
return sum + countSpaces(run2.text ?? "");
|
|
70256
|
+
}, 0);
|
|
70257
|
+
}
|
|
70258
|
+
const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
|
|
70259
|
+
const lineWidth = line.naturalWidth ?? line.width;
|
|
70260
|
+
const extraPerSpace = calculateJustifySpacing({
|
|
70261
|
+
lineWidth,
|
|
70262
|
+
availableWidth,
|
|
70263
|
+
spaceCount: totalSpaces,
|
|
70264
|
+
shouldJustify: true
|
|
70265
|
+
// Already checked above
|
|
70266
|
+
});
|
|
70217
70267
|
return {
|
|
70218
|
-
extraPerSpace
|
|
70268
|
+
extraPerSpace,
|
|
70219
70269
|
totalSpaces
|
|
70220
70270
|
};
|
|
70221
70271
|
};
|
|
@@ -70282,7 +70332,7 @@ function measureCharacterX(block, line, charOffset, availableWidthOverride, alig
|
|
|
70282
70332
|
line.width;
|
|
70283
70333
|
const justify = getJustifyAdjustment(block, line, availableWidth, alignmentOverride);
|
|
70284
70334
|
const alignment2 = alignmentOverride ?? (block.kind === "paragraph" ? block.attrs?.alignment : void 0);
|
|
70285
|
-
const renderedLineWidth = alignment2 === "justify"
|
|
70335
|
+
const renderedLineWidth = alignment2 === "justify" && justify.extraPerSpace !== 0 ? availableWidth : line.width;
|
|
70286
70336
|
const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
70287
70337
|
const alignmentOffset = !hasExplicitPositioning && alignment2 === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment2 === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
|
|
70288
70338
|
if (hasExplicitPositioning && line.segments && ctx2) {
|
|
@@ -70325,13 +70375,13 @@ function measureCharacterX(block, line, charOffset, availableWidthOverride, alig
|
|
|
70325
70375
|
const textUpToTarget = text.slice(0, offsetInRun);
|
|
70326
70376
|
const measured2 = ctx2.measureText(textUpToTarget);
|
|
70327
70377
|
const spacingWidth = computeLetterSpacingWidth(run2, offsetInRun, runLength);
|
|
70328
|
-
const spacesInPortion = justify.extraPerSpace
|
|
70378
|
+
const spacesInPortion = justify.extraPerSpace !== 0 ? countSpaces(textUpToTarget) : 0;
|
|
70329
70379
|
return alignmentOffset + currentX + measured2.width + spacingWidth + justify.extraPerSpace * (spaceTally + spacesInPortion);
|
|
70330
70380
|
}
|
|
70331
70381
|
ctx2.font = getRunFontString(run2);
|
|
70332
70382
|
const measured = ctx2.measureText(text);
|
|
70333
70383
|
const runLetterSpacing = computeLetterSpacingWidth(run2, runLength, runLength);
|
|
70334
|
-
const spacesInRun = justify.extraPerSpace
|
|
70384
|
+
const spacesInRun = justify.extraPerSpace !== 0 ? countSpaces(text) : 0;
|
|
70335
70385
|
currentX += measured.width + runLetterSpacing + justify.extraPerSpace * spacesInRun;
|
|
70336
70386
|
spaceTally += spacesInRun;
|
|
70337
70387
|
currentCharOffset += runLength;
|
|
@@ -75483,9 +75533,66 @@ const _DomPainter = class _DomPainter2 {
|
|
|
75483
75533
|
const firstLineOffset = suppressFirstLineIndent ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
|
|
75484
75534
|
const lastRun = block.runs.length > 0 ? block.runs[block.runs.length - 1] : null;
|
|
75485
75535
|
const paragraphEndsWithLineBreak = lastRun?.kind === "lineBreak";
|
|
75536
|
+
let listFirstLineMarkerTabWidth;
|
|
75537
|
+
if (!fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker) {
|
|
75538
|
+
const markerBoxWidth = fragment.markerWidth;
|
|
75539
|
+
const markerTextWidth = fragment.markerTextWidth != null && isFinite(fragment.markerTextWidth) && fragment.markerTextWidth >= 0 ? fragment.markerTextWidth : markerBoxWidth;
|
|
75540
|
+
const suffix2 = wordLayout.marker.suffix ?? "tab";
|
|
75541
|
+
if (suffix2 === "tab") {
|
|
75542
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
75543
|
+
const isFirstLineIndentMode = wordLayout.firstLineIndentMode === true;
|
|
75544
|
+
let markerStartPos;
|
|
75545
|
+
if (isFirstLineIndentMode && wordLayout.marker.markerX !== void 0 && Number.isFinite(wordLayout.marker.markerX)) {
|
|
75546
|
+
markerStartPos = wordLayout.marker.markerX;
|
|
75547
|
+
} else {
|
|
75548
|
+
const hanging = paraIndent?.hanging ?? 0;
|
|
75549
|
+
const firstLine = paraIndent?.firstLine ?? 0;
|
|
75550
|
+
markerStartPos = paraIndentLeft - hanging + firstLine;
|
|
75551
|
+
}
|
|
75552
|
+
const validMarkerStartPos = Number.isFinite(markerStartPos) ? markerStartPos : 0;
|
|
75553
|
+
let tabWidth;
|
|
75554
|
+
if (markerJustification === "left") {
|
|
75555
|
+
const currentPos = validMarkerStartPos + markerTextWidth;
|
|
75556
|
+
if (isFirstLineIndentMode) {
|
|
75557
|
+
const textStartTarget = wordLayout.marker.textStartX !== void 0 && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : wordLayout.textStartPx;
|
|
75558
|
+
if (textStartTarget !== void 0 && Number.isFinite(textStartTarget) && textStartTarget > currentPos) {
|
|
75559
|
+
tabWidth = textStartTarget - currentPos;
|
|
75560
|
+
} else {
|
|
75561
|
+
tabWidth = LIST_MARKER_GAP$1;
|
|
75562
|
+
}
|
|
75563
|
+
} else {
|
|
75564
|
+
const firstLine = paraIndent?.firstLine ?? 0;
|
|
75565
|
+
const textStart = paraIndentLeft + firstLine;
|
|
75566
|
+
tabWidth = textStart - currentPos;
|
|
75567
|
+
if (tabWidth <= 0) {
|
|
75568
|
+
tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
|
|
75569
|
+
} else if (tabWidth < LIST_MARKER_GAP$1) {
|
|
75570
|
+
tabWidth = LIST_MARKER_GAP$1;
|
|
75571
|
+
}
|
|
75572
|
+
}
|
|
75573
|
+
} else {
|
|
75574
|
+
const gutterWidth = fragment.markerGutter ?? wordLayout.marker.gutterWidthPx;
|
|
75575
|
+
tabWidth = gutterWidth !== void 0 && Number.isFinite(gutterWidth) && gutterWidth > 0 ? gutterWidth : LIST_MARKER_GAP$1;
|
|
75576
|
+
}
|
|
75577
|
+
if (tabWidth < LIST_MARKER_GAP$1) {
|
|
75578
|
+
tabWidth = LIST_MARKER_GAP$1;
|
|
75579
|
+
}
|
|
75580
|
+
listFirstLineMarkerTabWidth = validMarkerStartPos + markerTextWidth + tabWidth;
|
|
75581
|
+
} else if (suffix2 === "space") {
|
|
75582
|
+
const hanging = paraIndent?.hanging ?? 0;
|
|
75583
|
+
const firstLine = paraIndent?.firstLine ?? 0;
|
|
75584
|
+
const markerStartPos = paraIndentLeft - hanging + firstLine;
|
|
75585
|
+
const validMarkerStartPos = Number.isFinite(markerStartPos) ? markerStartPos : 0;
|
|
75586
|
+
listFirstLineMarkerTabWidth = validMarkerStartPos + markerTextWidth + 4;
|
|
75587
|
+
}
|
|
75588
|
+
}
|
|
75486
75589
|
lines.forEach((line, index2) => {
|
|
75487
|
-
const
|
|
75488
|
-
const
|
|
75590
|
+
const positiveIndentReduction = Math.max(0, paraIndentLeft) + Math.max(0, paraIndentRight);
|
|
75591
|
+
const fallbackAvailableWidth = Math.max(0, fragment.width - positiveIndentReduction);
|
|
75592
|
+
let availableWidthOverride = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
|
|
75593
|
+
if (index2 === 0 && listFirstLineMarkerTabWidth != null) {
|
|
75594
|
+
availableWidthOverride = fragment.width - listFirstLineMarkerTabWidth - Math.max(0, paraIndentRight);
|
|
75595
|
+
}
|
|
75489
75596
|
const isLastLineOfFragment = index2 === lines.length - 1;
|
|
75490
75597
|
const isLastLineOfParagraph = isLastLineOfFragment && !fragment.continuesOnNext;
|
|
75491
75598
|
const shouldSkipJustifyForLastLine = isLastLineOfParagraph && !paragraphEndsWithLineBreak;
|
|
@@ -75511,7 +75618,10 @@ const _DomPainter = class _DomPainter2 {
|
|
|
75511
75618
|
}
|
|
75512
75619
|
} else if (paraIndentLeft && paraIndentLeft > 0) {
|
|
75513
75620
|
lineEl.style.paddingLeft = `${paraIndentLeft}px`;
|
|
75514
|
-
} else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0
|
|
75621
|
+
} else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0 && // Only apply hanging padding when left indent is NOT negative.
|
|
75622
|
+
// When left indent is negative, the fragment position already accounts for it.
|
|
75623
|
+
// Adding padding here would shift body lines right, causing right-side overflow.
|
|
75624
|
+
!(paraIndentLeft != null && paraIndentLeft < 0)) {
|
|
75515
75625
|
lineEl.style.paddingLeft = `${paraIndent.hanging}px`;
|
|
75516
75626
|
}
|
|
75517
75627
|
}
|
|
@@ -75540,6 +75650,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
75540
75650
|
lineEl.style.paddingLeft = `${validMarkerStartPos}px`;
|
|
75541
75651
|
const markerContainer = this.doc.createElement("span");
|
|
75542
75652
|
markerContainer.style.display = "inline-block";
|
|
75653
|
+
markerContainer.style.wordSpacing = "0px";
|
|
75543
75654
|
const markerEl = this.doc.createElement("span");
|
|
75544
75655
|
markerEl.classList.add("superdoc-paragraph-marker");
|
|
75545
75656
|
markerEl.textContent = wordLayout.marker.markerText ?? "";
|
|
@@ -75625,10 +75736,15 @@ const _DomPainter = class _DomPainter2 {
|
|
|
75625
75736
|
}
|
|
75626
75737
|
}
|
|
75627
75738
|
tabEl.style.display = "inline-block";
|
|
75739
|
+
tabEl.style.wordSpacing = "0px";
|
|
75628
75740
|
tabEl.style.width = `${tabWidth}px`;
|
|
75629
75741
|
lineEl.prepend(tabEl);
|
|
75630
75742
|
} else if (suffix2 === "space") {
|
|
75631
|
-
|
|
75743
|
+
const spaceEl = this.doc.createElement("span");
|
|
75744
|
+
spaceEl.classList.add("superdoc-marker-suffix-space");
|
|
75745
|
+
spaceEl.style.wordSpacing = "0px";
|
|
75746
|
+
spaceEl.textContent = " ";
|
|
75747
|
+
lineEl.prepend(spaceEl);
|
|
75632
75748
|
}
|
|
75633
75749
|
lineEl.prepend(markerContainer);
|
|
75634
75750
|
}
|
|
@@ -76920,11 +77036,8 @@ const _DomPainter = class _DomPainter2 {
|
|
|
76920
77036
|
el.setAttribute("styleid", styleId);
|
|
76921
77037
|
}
|
|
76922
77038
|
const alignment2 = block.attrs?.alignment;
|
|
76923
|
-
|
|
76924
|
-
|
|
76925
|
-
el.style.textAlign = effectiveAlignment;
|
|
76926
|
-
} else if (effectiveAlignment === "justify") {
|
|
76927
|
-
el.style.textAlign = "left";
|
|
77039
|
+
if (alignment2 === "center" || alignment2 === "right") {
|
|
77040
|
+
el.style.textAlign = alignment2;
|
|
76928
77041
|
} else {
|
|
76929
77042
|
el.style.textAlign = "left";
|
|
76930
77043
|
}
|
|
@@ -76935,9 +77048,8 @@ const _DomPainter = class _DomPainter2 {
|
|
|
76935
77048
|
if (lineRange.pmEnd != null) {
|
|
76936
77049
|
el.dataset.pmEnd = String(lineRange.pmEnd);
|
|
76937
77050
|
}
|
|
76938
|
-
|
|
77051
|
+
let runsForLine = sliceRunsForLine(block, line);
|
|
76939
77052
|
const trackedConfig = this.resolveTrackedChangesConfig(block);
|
|
76940
|
-
runsForLine.length > 0 ? runsForLine.filter((r2) => (r2.kind === "text" || r2.kind === void 0) && "text" in r2 && r2.text != null).map((r2) => r2.text) : gatherTextSlicesForLine(block, line);
|
|
76941
77053
|
if (runsForLine.length === 0) {
|
|
76942
77054
|
const span = this.doc.createElement("span");
|
|
76943
77055
|
span.innerHTML = " ";
|
|
@@ -76984,7 +77096,156 @@ const _DomPainter = class _DomPainter2 {
|
|
|
76984
77096
|
});
|
|
76985
77097
|
}
|
|
76986
77098
|
const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
76987
|
-
availableWidthOverride ?? line.maxWidth ?? line.width;
|
|
77099
|
+
const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
|
|
77100
|
+
const justifyShouldApply = shouldApplyJustify({
|
|
77101
|
+
alignment: block.attrs?.alignment,
|
|
77102
|
+
hasExplicitPositioning: hasExplicitPositioning ?? false,
|
|
77103
|
+
// Caller already folds last-line + trailing lineBreak behavior into skipJustify.
|
|
77104
|
+
isLastLineOfParagraph: false,
|
|
77105
|
+
paragraphEndsWithLineBreak: false,
|
|
77106
|
+
skipJustifyOverride: skipJustify
|
|
77107
|
+
});
|
|
77108
|
+
const countSpaces2 = (text) => {
|
|
77109
|
+
let count = 0;
|
|
77110
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
77111
|
+
if (SPACE_CHARS$1.has(text[i])) count += 1;
|
|
77112
|
+
}
|
|
77113
|
+
return count;
|
|
77114
|
+
};
|
|
77115
|
+
if (justifyShouldApply) {
|
|
77116
|
+
const stableDataAttrs = (attrs) => {
|
|
77117
|
+
if (!attrs) return void 0;
|
|
77118
|
+
const keys2 = Object.keys(attrs).sort();
|
|
77119
|
+
const out = {};
|
|
77120
|
+
keys2.forEach((key2) => {
|
|
77121
|
+
out[key2] = attrs[key2];
|
|
77122
|
+
});
|
|
77123
|
+
return out;
|
|
77124
|
+
};
|
|
77125
|
+
const mergeSignature = (run2) => JSON.stringify({
|
|
77126
|
+
kind: run2.kind ?? "text",
|
|
77127
|
+
fontFamily: run2.fontFamily,
|
|
77128
|
+
fontSize: run2.fontSize,
|
|
77129
|
+
bold: run2.bold ?? false,
|
|
77130
|
+
italic: run2.italic ?? false,
|
|
77131
|
+
letterSpacing: run2.letterSpacing ?? null,
|
|
77132
|
+
color: run2.color ?? null,
|
|
77133
|
+
underline: run2.underline ?? null,
|
|
77134
|
+
strike: run2.strike ?? false,
|
|
77135
|
+
highlight: run2.highlight ?? null,
|
|
77136
|
+
textTransform: run2.textTransform ?? null,
|
|
77137
|
+
token: run2.token ?? null,
|
|
77138
|
+
pageRefMetadata: run2.pageRefMetadata ?? null,
|
|
77139
|
+
trackedChange: run2.trackedChange ?? null,
|
|
77140
|
+
sdt: run2.sdt ?? null,
|
|
77141
|
+
link: run2.link ?? null,
|
|
77142
|
+
comments: run2.comments ?? null,
|
|
77143
|
+
dataAttrs: stableDataAttrs(run2.dataAttrs) ?? null
|
|
77144
|
+
});
|
|
77145
|
+
const isWhitespaceOnly = (text) => {
|
|
77146
|
+
if (text.length === 0) return false;
|
|
77147
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
77148
|
+
if (!SPACE_CHARS$1.has(text[i])) return false;
|
|
77149
|
+
}
|
|
77150
|
+
return true;
|
|
77151
|
+
};
|
|
77152
|
+
const cloneTextRun = (run2) => ({
|
|
77153
|
+
...run2,
|
|
77154
|
+
comments: run2.comments ? [...run2.comments] : void 0,
|
|
77155
|
+
dataAttrs: run2.dataAttrs ? { ...run2.dataAttrs } : void 0,
|
|
77156
|
+
underline: run2.underline ? { ...run2.underline } : void 0,
|
|
77157
|
+
pageRefMetadata: run2.pageRefMetadata ? { ...run2.pageRefMetadata } : void 0
|
|
77158
|
+
});
|
|
77159
|
+
const normalized = runsForLine.map((run2) => {
|
|
77160
|
+
if (run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2)) return run2;
|
|
77161
|
+
return cloneTextRun(run2);
|
|
77162
|
+
});
|
|
77163
|
+
const merged = [];
|
|
77164
|
+
for (let i = 0; i < normalized.length; i += 1) {
|
|
77165
|
+
const run2 = normalized[i];
|
|
77166
|
+
if (run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2)) {
|
|
77167
|
+
merged.push(run2);
|
|
77168
|
+
continue;
|
|
77169
|
+
}
|
|
77170
|
+
const textRun = run2;
|
|
77171
|
+
if (!isWhitespaceOnly(textRun.text ?? "")) {
|
|
77172
|
+
merged.push(textRun);
|
|
77173
|
+
continue;
|
|
77174
|
+
}
|
|
77175
|
+
const prev = merged[merged.length - 1];
|
|
77176
|
+
if (prev && (prev.kind === "text" || prev.kind === void 0) && "text" in prev) {
|
|
77177
|
+
const prevTextRun = prev;
|
|
77178
|
+
if (mergeSignature(prevTextRun) === mergeSignature(textRun)) {
|
|
77179
|
+
const extra = textRun.text ?? "";
|
|
77180
|
+
prevTextRun.text = (prevTextRun.text ?? "") + extra;
|
|
77181
|
+
if (prevTextRun.pmStart != null) {
|
|
77182
|
+
prevTextRun.pmEnd = prevTextRun.pmStart + prevTextRun.text.length;
|
|
77183
|
+
} else if (prevTextRun.pmEnd != null) {
|
|
77184
|
+
prevTextRun.pmEnd = prevTextRun.pmEnd + extra.length;
|
|
77185
|
+
}
|
|
77186
|
+
continue;
|
|
77187
|
+
}
|
|
77188
|
+
}
|
|
77189
|
+
const next = normalized[i + 1];
|
|
77190
|
+
if (next && (next.kind === "text" || next.kind === void 0) && "text" in next) {
|
|
77191
|
+
const nextTextRun = next;
|
|
77192
|
+
if (mergeSignature(nextTextRun) === mergeSignature(textRun)) {
|
|
77193
|
+
const extra = textRun.text ?? "";
|
|
77194
|
+
nextTextRun.text = extra + (nextTextRun.text ?? "");
|
|
77195
|
+
if (textRun.pmStart != null) {
|
|
77196
|
+
nextTextRun.pmStart = textRun.pmStart;
|
|
77197
|
+
} else if (nextTextRun.pmStart != null) {
|
|
77198
|
+
nextTextRun.pmStart = nextTextRun.pmStart - extra.length;
|
|
77199
|
+
}
|
|
77200
|
+
if (nextTextRun.pmStart != null && nextTextRun.pmEnd == null) {
|
|
77201
|
+
nextTextRun.pmEnd = nextTextRun.pmStart + nextTextRun.text.length;
|
|
77202
|
+
}
|
|
77203
|
+
continue;
|
|
77204
|
+
}
|
|
77205
|
+
}
|
|
77206
|
+
merged.push(textRun);
|
|
77207
|
+
}
|
|
77208
|
+
runsForLine = merged;
|
|
77209
|
+
const hasNonSpaceText = runsForLine.some(
|
|
77210
|
+
(run2) => (run2.kind === "text" || run2.kind === void 0) && "text" in run2 && (run2.text ?? "").trim().length > 0
|
|
77211
|
+
);
|
|
77212
|
+
if (hasNonSpaceText) {
|
|
77213
|
+
for (let i = runsForLine.length - 1; i >= 0; i -= 1) {
|
|
77214
|
+
const run2 = runsForLine[i];
|
|
77215
|
+
if (run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2)) continue;
|
|
77216
|
+
const text = run2.text ?? "";
|
|
77217
|
+
let trimCount = 0;
|
|
77218
|
+
for (let j2 = text.length - 1; j2 >= 0 && text[j2] === " "; j2 -= 1) {
|
|
77219
|
+
trimCount += 1;
|
|
77220
|
+
}
|
|
77221
|
+
if (trimCount === 0) break;
|
|
77222
|
+
const nextText = text.slice(0, Math.max(0, text.length - trimCount));
|
|
77223
|
+
if (nextText.length === 0) {
|
|
77224
|
+
runsForLine.splice(i, 1);
|
|
77225
|
+
continue;
|
|
77226
|
+
}
|
|
77227
|
+
run2.text = nextText;
|
|
77228
|
+
if (run2.pmEnd != null) {
|
|
77229
|
+
run2.pmEnd = run2.pmEnd - trimCount;
|
|
77230
|
+
}
|
|
77231
|
+
break;
|
|
77232
|
+
}
|
|
77233
|
+
}
|
|
77234
|
+
}
|
|
77235
|
+
const spaceCount = line.spaceCount ?? runsForLine.reduce((sum, run2) => {
|
|
77236
|
+
if (run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2) || run2.text == null) return sum;
|
|
77237
|
+
return sum + countSpaces2(run2.text);
|
|
77238
|
+
}, 0);
|
|
77239
|
+
const lineWidth = line.naturalWidth ?? line.width;
|
|
77240
|
+
const spacingPerSpace = calculateJustifySpacing({
|
|
77241
|
+
lineWidth,
|
|
77242
|
+
availableWidth,
|
|
77243
|
+
spaceCount,
|
|
77244
|
+
shouldJustify: justifyShouldApply
|
|
77245
|
+
});
|
|
77246
|
+
if (spacingPerSpace !== 0) {
|
|
77247
|
+
el.style.wordSpacing = `${spacingPerSpace}px`;
|
|
77248
|
+
}
|
|
76988
77249
|
if (hasExplicitPositioning && line.segments) {
|
|
76989
77250
|
const paraIndent = block.attrs?.indent;
|
|
76990
77251
|
const indentLeft = paraIndent?.left ?? 0;
|
|
@@ -77856,7 +78117,7 @@ const applyParagraphBlockStyles = (element, attrs) => {
|
|
|
77856
78117
|
element.setAttribute("styleid", attrs.styleId);
|
|
77857
78118
|
}
|
|
77858
78119
|
if (attrs.alignment) {
|
|
77859
|
-
element.style.textAlign = attrs.alignment;
|
|
78120
|
+
element.style.textAlign = attrs.alignment === "justify" || attrs.alignment === "both" ? "left" : attrs.alignment;
|
|
77860
78121
|
}
|
|
77861
78122
|
if (attrs.dropCap) {
|
|
77862
78123
|
element.classList.add("sd-editor-dropcap");
|
|
@@ -77921,23 +78182,6 @@ const applyParagraphShadingStyles = (element, shading) => {
|
|
|
77921
78182
|
if (!shading?.fill) return;
|
|
77922
78183
|
element.style.backgroundColor = shading.fill;
|
|
77923
78184
|
};
|
|
77924
|
-
const gatherTextSlicesForLine = (block, line) => {
|
|
77925
|
-
const slices = [];
|
|
77926
|
-
const startRun = line.fromRun ?? 0;
|
|
77927
|
-
const endRun = line.toRun ?? startRun;
|
|
77928
|
-
for (let runIndex = startRun; runIndex <= endRun; runIndex += 1) {
|
|
77929
|
-
const run2 = block.runs[runIndex];
|
|
77930
|
-
if (!run2 || run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2) || !run2.text) continue;
|
|
77931
|
-
const isFirst = runIndex === startRun;
|
|
77932
|
-
const isLast = runIndex === endRun;
|
|
77933
|
-
const start2 = isFirst ? line.fromChar ?? 0 : 0;
|
|
77934
|
-
const end2 = isLast ? line.toChar ?? run2.text.length : run2.text.length;
|
|
77935
|
-
if (start2 >= end2) continue;
|
|
77936
|
-
const slice2 = run2.text.slice(start2, end2);
|
|
77937
|
-
if (slice2) slices.push(slice2);
|
|
77938
|
-
}
|
|
77939
|
-
return slices;
|
|
77940
|
-
};
|
|
77941
78185
|
const sliceRunsForLine = (block, line) => {
|
|
77942
78186
|
const result = [];
|
|
77943
78187
|
for (let runIndex = line.fromRun; runIndex <= line.toRun; runIndex += 1) {
|
|
@@ -78559,7 +78803,8 @@ function calculateTextStartIndent(params2) {
|
|
|
78559
78803
|
let indentAdjust = paraIndentLeft;
|
|
78560
78804
|
if (isListItem2 && isFirstLine && isFirstLineIndentMode) {
|
|
78561
78805
|
const textStartFallback = paraIndentLeft + Math.max(firstLineIndent, 0) + markerWidth;
|
|
78562
|
-
|
|
78806
|
+
const markerTextStartX = wordLayout?.marker?.textStartX;
|
|
78807
|
+
indentAdjust = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : textStartFallback;
|
|
78563
78808
|
} else if (isFirstLine && !isListItem2) {
|
|
78564
78809
|
indentAdjust += firstLineOffset;
|
|
78565
78810
|
}
|
|
@@ -79249,6 +79494,20 @@ const asSafeNumber = (value) => {
|
|
|
79249
79494
|
}
|
|
79250
79495
|
return value;
|
|
79251
79496
|
};
|
|
79497
|
+
function calculateFirstLineIndent(block, measure) {
|
|
79498
|
+
const wordLayout = block.attrs?.wordLayout;
|
|
79499
|
+
if (!wordLayout?.firstLineIndentMode) {
|
|
79500
|
+
return 0;
|
|
79501
|
+
}
|
|
79502
|
+
if (!wordLayout.marker || !measure.marker) {
|
|
79503
|
+
return 0;
|
|
79504
|
+
}
|
|
79505
|
+
const markerWidthRaw = measure.marker.markerWidth ?? wordLayout.marker.markerBoxWidthPx ?? 0;
|
|
79506
|
+
const markerWidth = Number.isFinite(markerWidthRaw) && markerWidthRaw >= 0 ? markerWidthRaw : 0;
|
|
79507
|
+
const gutterWidthRaw = measure.marker.gutterWidth ?? 0;
|
|
79508
|
+
const gutterWidth = Number.isFinite(gutterWidthRaw) && gutterWidthRaw >= 0 ? gutterWidthRaw : 0;
|
|
79509
|
+
return markerWidth + gutterWidth;
|
|
79510
|
+
}
|
|
79252
79511
|
function layoutParagraphBlock(ctx2, anchors) {
|
|
79253
79512
|
const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
|
|
79254
79513
|
const remeasureParagraph2 = ctx2.remeasureParagraph;
|
|
@@ -79378,17 +79637,8 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
79378
79637
|
const remeasureWidth = Math.max(1, columnWidth - indentLeft - indentRight);
|
|
79379
79638
|
let didRemeasureForColumnWidth = false;
|
|
79380
79639
|
if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
|
|
79381
|
-
|
|
79382
|
-
const
|
|
79383
|
-
if (wordLayout?.marker && measure.marker) {
|
|
79384
|
-
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
79385
|
-
if (markerJustification === "left") {
|
|
79386
|
-
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
79387
|
-
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
79388
|
-
firstLineIndent = markerWidth + gutterWidth;
|
|
79389
|
-
}
|
|
79390
|
-
}
|
|
79391
|
-
const newMeasure = remeasureParagraph2(block, remeasureWidth, firstLineIndent);
|
|
79640
|
+
const firstLineIndent = calculateFirstLineIndent(block, measure);
|
|
79641
|
+
const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
|
|
79392
79642
|
lines = normalizeLines(newMeasure);
|
|
79393
79643
|
didRemeasureForColumnWidth = true;
|
|
79394
79644
|
}
|
|
@@ -79469,16 +79719,7 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
79469
79719
|
}
|
|
79470
79720
|
const narrowestRemeasureWidth = Math.max(1, narrowestWidth - indentLeft - indentRight);
|
|
79471
79721
|
if (narrowestRemeasureWidth < remeasureWidth) {
|
|
79472
|
-
|
|
79473
|
-
const wordLayout = block.attrs?.wordLayout;
|
|
79474
|
-
if (wordLayout?.marker && measure.marker) {
|
|
79475
|
-
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
79476
|
-
if (markerJustification === "left") {
|
|
79477
|
-
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
79478
|
-
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
79479
|
-
firstLineIndent = markerWidth + gutterWidth;
|
|
79480
|
-
}
|
|
79481
|
-
}
|
|
79722
|
+
const firstLineIndent = calculateFirstLineIndent(block, measure);
|
|
79482
79723
|
const newMeasure = remeasureParagraph2(block, narrowestRemeasureWidth, firstLineIndent);
|
|
79483
79724
|
lines = normalizeLines(newMeasure);
|
|
79484
79725
|
didRemeasureForFloats = true;
|
|
@@ -82625,7 +82866,8 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
82625
82866
|
const indentHanging = Math.max(0, indent?.hanging ?? 0);
|
|
82626
82867
|
const rawFirstLineOffset = Math.max(0, firstLineIndent || indentFirstLine - indentHanging);
|
|
82627
82868
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
82628
|
-
const
|
|
82869
|
+
const markerTextStartX = wordLayout?.marker?.textStartX;
|
|
82870
|
+
const textStartPx = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : void 0;
|
|
82629
82871
|
const treatAsHanging = textStartPx && indentLeft === 0 && indentHanging === 0;
|
|
82630
82872
|
const firstLineWidth = typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging ? Math.max(1, maxWidth - textStartPx - indentRight) : Math.max(1, contentWidth - rawFirstLineOffset);
|
|
82631
82873
|
const tabStops = buildTabStopsPx$1(indent, attrs?.tabs, attrs?.tabIntervalTwips);
|
|
@@ -82637,6 +82879,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
82637
82879
|
const startRun = currentRun;
|
|
82638
82880
|
const startChar = currentChar;
|
|
82639
82881
|
let width = 0;
|
|
82882
|
+
let widthAtLastBreak = -1;
|
|
82640
82883
|
let lastBreakRun = -1;
|
|
82641
82884
|
let lastBreakChar = -1;
|
|
82642
82885
|
let endRun = currentRun;
|
|
@@ -82654,6 +82897,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
82654
82897
|
endChar = 1;
|
|
82655
82898
|
lastBreakRun = r2;
|
|
82656
82899
|
lastBreakChar = 1;
|
|
82900
|
+
widthAtLastBreak = width;
|
|
82657
82901
|
continue;
|
|
82658
82902
|
}
|
|
82659
82903
|
const text = runText(run2);
|
|
@@ -82664,6 +82908,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
82664
82908
|
if (lastBreakRun >= 0) {
|
|
82665
82909
|
endRun = lastBreakRun;
|
|
82666
82910
|
endChar = lastBreakChar;
|
|
82911
|
+
width = widthAtLastBreak >= 0 ? widthAtLastBreak : width;
|
|
82667
82912
|
} else {
|
|
82668
82913
|
endRun = r2;
|
|
82669
82914
|
endChar = c2;
|
|
@@ -82678,6 +82923,7 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
|
82678
82923
|
if (ch === " " || ch === " " || ch === "-") {
|
|
82679
82924
|
lastBreakRun = r2;
|
|
82680
82925
|
lastBreakChar = c2 + 1;
|
|
82926
|
+
widthAtLastBreak = width;
|
|
82681
82927
|
}
|
|
82682
82928
|
}
|
|
82683
82929
|
if (didBreakInThisLine) break;
|
|
@@ -84388,7 +84634,9 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
|
|
|
84388
84634
|
}
|
|
84389
84635
|
const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
84390
84636
|
const isListItem3 = markerWidth > 0;
|
|
84391
|
-
const
|
|
84637
|
+
const paraAlignment = block.attrs?.alignment;
|
|
84638
|
+
const isJustified = paraAlignment === "justify" || paraAlignment === "both";
|
|
84639
|
+
const alignmentOverride = isListItem3 && !isJustified ? "left" : void 0;
|
|
84392
84640
|
const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth, alignmentOverride);
|
|
84393
84641
|
if (pos == null) {
|
|
84394
84642
|
logClickStage("warn", "no-position", {
|
|
@@ -84455,7 +84703,9 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
|
|
|
84455
84703
|
}
|
|
84456
84704
|
const cellMarkerWidth = cellMeasure.marker?.markerWidth ?? 0;
|
|
84457
84705
|
const isListItem3 = cellMarkerWidth > 0;
|
|
84458
|
-
const
|
|
84706
|
+
const cellAlignment = cellBlock.attrs?.alignment;
|
|
84707
|
+
const isJustified = cellAlignment === "justify" || cellAlignment === "both";
|
|
84708
|
+
const alignmentOverride = isListItem3 && !isJustified ? "left" : void 0;
|
|
84459
84709
|
const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth, alignmentOverride);
|
|
84460
84710
|
if (pos != null) {
|
|
84461
84711
|
logClickStage("log", "success", {
|
|
@@ -84624,7 +84874,9 @@ function selectionToRects(layout, blocks, measures, from2, to, geometryHelper) {
|
|
|
84624
84874
|
const charOffsetTo = pmPosToCharOffset(block, line, sliceTo);
|
|
84625
84875
|
const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
84626
84876
|
const isListItemFlag = isListItem(markerWidth, block);
|
|
84627
|
-
const
|
|
84877
|
+
const blockAlignment = block.attrs?.alignment;
|
|
84878
|
+
const isJustified = blockAlignment === "justify" || blockAlignment === "both";
|
|
84879
|
+
const alignmentOverride = isListItemFlag && !isJustified ? "left" : void 0;
|
|
84628
84880
|
const startX = mapPmToX(block, line, charOffsetFrom, fragment.width, alignmentOverride);
|
|
84629
84881
|
const endX = mapPmToX(block, line, charOffsetTo, fragment.width, alignmentOverride);
|
|
84630
84882
|
const indent = extractParagraphIndent(block.attrs?.indent);
|
|
@@ -85366,7 +85618,9 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85366
85618
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
85367
85619
|
const bodyContentWidth = contentWidth;
|
|
85368
85620
|
let initialAvailableWidth;
|
|
85369
|
-
const
|
|
85621
|
+
const rawTextStartPx = wordLayout?.textStartPx;
|
|
85622
|
+
const markerTextStartX = wordLayout?.marker?.textStartX;
|
|
85623
|
+
const textStartPx = typeof markerTextStartX === "number" && Number.isFinite(markerTextStartX) ? markerTextStartX : typeof rawTextStartPx === "number" && Number.isFinite(rawTextStartPx) ? rawTextStartPx : void 0;
|
|
85370
85624
|
if (typeof textStartPx === "number" && textStartPx > indentLeft) {
|
|
85371
85625
|
initialAvailableWidth = Math.max(1, maxWidth - textStartPx - indentRight);
|
|
85372
85626
|
} else {
|
|
@@ -85501,12 +85755,40 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85501
85755
|
runsToProcess.push(run2);
|
|
85502
85756
|
}
|
|
85503
85757
|
}
|
|
85758
|
+
const trimTrailingWrapSpaces = (lineToTrim) => {
|
|
85759
|
+
const lastRun = runsToProcess[lineToTrim.toRun];
|
|
85760
|
+
if (!lastRun || !("text" in lastRun) || typeof lastRun.text !== "string") return;
|
|
85761
|
+
const sliceStart = lineToTrim.toRun === lineToTrim.fromRun ? lineToTrim.fromChar : 0;
|
|
85762
|
+
const sliceEnd = lineToTrim.toChar;
|
|
85763
|
+
if (sliceEnd <= sliceStart) return;
|
|
85764
|
+
const sliceText = lastRun.text.slice(sliceStart, sliceEnd);
|
|
85765
|
+
let trimCount = 0;
|
|
85766
|
+
for (let i = sliceText.length - 1; i >= 0 && sliceText[i] === " "; i -= 1) {
|
|
85767
|
+
trimCount += 1;
|
|
85768
|
+
}
|
|
85769
|
+
if (trimCount === 0) return;
|
|
85770
|
+
if (lineToTrim.fromRun === lineToTrim.toRun && sliceText.trim().length === 0) {
|
|
85771
|
+
return;
|
|
85772
|
+
}
|
|
85773
|
+
const keptText = sliceText.slice(0, Math.max(0, sliceText.length - trimCount));
|
|
85774
|
+
const { font } = buildFontString(
|
|
85775
|
+
lastRun
|
|
85776
|
+
);
|
|
85777
|
+
const fullWidth = measureRunWidth(sliceText, font, ctx2, lastRun);
|
|
85778
|
+
const keptWidth = keptText.length > 0 ? measureRunWidth(keptText, font, ctx2, lastRun) : 0;
|
|
85779
|
+
const delta = Math.max(0, fullWidth - keptWidth);
|
|
85780
|
+
lineToTrim.width = roundValue(Math.max(0, lineToTrim.width - delta));
|
|
85781
|
+
lineToTrim.spaceCount = Math.max(0, lineToTrim.spaceCount - trimCount);
|
|
85782
|
+
if (lineToTrim.naturalWidth != null && typeof lineToTrim.naturalWidth === "number") {
|
|
85783
|
+
lineToTrim.naturalWidth = roundValue(Math.max(0, lineToTrim.naturalWidth - delta));
|
|
85784
|
+
}
|
|
85785
|
+
};
|
|
85504
85786
|
for (let runIndex = 0; runIndex < runsToProcess.length; runIndex++) {
|
|
85505
85787
|
const run2 = runsToProcess[runIndex];
|
|
85506
85788
|
if (run2.kind === "break") {
|
|
85507
85789
|
if (currentLine) {
|
|
85508
85790
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
85509
|
-
const
|
|
85791
|
+
const lineBase = currentLine;
|
|
85510
85792
|
const completedLine = { ...lineBase, ...metrics };
|
|
85511
85793
|
addBarTabsToLine(completedLine);
|
|
85512
85794
|
lines.push(completedLine);
|
|
@@ -85551,7 +85833,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85551
85833
|
toRun: runIndex,
|
|
85552
85834
|
toChar: 0,
|
|
85553
85835
|
width: 0,
|
|
85554
|
-
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
85836
|
+
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
85555
85837
|
segments: [],
|
|
85556
85838
|
...metrics
|
|
85557
85839
|
};
|
|
@@ -85586,7 +85868,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85586
85868
|
width: 0,
|
|
85587
85869
|
maxFontSize: 12,
|
|
85588
85870
|
// Default font size for tabs
|
|
85589
|
-
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
85871
|
+
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
85590
85872
|
segments: [],
|
|
85591
85873
|
spaceCount: 0
|
|
85592
85874
|
};
|
|
@@ -85636,7 +85918,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85636
85918
|
width: imageWidth,
|
|
85637
85919
|
maxFontSize: imageHeight,
|
|
85638
85920
|
// Use image height for line height calculation
|
|
85639
|
-
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
85921
|
+
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
85640
85922
|
spaceCount: 0,
|
|
85641
85923
|
segments: [
|
|
85642
85924
|
{
|
|
@@ -85652,8 +85934,9 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85652
85934
|
}
|
|
85653
85935
|
const appliedTabAlign = lastAppliedTabAlign;
|
|
85654
85936
|
if (currentLine.width + imageWidth > currentLine.maxWidth && currentLine.width > 0) {
|
|
85937
|
+
trimTrailingWrapSpaces(currentLine);
|
|
85655
85938
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
85656
|
-
const
|
|
85939
|
+
const lineBase = currentLine;
|
|
85657
85940
|
const completedLine = {
|
|
85658
85941
|
...lineBase,
|
|
85659
85942
|
...metrics
|
|
@@ -85726,7 +86009,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85726
86009
|
// Field annotations are atomic units
|
|
85727
86010
|
width: annotationWidth,
|
|
85728
86011
|
maxFontSize: annotationHeight,
|
|
85729
|
-
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
86012
|
+
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
85730
86013
|
spaceCount: 0,
|
|
85731
86014
|
segments: [
|
|
85732
86015
|
{
|
|
@@ -85741,8 +86024,9 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85741
86024
|
continue;
|
|
85742
86025
|
}
|
|
85743
86026
|
if (currentLine.width + annotationWidth > currentLine.maxWidth && currentLine.width > 0) {
|
|
86027
|
+
trimTrailingWrapSpaces(currentLine);
|
|
85744
86028
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
85745
|
-
const
|
|
86029
|
+
const lineBase = currentLine;
|
|
85746
86030
|
const completedLine = {
|
|
85747
86031
|
...lineBase,
|
|
85748
86032
|
...metrics
|
|
@@ -85815,15 +86099,16 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85815
86099
|
width: spacesWidth,
|
|
85816
86100
|
maxFontSize: run2.fontSize,
|
|
85817
86101
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
85818
|
-
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
86102
|
+
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
85819
86103
|
segments: [{ runIndex, fromChar: spacesStartChar, toChar: spacesEndChar, width: spacesWidth }],
|
|
85820
86104
|
spaceCount: spacesLength
|
|
85821
86105
|
};
|
|
85822
86106
|
} else {
|
|
85823
86107
|
const boundarySpacing = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
|
|
85824
86108
|
if (currentLine.width + boundarySpacing + spacesWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
|
|
86109
|
+
trimTrailingWrapSpaces(currentLine);
|
|
85825
86110
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
85826
|
-
const
|
|
86111
|
+
const lineBase = currentLine;
|
|
85827
86112
|
const completedLine = {
|
|
85828
86113
|
...lineBase,
|
|
85829
86114
|
...metrics
|
|
@@ -85859,6 +86144,13 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85859
86144
|
continue;
|
|
85860
86145
|
}
|
|
85861
86146
|
const words = segment.split(" ");
|
|
86147
|
+
let lastNonEmptyWordIndex = -1;
|
|
86148
|
+
for (let i = words.length - 1; i >= 0; i -= 1) {
|
|
86149
|
+
if (words[i] !== "") {
|
|
86150
|
+
lastNonEmptyWordIndex = i;
|
|
86151
|
+
break;
|
|
86152
|
+
}
|
|
86153
|
+
}
|
|
85862
86154
|
let segmentStartX;
|
|
85863
86155
|
if (currentLine && pendingTabAlignment) {
|
|
85864
86156
|
segmentStartX = alignSegmentAtTab(segment, font, run2);
|
|
@@ -85881,15 +86173,16 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85881
86173
|
width: singleSpaceWidth,
|
|
85882
86174
|
maxFontSize: run2.fontSize,
|
|
85883
86175
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
85884
|
-
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
86176
|
+
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
85885
86177
|
segments: [{ runIndex, fromChar: spaceStartChar, toChar: spaceEndChar, width: singleSpaceWidth }],
|
|
85886
86178
|
spaceCount: 1
|
|
85887
86179
|
};
|
|
85888
86180
|
} else {
|
|
85889
86181
|
const boundarySpacing2 = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
|
|
85890
86182
|
if (currentLine.width + boundarySpacing2 + singleSpaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
|
|
86183
|
+
trimTrailingWrapSpaces(currentLine);
|
|
85891
86184
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
85892
|
-
const
|
|
86185
|
+
const lineBase = currentLine;
|
|
85893
86186
|
const completedLine = { ...lineBase, ...metrics };
|
|
85894
86187
|
addBarTabsToLine(completedLine);
|
|
85895
86188
|
lines.push(completedLine);
|
|
@@ -85921,19 +86214,19 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85921
86214
|
charPosInRun = spaceEndChar;
|
|
85922
86215
|
continue;
|
|
85923
86216
|
}
|
|
85924
|
-
const isLastWordInSegment = wordIndex === words.length - 1;
|
|
85925
|
-
const isLastWord = isLastWordInSegment && isLastSegment;
|
|
85926
86217
|
const wordOnlyWidth = measureRunWidth(word, font, ctx2, run2);
|
|
85927
|
-
const
|
|
85928
|
-
const
|
|
86218
|
+
const shouldIncludeDelimiterSpace = wordIndex < lastNonEmptyWordIndex;
|
|
86219
|
+
const spaceWidth = shouldIncludeDelimiterSpace ? measureRunWidth(" ", font, ctx2, run2) : 0;
|
|
86220
|
+
const wordCommitWidth = wordOnlyWidth + spaceWidth;
|
|
85929
86221
|
const wordStartChar = charPosInRun;
|
|
85930
86222
|
const wordEndNoSpace = charPosInRun + word.length;
|
|
85931
|
-
const wordEndWithSpace =
|
|
86223
|
+
const wordEndWithSpace = wordEndNoSpace + (shouldIncludeDelimiterSpace ? 1 : 0);
|
|
85932
86224
|
const effectiveMaxWidth = currentLine ? currentLine.maxWidth : getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
|
|
85933
86225
|
if (wordOnlyWidth > effectiveMaxWidth && word.length > 1) {
|
|
85934
86226
|
if (currentLine && currentLine.width > 0 && currentLine.segments && currentLine.segments.length > 0) {
|
|
86227
|
+
trimTrailingWrapSpaces(currentLine);
|
|
85935
86228
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
85936
|
-
const
|
|
86229
|
+
const lineBase = currentLine;
|
|
85937
86230
|
const completedLine = { ...lineBase, ...metrics };
|
|
85938
86231
|
addBarTabsToLine(completedLine);
|
|
85939
86232
|
lines.push(completedLine);
|
|
@@ -85967,7 +86260,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85967
86260
|
});
|
|
85968
86261
|
if (isLastChunk) {
|
|
85969
86262
|
const ls = run2.letterSpacing ?? 0;
|
|
85970
|
-
if (
|
|
86263
|
+
if (shouldIncludeDelimiterSpace && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
85971
86264
|
currentLine.toChar = wordEndWithSpace;
|
|
85972
86265
|
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
85973
86266
|
charPosInRun = wordEndWithSpace;
|
|
@@ -85976,8 +86269,9 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85976
86269
|
charPosInRun = wordEndWithSpace;
|
|
85977
86270
|
}
|
|
85978
86271
|
} else {
|
|
86272
|
+
trimTrailingWrapSpaces(currentLine);
|
|
85979
86273
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
85980
|
-
const
|
|
86274
|
+
const lineBase = currentLine;
|
|
85981
86275
|
const completedLine = { ...lineBase, ...metrics };
|
|
85982
86276
|
addBarTabsToLine(completedLine);
|
|
85983
86277
|
lines.push(completedLine);
|
|
@@ -85999,7 +86293,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
85999
86293
|
spaceCount: 0
|
|
86000
86294
|
};
|
|
86001
86295
|
const ls = run2.letterSpacing ?? 0;
|
|
86002
|
-
if (
|
|
86296
|
+
if (shouldIncludeDelimiterSpace && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
86003
86297
|
currentLine.toChar = wordEndWithSpace;
|
|
86004
86298
|
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
86005
86299
|
charPosInRun = wordEndWithSpace;
|
|
@@ -86036,12 +86330,12 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
86036
86330
|
width: wordOnlyWidth,
|
|
86037
86331
|
maxFontSize: run2.fontSize,
|
|
86038
86332
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
86039
|
-
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
86333
|
+
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
86040
86334
|
segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
|
|
86041
86335
|
spaceCount: 0
|
|
86042
86336
|
};
|
|
86043
86337
|
const ls = run2.letterSpacing ?? 0;
|
|
86044
|
-
if (
|
|
86338
|
+
if (shouldIncludeDelimiterSpace && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
86045
86339
|
currentLine.toChar = wordEndWithSpace;
|
|
86046
86340
|
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
86047
86341
|
charPosInRun = wordEndWithSpace;
|
|
@@ -86055,15 +86349,16 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
86055
86349
|
const boundarySpacing = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
|
|
86056
86350
|
const justifyAlignment = block.attrs?.alignment === "justify";
|
|
86057
86351
|
const totalWidthWithWord = currentLine.width + boundarySpacing + wordCommitWidth + // Safe cast: only TextRuns produce word segments from split(), other run types are handled earlier
|
|
86058
|
-
(
|
|
86352
|
+
(shouldIncludeDelimiterSpace ? run2.letterSpacing ?? 0 : 0);
|
|
86059
86353
|
const availableWidth = currentLine.maxWidth - WIDTH_FUDGE_PX2;
|
|
86060
86354
|
let shouldBreak = currentLine.width + boundarySpacing + wordOnlyWidth > availableWidth && currentLine.width > 0 && !isTocEntry;
|
|
86061
86355
|
let compressedWidth = null;
|
|
86062
86356
|
if (shouldBreak && justifyAlignment) {
|
|
86063
|
-
const
|
|
86357
|
+
const isLastNonEmptyWordInSegment = wordIndex === lastNonEmptyWordIndex;
|
|
86358
|
+
const isParagraphLastWord = isLastSegment && isLastNonEmptyWordInSegment && runIndex === runsToProcess.length - 1;
|
|
86064
86359
|
if (!isParagraphLastWord) {
|
|
86065
86360
|
const existingSpaces = currentLine.spaceCount ?? 0;
|
|
86066
|
-
const candidateSpaces = existingSpaces + (
|
|
86361
|
+
const candidateSpaces = existingSpaces + (shouldIncludeDelimiterSpace ? 1 : 0);
|
|
86067
86362
|
if (candidateSpaces > 0) {
|
|
86068
86363
|
const overflow = totalWidthWithWord - availableWidth;
|
|
86069
86364
|
if (overflow > 0) {
|
|
@@ -86079,8 +86374,9 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
86079
86374
|
}
|
|
86080
86375
|
}
|
|
86081
86376
|
if (shouldBreak) {
|
|
86377
|
+
trimTrailingWrapSpaces(currentLine);
|
|
86082
86378
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
86083
|
-
const
|
|
86379
|
+
const lineBase = currentLine;
|
|
86084
86380
|
const completedLine = {
|
|
86085
86381
|
...lineBase,
|
|
86086
86382
|
...metrics
|
|
@@ -86101,7 +86397,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
86101
86397
|
segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
|
|
86102
86398
|
spaceCount: 0
|
|
86103
86399
|
};
|
|
86104
|
-
if (
|
|
86400
|
+
if (shouldIncludeDelimiterSpace && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
86105
86401
|
currentLine.toChar = wordEndWithSpace;
|
|
86106
86402
|
currentLine.width = roundValue(currentLine.width + spaceWidth + (run2.letterSpacing ?? 0));
|
|
86107
86403
|
charPosInRun = wordEndWithSpace;
|
|
@@ -86111,7 +86407,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
86111
86407
|
}
|
|
86112
86408
|
} else {
|
|
86113
86409
|
currentLine.toRun = runIndex;
|
|
86114
|
-
if (
|
|
86410
|
+
if (shouldIncludeDelimiterSpace && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
86115
86411
|
currentLine.toChar = wordEndNoSpace;
|
|
86116
86412
|
currentLine.width = roundValue(currentLine.width + boundarySpacing + wordOnlyWidth);
|
|
86117
86413
|
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
@@ -86125,8 +86421,9 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
86125
86421
|
wordOnlyWidth,
|
|
86126
86422
|
useExplicitXHere ? segmentStartX : void 0
|
|
86127
86423
|
);
|
|
86424
|
+
trimTrailingWrapSpaces(currentLine);
|
|
86128
86425
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
86129
|
-
const
|
|
86426
|
+
const lineBase = currentLine;
|
|
86130
86427
|
const completedLine = { ...lineBase, ...metrics };
|
|
86131
86428
|
addBarTabsToLine(completedLine);
|
|
86132
86429
|
lines.push(completedLine);
|
|
@@ -86136,20 +86433,23 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
86136
86433
|
charPosInRun = wordEndNoSpace + 1;
|
|
86137
86434
|
continue;
|
|
86138
86435
|
}
|
|
86139
|
-
const newToChar =
|
|
86436
|
+
const newToChar = shouldIncludeDelimiterSpace ? wordEndWithSpace : wordEndNoSpace;
|
|
86140
86437
|
currentLine.toChar = newToChar;
|
|
86141
86438
|
const useExplicitX = wordIndex === 0 && segmentStartX !== void 0;
|
|
86142
86439
|
const explicitX = useExplicitX ? segmentStartX : void 0;
|
|
86143
|
-
const targetWidth = compressedWidth != null ? compressedWidth : currentLine.width + boundarySpacing + wordCommitWidth + (
|
|
86440
|
+
const targetWidth = compressedWidth != null ? compressedWidth : currentLine.width + boundarySpacing + wordCommitWidth + (shouldIncludeDelimiterSpace ? run2.letterSpacing ?? 0 : 0);
|
|
86441
|
+
if (compressedWidth != null) {
|
|
86442
|
+
currentLine.naturalWidth = roundValue(totalWidthWithWord);
|
|
86443
|
+
}
|
|
86144
86444
|
currentLine.width = roundValue(targetWidth);
|
|
86145
86445
|
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
86146
86446
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run2.fontSize);
|
|
86147
86447
|
appendSegment(currentLine.segments, runIndex, wordStartChar, newToChar, wordCommitWidth, explicitX);
|
|
86148
|
-
if (
|
|
86448
|
+
if (shouldIncludeDelimiterSpace) {
|
|
86149
86449
|
currentLine.spaceCount += 1;
|
|
86150
86450
|
}
|
|
86151
86451
|
}
|
|
86152
|
-
charPosInRun =
|
|
86452
|
+
charPosInRun = shouldIncludeDelimiterSpace ? wordEndWithSpace : wordEndNoSpace;
|
|
86153
86453
|
}
|
|
86154
86454
|
if (lastAppliedTabAlign && currentLine) {
|
|
86155
86455
|
const appliedTab = lastAppliedTabAlign;
|
|
@@ -86169,7 +86469,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
86169
86469
|
width: 0,
|
|
86170
86470
|
maxFontSize: run2.fontSize,
|
|
86171
86471
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
86172
|
-
maxWidth: getEffectiveWidth(initialAvailableWidth),
|
|
86472
|
+
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
86173
86473
|
segments: [],
|
|
86174
86474
|
spaceCount: 0
|
|
86175
86475
|
};
|
|
@@ -86201,8 +86501,8 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
86201
86501
|
}
|
|
86202
86502
|
}
|
|
86203
86503
|
if (!currentLine && lines.length === 0) {
|
|
86204
|
-
const
|
|
86205
|
-
const metrics = calculateTypographyMetrics(
|
|
86504
|
+
const uiDisplayFallbackFontSize = (block.runs[0]?.kind === "text" ? block.runs[0].fontSize : void 0) ?? 12;
|
|
86505
|
+
const metrics = calculateTypographyMetrics(uiDisplayFallbackFontSize, spacing);
|
|
86206
86506
|
const fallbackLine = {
|
|
86207
86507
|
fromRun: 0,
|
|
86208
86508
|
fromChar: 0,
|
|
@@ -86217,7 +86517,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
86217
86517
|
}
|
|
86218
86518
|
if (currentLine) {
|
|
86219
86519
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
86220
|
-
const
|
|
86520
|
+
const lineBase = currentLine;
|
|
86221
86521
|
const finalLine = {
|
|
86222
86522
|
...lineBase,
|
|
86223
86523
|
...metrics
|
|
@@ -110839,316 +111139,6 @@ const toolbarIcons = {
|
|
|
110839
111139
|
paste: pasteIconSvg,
|
|
110840
111140
|
strikethrough: strikethroughSvg
|
|
110841
111141
|
};
|
|
110842
|
-
const _hoisted_1$4$1 = { class: "toolbar-icon" };
|
|
110843
|
-
const _hoisted_2$3$1 = ["innerHTML"];
|
|
110844
|
-
const _sfc_main$5$1 = {
|
|
110845
|
-
__name: "ToolbarButtonIcon",
|
|
110846
|
-
props: {
|
|
110847
|
-
name: {
|
|
110848
|
-
type: String,
|
|
110849
|
-
required: true
|
|
110850
|
-
},
|
|
110851
|
-
color: {
|
|
110852
|
-
type: String,
|
|
110853
|
-
default: null
|
|
110854
|
-
},
|
|
110855
|
-
icon: {
|
|
110856
|
-
type: String,
|
|
110857
|
-
default: null
|
|
110858
|
-
}
|
|
110859
|
-
},
|
|
110860
|
-
setup(__props) {
|
|
110861
|
-
const props = __props;
|
|
110862
|
-
const getBarColor = computed(() => {
|
|
110863
|
-
if (props.name === "color") return { backgroundColor: props.color || "#111111" };
|
|
110864
|
-
if (props.name === "highlight") return { backgroundColor: props.color || "#D6D6D6" };
|
|
110865
|
-
});
|
|
110866
|
-
const hasColorBar = computed(() => {
|
|
110867
|
-
return ["color", "highlight"].includes(props.name);
|
|
110868
|
-
});
|
|
110869
|
-
return (_ctx, _cache) => {
|
|
110870
|
-
return openBlock(), createElementBlock("div", _hoisted_1$4$1, [
|
|
110871
|
-
createBaseVNode("div", {
|
|
110872
|
-
class: normalizeClass(["toolbar-icon__icon", [`toolbar-icon__icon--${props.name}`]]),
|
|
110873
|
-
innerHTML: __props.icon
|
|
110874
|
-
}, null, 10, _hoisted_2$3$1),
|
|
110875
|
-
hasColorBar.value ? (openBlock(), createElementBlock("div", {
|
|
110876
|
-
key: 0,
|
|
110877
|
-
class: "color-bar",
|
|
110878
|
-
style: normalizeStyle(getBarColor.value)
|
|
110879
|
-
}, null, 4)) : createCommentVNode("", true)
|
|
110880
|
-
]);
|
|
110881
|
-
};
|
|
110882
|
-
}
|
|
110883
|
-
};
|
|
110884
|
-
const ToolbarButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$5$1, [["__scopeId", "data-v-6d7523ab"]]);
|
|
110885
|
-
const _hoisted_1$3$1 = ["role", "aria-label", "onKeydown"];
|
|
110886
|
-
const _hoisted_2$2$1 = ["data-item"];
|
|
110887
|
-
const _hoisted_3$2$1 = {
|
|
110888
|
-
key: 1,
|
|
110889
|
-
class: "button-label"
|
|
110890
|
-
};
|
|
110891
|
-
const _hoisted_4$1$1 = { key: 2 };
|
|
110892
|
-
const _hoisted_5$4 = ["onKeydown", "id"];
|
|
110893
|
-
const _hoisted_6$2 = ["placeholder", "onKeydown", "id"];
|
|
110894
|
-
const _hoisted_7$1 = ["innerHTML"];
|
|
110895
|
-
const _hoisted_8$1 = {
|
|
110896
|
-
"aria-live": "polite",
|
|
110897
|
-
class: "visually-hidden"
|
|
110898
|
-
};
|
|
110899
|
-
const _sfc_main$4$1 = {
|
|
110900
|
-
__name: "ToolbarButton",
|
|
110901
|
-
props: {
|
|
110902
|
-
iconColor: {
|
|
110903
|
-
type: String,
|
|
110904
|
-
default: null
|
|
110905
|
-
},
|
|
110906
|
-
active: {
|
|
110907
|
-
type: Boolean,
|
|
110908
|
-
default: false
|
|
110909
|
-
},
|
|
110910
|
-
isNarrow: {
|
|
110911
|
-
type: Boolean,
|
|
110912
|
-
default: false
|
|
110913
|
-
},
|
|
110914
|
-
isWide: {
|
|
110915
|
-
type: Boolean,
|
|
110916
|
-
default: false
|
|
110917
|
-
},
|
|
110918
|
-
toolbarItem: {
|
|
110919
|
-
type: Object,
|
|
110920
|
-
required: true
|
|
110921
|
-
},
|
|
110922
|
-
defaultLabel: {
|
|
110923
|
-
type: String,
|
|
110924
|
-
default: null
|
|
110925
|
-
},
|
|
110926
|
-
isOverflowItem: {
|
|
110927
|
-
type: Boolean,
|
|
110928
|
-
default: false
|
|
110929
|
-
}
|
|
110930
|
-
},
|
|
110931
|
-
emits: ["buttonClick", "textSubmit"],
|
|
110932
|
-
setup(__props, { emit: __emit }) {
|
|
110933
|
-
const emit = __emit;
|
|
110934
|
-
const props = __props;
|
|
110935
|
-
const {
|
|
110936
|
-
name,
|
|
110937
|
-
active,
|
|
110938
|
-
icon,
|
|
110939
|
-
label,
|
|
110940
|
-
hideLabel,
|
|
110941
|
-
iconColor,
|
|
110942
|
-
hasCaret,
|
|
110943
|
-
disabled,
|
|
110944
|
-
inlineTextInputVisible,
|
|
110945
|
-
hasInlineTextInput,
|
|
110946
|
-
minWidth,
|
|
110947
|
-
style: style2,
|
|
110948
|
-
attributes
|
|
110949
|
-
} = props.toolbarItem;
|
|
110950
|
-
const inlineTextInput = ref$1(label);
|
|
110951
|
-
const inlineInput = ref$1(null);
|
|
110952
|
-
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
110953
|
-
const handleClick2 = () => {
|
|
110954
|
-
if (hasInlineTextInput) {
|
|
110955
|
-
nextTick(() => {
|
|
110956
|
-
inlineInput.value?.focus();
|
|
110957
|
-
inlineInput.value?.select();
|
|
110958
|
-
});
|
|
110959
|
-
}
|
|
110960
|
-
emit("buttonClick");
|
|
110961
|
-
};
|
|
110962
|
-
const handleInputSubmit = () => {
|
|
110963
|
-
const value = inlineTextInput.value;
|
|
110964
|
-
const cleanValue = value.match(/^\d+(\.5)?$/) ? value : Math.floor(parseFloat(value)).toString();
|
|
110965
|
-
emit("textSubmit", cleanValue);
|
|
110966
|
-
inlineTextInput.value = cleanValue;
|
|
110967
|
-
};
|
|
110968
|
-
const getStyle = computed(() => {
|
|
110969
|
-
if (style2.value) return style2.value;
|
|
110970
|
-
return {
|
|
110971
|
-
minWidth: props.minWidth
|
|
110972
|
-
};
|
|
110973
|
-
});
|
|
110974
|
-
const caretIcon = computed(() => {
|
|
110975
|
-
return active.value ? toolbarIcons.dropdownCaretUp : toolbarIcons.dropdownCaretDown;
|
|
110976
|
-
});
|
|
110977
|
-
return (_ctx, _cache) => {
|
|
110978
|
-
return openBlock(), createElementBlock("div", {
|
|
110979
|
-
class: normalizeClass(["toolbar-item", unref(attributes).className]),
|
|
110980
|
-
style: normalizeStyle(getStyle.value),
|
|
110981
|
-
role: __props.isOverflowItem ? "menuitem" : "button",
|
|
110982
|
-
"aria-label": unref(attributes).ariaLabel,
|
|
110983
|
-
onClick: handleClick2,
|
|
110984
|
-
onKeydown: withKeys(withModifiers(handleClick2, ["stop"]), ["enter"]),
|
|
110985
|
-
tabindex: "0"
|
|
110986
|
-
}, [
|
|
110987
|
-
createBaseVNode("div", {
|
|
110988
|
-
class: normalizeClass(["toolbar-button", {
|
|
110989
|
-
active: unref(active),
|
|
110990
|
-
disabled: unref(disabled),
|
|
110991
|
-
narrow: __props.isNarrow,
|
|
110992
|
-
wide: __props.isWide,
|
|
110993
|
-
"has-inline-text-input": unref(hasInlineTextInput),
|
|
110994
|
-
"high-contrast": unref(isHighContrastMode2)
|
|
110995
|
-
}]),
|
|
110996
|
-
"data-item": `btn-${unref(name) || ""}`
|
|
110997
|
-
}, [
|
|
110998
|
-
unref(icon) ? (openBlock(), createBlock(ToolbarButtonIcon, {
|
|
110999
|
-
key: 0,
|
|
111000
|
-
color: unref(iconColor),
|
|
111001
|
-
class: "toolbar-icon",
|
|
111002
|
-
icon: unref(icon),
|
|
111003
|
-
name: unref(name)
|
|
111004
|
-
}, null, 8, ["color", "icon", "name"])) : createCommentVNode("", true),
|
|
111005
|
-
unref(label) && !unref(hideLabel) && !unref(inlineTextInputVisible) ? (openBlock(), createElementBlock("div", _hoisted_3$2$1, toDisplayString(unref(label)), 1)) : createCommentVNode("", true),
|
|
111006
|
-
unref(inlineTextInputVisible) ? (openBlock(), createElementBlock("span", _hoisted_4$1$1, [
|
|
111007
|
-
unref(name) === "fontSize" ? withDirectives((openBlock(), createElementBlock("input", {
|
|
111008
|
-
key: 0,
|
|
111009
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inlineTextInput.value = $event),
|
|
111010
|
-
onKeydown: withKeys(withModifiers(handleInputSubmit, ["prevent"]), ["enter"]),
|
|
111011
|
-
type: "text",
|
|
111012
|
-
class: normalizeClass(["button-text-input button-text-input--font-size", { "high-contrast": unref(isHighContrastMode2) }]),
|
|
111013
|
-
id: "inlineTextInput-" + unref(name),
|
|
111014
|
-
autocomplete: "off",
|
|
111015
|
-
ref_key: "inlineInput",
|
|
111016
|
-
ref: inlineInput
|
|
111017
|
-
}, null, 42, _hoisted_5$4)), [
|
|
111018
|
-
[vModelText, inlineTextInput.value]
|
|
111019
|
-
]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
111020
|
-
key: 1,
|
|
111021
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inlineTextInput.value = $event),
|
|
111022
|
-
placeholder: unref(label),
|
|
111023
|
-
onKeydown: withKeys(withModifiers(handleInputSubmit, ["prevent"]), ["enter"]),
|
|
111024
|
-
type: "text",
|
|
111025
|
-
class: "button-text-input",
|
|
111026
|
-
id: "inlineTextInput-" + unref(name),
|
|
111027
|
-
autocomplete: "off",
|
|
111028
|
-
ref_key: "inlineInput",
|
|
111029
|
-
ref: inlineInput
|
|
111030
|
-
}, null, 40, _hoisted_6$2)), [
|
|
111031
|
-
[vModelText, inlineTextInput.value]
|
|
111032
|
-
])
|
|
111033
|
-
])) : createCommentVNode("", true),
|
|
111034
|
-
unref(hasCaret) ? (openBlock(), createElementBlock("div", {
|
|
111035
|
-
key: 3,
|
|
111036
|
-
class: "dropdown-caret",
|
|
111037
|
-
innerHTML: caretIcon.value,
|
|
111038
|
-
style: normalizeStyle({ opacity: unref(disabled) ? 0.6 : 1 })
|
|
111039
|
-
}, null, 12, _hoisted_7$1)) : createCommentVNode("", true),
|
|
111040
|
-
createBaseVNode("div", _hoisted_8$1, toDisplayString(`${unref(attributes).ariaLabel} ${unref(active) ? "selected" : "unset"}`), 1)
|
|
111041
|
-
], 10, _hoisted_2$2$1)
|
|
111042
|
-
], 46, _hoisted_1$3$1);
|
|
111043
|
-
};
|
|
111044
|
-
}
|
|
111045
|
-
};
|
|
111046
|
-
const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-ea93b080"]]);
|
|
111047
|
-
const _hoisted_1$2$1 = {
|
|
111048
|
-
class: "toolbar-separator",
|
|
111049
|
-
role: "separator",
|
|
111050
|
-
"aria-label": "Toolbar separator"
|
|
111051
|
-
};
|
|
111052
|
-
const _sfc_main$3$1 = {
|
|
111053
|
-
__name: "ToolbarSeparator",
|
|
111054
|
-
props: {
|
|
111055
|
-
active: {
|
|
111056
|
-
type: Boolean,
|
|
111057
|
-
default: false
|
|
111058
|
-
}
|
|
111059
|
-
},
|
|
111060
|
-
emits: ["command"],
|
|
111061
|
-
setup(__props, { emit: __emit }) {
|
|
111062
|
-
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
111063
|
-
const getSeparatorColor = () => {
|
|
111064
|
-
if (isHighContrastMode2.value) {
|
|
111065
|
-
return "#000";
|
|
111066
|
-
}
|
|
111067
|
-
return "#dbdbdb";
|
|
111068
|
-
};
|
|
111069
|
-
return (_ctx, _cache) => {
|
|
111070
|
-
return openBlock(), createElementBlock("div", _hoisted_1$2$1, [
|
|
111071
|
-
createBaseVNode("div", {
|
|
111072
|
-
class: "separator-inner",
|
|
111073
|
-
style: normalizeStyle({ backgroundColor: getSeparatorColor() })
|
|
111074
|
-
}, null, 4)
|
|
111075
|
-
]);
|
|
111076
|
-
};
|
|
111077
|
-
}
|
|
111078
|
-
};
|
|
111079
|
-
const ToolbarSeparator = /* @__PURE__ */ _export_sfc(_sfc_main$3$1, [["__scopeId", "data-v-4ef9aa18"]]);
|
|
111080
|
-
const _hoisted_1$1$1 = { class: "overflow-menu" };
|
|
111081
|
-
const _hoisted_2$1$1 = { class: "overflow-menu-trigger" };
|
|
111082
|
-
const _hoisted_3$1$1 = {
|
|
111083
|
-
key: 0,
|
|
111084
|
-
class: "overflow-menu_items",
|
|
111085
|
-
role: "group"
|
|
111086
|
-
};
|
|
111087
|
-
const _sfc_main$2$1 = {
|
|
111088
|
-
__name: "OverflowMenu",
|
|
111089
|
-
props: {
|
|
111090
|
-
toolbarItem: {
|
|
111091
|
-
type: Object,
|
|
111092
|
-
required: true
|
|
111093
|
-
},
|
|
111094
|
-
overflowItems: {
|
|
111095
|
-
type: Array,
|
|
111096
|
-
required: true
|
|
111097
|
-
}
|
|
111098
|
-
},
|
|
111099
|
-
emits: ["buttonClick", "close"],
|
|
111100
|
-
setup(__props, { emit: __emit }) {
|
|
111101
|
-
const { proxy } = getCurrentInstance();
|
|
111102
|
-
const emit = __emit;
|
|
111103
|
-
const props = __props;
|
|
111104
|
-
const isOverflowMenuOpened = computed(() => props.toolbarItem.expand.value);
|
|
111105
|
-
const hasOpenDropdown = ref$1(false);
|
|
111106
|
-
const overflowToolbarItem = computed(() => ({
|
|
111107
|
-
...props.toolbarItem,
|
|
111108
|
-
active: isOverflowMenuOpened.value
|
|
111109
|
-
}));
|
|
111110
|
-
const toggleOverflowMenu = () => {
|
|
111111
|
-
emit("buttonClick", props.toolbarItem);
|
|
111112
|
-
};
|
|
111113
|
-
const handleCommand = ({ item, argument }) => {
|
|
111114
|
-
proxy.$toolbar.emitCommand({ item, argument });
|
|
111115
|
-
};
|
|
111116
|
-
const handleKeyDown2 = (e) => {
|
|
111117
|
-
if (e.key === "Escape") {
|
|
111118
|
-
if (isOverflowMenuOpened.value && !hasOpenDropdown.value) {
|
|
111119
|
-
e.preventDefault();
|
|
111120
|
-
emit("close");
|
|
111121
|
-
}
|
|
111122
|
-
}
|
|
111123
|
-
};
|
|
111124
|
-
onMounted(() => {
|
|
111125
|
-
document.addEventListener("keydown", handleKeyDown2, true);
|
|
111126
|
-
});
|
|
111127
|
-
onBeforeUnmount(() => {
|
|
111128
|
-
document.removeEventListener("keydown", handleKeyDown2, true);
|
|
111129
|
-
});
|
|
111130
|
-
return (_ctx, _cache) => {
|
|
111131
|
-
return openBlock(), createElementBlock("div", _hoisted_1$1$1, [
|
|
111132
|
-
createBaseVNode("div", _hoisted_2$1$1, [
|
|
111133
|
-
createVNode(ToolbarButton, {
|
|
111134
|
-
"toolbar-item": overflowToolbarItem.value,
|
|
111135
|
-
onButtonClick: toggleOverflowMenu
|
|
111136
|
-
}, null, 8, ["toolbar-item"])
|
|
111137
|
-
]),
|
|
111138
|
-
isOverflowMenuOpened.value ? (openBlock(), createElementBlock("div", _hoisted_3$1$1, [
|
|
111139
|
-
createVNode(ButtonGroup, {
|
|
111140
|
-
class: "superdoc-toolbar-overflow",
|
|
111141
|
-
"toolbar-items": __props.overflowItems,
|
|
111142
|
-
"from-overflow": "",
|
|
111143
|
-
onCommand: handleCommand,
|
|
111144
|
-
onDropdownUpdateShow: _cache[0] || (_cache[0] = ($event) => hasOpenDropdown.value = $event)
|
|
111145
|
-
}, null, 8, ["toolbar-items"])
|
|
111146
|
-
])) : createCommentVNode("", true)
|
|
111147
|
-
]);
|
|
111148
|
-
};
|
|
111149
|
-
}
|
|
111150
|
-
};
|
|
111151
|
-
const OverflowMenu = /* @__PURE__ */ _export_sfc(_sfc_main$2$1, [["__scopeId", "data-v-ef28da92"]]);
|
|
111152
111142
|
function plugin$1(options) {
|
|
111153
111143
|
let _bPrefix = ".";
|
|
111154
111144
|
let _ePrefix = "__";
|
|
@@ -114759,30 +114749,30 @@ const defaultClsPrefix = "n";
|
|
|
114759
114749
|
function useConfig(props = {}, options = {
|
|
114760
114750
|
defaultBordered: true
|
|
114761
114751
|
}) {
|
|
114762
|
-
const
|
|
114752
|
+
const NConfigProvider2 = inject(configProviderInjectionKey, null);
|
|
114763
114753
|
return {
|
|
114764
114754
|
// NConfigProvider,
|
|
114765
|
-
inlineThemeDisabled:
|
|
114766
|
-
mergedRtlRef:
|
|
114767
|
-
mergedComponentPropsRef:
|
|
114768
|
-
mergedBreakpointsRef:
|
|
114755
|
+
inlineThemeDisabled: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.inlineThemeDisabled,
|
|
114756
|
+
mergedRtlRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedRtlRef,
|
|
114757
|
+
mergedComponentPropsRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedComponentPropsRef,
|
|
114758
|
+
mergedBreakpointsRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBreakpointsRef,
|
|
114769
114759
|
mergedBorderedRef: computed(() => {
|
|
114770
114760
|
var _a2, _b2;
|
|
114771
114761
|
const {
|
|
114772
114762
|
bordered
|
|
114773
114763
|
} = props;
|
|
114774
114764
|
if (bordered !== void 0) return bordered;
|
|
114775
|
-
return (_b2 = (_a2 =
|
|
114765
|
+
return (_b2 = (_a2 = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBorderedRef.value) !== null && _a2 !== void 0 ? _a2 : options.defaultBordered) !== null && _b2 !== void 0 ? _b2 : true;
|
|
114776
114766
|
}),
|
|
114777
|
-
mergedClsPrefixRef:
|
|
114778
|
-
namespaceRef: computed(() =>
|
|
114767
|
+
mergedClsPrefixRef: NConfigProvider2 ? NConfigProvider2.mergedClsPrefixRef : shallowRef(defaultClsPrefix),
|
|
114768
|
+
namespaceRef: computed(() => NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedNamespaceRef.value)
|
|
114779
114769
|
};
|
|
114780
114770
|
}
|
|
114781
114771
|
function useThemeClass(componentName, hashRef, cssVarsRef, props) {
|
|
114782
114772
|
if (!cssVarsRef) throwError("useThemeClass", "cssVarsRef is not passed");
|
|
114783
|
-
const
|
|
114784
|
-
const mergedThemeHashRef =
|
|
114785
|
-
const styleMountTarget =
|
|
114773
|
+
const NConfigProvider2 = inject(configProviderInjectionKey, null);
|
|
114774
|
+
const mergedThemeHashRef = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeHashRef;
|
|
114775
|
+
const styleMountTarget = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget;
|
|
114786
114776
|
const themeClassRef = ref$1("");
|
|
114787
114777
|
const ssrAdapter2 = useSsrAdapter();
|
|
114788
114778
|
let renderCallback;
|
|
@@ -116127,7 +116117,7 @@ function useRtl(mountId, rtlStateRef, clsPrefixRef) {
|
|
|
116127
116117
|
}
|
|
116128
116118
|
return componentRtlState;
|
|
116129
116119
|
});
|
|
116130
|
-
const
|
|
116120
|
+
const NConfigProvider2 = inject(configProviderInjectionKey, null);
|
|
116131
116121
|
const mountStyle = () => {
|
|
116132
116122
|
watchEffect(() => {
|
|
116133
116123
|
const {
|
|
@@ -116147,7 +116137,7 @@ function useRtl(mountId, rtlStateRef, clsPrefixRef) {
|
|
|
116147
116137
|
bPrefix: clsPrefix ? `.${clsPrefix}-` : void 0
|
|
116148
116138
|
},
|
|
116149
116139
|
ssr: ssrAdapter2,
|
|
116150
|
-
parent:
|
|
116140
|
+
parent: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget
|
|
116151
116141
|
});
|
|
116152
116142
|
});
|
|
116153
116143
|
};
|
|
@@ -116205,7 +116195,7 @@ function createTheme(theme) {
|
|
|
116205
116195
|
}
|
|
116206
116196
|
function useTheme(resolveId, mountId, style2, defaultTheme, props, clsPrefixRef) {
|
|
116207
116197
|
const ssrAdapter2 = useSsrAdapter();
|
|
116208
|
-
const
|
|
116198
|
+
const NConfigProvider2 = inject(configProviderInjectionKey, null);
|
|
116209
116199
|
if (style2) {
|
|
116210
116200
|
const mountStyle = () => {
|
|
116211
116201
|
const clsPrefix = clsPrefixRef === null || clsPrefixRef === void 0 ? void 0 : clsPrefixRef.value;
|
|
@@ -116217,15 +116207,15 @@ function useTheme(resolveId, mountId, style2, defaultTheme, props, clsPrefixRef)
|
|
|
116217
116207
|
},
|
|
116218
116208
|
anchorMetaName: cssrAnchorMetaName,
|
|
116219
116209
|
ssr: ssrAdapter2,
|
|
116220
|
-
parent:
|
|
116210
|
+
parent: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget
|
|
116221
116211
|
});
|
|
116222
|
-
if (!(
|
|
116212
|
+
if (!(NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.preflightStyleDisabled)) {
|
|
116223
116213
|
globalStyle.mount({
|
|
116224
116214
|
id: "n-global",
|
|
116225
116215
|
head: true,
|
|
116226
116216
|
anchorMetaName: cssrAnchorMetaName,
|
|
116227
116217
|
ssr: ssrAdapter2,
|
|
116228
|
-
parent:
|
|
116218
|
+
parent: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget
|
|
116229
116219
|
});
|
|
116230
116220
|
}
|
|
116231
116221
|
};
|
|
@@ -116257,11 +116247,11 @@ function useTheme(resolveId, mountId, style2, defaultTheme, props, clsPrefixRef)
|
|
|
116257
116247
|
self: globalSelf = void 0,
|
|
116258
116248
|
peers: globalPeers = {}
|
|
116259
116249
|
} = {}
|
|
116260
|
-
} = (
|
|
116250
|
+
} = (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeRef.value) || {};
|
|
116261
116251
|
const {
|
|
116262
116252
|
common: globalCommonOverrides = void 0,
|
|
116263
116253
|
[resolveId]: globalSelfOverrides = {}
|
|
116264
|
-
} = (
|
|
116254
|
+
} = (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value) || {};
|
|
116265
116255
|
const {
|
|
116266
116256
|
common: globalSelfCommonOverrides,
|
|
116267
116257
|
peers: globalPeersOverrides = {}
|
|
@@ -119019,6 +119009,209 @@ const NPopover = defineComponent({
|
|
|
119019
119009
|
});
|
|
119020
119010
|
}
|
|
119021
119011
|
});
|
|
119012
|
+
const configProviderProps = {
|
|
119013
|
+
abstract: Boolean,
|
|
119014
|
+
bordered: {
|
|
119015
|
+
type: Boolean,
|
|
119016
|
+
default: void 0
|
|
119017
|
+
},
|
|
119018
|
+
clsPrefix: String,
|
|
119019
|
+
locale: Object,
|
|
119020
|
+
dateLocale: Object,
|
|
119021
|
+
namespace: String,
|
|
119022
|
+
rtl: Array,
|
|
119023
|
+
tag: {
|
|
119024
|
+
type: String,
|
|
119025
|
+
default: "div"
|
|
119026
|
+
},
|
|
119027
|
+
hljs: Object,
|
|
119028
|
+
katex: Object,
|
|
119029
|
+
theme: Object,
|
|
119030
|
+
themeOverrides: Object,
|
|
119031
|
+
componentOptions: Object,
|
|
119032
|
+
icons: Object,
|
|
119033
|
+
breakpoints: Object,
|
|
119034
|
+
preflightStyleDisabled: Boolean,
|
|
119035
|
+
styleMountTarget: Object,
|
|
119036
|
+
inlineThemeDisabled: {
|
|
119037
|
+
type: Boolean,
|
|
119038
|
+
default: void 0
|
|
119039
|
+
},
|
|
119040
|
+
// deprecated
|
|
119041
|
+
as: {
|
|
119042
|
+
type: String,
|
|
119043
|
+
validator: () => {
|
|
119044
|
+
warn("config-provider", "`as` is deprecated, please use `tag` instead.");
|
|
119045
|
+
return true;
|
|
119046
|
+
},
|
|
119047
|
+
default: void 0
|
|
119048
|
+
}
|
|
119049
|
+
};
|
|
119050
|
+
const NConfigProvider = defineComponent({
|
|
119051
|
+
name: "ConfigProvider",
|
|
119052
|
+
alias: ["App"],
|
|
119053
|
+
props: configProviderProps,
|
|
119054
|
+
setup(props) {
|
|
119055
|
+
const NConfigProvider2 = inject(configProviderInjectionKey, null);
|
|
119056
|
+
const mergedThemeRef = computed(() => {
|
|
119057
|
+
const {
|
|
119058
|
+
theme
|
|
119059
|
+
} = props;
|
|
119060
|
+
if (theme === null) return void 0;
|
|
119061
|
+
const inheritedTheme = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeRef.value;
|
|
119062
|
+
return theme === void 0 ? inheritedTheme : inheritedTheme === void 0 ? theme : Object.assign({}, inheritedTheme, theme);
|
|
119063
|
+
});
|
|
119064
|
+
const mergedThemeOverridesRef = computed(() => {
|
|
119065
|
+
const {
|
|
119066
|
+
themeOverrides
|
|
119067
|
+
} = props;
|
|
119068
|
+
if (themeOverrides === null) return void 0;
|
|
119069
|
+
if (themeOverrides === void 0) {
|
|
119070
|
+
return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value;
|
|
119071
|
+
} else {
|
|
119072
|
+
const inheritedThemeOverrides = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value;
|
|
119073
|
+
if (inheritedThemeOverrides === void 0) {
|
|
119074
|
+
return themeOverrides;
|
|
119075
|
+
} else {
|
|
119076
|
+
return merge$1({}, inheritedThemeOverrides, themeOverrides);
|
|
119077
|
+
}
|
|
119078
|
+
}
|
|
119079
|
+
});
|
|
119080
|
+
const mergedNamespaceRef = useMemo(() => {
|
|
119081
|
+
const {
|
|
119082
|
+
namespace: namespace2
|
|
119083
|
+
} = props;
|
|
119084
|
+
return namespace2 === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedNamespaceRef.value : namespace2;
|
|
119085
|
+
});
|
|
119086
|
+
const mergedBorderedRef = useMemo(() => {
|
|
119087
|
+
const {
|
|
119088
|
+
bordered
|
|
119089
|
+
} = props;
|
|
119090
|
+
return bordered === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBorderedRef.value : bordered;
|
|
119091
|
+
});
|
|
119092
|
+
const mergedIconsRef = computed(() => {
|
|
119093
|
+
const {
|
|
119094
|
+
icons: icons2
|
|
119095
|
+
} = props;
|
|
119096
|
+
return icons2 === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedIconsRef.value : icons2;
|
|
119097
|
+
});
|
|
119098
|
+
const mergedComponentPropsRef = computed(() => {
|
|
119099
|
+
const {
|
|
119100
|
+
componentOptions
|
|
119101
|
+
} = props;
|
|
119102
|
+
if (componentOptions !== void 0) return componentOptions;
|
|
119103
|
+
return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedComponentPropsRef.value;
|
|
119104
|
+
});
|
|
119105
|
+
const mergedClsPrefixRef = computed(() => {
|
|
119106
|
+
const {
|
|
119107
|
+
clsPrefix
|
|
119108
|
+
} = props;
|
|
119109
|
+
if (clsPrefix !== void 0) return clsPrefix;
|
|
119110
|
+
if (NConfigProvider2) return NConfigProvider2.mergedClsPrefixRef.value;
|
|
119111
|
+
return defaultClsPrefix;
|
|
119112
|
+
});
|
|
119113
|
+
const mergedRtlRef = computed(() => {
|
|
119114
|
+
var _a2;
|
|
119115
|
+
const {
|
|
119116
|
+
rtl
|
|
119117
|
+
} = props;
|
|
119118
|
+
if (rtl === void 0) {
|
|
119119
|
+
return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedRtlRef.value;
|
|
119120
|
+
}
|
|
119121
|
+
const rtlEnabledState = {};
|
|
119122
|
+
for (const rtlInfo of rtl) {
|
|
119123
|
+
rtlEnabledState[rtlInfo.name] = markRaw(rtlInfo);
|
|
119124
|
+
(_a2 = rtlInfo.peers) === null || _a2 === void 0 ? void 0 : _a2.forEach((peerRtlInfo) => {
|
|
119125
|
+
if (!(peerRtlInfo.name in rtlEnabledState)) {
|
|
119126
|
+
rtlEnabledState[peerRtlInfo.name] = markRaw(peerRtlInfo);
|
|
119127
|
+
}
|
|
119128
|
+
});
|
|
119129
|
+
}
|
|
119130
|
+
return rtlEnabledState;
|
|
119131
|
+
});
|
|
119132
|
+
const mergedBreakpointsRef = computed(() => {
|
|
119133
|
+
return props.breakpoints || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBreakpointsRef.value);
|
|
119134
|
+
});
|
|
119135
|
+
const inlineThemeDisabled = props.inlineThemeDisabled || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.inlineThemeDisabled);
|
|
119136
|
+
const preflightStyleDisabled = props.preflightStyleDisabled || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.preflightStyleDisabled);
|
|
119137
|
+
const styleMountTarget = props.styleMountTarget || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.styleMountTarget);
|
|
119138
|
+
const mergedThemeHashRef = computed(() => {
|
|
119139
|
+
const {
|
|
119140
|
+
value: theme
|
|
119141
|
+
} = mergedThemeRef;
|
|
119142
|
+
const {
|
|
119143
|
+
value: mergedThemeOverrides
|
|
119144
|
+
} = mergedThemeOverridesRef;
|
|
119145
|
+
const hasThemeOverrides = mergedThemeOverrides && Object.keys(mergedThemeOverrides).length !== 0;
|
|
119146
|
+
const themeName = theme === null || theme === void 0 ? void 0 : theme.name;
|
|
119147
|
+
if (themeName) {
|
|
119148
|
+
if (hasThemeOverrides) {
|
|
119149
|
+
return `${themeName}-${murmur2(JSON.stringify(mergedThemeOverridesRef.value))}`;
|
|
119150
|
+
}
|
|
119151
|
+
return themeName;
|
|
119152
|
+
} else {
|
|
119153
|
+
if (hasThemeOverrides) {
|
|
119154
|
+
return murmur2(JSON.stringify(mergedThemeOverridesRef.value));
|
|
119155
|
+
}
|
|
119156
|
+
return "";
|
|
119157
|
+
}
|
|
119158
|
+
});
|
|
119159
|
+
provide(configProviderInjectionKey, {
|
|
119160
|
+
mergedThemeHashRef,
|
|
119161
|
+
mergedBreakpointsRef,
|
|
119162
|
+
mergedRtlRef,
|
|
119163
|
+
mergedIconsRef,
|
|
119164
|
+
mergedComponentPropsRef,
|
|
119165
|
+
mergedBorderedRef,
|
|
119166
|
+
mergedNamespaceRef,
|
|
119167
|
+
mergedClsPrefixRef,
|
|
119168
|
+
mergedLocaleRef: computed(() => {
|
|
119169
|
+
const {
|
|
119170
|
+
locale
|
|
119171
|
+
} = props;
|
|
119172
|
+
if (locale === null) return void 0;
|
|
119173
|
+
return locale === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedLocaleRef.value : locale;
|
|
119174
|
+
}),
|
|
119175
|
+
mergedDateLocaleRef: computed(() => {
|
|
119176
|
+
const {
|
|
119177
|
+
dateLocale
|
|
119178
|
+
} = props;
|
|
119179
|
+
if (dateLocale === null) return void 0;
|
|
119180
|
+
return dateLocale === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedDateLocaleRef.value : dateLocale;
|
|
119181
|
+
}),
|
|
119182
|
+
mergedHljsRef: computed(() => {
|
|
119183
|
+
const {
|
|
119184
|
+
hljs
|
|
119185
|
+
} = props;
|
|
119186
|
+
return hljs === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedHljsRef.value : hljs;
|
|
119187
|
+
}),
|
|
119188
|
+
mergedKatexRef: computed(() => {
|
|
119189
|
+
const {
|
|
119190
|
+
katex
|
|
119191
|
+
} = props;
|
|
119192
|
+
return katex === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedKatexRef.value : katex;
|
|
119193
|
+
}),
|
|
119194
|
+
mergedThemeRef,
|
|
119195
|
+
mergedThemeOverridesRef,
|
|
119196
|
+
inlineThemeDisabled: inlineThemeDisabled || false,
|
|
119197
|
+
preflightStyleDisabled: preflightStyleDisabled || false,
|
|
119198
|
+
styleMountTarget
|
|
119199
|
+
});
|
|
119200
|
+
return {
|
|
119201
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
119202
|
+
mergedBordered: mergedBorderedRef,
|
|
119203
|
+
mergedNamespace: mergedNamespaceRef,
|
|
119204
|
+
mergedTheme: mergedThemeRef,
|
|
119205
|
+
mergedThemeOverrides: mergedThemeOverridesRef
|
|
119206
|
+
};
|
|
119207
|
+
},
|
|
119208
|
+
render() {
|
|
119209
|
+
var _a2, _b2, _c, _d;
|
|
119210
|
+
return !this.abstract ? h(this.as || this.tag, {
|
|
119211
|
+
class: `${this.mergedClsPrefix || defaultClsPrefix}-config-provider`
|
|
119212
|
+
}, (_b2 = (_a2 = this.$slots).default) === null || _b2 === void 0 ? void 0 : _b2.call(_a2)) : (_d = (_c = this.$slots).default) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
119213
|
+
}
|
|
119214
|
+
});
|
|
119022
119215
|
const commonVariables = {
|
|
119023
119216
|
padding: "4px 0",
|
|
119024
119217
|
optionIconSizeSmall: "14px",
|
|
@@ -120496,6 +120689,316 @@ const NSkeleton = defineComponent({
|
|
|
120496
120689
|
return child;
|
|
120497
120690
|
}
|
|
120498
120691
|
});
|
|
120692
|
+
const _hoisted_1$4$1 = { class: "toolbar-icon" };
|
|
120693
|
+
const _hoisted_2$3$1 = ["innerHTML"];
|
|
120694
|
+
const _sfc_main$5$1 = {
|
|
120695
|
+
__name: "ToolbarButtonIcon",
|
|
120696
|
+
props: {
|
|
120697
|
+
name: {
|
|
120698
|
+
type: String,
|
|
120699
|
+
required: true
|
|
120700
|
+
},
|
|
120701
|
+
color: {
|
|
120702
|
+
type: String,
|
|
120703
|
+
default: null
|
|
120704
|
+
},
|
|
120705
|
+
icon: {
|
|
120706
|
+
type: String,
|
|
120707
|
+
default: null
|
|
120708
|
+
}
|
|
120709
|
+
},
|
|
120710
|
+
setup(__props) {
|
|
120711
|
+
const props = __props;
|
|
120712
|
+
const getBarColor = computed(() => {
|
|
120713
|
+
if (props.name === "color") return { backgroundColor: props.color || "#111111" };
|
|
120714
|
+
if (props.name === "highlight") return { backgroundColor: props.color || "#D6D6D6" };
|
|
120715
|
+
});
|
|
120716
|
+
const hasColorBar = computed(() => {
|
|
120717
|
+
return ["color", "highlight"].includes(props.name);
|
|
120718
|
+
});
|
|
120719
|
+
return (_ctx, _cache) => {
|
|
120720
|
+
return openBlock(), createElementBlock("div", _hoisted_1$4$1, [
|
|
120721
|
+
createBaseVNode("div", {
|
|
120722
|
+
class: normalizeClass(["toolbar-icon__icon", [`toolbar-icon__icon--${props.name}`]]),
|
|
120723
|
+
innerHTML: __props.icon
|
|
120724
|
+
}, null, 10, _hoisted_2$3$1),
|
|
120725
|
+
hasColorBar.value ? (openBlock(), createElementBlock("div", {
|
|
120726
|
+
key: 0,
|
|
120727
|
+
class: "color-bar",
|
|
120728
|
+
style: normalizeStyle(getBarColor.value)
|
|
120729
|
+
}, null, 4)) : createCommentVNode("", true)
|
|
120730
|
+
]);
|
|
120731
|
+
};
|
|
120732
|
+
}
|
|
120733
|
+
};
|
|
120734
|
+
const ToolbarButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$5$1, [["__scopeId", "data-v-6d7523ab"]]);
|
|
120735
|
+
const _hoisted_1$3$1 = ["role", "aria-label", "onKeydown"];
|
|
120736
|
+
const _hoisted_2$2$1 = ["data-item"];
|
|
120737
|
+
const _hoisted_3$2$1 = {
|
|
120738
|
+
key: 1,
|
|
120739
|
+
class: "button-label"
|
|
120740
|
+
};
|
|
120741
|
+
const _hoisted_4$1$1 = { key: 2 };
|
|
120742
|
+
const _hoisted_5$4 = ["onKeydown", "id"];
|
|
120743
|
+
const _hoisted_6$2 = ["placeholder", "onKeydown", "id"];
|
|
120744
|
+
const _hoisted_7$1 = ["innerHTML"];
|
|
120745
|
+
const _hoisted_8$1 = {
|
|
120746
|
+
"aria-live": "polite",
|
|
120747
|
+
class: "visually-hidden"
|
|
120748
|
+
};
|
|
120749
|
+
const _sfc_main$4$1 = {
|
|
120750
|
+
__name: "ToolbarButton",
|
|
120751
|
+
props: {
|
|
120752
|
+
iconColor: {
|
|
120753
|
+
type: String,
|
|
120754
|
+
default: null
|
|
120755
|
+
},
|
|
120756
|
+
active: {
|
|
120757
|
+
type: Boolean,
|
|
120758
|
+
default: false
|
|
120759
|
+
},
|
|
120760
|
+
isNarrow: {
|
|
120761
|
+
type: Boolean,
|
|
120762
|
+
default: false
|
|
120763
|
+
},
|
|
120764
|
+
isWide: {
|
|
120765
|
+
type: Boolean,
|
|
120766
|
+
default: false
|
|
120767
|
+
},
|
|
120768
|
+
toolbarItem: {
|
|
120769
|
+
type: Object,
|
|
120770
|
+
required: true
|
|
120771
|
+
},
|
|
120772
|
+
defaultLabel: {
|
|
120773
|
+
type: String,
|
|
120774
|
+
default: null
|
|
120775
|
+
},
|
|
120776
|
+
isOverflowItem: {
|
|
120777
|
+
type: Boolean,
|
|
120778
|
+
default: false
|
|
120779
|
+
}
|
|
120780
|
+
},
|
|
120781
|
+
emits: ["buttonClick", "textSubmit"],
|
|
120782
|
+
setup(__props, { emit: __emit }) {
|
|
120783
|
+
const emit = __emit;
|
|
120784
|
+
const props = __props;
|
|
120785
|
+
const {
|
|
120786
|
+
name,
|
|
120787
|
+
active,
|
|
120788
|
+
icon,
|
|
120789
|
+
label,
|
|
120790
|
+
hideLabel,
|
|
120791
|
+
iconColor,
|
|
120792
|
+
hasCaret,
|
|
120793
|
+
disabled,
|
|
120794
|
+
inlineTextInputVisible,
|
|
120795
|
+
hasInlineTextInput,
|
|
120796
|
+
minWidth,
|
|
120797
|
+
style: style2,
|
|
120798
|
+
attributes
|
|
120799
|
+
} = props.toolbarItem;
|
|
120800
|
+
const inlineTextInput = ref$1(label);
|
|
120801
|
+
const inlineInput = ref$1(null);
|
|
120802
|
+
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
120803
|
+
const handleClick2 = () => {
|
|
120804
|
+
if (hasInlineTextInput) {
|
|
120805
|
+
nextTick(() => {
|
|
120806
|
+
inlineInput.value?.focus();
|
|
120807
|
+
inlineInput.value?.select();
|
|
120808
|
+
});
|
|
120809
|
+
}
|
|
120810
|
+
emit("buttonClick");
|
|
120811
|
+
};
|
|
120812
|
+
const handleInputSubmit = () => {
|
|
120813
|
+
const value = inlineTextInput.value;
|
|
120814
|
+
const cleanValue = value.match(/^\d+(\.5)?$/) ? value : Math.floor(parseFloat(value)).toString();
|
|
120815
|
+
emit("textSubmit", cleanValue);
|
|
120816
|
+
inlineTextInput.value = cleanValue;
|
|
120817
|
+
};
|
|
120818
|
+
const getStyle = computed(() => {
|
|
120819
|
+
if (style2.value) return style2.value;
|
|
120820
|
+
return {
|
|
120821
|
+
minWidth: props.minWidth
|
|
120822
|
+
};
|
|
120823
|
+
});
|
|
120824
|
+
const caretIcon = computed(() => {
|
|
120825
|
+
return active.value ? toolbarIcons.dropdownCaretUp : toolbarIcons.dropdownCaretDown;
|
|
120826
|
+
});
|
|
120827
|
+
return (_ctx, _cache) => {
|
|
120828
|
+
return openBlock(), createElementBlock("div", {
|
|
120829
|
+
class: normalizeClass(["toolbar-item", unref(attributes).className]),
|
|
120830
|
+
style: normalizeStyle(getStyle.value),
|
|
120831
|
+
role: __props.isOverflowItem ? "menuitem" : "button",
|
|
120832
|
+
"aria-label": unref(attributes).ariaLabel,
|
|
120833
|
+
onClick: handleClick2,
|
|
120834
|
+
onKeydown: withKeys(withModifiers(handleClick2, ["stop"]), ["enter"]),
|
|
120835
|
+
tabindex: "0"
|
|
120836
|
+
}, [
|
|
120837
|
+
createBaseVNode("div", {
|
|
120838
|
+
class: normalizeClass(["toolbar-button", {
|
|
120839
|
+
active: unref(active),
|
|
120840
|
+
disabled: unref(disabled),
|
|
120841
|
+
narrow: __props.isNarrow,
|
|
120842
|
+
wide: __props.isWide,
|
|
120843
|
+
"has-inline-text-input": unref(hasInlineTextInput),
|
|
120844
|
+
"high-contrast": unref(isHighContrastMode2)
|
|
120845
|
+
}]),
|
|
120846
|
+
"data-item": `btn-${unref(name) || ""}`
|
|
120847
|
+
}, [
|
|
120848
|
+
unref(icon) ? (openBlock(), createBlock(ToolbarButtonIcon, {
|
|
120849
|
+
key: 0,
|
|
120850
|
+
color: unref(iconColor),
|
|
120851
|
+
class: "toolbar-icon",
|
|
120852
|
+
icon: unref(icon),
|
|
120853
|
+
name: unref(name)
|
|
120854
|
+
}, null, 8, ["color", "icon", "name"])) : createCommentVNode("", true),
|
|
120855
|
+
unref(label) && !unref(hideLabel) && !unref(inlineTextInputVisible) ? (openBlock(), createElementBlock("div", _hoisted_3$2$1, toDisplayString(unref(label)), 1)) : createCommentVNode("", true),
|
|
120856
|
+
unref(inlineTextInputVisible) ? (openBlock(), createElementBlock("span", _hoisted_4$1$1, [
|
|
120857
|
+
unref(name) === "fontSize" ? withDirectives((openBlock(), createElementBlock("input", {
|
|
120858
|
+
key: 0,
|
|
120859
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inlineTextInput.value = $event),
|
|
120860
|
+
onKeydown: withKeys(withModifiers(handleInputSubmit, ["prevent"]), ["enter"]),
|
|
120861
|
+
type: "text",
|
|
120862
|
+
class: normalizeClass(["button-text-input button-text-input--font-size", { "high-contrast": unref(isHighContrastMode2) }]),
|
|
120863
|
+
id: "inlineTextInput-" + unref(name),
|
|
120864
|
+
autocomplete: "off",
|
|
120865
|
+
ref_key: "inlineInput",
|
|
120866
|
+
ref: inlineInput
|
|
120867
|
+
}, null, 42, _hoisted_5$4)), [
|
|
120868
|
+
[vModelText, inlineTextInput.value]
|
|
120869
|
+
]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
120870
|
+
key: 1,
|
|
120871
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inlineTextInput.value = $event),
|
|
120872
|
+
placeholder: unref(label),
|
|
120873
|
+
onKeydown: withKeys(withModifiers(handleInputSubmit, ["prevent"]), ["enter"]),
|
|
120874
|
+
type: "text",
|
|
120875
|
+
class: "button-text-input",
|
|
120876
|
+
id: "inlineTextInput-" + unref(name),
|
|
120877
|
+
autocomplete: "off",
|
|
120878
|
+
ref_key: "inlineInput",
|
|
120879
|
+
ref: inlineInput
|
|
120880
|
+
}, null, 40, _hoisted_6$2)), [
|
|
120881
|
+
[vModelText, inlineTextInput.value]
|
|
120882
|
+
])
|
|
120883
|
+
])) : createCommentVNode("", true),
|
|
120884
|
+
unref(hasCaret) ? (openBlock(), createElementBlock("div", {
|
|
120885
|
+
key: 3,
|
|
120886
|
+
class: "dropdown-caret",
|
|
120887
|
+
innerHTML: caretIcon.value,
|
|
120888
|
+
style: normalizeStyle({ opacity: unref(disabled) ? 0.6 : 1 })
|
|
120889
|
+
}, null, 12, _hoisted_7$1)) : createCommentVNode("", true),
|
|
120890
|
+
createBaseVNode("div", _hoisted_8$1, toDisplayString(`${unref(attributes).ariaLabel} ${unref(active) ? "selected" : "unset"}`), 1)
|
|
120891
|
+
], 10, _hoisted_2$2$1)
|
|
120892
|
+
], 46, _hoisted_1$3$1);
|
|
120893
|
+
};
|
|
120894
|
+
}
|
|
120895
|
+
};
|
|
120896
|
+
const ToolbarButton = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["__scopeId", "data-v-ea93b080"]]);
|
|
120897
|
+
const _hoisted_1$2$1 = {
|
|
120898
|
+
class: "toolbar-separator",
|
|
120899
|
+
role: "separator",
|
|
120900
|
+
"aria-label": "Toolbar separator"
|
|
120901
|
+
};
|
|
120902
|
+
const _sfc_main$3$1 = {
|
|
120903
|
+
__name: "ToolbarSeparator",
|
|
120904
|
+
props: {
|
|
120905
|
+
active: {
|
|
120906
|
+
type: Boolean,
|
|
120907
|
+
default: false
|
|
120908
|
+
}
|
|
120909
|
+
},
|
|
120910
|
+
emits: ["command"],
|
|
120911
|
+
setup(__props, { emit: __emit }) {
|
|
120912
|
+
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
120913
|
+
const getSeparatorColor = () => {
|
|
120914
|
+
if (isHighContrastMode2.value) {
|
|
120915
|
+
return "#000";
|
|
120916
|
+
}
|
|
120917
|
+
return "#dbdbdb";
|
|
120918
|
+
};
|
|
120919
|
+
return (_ctx, _cache) => {
|
|
120920
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2$1, [
|
|
120921
|
+
createBaseVNode("div", {
|
|
120922
|
+
class: "separator-inner",
|
|
120923
|
+
style: normalizeStyle({ backgroundColor: getSeparatorColor() })
|
|
120924
|
+
}, null, 4)
|
|
120925
|
+
]);
|
|
120926
|
+
};
|
|
120927
|
+
}
|
|
120928
|
+
};
|
|
120929
|
+
const ToolbarSeparator = /* @__PURE__ */ _export_sfc(_sfc_main$3$1, [["__scopeId", "data-v-4ef9aa18"]]);
|
|
120930
|
+
const _hoisted_1$1$1 = { class: "overflow-menu" };
|
|
120931
|
+
const _hoisted_2$1$1 = { class: "overflow-menu-trigger" };
|
|
120932
|
+
const _hoisted_3$1$1 = {
|
|
120933
|
+
key: 0,
|
|
120934
|
+
class: "overflow-menu_items",
|
|
120935
|
+
role: "group"
|
|
120936
|
+
};
|
|
120937
|
+
const _sfc_main$2$1 = {
|
|
120938
|
+
__name: "OverflowMenu",
|
|
120939
|
+
props: {
|
|
120940
|
+
toolbarItem: {
|
|
120941
|
+
type: Object,
|
|
120942
|
+
required: true
|
|
120943
|
+
},
|
|
120944
|
+
overflowItems: {
|
|
120945
|
+
type: Array,
|
|
120946
|
+
required: true
|
|
120947
|
+
}
|
|
120948
|
+
},
|
|
120949
|
+
emits: ["buttonClick", "close"],
|
|
120950
|
+
setup(__props, { emit: __emit }) {
|
|
120951
|
+
const { proxy } = getCurrentInstance();
|
|
120952
|
+
const emit = __emit;
|
|
120953
|
+
const props = __props;
|
|
120954
|
+
const isOverflowMenuOpened = computed(() => props.toolbarItem.expand.value);
|
|
120955
|
+
const hasOpenDropdown = ref$1(false);
|
|
120956
|
+
const overflowToolbarItem = computed(() => ({
|
|
120957
|
+
...props.toolbarItem,
|
|
120958
|
+
active: isOverflowMenuOpened.value
|
|
120959
|
+
}));
|
|
120960
|
+
const toggleOverflowMenu = () => {
|
|
120961
|
+
emit("buttonClick", props.toolbarItem);
|
|
120962
|
+
};
|
|
120963
|
+
const handleCommand = ({ item, argument }) => {
|
|
120964
|
+
proxy.$toolbar.emitCommand({ item, argument });
|
|
120965
|
+
};
|
|
120966
|
+
const handleKeyDown2 = (e) => {
|
|
120967
|
+
if (e.key === "Escape") {
|
|
120968
|
+
if (isOverflowMenuOpened.value && !hasOpenDropdown.value) {
|
|
120969
|
+
e.preventDefault();
|
|
120970
|
+
emit("close");
|
|
120971
|
+
}
|
|
120972
|
+
}
|
|
120973
|
+
};
|
|
120974
|
+
onMounted(() => {
|
|
120975
|
+
document.addEventListener("keydown", handleKeyDown2, true);
|
|
120976
|
+
});
|
|
120977
|
+
onBeforeUnmount(() => {
|
|
120978
|
+
document.removeEventListener("keydown", handleKeyDown2, true);
|
|
120979
|
+
});
|
|
120980
|
+
return (_ctx, _cache) => {
|
|
120981
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1$1, [
|
|
120982
|
+
createBaseVNode("div", _hoisted_2$1$1, [
|
|
120983
|
+
createVNode(ToolbarButton, {
|
|
120984
|
+
"toolbar-item": overflowToolbarItem.value,
|
|
120985
|
+
onButtonClick: toggleOverflowMenu
|
|
120986
|
+
}, null, 8, ["toolbar-item"])
|
|
120987
|
+
]),
|
|
120988
|
+
isOverflowMenuOpened.value ? (openBlock(), createElementBlock("div", _hoisted_3$1$1, [
|
|
120989
|
+
createVNode(ButtonGroup, {
|
|
120990
|
+
class: "superdoc-toolbar-overflow",
|
|
120991
|
+
"toolbar-items": __props.overflowItems,
|
|
120992
|
+
"from-overflow": "",
|
|
120993
|
+
onCommand: handleCommand,
|
|
120994
|
+
onDropdownUpdateShow: _cache[0] || (_cache[0] = ($event) => hasOpenDropdown.value = $event)
|
|
120995
|
+
}, null, 8, ["toolbar-items"])
|
|
120996
|
+
])) : createCommentVNode("", true)
|
|
120997
|
+
]);
|
|
120998
|
+
};
|
|
120999
|
+
}
|
|
121000
|
+
};
|
|
121001
|
+
const OverflowMenu = /* @__PURE__ */ _export_sfc(_sfc_main$2$1, [["__scopeId", "data-v-ef28da92"]]);
|
|
120499
121002
|
const _hoisted_1$h = ["onKeydown", "tabindex", "data-item-id"];
|
|
120500
121003
|
const _hoisted_2$b = { key: 0 };
|
|
120501
121004
|
const _hoisted_3$9 = { key: 0 };
|
|
@@ -120511,6 +121014,16 @@ const _sfc_main$1$1 = {
|
|
|
120511
121014
|
type: Array,
|
|
120512
121015
|
default: () => []
|
|
120513
121016
|
},
|
|
121017
|
+
/**
|
|
121018
|
+
* The font-family to use for UI elements like dropdowns and tooltips.
|
|
121019
|
+
* This ensures consistent typography across toolbar UI components.
|
|
121020
|
+
* @type {string}
|
|
121021
|
+
* @default 'Arial, Helvetica, sans-serif'
|
|
121022
|
+
*/
|
|
121023
|
+
uiFontFamily: {
|
|
121024
|
+
type: String,
|
|
121025
|
+
default: "Arial, Helvetica, sans-serif"
|
|
121026
|
+
},
|
|
120514
121027
|
position: {
|
|
120515
121028
|
type: String,
|
|
120516
121029
|
default: "left"
|
|
@@ -120703,6 +121216,7 @@ const _sfc_main$1$1 = {
|
|
|
120703
121216
|
options: dropdownOptions(item),
|
|
120704
121217
|
trigger: item.disabled.value ? null : "click",
|
|
120705
121218
|
show: item.expand.value,
|
|
121219
|
+
"content-style": { fontFamily: props.uiFontFamily },
|
|
120706
121220
|
size: "medium",
|
|
120707
121221
|
placement: "bottom-start",
|
|
120708
121222
|
class: normalizeClass(["toolbar-button toolbar-dropdown sd-editor-toolbar-dropdown", { "high-contrast": unref(isHighContrastMode2) }]),
|
|
@@ -120710,14 +121224,16 @@ const _sfc_main$1$1 = {
|
|
|
120710
121224
|
onUpdateShow: handleDropdownUpdateShow,
|
|
120711
121225
|
style: normalizeStyle(item.dropdownStyles.value),
|
|
120712
121226
|
"menu-props": () => ({
|
|
120713
|
-
role: "menu"
|
|
121227
|
+
role: "menu",
|
|
121228
|
+
style: { fontFamily: props.uiFontFamily }
|
|
120714
121229
|
}),
|
|
120715
121230
|
"node-props": (option) => getDropdownAttributes(option, item)
|
|
120716
121231
|
}, {
|
|
120717
121232
|
default: withCtx(() => [
|
|
120718
121233
|
createVNode(unref(NTooltip), {
|
|
120719
121234
|
trigger: "hover",
|
|
120720
|
-
disabled: !item.tooltip?.value
|
|
121235
|
+
disabled: !item.tooltip?.value,
|
|
121236
|
+
"content-style": { fontFamily: props.uiFontFamily }
|
|
120721
121237
|
}, {
|
|
120722
121238
|
trigger: withCtx(() => [
|
|
120723
121239
|
createVNode(ToolbarButton, {
|
|
@@ -120734,13 +121250,14 @@ const _sfc_main$1$1 = {
|
|
|
120734
121250
|
])
|
|
120735
121251
|
]),
|
|
120736
121252
|
_: 2
|
|
120737
|
-
}, 1032, ["disabled"])
|
|
121253
|
+
}, 1032, ["disabled", "content-style"])
|
|
120738
121254
|
]),
|
|
120739
121255
|
_: 2
|
|
120740
|
-
}, 1032, ["options", "trigger", "show", "class", "onSelect", "style", "node-props"])) : isButton(item) ? (openBlock(), createBlock(unref(NTooltip), {
|
|
121256
|
+
}, 1032, ["options", "trigger", "show", "content-style", "class", "onSelect", "style", "menu-props", "node-props"])) : isButton(item) ? (openBlock(), createBlock(unref(NTooltip), {
|
|
120741
121257
|
key: 2,
|
|
120742
121258
|
trigger: "hover",
|
|
120743
|
-
class: "sd-editor-toolbar-tooltip"
|
|
121259
|
+
class: "sd-editor-toolbar-tooltip",
|
|
121260
|
+
"content-style": { fontFamily: props.uiFontFamily }
|
|
120744
121261
|
}, {
|
|
120745
121262
|
trigger: withCtx(() => [
|
|
120746
121263
|
createVNode(ToolbarButton, {
|
|
@@ -120757,7 +121274,7 @@ const _sfc_main$1$1 = {
|
|
|
120757
121274
|
])) : createCommentVNode("", true)
|
|
120758
121275
|
]),
|
|
120759
121276
|
_: 2
|
|
120760
|
-
},
|
|
121277
|
+
}, 1032, ["content-style"])) : createCommentVNode("", true),
|
|
120761
121278
|
isOverflow(item) && __props.overflowItems.length ? (openBlock(), createBlock(OverflowMenu, {
|
|
120762
121279
|
key: 3,
|
|
120763
121280
|
"toolbar-item": item,
|
|
@@ -120771,13 +121288,21 @@ const _sfc_main$1$1 = {
|
|
|
120771
121288
|
};
|
|
120772
121289
|
}
|
|
120773
121290
|
};
|
|
120774
|
-
const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1$1, [["__scopeId", "data-v-
|
|
121291
|
+
const ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1$1, [["__scopeId", "data-v-f732136c"]]);
|
|
121292
|
+
const DEFAULT_UI_FONT_FAMILY = "Arial, Helvetica, sans-serif";
|
|
120775
121293
|
const _sfc_main$j = {
|
|
120776
121294
|
__name: "Toolbar",
|
|
120777
121295
|
emits: ["command", "toggle", "select"],
|
|
120778
121296
|
setup(__props, { emit: __emit }) {
|
|
120779
121297
|
const { proxy } = getCurrentInstance();
|
|
120780
121298
|
let toolbarKey = ref$1(1);
|
|
121299
|
+
const uiFontFamily = computed(() => {
|
|
121300
|
+
const configured = proxy?.$toolbar?.config?.uiDisplayFallbackFont;
|
|
121301
|
+
if (typeof configured === "string" && configured.trim()) {
|
|
121302
|
+
return configured.trim();
|
|
121303
|
+
}
|
|
121304
|
+
return DEFAULT_UI_FONT_FAMILY;
|
|
121305
|
+
});
|
|
120781
121306
|
const showLeftSide = proxy.$toolbar.config?.toolbarGroups?.includes("left");
|
|
120782
121307
|
const showRightSide = proxy.$toolbar.config?.toolbarGroups?.includes("right");
|
|
120783
121308
|
const excludeButtonsList = proxy.$toolbar.config?.toolbarButtonsExclude || [];
|
|
@@ -120824,37 +121349,48 @@ const _sfc_main$j = {
|
|
|
120824
121349
|
"aria-label": "Toolbar",
|
|
120825
121350
|
"data-editor-ui-surface": ""
|
|
120826
121351
|
}, [
|
|
120827
|
-
unref(
|
|
120828
|
-
|
|
120829
|
-
|
|
120830
|
-
|
|
120831
|
-
|
|
120832
|
-
|
|
120833
|
-
|
|
120834
|
-
|
|
120835
|
-
|
|
120836
|
-
|
|
120837
|
-
|
|
120838
|
-
|
|
120839
|
-
|
|
120840
|
-
|
|
120841
|
-
|
|
120842
|
-
|
|
120843
|
-
|
|
120844
|
-
|
|
120845
|
-
|
|
120846
|
-
|
|
120847
|
-
|
|
120848
|
-
|
|
120849
|
-
|
|
120850
|
-
|
|
120851
|
-
|
|
120852
|
-
|
|
121352
|
+
createVNode(unref(NConfigProvider), {
|
|
121353
|
+
abstract: "",
|
|
121354
|
+
"preflight-style-disabled": ""
|
|
121355
|
+
}, {
|
|
121356
|
+
default: withCtx(() => [
|
|
121357
|
+
unref(showLeftSide) ? (openBlock(), createBlock(ButtonGroup, {
|
|
121358
|
+
key: 0,
|
|
121359
|
+
tabindex: "0",
|
|
121360
|
+
"toolbar-items": getFilteredItems("left"),
|
|
121361
|
+
"ui-font-family": uiFontFamily.value,
|
|
121362
|
+
position: "left",
|
|
121363
|
+
onCommand: handleCommand,
|
|
121364
|
+
onItemClicked: restoreSelection2,
|
|
121365
|
+
class: "superdoc-toolbar-group-side"
|
|
121366
|
+
}, null, 8, ["toolbar-items", "ui-font-family"])) : createCommentVNode("", true),
|
|
121367
|
+
createVNode(ButtonGroup, {
|
|
121368
|
+
tabindex: "0",
|
|
121369
|
+
"toolbar-items": getFilteredItems("center"),
|
|
121370
|
+
"overflow-items": unref(proxy).$toolbar.overflowItems,
|
|
121371
|
+
"ui-font-family": uiFontFamily.value,
|
|
121372
|
+
position: "center",
|
|
121373
|
+
onCommand: handleCommand,
|
|
121374
|
+
onItemClicked: restoreSelection2
|
|
121375
|
+
}, null, 8, ["toolbar-items", "overflow-items", "ui-font-family"]),
|
|
121376
|
+
unref(showRightSide) ? (openBlock(), createBlock(ButtonGroup, {
|
|
121377
|
+
key: 1,
|
|
121378
|
+
tabindex: "0",
|
|
121379
|
+
"toolbar-items": getFilteredItems("right"),
|
|
121380
|
+
"ui-font-family": uiFontFamily.value,
|
|
121381
|
+
position: "right",
|
|
121382
|
+
onCommand: handleCommand,
|
|
121383
|
+
onItemClicked: restoreSelection2,
|
|
121384
|
+
class: "superdoc-toolbar-group-side"
|
|
121385
|
+
}, null, 8, ["toolbar-items", "ui-font-family"])) : createCommentVNode("", true)
|
|
121386
|
+
]),
|
|
121387
|
+
_: 1
|
|
121388
|
+
})
|
|
120853
121389
|
]);
|
|
120854
121390
|
};
|
|
120855
121391
|
}
|
|
120856
121392
|
};
|
|
120857
|
-
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-
|
|
121393
|
+
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-c7a72aa9"]]);
|
|
120858
121394
|
const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
|
|
120859
121395
|
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: ";
|
|
120860
121396
|
async function baseInsightsFetch(payload, options = {}) {
|
|
@@ -121371,7 +121907,7 @@ const _sfc_main$i = {
|
|
|
121371
121907
|
};
|
|
121372
121908
|
}
|
|
121373
121909
|
};
|
|
121374
|
-
const AIWriter = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-
|
|
121910
|
+
const AIWriter = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-a4bc3d14"]]);
|
|
121375
121911
|
async function createZip(blobs, fileNames) {
|
|
121376
121912
|
const zip = new JSZip();
|
|
121377
121913
|
blobs.forEach((blob, index2) => {
|
|
@@ -124220,6 +124756,10 @@ const _SuperToolbar = class _SuperToolbar2 extends EventEmitter2 {
|
|
|
124220
124756
|
this.config.selector = this.config.element;
|
|
124221
124757
|
}
|
|
124222
124758
|
this.toolbarContainer = this.findElementBySelector(this.config.selector);
|
|
124759
|
+
if (this.toolbarContainer) {
|
|
124760
|
+
const uiFontFamily = (this.config?.uiDisplayFallbackFont || "").toString().trim() || "Arial, Helvetica, sans-serif";
|
|
124761
|
+
this.toolbarContainer.style.setProperty("--sd-ui-font-family", uiFontFamily);
|
|
124762
|
+
}
|
|
124223
124763
|
__privateMethod(this, _SuperToolbar_instances, initToolbarGroups_fn).call(this);
|
|
124224
124764
|
__privateMethod(this, _SuperToolbar_instances, makeToolbarItems_fn).call(this, {
|
|
124225
124765
|
superToolbar: this,
|