@harbour-enterprises/superdoc 1.0.0-beta.3 → 1.0.0-beta.5
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-CxHbcDGx.cjs → PdfViewer-B2yJpudB.cjs} +1 -1
- package/dist/chunks/{PdfViewer-CKzs9Ct5.es.js → PdfViewer-Ebg4DPUi.es.js} +1 -1
- package/dist/chunks/{index-DukSDI8_.es.js → index-6_t69RiQ.es.js} +3 -3
- package/dist/chunks/{index-CJUy3fVi-D8zt9F3Z.es.js → index-D653XgvV-B-4_BIjA.es.js} +1 -1
- package/dist/chunks/{index-CJUy3fVi-BGLfCP5B.cjs → index-D653XgvV-BN--CbY4.cjs} +1 -1
- package/dist/chunks/{index-Dp3rVMnX.cjs → index-DcKcwu3F.cjs} +3 -3
- package/dist/chunks/{super-editor.es-BRKZG90h.es.js → super-editor.es-0TS__OEc.es.js} +205 -37
- package/dist/chunks/{super-editor.es-CDiTp9Fe.cjs → super-editor.es-Bt9VCC9D.cjs} +205 -37
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-B9YfBdcc.js → converter-BiUZIOjP.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-V16OzZ7a.js → docx-zipper-Dz6dcXS4.js} +1 -1
- package/dist/super-editor/chunks/{editor-DlvlVSbc.js → editor-BtePjrrv.js} +206 -38
- package/dist/super-editor/chunks/{index-CJUy3fVi.js → index-D653XgvV.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-cNDvtryE.js → toolbar-D6JNBgna.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +207 -39
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("./vue-ARQSyfaw.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
4
|
+
const superdoc = require("./index-DcKcwu3F.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { y as defineComponent, z as h, O as Transition, $ as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, u as createVNode, v as unref } from "./vue-CztqUvm1.es.js";
|
|
2
|
-
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-
|
|
2
|
+
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-6_t69RiQ.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-
|
|
1
|
+
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-0TS__OEc.es.js";
|
|
2
2
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
3
3
|
import { E as EventEmitter } from "./eventemitter3-ByBH0NYV.es.js";
|
|
4
4
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
@@ -17210,7 +17210,7 @@ const _sfc_main = {
|
|
|
17210
17210
|
__name: "SuperDoc",
|
|
17211
17211
|
emits: ["selection-update"],
|
|
17212
17212
|
setup(__props, { emit: __emit }) {
|
|
17213
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17213
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-Ebg4DPUi.es.js"));
|
|
17214
17214
|
const superdocStore = useSuperdocStore();
|
|
17215
17215
|
const commentsStore = useCommentsStore();
|
|
17216
17216
|
const {
|
|
@@ -18063,7 +18063,7 @@ class SuperDoc extends EventEmitter {
|
|
|
18063
18063
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18064
18064
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18065
18065
|
this.colorIndex = 0;
|
|
18066
|
-
this.version = "1.0.0-beta.
|
|
18066
|
+
this.version = "1.0.0-beta.5";
|
|
18067
18067
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18068
18068
|
this.superdocId = config.superdocId || v4();
|
|
18069
18069
|
this.colors = this.config.colors;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./super-editor.es-
|
|
3
|
+
const superEditor_es = require("./super-editor.es-Bt9VCC9D.cjs");
|
|
4
4
|
const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
|
|
5
5
|
function bail(error) {
|
|
6
6
|
if (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-Bt9VCC9D.cjs");
|
|
3
3
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
4
4
|
const eventemitter3 = require("./eventemitter3-CFCpOk3d.cjs");
|
|
5
5
|
const provider = require("@hocuspocus/provider");
|
|
@@ -17227,7 +17227,7 @@ const _sfc_main = {
|
|
|
17227
17227
|
__name: "SuperDoc",
|
|
17228
17228
|
emits: ["selection-update"],
|
|
17229
17229
|
setup(__props, { emit: __emit }) {
|
|
17230
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17230
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-B2yJpudB.cjs")));
|
|
17231
17231
|
const superdocStore = useSuperdocStore();
|
|
17232
17232
|
const commentsStore = useCommentsStore();
|
|
17233
17233
|
const {
|
|
@@ -18080,7 +18080,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18080
18080
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18081
18081
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18082
18082
|
this.colorIndex = 0;
|
|
18083
|
-
this.version = "1.0.0-beta.
|
|
18083
|
+
this.version = "1.0.0-beta.5";
|
|
18084
18084
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18085
18085
|
this.superdocId = config.superdocId || uuid.v4();
|
|
18086
18086
|
this.colors = this.config.colors;
|
|
@@ -35563,7 +35563,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
35563
35563
|
static getStoredSuperdocVersion(docx) {
|
|
35564
35564
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35565
35565
|
}
|
|
35566
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
35566
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.5") {
|
|
35567
35567
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35568
35568
|
}
|
|
35569
35569
|
/**
|
|
@@ -52270,7 +52270,7 @@ const isHeadless = (editor) => {
|
|
|
52270
52270
|
const shouldSkipNodeView = (editor) => {
|
|
52271
52271
|
return isHeadless(editor);
|
|
52272
52272
|
};
|
|
52273
|
-
const summaryVersion = "1.0.0-beta.
|
|
52273
|
+
const summaryVersion = "1.0.0-beta.5";
|
|
52274
52274
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
52275
52275
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
52276
52276
|
function mapAttributes(attrs) {
|
|
@@ -53049,7 +53049,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53049
53049
|
{ default: remarkStringify },
|
|
53050
53050
|
{ default: remarkGfm }
|
|
53051
53051
|
] = await Promise.all([
|
|
53052
|
-
import("./index-
|
|
53052
|
+
import("./index-D653XgvV-B-4_BIjA.es.js"),
|
|
53053
53053
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
53054
53054
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
53055
53055
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -53254,7 +53254,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53254
53254
|
* Process collaboration migrations
|
|
53255
53255
|
*/
|
|
53256
53256
|
processCollaborationMigrations() {
|
|
53257
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
53257
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.5");
|
|
53258
53258
|
if (!this.options.ydoc) return;
|
|
53259
53259
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
53260
53260
|
let docVersion = metaMap.get("version");
|
|
@@ -55085,6 +55085,19 @@ const sanitizeFontFamily = (fontFamily2) => {
|
|
|
55085
55085
|
}
|
|
55086
55086
|
return sanitized;
|
|
55087
55087
|
};
|
|
55088
|
+
const normalizeFontSizePx = (value) => {
|
|
55089
|
+
if (isFiniteNumber(value)) return value;
|
|
55090
|
+
if (typeof value !== "string") return void 0;
|
|
55091
|
+
const trimmed = value.trim();
|
|
55092
|
+
if (!trimmed) return void 0;
|
|
55093
|
+
const numeric = Number.parseFloat(trimmed);
|
|
55094
|
+
if (!Number.isFinite(numeric)) return void 0;
|
|
55095
|
+
const unit = trimmed.match(/[a-zA-Z%]+$/)?.[0]?.toLowerCase();
|
|
55096
|
+
if (unit === "pt") {
|
|
55097
|
+
return ptToPx(numeric);
|
|
55098
|
+
}
|
|
55099
|
+
return numeric;
|
|
55100
|
+
};
|
|
55088
55101
|
const applyTextStyleMark = (run2, attrs, themeColors) => {
|
|
55089
55102
|
const resolvedColor = resolveColorFromAttributes(attrs, themeColors);
|
|
55090
55103
|
if (resolvedColor) {
|
|
@@ -55096,9 +55109,9 @@ const applyTextStyleMark = (run2, attrs, themeColors) => {
|
|
|
55096
55109
|
run2.fontFamily = sanitized;
|
|
55097
55110
|
}
|
|
55098
55111
|
}
|
|
55099
|
-
const
|
|
55100
|
-
if (
|
|
55101
|
-
run2.fontSize =
|
|
55112
|
+
const fontSizePx = normalizeFontSizePx(attrs.fontSize);
|
|
55113
|
+
if (fontSizePx !== void 0 && fontSizePx >= 1 && fontSizePx <= 1e3) {
|
|
55114
|
+
run2.fontSize = fontSizePx;
|
|
55102
55115
|
}
|
|
55103
55116
|
if (isFiniteNumber(attrs.letterSpacing)) {
|
|
55104
55117
|
const spacing = Number(attrs.letterSpacing);
|
|
@@ -65358,8 +65371,59 @@ const _DomPainter = class _DomPainter2 {
|
|
|
65358
65371
|
this.headerProvider = header;
|
|
65359
65372
|
this.footerProvider = footer;
|
|
65360
65373
|
}
|
|
65361
|
-
|
|
65374
|
+
/**
|
|
65375
|
+
* Updates the painter's block and measure data.
|
|
65376
|
+
*
|
|
65377
|
+
* @param blocks - Main document blocks
|
|
65378
|
+
* @param measures - Measures corresponding to main document blocks
|
|
65379
|
+
* @param headerBlocks - Optional header blocks from header/footer layout results
|
|
65380
|
+
* @param headerMeasures - Optional measures corresponding to header blocks
|
|
65381
|
+
* @param footerBlocks - Optional footer blocks from header/footer layout results
|
|
65382
|
+
* @param footerMeasures - Optional measures corresponding to footer blocks
|
|
65383
|
+
*/
|
|
65384
|
+
setData(blocks, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures) {
|
|
65385
|
+
if (blocks.length !== measures.length) {
|
|
65386
|
+
throw new Error(
|
|
65387
|
+
`setData: blocks and measures arrays must have the same length. Got blocks.length=${blocks.length}, measures.length=${measures.length}`
|
|
65388
|
+
);
|
|
65389
|
+
}
|
|
65390
|
+
const hasHeaderBlocks = headerBlocks !== void 0;
|
|
65391
|
+
const hasHeaderMeasures = headerMeasures !== void 0;
|
|
65392
|
+
if (hasHeaderBlocks !== hasHeaderMeasures) {
|
|
65393
|
+
throw new Error(
|
|
65394
|
+
`setData: headerBlocks and headerMeasures must both be provided or both be omitted. Got headerBlocks=${hasHeaderBlocks ? "provided" : "omitted"}, headerMeasures=${hasHeaderMeasures ? "provided" : "omitted"}`
|
|
65395
|
+
);
|
|
65396
|
+
}
|
|
65397
|
+
if (hasHeaderBlocks && hasHeaderMeasures && headerBlocks.length !== headerMeasures.length) {
|
|
65398
|
+
throw new Error(
|
|
65399
|
+
`setData: headerBlocks and headerMeasures arrays must have the same length. Got headerBlocks.length=${headerBlocks.length}, headerMeasures.length=${headerMeasures.length}`
|
|
65400
|
+
);
|
|
65401
|
+
}
|
|
65402
|
+
const hasFooterBlocks = footerBlocks !== void 0;
|
|
65403
|
+
const hasFooterMeasures = footerMeasures !== void 0;
|
|
65404
|
+
if (hasFooterBlocks !== hasFooterMeasures) {
|
|
65405
|
+
throw new Error(
|
|
65406
|
+
`setData: footerBlocks and footerMeasures must both be provided or both be omitted. Got footerBlocks=${hasFooterBlocks ? "provided" : "omitted"}, footerMeasures=${hasFooterMeasures ? "provided" : "omitted"}`
|
|
65407
|
+
);
|
|
65408
|
+
}
|
|
65409
|
+
if (hasFooterBlocks && hasFooterMeasures && footerBlocks.length !== footerMeasures.length) {
|
|
65410
|
+
throw new Error(
|
|
65411
|
+
`setData: footerBlocks and footerMeasures arrays must have the same length. Got footerBlocks.length=${footerBlocks.length}, footerMeasures.length=${footerMeasures.length}`
|
|
65412
|
+
);
|
|
65413
|
+
}
|
|
65362
65414
|
const nextLookup = this.buildBlockLookup(blocks, measures);
|
|
65415
|
+
if (headerBlocks && headerMeasures) {
|
|
65416
|
+
const headerLookup = this.buildBlockLookup(headerBlocks, headerMeasures);
|
|
65417
|
+
headerLookup.forEach((entry, id) => {
|
|
65418
|
+
nextLookup.set(id, entry);
|
|
65419
|
+
});
|
|
65420
|
+
}
|
|
65421
|
+
if (footerBlocks && footerMeasures) {
|
|
65422
|
+
const footerLookup = this.buildBlockLookup(footerBlocks, footerMeasures);
|
|
65423
|
+
footerLookup.forEach((entry, id) => {
|
|
65424
|
+
nextLookup.set(id, entry);
|
|
65425
|
+
});
|
|
65426
|
+
}
|
|
65363
65427
|
const changed = /* @__PURE__ */ new Set();
|
|
65364
65428
|
nextLookup.forEach((entry, id) => {
|
|
65365
65429
|
const previous = this.blockLookup.get(id);
|
|
@@ -65682,6 +65746,14 @@ const _DomPainter = class _DomPainter2 {
|
|
|
65682
65746
|
container.style.height = `${data.height}px`;
|
|
65683
65747
|
container.style.top = `${Math.max(0, offset2)}px`;
|
|
65684
65748
|
container.style.zIndex = "1";
|
|
65749
|
+
let footerYOffset = 0;
|
|
65750
|
+
if (kind === "footer" && data.fragments.length > 0) {
|
|
65751
|
+
const contentHeight = typeof data.contentHeight === "number" ? data.contentHeight : data.fragments.reduce((max2, f2) => {
|
|
65752
|
+
const fragHeight = "height" in f2 && typeof f2.height === "number" ? f2.height : this.estimateFragmentHeight(f2);
|
|
65753
|
+
return Math.max(max2, f2.y + Math.max(0, fragHeight));
|
|
65754
|
+
}, 0);
|
|
65755
|
+
footerYOffset = Math.max(0, data.height - contentHeight);
|
|
65756
|
+
}
|
|
65685
65757
|
const context = {
|
|
65686
65758
|
pageNumber: page.number,
|
|
65687
65759
|
totalPages: this.totalPages,
|
|
@@ -65690,6 +65762,10 @@ const _DomPainter = class _DomPainter2 {
|
|
|
65690
65762
|
};
|
|
65691
65763
|
data.fragments.forEach((fragment) => {
|
|
65692
65764
|
const fragEl = this.renderFragment(fragment, context);
|
|
65765
|
+
if (footerYOffset > 0) {
|
|
65766
|
+
const currentTop = parseFloat(fragEl.style.top) || fragment.y;
|
|
65767
|
+
fragEl.style.top = `${currentTop + footerYOffset}px`;
|
|
65768
|
+
}
|
|
65693
65769
|
container.appendChild(fragEl);
|
|
65694
65770
|
});
|
|
65695
65771
|
if (!existing) {
|
|
@@ -66001,13 +66077,13 @@ const _DomPainter = class _DomPainter2 {
|
|
|
66001
66077
|
const markerEl = this.doc.createElement("span");
|
|
66002
66078
|
markerEl.classList.add("superdoc-list-marker");
|
|
66003
66079
|
const wordLayout = item.paragraph.attrs?.wordLayout;
|
|
66004
|
-
|
|
66005
|
-
|
|
66006
|
-
markerEl.textContent = marker.markerText;
|
|
66080
|
+
const marker = wordLayout?.marker;
|
|
66081
|
+
if (marker) {
|
|
66082
|
+
markerEl.textContent = marker.markerText ?? null;
|
|
66007
66083
|
markerEl.style.display = "inline-block";
|
|
66008
66084
|
markerEl.style.width = `${Math.max(0, fragment.markerWidth - LIST_MARKER_GAP$1)}px`;
|
|
66009
66085
|
markerEl.style.paddingRight = `${LIST_MARKER_GAP$1}px`;
|
|
66010
|
-
markerEl.style.textAlign = marker.justification;
|
|
66086
|
+
markerEl.style.textAlign = marker.justification ?? "";
|
|
66011
66087
|
markerEl.style.fontFamily = marker.run.fontFamily;
|
|
66012
66088
|
markerEl.style.fontSize = `${marker.run.fontSize}px`;
|
|
66013
66089
|
if (marker.run.bold) markerEl.style.fontWeight = "bold";
|
|
@@ -66756,6 +66832,33 @@ const _DomPainter = class _DomPainter2 {
|
|
|
66756
66832
|
}
|
|
66757
66833
|
}
|
|
66758
66834
|
}
|
|
66835
|
+
/**
|
|
66836
|
+
* Estimates the height of a fragment when explicit height is not available.
|
|
66837
|
+
*
|
|
66838
|
+
* This method provides fallback height calculations for footer bottom-alignment
|
|
66839
|
+
* by consulting measure data for paragraphs and list items, or using the
|
|
66840
|
+
* fragment's height property for tables, images, and drawings.
|
|
66841
|
+
*
|
|
66842
|
+
* @param fragment - The fragment to estimate height for
|
|
66843
|
+
* @returns Estimated height in pixels, or 0 if height cannot be determined
|
|
66844
|
+
*/
|
|
66845
|
+
estimateFragmentHeight(fragment) {
|
|
66846
|
+
const lookup2 = this.blockLookup.get(fragment.blockId);
|
|
66847
|
+
const measure = lookup2?.measure;
|
|
66848
|
+
if (fragment.kind === "para" && measure?.kind === "paragraph") {
|
|
66849
|
+
return measure.totalHeight;
|
|
66850
|
+
}
|
|
66851
|
+
if (fragment.kind === "list-item" && measure?.kind === "list") {
|
|
66852
|
+
return measure.totalHeight;
|
|
66853
|
+
}
|
|
66854
|
+
if (fragment.kind === "table") {
|
|
66855
|
+
return fragment.height;
|
|
66856
|
+
}
|
|
66857
|
+
if (fragment.kind === "image" || fragment.kind === "drawing") {
|
|
66858
|
+
return fragment.height;
|
|
66859
|
+
}
|
|
66860
|
+
return 0;
|
|
66861
|
+
}
|
|
66759
66862
|
buildBlockLookup(blocks, measures) {
|
|
66760
66863
|
if (blocks.length !== measures.length) {
|
|
66761
66864
|
throw new Error("DomPainter requires the same number of blocks and measures");
|
|
@@ -67224,8 +67327,8 @@ const createDomPainter = (options) => {
|
|
|
67224
67327
|
paint(layout, mount2) {
|
|
67225
67328
|
painter.paint(layout, mount2);
|
|
67226
67329
|
},
|
|
67227
|
-
setData(blocks, measures) {
|
|
67228
|
-
painter.setData(blocks, measures);
|
|
67330
|
+
setData(blocks, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures) {
|
|
67331
|
+
painter.setData(blocks, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures);
|
|
67229
67332
|
},
|
|
67230
67333
|
// Non-standard extension for demo app to avoid re-instantiating on provider changes
|
|
67231
67334
|
setProviders(header, footer) {
|
|
@@ -70614,7 +70717,30 @@ rerender_fn = async function() {
|
|
|
70614
70717
|
if (typeof painter.setProviders === "function") {
|
|
70615
70718
|
painter.setProviders(__privateGet$1(this, _headerDecorationProvider), __privateGet$1(this, _footerDecorationProvider));
|
|
70616
70719
|
}
|
|
70617
|
-
|
|
70720
|
+
const headerBlocks = [];
|
|
70721
|
+
const headerMeasures = [];
|
|
70722
|
+
if (headerLayouts) {
|
|
70723
|
+
for (const headerResult of headerLayouts) {
|
|
70724
|
+
headerBlocks.push(...headerResult.blocks);
|
|
70725
|
+
headerMeasures.push(...headerResult.measures);
|
|
70726
|
+
}
|
|
70727
|
+
}
|
|
70728
|
+
const footerBlocks = [];
|
|
70729
|
+
const footerMeasures = [];
|
|
70730
|
+
if (footerLayouts) {
|
|
70731
|
+
for (const footerResult of footerLayouts) {
|
|
70732
|
+
footerBlocks.push(...footerResult.blocks);
|
|
70733
|
+
footerMeasures.push(...footerResult.measures);
|
|
70734
|
+
}
|
|
70735
|
+
}
|
|
70736
|
+
painter.setData?.(
|
|
70737
|
+
blocks,
|
|
70738
|
+
measures,
|
|
70739
|
+
headerBlocks.length > 0 ? headerBlocks : void 0,
|
|
70740
|
+
headerMeasures.length > 0 ? headerMeasures : void 0,
|
|
70741
|
+
footerBlocks.length > 0 ? footerBlocks : void 0,
|
|
70742
|
+
footerMeasures.length > 0 ? footerMeasures : void 0
|
|
70743
|
+
);
|
|
70618
70744
|
painter.paint(layout, __privateGet$1(this, _painterHost));
|
|
70619
70745
|
__privateSet(this, _layoutError, null);
|
|
70620
70746
|
__privateSet(this, _layoutErrorState, "healthy");
|
|
@@ -70784,7 +70910,8 @@ createDecorationProvider_fn = function(kind, layout) {
|
|
|
70784
70910
|
const finalHeaderId = headerId ?? fallbackId ?? void 0;
|
|
70785
70911
|
return {
|
|
70786
70912
|
fragments: slotPage.fragments,
|
|
70787
|
-
height:
|
|
70913
|
+
height: box.height,
|
|
70914
|
+
contentHeight: variant.layout.height ?? box.height,
|
|
70788
70915
|
offset: box.offset,
|
|
70789
70916
|
marginLeft: box.x,
|
|
70790
70917
|
contentWidth: box.width,
|
|
@@ -70811,18 +70938,19 @@ computeDecorationBox_fn = function(kind, pageMargins, pageHeight) {
|
|
|
70811
70938
|
const left2 = margins.left ?? DEFAULT_MARGINS.left;
|
|
70812
70939
|
const right2 = margins.right ?? DEFAULT_MARGINS.right;
|
|
70813
70940
|
const width = Math.max(pageSize.w - (left2 + right2), 1);
|
|
70814
|
-
const defaultHeight = kind === "header" ? margins.top ?? DEFAULT_MARGINS.top : margins.bottom ?? DEFAULT_MARGINS.bottom;
|
|
70815
|
-
const { headerSpace, footerSpace } = extractHeaderFooterSpace(margins);
|
|
70816
|
-
const target = kind === "header" ? headerSpace : footerSpace;
|
|
70817
|
-
const height = Math.max(target || defaultHeight || 1, 1);
|
|
70818
70941
|
const totalHeight = pageHeight ?? pageSize.h;
|
|
70819
|
-
|
|
70820
|
-
|
|
70821
|
-
|
|
70822
|
-
|
|
70823
|
-
height,
|
|
70824
|
-
|
|
70825
|
-
|
|
70942
|
+
if (kind === "header") {
|
|
70943
|
+
const headerMargin = margins.header ?? 0;
|
|
70944
|
+
const topMargin = margins.top ?? DEFAULT_MARGINS.top ?? 0;
|
|
70945
|
+
const height = Math.max(topMargin - headerMargin, 1);
|
|
70946
|
+
return { x: left2, width, height, offset: headerMargin };
|
|
70947
|
+
} else {
|
|
70948
|
+
const footerMargin = margins.footer ?? 0;
|
|
70949
|
+
const bottomMargin = margins.bottom ?? DEFAULT_MARGINS.bottom ?? 0;
|
|
70950
|
+
const height = Math.max(bottomMargin - footerMargin, 1);
|
|
70951
|
+
const offset2 = Math.max(0, totalHeight - footerMargin - height);
|
|
70952
|
+
return { x: left2, width, height, offset: offset2 };
|
|
70953
|
+
}
|
|
70826
70954
|
};
|
|
70827
70955
|
rebuildHeaderFooterRegions_fn = function(layout) {
|
|
70828
70956
|
__privateGet$1(this, _headerRegions).clear();
|
|
@@ -89243,13 +89371,22 @@ function checkWordBoundary(state2, pos) {
|
|
|
89243
89371
|
return !/\p{L}$/u.test(before.text) || !/^\p{L}/u.test(after.text);
|
|
89244
89372
|
}
|
|
89245
89373
|
class SearchState {
|
|
89246
|
-
|
|
89374
|
+
/**
|
|
89375
|
+
* Create a new SearchState instance.
|
|
89376
|
+
*
|
|
89377
|
+
* @param {SearchQuery} query - The search query to execute
|
|
89378
|
+
* @param {{from: number, to: number}|null} range - Optional range to restrict search to, or null for entire document
|
|
89379
|
+
* @param {boolean} highlight - Whether to apply CSS classes for visual highlighting of matches
|
|
89380
|
+
* @param {DecorationSet} deco - The decoration set containing match highlights
|
|
89381
|
+
*/
|
|
89382
|
+
constructor(query, range2, highlight, deco) {
|
|
89247
89383
|
this.query = query;
|
|
89248
89384
|
this.range = range2;
|
|
89385
|
+
this.highlight = highlight;
|
|
89249
89386
|
this.deco = deco;
|
|
89250
89387
|
}
|
|
89251
89388
|
}
|
|
89252
|
-
function buildMatchDeco(state2, query, range2) {
|
|
89389
|
+
function buildMatchDeco(state2, query, range2, highlight = true) {
|
|
89253
89390
|
if (!query.valid) return DecorationSet.empty;
|
|
89254
89391
|
let deco = [];
|
|
89255
89392
|
let sel = state2.selection;
|
|
@@ -89257,7 +89394,8 @@ function buildMatchDeco(state2, query, range2) {
|
|
|
89257
89394
|
let next = query.findNext(state2, pos, end2);
|
|
89258
89395
|
if (!next) break;
|
|
89259
89396
|
let cls = next.from == sel.from && next.to == sel.to ? "ProseMirror-active-search-match" : "ProseMirror-search-match";
|
|
89260
|
-
|
|
89397
|
+
const attrs = highlight ? { class: cls } : {};
|
|
89398
|
+
deco.push(Decoration.inline(next.from, next.to, attrs));
|
|
89261
89399
|
pos = next.to;
|
|
89262
89400
|
}
|
|
89263
89401
|
return DecorationSet.create(state2.doc, deco);
|
|
@@ -89270,11 +89408,20 @@ function search(options = {}) {
|
|
|
89270
89408
|
init(_config, state2) {
|
|
89271
89409
|
let query = options.initialQuery || new SearchQuery({ search: "" });
|
|
89272
89410
|
let range2 = options.initialRange || null;
|
|
89273
|
-
|
|
89411
|
+
const highlight = options.initialHighlight ?? true;
|
|
89412
|
+
return new SearchState(query, range2, highlight, buildMatchDeco(state2, query, range2, highlight));
|
|
89274
89413
|
},
|
|
89275
89414
|
apply(tr, search2, _oldState, state2) {
|
|
89276
89415
|
let set = tr.getMeta(searchKey);
|
|
89277
|
-
if (set)
|
|
89416
|
+
if (set) {
|
|
89417
|
+
const highlight = typeof set.highlight === "boolean" ? set.highlight : true;
|
|
89418
|
+
return new SearchState(
|
|
89419
|
+
set.query,
|
|
89420
|
+
set.range,
|
|
89421
|
+
highlight,
|
|
89422
|
+
buildMatchDeco(state2, set.query, set.range, highlight)
|
|
89423
|
+
);
|
|
89424
|
+
}
|
|
89278
89425
|
if (tr.docChanged || tr.selectionSet) {
|
|
89279
89426
|
let range2 = search2.range;
|
|
89280
89427
|
if (range2) {
|
|
@@ -89282,7 +89429,13 @@ function search(options = {}) {
|
|
|
89282
89429
|
let to = tr.mapping.map(range2.to, -1);
|
|
89283
89430
|
range2 = from2 < to ? { from: from2, to } : null;
|
|
89284
89431
|
}
|
|
89285
|
-
|
|
89432
|
+
const highlight = typeof search2.highlight === "boolean" ? search2.highlight : true;
|
|
89433
|
+
search2 = new SearchState(
|
|
89434
|
+
search2.query,
|
|
89435
|
+
range2,
|
|
89436
|
+
highlight,
|
|
89437
|
+
buildMatchDeco(state2, search2.query, range2, highlight)
|
|
89438
|
+
);
|
|
89286
89439
|
}
|
|
89287
89440
|
return search2;
|
|
89288
89441
|
}
|
|
@@ -89296,8 +89449,12 @@ function getMatchHighlights(state2) {
|
|
|
89296
89449
|
let search2 = searchKey.getState(state2);
|
|
89297
89450
|
return search2 ? search2.deco : DecorationSet.empty;
|
|
89298
89451
|
}
|
|
89299
|
-
function setSearchState(tr, query, range2 = null) {
|
|
89300
|
-
|
|
89452
|
+
function setSearchState(tr, query, range2 = null, options = {}) {
|
|
89453
|
+
if (options != null && (typeof options !== "object" || Array.isArray(options))) {
|
|
89454
|
+
throw new TypeError("setSearchState options must be an object");
|
|
89455
|
+
}
|
|
89456
|
+
const highlight = typeof options?.highlight === "boolean" ? options.highlight : true;
|
|
89457
|
+
return tr.setMeta(searchKey, { query, range: range2, highlight });
|
|
89301
89458
|
}
|
|
89302
89459
|
const isRegExp = (value) => Object.prototype.toString.call(value) === "[object RegExp]";
|
|
89303
89460
|
const Search = Extension.create({
|
|
@@ -89358,14 +89515,25 @@ const Search = Extension.create({
|
|
|
89358
89515
|
* Search for string matches in editor content
|
|
89359
89516
|
* @category Command
|
|
89360
89517
|
* @param {String|RegExp} patternInput - Search string or pattern
|
|
89518
|
+
* @param {SearchCommandOptions} [options={}] - Options to control search behavior
|
|
89361
89519
|
* @example
|
|
89520
|
+
* // Basic search with highlighting (default)
|
|
89362
89521
|
* const matches = editor.commands.search('test string')
|
|
89522
|
+
*
|
|
89523
|
+
* // Regex search
|
|
89363
89524
|
* const regexMatches = editor.commands.search(/test/i)
|
|
89525
|
+
*
|
|
89526
|
+
* // Search without visual highlighting
|
|
89527
|
+
* const silentMatches = editor.commands.search('test', { highlight: false })
|
|
89364
89528
|
* @note Returns array of SearchMatch objects with positions and IDs
|
|
89365
89529
|
*/
|
|
89366
|
-
search: (patternInput) => (
|
|
89530
|
+
search: (patternInput, options = {}) => (
|
|
89367
89531
|
/** @returns {SearchMatch[]} */
|
|
89368
89532
|
(({ state: state2, dispatch }) => {
|
|
89533
|
+
if (options != null && (typeof options !== "object" || Array.isArray(options))) {
|
|
89534
|
+
throw new TypeError("Search options must be an object");
|
|
89535
|
+
}
|
|
89536
|
+
const highlight = typeof options?.highlight === "boolean" ? options.highlight : true;
|
|
89369
89537
|
let pattern;
|
|
89370
89538
|
let caseSensitive = false;
|
|
89371
89539
|
let regexp = false;
|
|
@@ -89392,7 +89560,7 @@ const Search = Extension.create({
|
|
|
89392
89560
|
regexp,
|
|
89393
89561
|
wholeWord
|
|
89394
89562
|
});
|
|
89395
|
-
const tr = setSearchState(state2.tr, query);
|
|
89563
|
+
const tr = setSearchState(state2.tr, query, null, { highlight });
|
|
89396
89564
|
dispatch(tr);
|
|
89397
89565
|
const newState = state2.apply(tr);
|
|
89398
89566
|
const decoSet = getMatchHighlights(newState);
|