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
package/dist/superdoc.umd.js
CHANGED
|
@@ -35581,7 +35581,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35581
35581
|
static getStoredSuperdocVersion(docx) {
|
|
35582
35582
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35583
35583
|
}
|
|
35584
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
35584
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.5") {
|
|
35585
35585
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35586
35586
|
}
|
|
35587
35587
|
/**
|
|
@@ -60069,7 +60069,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60069
60069
|
const shouldSkipNodeView = (editor) => {
|
|
60070
60070
|
return isHeadless(editor);
|
|
60071
60071
|
};
|
|
60072
|
-
const summaryVersion = "1.0.0-beta.
|
|
60072
|
+
const summaryVersion = "1.0.0-beta.5";
|
|
60073
60073
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
60074
60074
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
60075
60075
|
function mapAttributes(attrs) {
|
|
@@ -60848,7 +60848,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60848
60848
|
{ default: remarkStringify2 },
|
|
60849
60849
|
{ default: remarkGfm2 }
|
|
60850
60850
|
] = await Promise.all([
|
|
60851
|
-
Promise.resolve().then(() =>
|
|
60851
|
+
Promise.resolve().then(() => indexD653XgvV),
|
|
60852
60852
|
Promise.resolve().then(() => indexDRCvimau),
|
|
60853
60853
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
60854
60854
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -61053,7 +61053,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61053
61053
|
* Process collaboration migrations
|
|
61054
61054
|
*/
|
|
61055
61055
|
processCollaborationMigrations() {
|
|
61056
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
61056
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.5");
|
|
61057
61057
|
if (!this.options.ydoc) return;
|
|
61058
61058
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
61059
61059
|
let docVersion = metaMap.get("version");
|
|
@@ -62884,6 +62884,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62884
62884
|
}
|
|
62885
62885
|
return sanitized;
|
|
62886
62886
|
};
|
|
62887
|
+
const normalizeFontSizePx = (value) => {
|
|
62888
|
+
if (isFiniteNumber(value)) return value;
|
|
62889
|
+
if (typeof value !== "string") return void 0;
|
|
62890
|
+
const trimmed = value.trim();
|
|
62891
|
+
if (!trimmed) return void 0;
|
|
62892
|
+
const numeric = Number.parseFloat(trimmed);
|
|
62893
|
+
if (!Number.isFinite(numeric)) return void 0;
|
|
62894
|
+
const unit = trimmed.match(/[a-zA-Z%]+$/)?.[0]?.toLowerCase();
|
|
62895
|
+
if (unit === "pt") {
|
|
62896
|
+
return ptToPx(numeric);
|
|
62897
|
+
}
|
|
62898
|
+
return numeric;
|
|
62899
|
+
};
|
|
62887
62900
|
const applyTextStyleMark = (run2, attrs, themeColors) => {
|
|
62888
62901
|
const resolvedColor = resolveColorFromAttributes(attrs, themeColors);
|
|
62889
62902
|
if (resolvedColor) {
|
|
@@ -62895,9 +62908,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62895
62908
|
run2.fontFamily = sanitized;
|
|
62896
62909
|
}
|
|
62897
62910
|
}
|
|
62898
|
-
const
|
|
62899
|
-
if (
|
|
62900
|
-
run2.fontSize =
|
|
62911
|
+
const fontSizePx = normalizeFontSizePx(attrs.fontSize);
|
|
62912
|
+
if (fontSizePx !== void 0 && fontSizePx >= 1 && fontSizePx <= 1e3) {
|
|
62913
|
+
run2.fontSize = fontSizePx;
|
|
62901
62914
|
}
|
|
62902
62915
|
if (isFiniteNumber(attrs.letterSpacing)) {
|
|
62903
62916
|
const spacing = Number(attrs.letterSpacing);
|
|
@@ -73157,8 +73170,59 @@ ${l}
|
|
|
73157
73170
|
this.headerProvider = header;
|
|
73158
73171
|
this.footerProvider = footer;
|
|
73159
73172
|
}
|
|
73160
|
-
|
|
73173
|
+
/**
|
|
73174
|
+
* Updates the painter's block and measure data.
|
|
73175
|
+
*
|
|
73176
|
+
* @param blocks - Main document blocks
|
|
73177
|
+
* @param measures - Measures corresponding to main document blocks
|
|
73178
|
+
* @param headerBlocks - Optional header blocks from header/footer layout results
|
|
73179
|
+
* @param headerMeasures - Optional measures corresponding to header blocks
|
|
73180
|
+
* @param footerBlocks - Optional footer blocks from header/footer layout results
|
|
73181
|
+
* @param footerMeasures - Optional measures corresponding to footer blocks
|
|
73182
|
+
*/
|
|
73183
|
+
setData(blocks2, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures) {
|
|
73184
|
+
if (blocks2.length !== measures.length) {
|
|
73185
|
+
throw new Error(
|
|
73186
|
+
`setData: blocks and measures arrays must have the same length. Got blocks.length=${blocks2.length}, measures.length=${measures.length}`
|
|
73187
|
+
);
|
|
73188
|
+
}
|
|
73189
|
+
const hasHeaderBlocks = headerBlocks !== void 0;
|
|
73190
|
+
const hasHeaderMeasures = headerMeasures !== void 0;
|
|
73191
|
+
if (hasHeaderBlocks !== hasHeaderMeasures) {
|
|
73192
|
+
throw new Error(
|
|
73193
|
+
`setData: headerBlocks and headerMeasures must both be provided or both be omitted. Got headerBlocks=${hasHeaderBlocks ? "provided" : "omitted"}, headerMeasures=${hasHeaderMeasures ? "provided" : "omitted"}`
|
|
73194
|
+
);
|
|
73195
|
+
}
|
|
73196
|
+
if (hasHeaderBlocks && hasHeaderMeasures && headerBlocks.length !== headerMeasures.length) {
|
|
73197
|
+
throw new Error(
|
|
73198
|
+
`setData: headerBlocks and headerMeasures arrays must have the same length. Got headerBlocks.length=${headerBlocks.length}, headerMeasures.length=${headerMeasures.length}`
|
|
73199
|
+
);
|
|
73200
|
+
}
|
|
73201
|
+
const hasFooterBlocks = footerBlocks !== void 0;
|
|
73202
|
+
const hasFooterMeasures = footerMeasures !== void 0;
|
|
73203
|
+
if (hasFooterBlocks !== hasFooterMeasures) {
|
|
73204
|
+
throw new Error(
|
|
73205
|
+
`setData: footerBlocks and footerMeasures must both be provided or both be omitted. Got footerBlocks=${hasFooterBlocks ? "provided" : "omitted"}, footerMeasures=${hasFooterMeasures ? "provided" : "omitted"}`
|
|
73206
|
+
);
|
|
73207
|
+
}
|
|
73208
|
+
if (hasFooterBlocks && hasFooterMeasures && footerBlocks.length !== footerMeasures.length) {
|
|
73209
|
+
throw new Error(
|
|
73210
|
+
`setData: footerBlocks and footerMeasures arrays must have the same length. Got footerBlocks.length=${footerBlocks.length}, footerMeasures.length=${footerMeasures.length}`
|
|
73211
|
+
);
|
|
73212
|
+
}
|
|
73161
73213
|
const nextLookup = this.buildBlockLookup(blocks2, measures);
|
|
73214
|
+
if (headerBlocks && headerMeasures) {
|
|
73215
|
+
const headerLookup = this.buildBlockLookup(headerBlocks, headerMeasures);
|
|
73216
|
+
headerLookup.forEach((entry, id) => {
|
|
73217
|
+
nextLookup.set(id, entry);
|
|
73218
|
+
});
|
|
73219
|
+
}
|
|
73220
|
+
if (footerBlocks && footerMeasures) {
|
|
73221
|
+
const footerLookup = this.buildBlockLookup(footerBlocks, footerMeasures);
|
|
73222
|
+
footerLookup.forEach((entry, id) => {
|
|
73223
|
+
nextLookup.set(id, entry);
|
|
73224
|
+
});
|
|
73225
|
+
}
|
|
73162
73226
|
const changed = /* @__PURE__ */ new Set();
|
|
73163
73227
|
nextLookup.forEach((entry, id) => {
|
|
73164
73228
|
const previous2 = this.blockLookup.get(id);
|
|
@@ -73481,6 +73545,14 @@ ${l}
|
|
|
73481
73545
|
container.style.height = `${data.height}px`;
|
|
73482
73546
|
container.style.top = `${Math.max(0, offset2)}px`;
|
|
73483
73547
|
container.style.zIndex = "1";
|
|
73548
|
+
let footerYOffset = 0;
|
|
73549
|
+
if (kind === "footer" && data.fragments.length > 0) {
|
|
73550
|
+
const contentHeight = typeof data.contentHeight === "number" ? data.contentHeight : data.fragments.reduce((max2, f2) => {
|
|
73551
|
+
const fragHeight = "height" in f2 && typeof f2.height === "number" ? f2.height : this.estimateFragmentHeight(f2);
|
|
73552
|
+
return Math.max(max2, f2.y + Math.max(0, fragHeight));
|
|
73553
|
+
}, 0);
|
|
73554
|
+
footerYOffset = Math.max(0, data.height - contentHeight);
|
|
73555
|
+
}
|
|
73484
73556
|
const context = {
|
|
73485
73557
|
pageNumber: page.number,
|
|
73486
73558
|
totalPages: this.totalPages,
|
|
@@ -73489,6 +73561,10 @@ ${l}
|
|
|
73489
73561
|
};
|
|
73490
73562
|
data.fragments.forEach((fragment) => {
|
|
73491
73563
|
const fragEl = this.renderFragment(fragment, context);
|
|
73564
|
+
if (footerYOffset > 0) {
|
|
73565
|
+
const currentTop = parseFloat(fragEl.style.top) || fragment.y;
|
|
73566
|
+
fragEl.style.top = `${currentTop + footerYOffset}px`;
|
|
73567
|
+
}
|
|
73492
73568
|
container.appendChild(fragEl);
|
|
73493
73569
|
});
|
|
73494
73570
|
if (!existing) {
|
|
@@ -73800,13 +73876,13 @@ ${l}
|
|
|
73800
73876
|
const markerEl = this.doc.createElement("span");
|
|
73801
73877
|
markerEl.classList.add("superdoc-list-marker");
|
|
73802
73878
|
const wordLayout = item.paragraph.attrs?.wordLayout;
|
|
73803
|
-
|
|
73804
|
-
|
|
73805
|
-
markerEl.textContent = marker.markerText;
|
|
73879
|
+
const marker = wordLayout?.marker;
|
|
73880
|
+
if (marker) {
|
|
73881
|
+
markerEl.textContent = marker.markerText ?? null;
|
|
73806
73882
|
markerEl.style.display = "inline-block";
|
|
73807
73883
|
markerEl.style.width = `${Math.max(0, fragment.markerWidth - LIST_MARKER_GAP$1)}px`;
|
|
73808
73884
|
markerEl.style.paddingRight = `${LIST_MARKER_GAP$1}px`;
|
|
73809
|
-
markerEl.style.textAlign = marker.justification;
|
|
73885
|
+
markerEl.style.textAlign = marker.justification ?? "";
|
|
73810
73886
|
markerEl.style.fontFamily = marker.run.fontFamily;
|
|
73811
73887
|
markerEl.style.fontSize = `${marker.run.fontSize}px`;
|
|
73812
73888
|
if (marker.run.bold) markerEl.style.fontWeight = "bold";
|
|
@@ -74555,6 +74631,33 @@ ${l}
|
|
|
74555
74631
|
}
|
|
74556
74632
|
}
|
|
74557
74633
|
}
|
|
74634
|
+
/**
|
|
74635
|
+
* Estimates the height of a fragment when explicit height is not available.
|
|
74636
|
+
*
|
|
74637
|
+
* This method provides fallback height calculations for footer bottom-alignment
|
|
74638
|
+
* by consulting measure data for paragraphs and list items, or using the
|
|
74639
|
+
* fragment's height property for tables, images, and drawings.
|
|
74640
|
+
*
|
|
74641
|
+
* @param fragment - The fragment to estimate height for
|
|
74642
|
+
* @returns Estimated height in pixels, or 0 if height cannot be determined
|
|
74643
|
+
*/
|
|
74644
|
+
estimateFragmentHeight(fragment) {
|
|
74645
|
+
const lookup2 = this.blockLookup.get(fragment.blockId);
|
|
74646
|
+
const measure = lookup2?.measure;
|
|
74647
|
+
if (fragment.kind === "para" && measure?.kind === "paragraph") {
|
|
74648
|
+
return measure.totalHeight;
|
|
74649
|
+
}
|
|
74650
|
+
if (fragment.kind === "list-item" && measure?.kind === "list") {
|
|
74651
|
+
return measure.totalHeight;
|
|
74652
|
+
}
|
|
74653
|
+
if (fragment.kind === "table") {
|
|
74654
|
+
return fragment.height;
|
|
74655
|
+
}
|
|
74656
|
+
if (fragment.kind === "image" || fragment.kind === "drawing") {
|
|
74657
|
+
return fragment.height;
|
|
74658
|
+
}
|
|
74659
|
+
return 0;
|
|
74660
|
+
}
|
|
74558
74661
|
buildBlockLookup(blocks2, measures) {
|
|
74559
74662
|
if (blocks2.length !== measures.length) {
|
|
74560
74663
|
throw new Error("DomPainter requires the same number of blocks and measures");
|
|
@@ -75023,8 +75126,8 @@ ${l}
|
|
|
75023
75126
|
paint(layout, mount2) {
|
|
75024
75127
|
painter.paint(layout, mount2);
|
|
75025
75128
|
},
|
|
75026
|
-
setData(blocks2, measures) {
|
|
75027
|
-
painter.setData(blocks2, measures);
|
|
75129
|
+
setData(blocks2, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures) {
|
|
75130
|
+
painter.setData(blocks2, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures);
|
|
75028
75131
|
},
|
|
75029
75132
|
// Non-standard extension for demo app to avoid re-instantiating on provider changes
|
|
75030
75133
|
setProviders(header, footer) {
|
|
@@ -78413,7 +78516,30 @@ ${l}
|
|
|
78413
78516
|
if (typeof painter.setProviders === "function") {
|
|
78414
78517
|
painter.setProviders(__privateGet$1(this, _headerDecorationProvider), __privateGet$1(this, _footerDecorationProvider));
|
|
78415
78518
|
}
|
|
78416
|
-
|
|
78519
|
+
const headerBlocks = [];
|
|
78520
|
+
const headerMeasures = [];
|
|
78521
|
+
if (headerLayouts) {
|
|
78522
|
+
for (const headerResult of headerLayouts) {
|
|
78523
|
+
headerBlocks.push(...headerResult.blocks);
|
|
78524
|
+
headerMeasures.push(...headerResult.measures);
|
|
78525
|
+
}
|
|
78526
|
+
}
|
|
78527
|
+
const footerBlocks = [];
|
|
78528
|
+
const footerMeasures = [];
|
|
78529
|
+
if (footerLayouts) {
|
|
78530
|
+
for (const footerResult of footerLayouts) {
|
|
78531
|
+
footerBlocks.push(...footerResult.blocks);
|
|
78532
|
+
footerMeasures.push(...footerResult.measures);
|
|
78533
|
+
}
|
|
78534
|
+
}
|
|
78535
|
+
painter.setData?.(
|
|
78536
|
+
blocks2,
|
|
78537
|
+
measures,
|
|
78538
|
+
headerBlocks.length > 0 ? headerBlocks : void 0,
|
|
78539
|
+
headerMeasures.length > 0 ? headerMeasures : void 0,
|
|
78540
|
+
footerBlocks.length > 0 ? footerBlocks : void 0,
|
|
78541
|
+
footerMeasures.length > 0 ? footerMeasures : void 0
|
|
78542
|
+
);
|
|
78417
78543
|
painter.paint(layout, __privateGet$1(this, _painterHost));
|
|
78418
78544
|
__privateSet(this, _layoutError, null);
|
|
78419
78545
|
__privateSet(this, _layoutErrorState, "healthy");
|
|
@@ -78583,7 +78709,8 @@ ${l}
|
|
|
78583
78709
|
const finalHeaderId = headerId ?? fallbackId ?? void 0;
|
|
78584
78710
|
return {
|
|
78585
78711
|
fragments: slotPage.fragments,
|
|
78586
|
-
height:
|
|
78712
|
+
height: box.height,
|
|
78713
|
+
contentHeight: variant.layout.height ?? box.height,
|
|
78587
78714
|
offset: box.offset,
|
|
78588
78715
|
marginLeft: box.x,
|
|
78589
78716
|
contentWidth: box.width,
|
|
@@ -78610,18 +78737,19 @@ ${l}
|
|
|
78610
78737
|
const left2 = margins.left ?? DEFAULT_MARGINS.left;
|
|
78611
78738
|
const right2 = margins.right ?? DEFAULT_MARGINS.right;
|
|
78612
78739
|
const width = Math.max(pageSize.w - (left2 + right2), 1);
|
|
78613
|
-
const defaultHeight = kind === "header" ? margins.top ?? DEFAULT_MARGINS.top : margins.bottom ?? DEFAULT_MARGINS.bottom;
|
|
78614
|
-
const { headerSpace, footerSpace } = extractHeaderFooterSpace(margins);
|
|
78615
|
-
const target = kind === "header" ? headerSpace : footerSpace;
|
|
78616
|
-
const height = Math.max(target || defaultHeight || 1, 1);
|
|
78617
78740
|
const totalHeight = pageHeight ?? pageSize.h;
|
|
78618
|
-
|
|
78619
|
-
|
|
78620
|
-
|
|
78621
|
-
|
|
78622
|
-
height,
|
|
78623
|
-
|
|
78624
|
-
|
|
78741
|
+
if (kind === "header") {
|
|
78742
|
+
const headerMargin = margins.header ?? 0;
|
|
78743
|
+
const topMargin = margins.top ?? DEFAULT_MARGINS.top ?? 0;
|
|
78744
|
+
const height = Math.max(topMargin - headerMargin, 1);
|
|
78745
|
+
return { x: left2, width, height, offset: headerMargin };
|
|
78746
|
+
} else {
|
|
78747
|
+
const footerMargin = margins.footer ?? 0;
|
|
78748
|
+
const bottomMargin = margins.bottom ?? DEFAULT_MARGINS.bottom ?? 0;
|
|
78749
|
+
const height = Math.max(bottomMargin - footerMargin, 1);
|
|
78750
|
+
const offset2 = Math.max(0, totalHeight - footerMargin - height);
|
|
78751
|
+
return { x: left2, width, height, offset: offset2 };
|
|
78752
|
+
}
|
|
78625
78753
|
};
|
|
78626
78754
|
rebuildHeaderFooterRegions_fn = function(layout) {
|
|
78627
78755
|
__privateGet$1(this, _headerRegions).clear();
|
|
@@ -97042,13 +97170,22 @@ ${l}
|
|
|
97042
97170
|
return !/\p{L}$/u.test(before.text) || !/^\p{L}/u.test(after.text);
|
|
97043
97171
|
}
|
|
97044
97172
|
class SearchState {
|
|
97045
|
-
|
|
97173
|
+
/**
|
|
97174
|
+
* Create a new SearchState instance.
|
|
97175
|
+
*
|
|
97176
|
+
* @param {SearchQuery} query - The search query to execute
|
|
97177
|
+
* @param {{from: number, to: number}|null} range - Optional range to restrict search to, or null for entire document
|
|
97178
|
+
* @param {boolean} highlight - Whether to apply CSS classes for visual highlighting of matches
|
|
97179
|
+
* @param {DecorationSet} deco - The decoration set containing match highlights
|
|
97180
|
+
*/
|
|
97181
|
+
constructor(query, range2, highlight, deco) {
|
|
97046
97182
|
this.query = query;
|
|
97047
97183
|
this.range = range2;
|
|
97184
|
+
this.highlight = highlight;
|
|
97048
97185
|
this.deco = deco;
|
|
97049
97186
|
}
|
|
97050
97187
|
}
|
|
97051
|
-
function buildMatchDeco(state2, query, range2) {
|
|
97188
|
+
function buildMatchDeco(state2, query, range2, highlight = true) {
|
|
97052
97189
|
if (!query.valid) return DecorationSet.empty;
|
|
97053
97190
|
let deco = [];
|
|
97054
97191
|
let sel = state2.selection;
|
|
@@ -97056,7 +97193,8 @@ ${l}
|
|
|
97056
97193
|
let next2 = query.findNext(state2, pos, end2);
|
|
97057
97194
|
if (!next2) break;
|
|
97058
97195
|
let cls = next2.from == sel.from && next2.to == sel.to ? "ProseMirror-active-search-match" : "ProseMirror-search-match";
|
|
97059
|
-
|
|
97196
|
+
const attrs = highlight ? { class: cls } : {};
|
|
97197
|
+
deco.push(Decoration.inline(next2.from, next2.to, attrs));
|
|
97060
97198
|
pos = next2.to;
|
|
97061
97199
|
}
|
|
97062
97200
|
return DecorationSet.create(state2.doc, deco);
|
|
@@ -97069,11 +97207,20 @@ ${l}
|
|
|
97069
97207
|
init(_config, state2) {
|
|
97070
97208
|
let query = options.initialQuery || new SearchQuery({ search: "" });
|
|
97071
97209
|
let range2 = options.initialRange || null;
|
|
97072
|
-
|
|
97210
|
+
const highlight = options.initialHighlight ?? true;
|
|
97211
|
+
return new SearchState(query, range2, highlight, buildMatchDeco(state2, query, range2, highlight));
|
|
97073
97212
|
},
|
|
97074
97213
|
apply(tr, search2, _oldState, state2) {
|
|
97075
97214
|
let set = tr.getMeta(searchKey);
|
|
97076
|
-
if (set)
|
|
97215
|
+
if (set) {
|
|
97216
|
+
const highlight = typeof set.highlight === "boolean" ? set.highlight : true;
|
|
97217
|
+
return new SearchState(
|
|
97218
|
+
set.query,
|
|
97219
|
+
set.range,
|
|
97220
|
+
highlight,
|
|
97221
|
+
buildMatchDeco(state2, set.query, set.range, highlight)
|
|
97222
|
+
);
|
|
97223
|
+
}
|
|
97077
97224
|
if (tr.docChanged || tr.selectionSet) {
|
|
97078
97225
|
let range2 = search2.range;
|
|
97079
97226
|
if (range2) {
|
|
@@ -97081,7 +97228,13 @@ ${l}
|
|
|
97081
97228
|
let to = tr.mapping.map(range2.to, -1);
|
|
97082
97229
|
range2 = from2 < to ? { from: from2, to } : null;
|
|
97083
97230
|
}
|
|
97084
|
-
|
|
97231
|
+
const highlight = typeof search2.highlight === "boolean" ? search2.highlight : true;
|
|
97232
|
+
search2 = new SearchState(
|
|
97233
|
+
search2.query,
|
|
97234
|
+
range2,
|
|
97235
|
+
highlight,
|
|
97236
|
+
buildMatchDeco(state2, search2.query, range2, highlight)
|
|
97237
|
+
);
|
|
97085
97238
|
}
|
|
97086
97239
|
return search2;
|
|
97087
97240
|
}
|
|
@@ -97095,8 +97248,12 @@ ${l}
|
|
|
97095
97248
|
let search2 = searchKey.getState(state2);
|
|
97096
97249
|
return search2 ? search2.deco : DecorationSet.empty;
|
|
97097
97250
|
}
|
|
97098
|
-
function setSearchState(tr, query, range2 = null) {
|
|
97099
|
-
|
|
97251
|
+
function setSearchState(tr, query, range2 = null, options = {}) {
|
|
97252
|
+
if (options != null && (typeof options !== "object" || Array.isArray(options))) {
|
|
97253
|
+
throw new TypeError("setSearchState options must be an object");
|
|
97254
|
+
}
|
|
97255
|
+
const highlight = typeof options?.highlight === "boolean" ? options.highlight : true;
|
|
97256
|
+
return tr.setMeta(searchKey, { query, range: range2, highlight });
|
|
97100
97257
|
}
|
|
97101
97258
|
const isRegExp = (value) => Object.prototype.toString.call(value) === "[object RegExp]";
|
|
97102
97259
|
const Search = Extension.create({
|
|
@@ -97157,14 +97314,25 @@ ${l}
|
|
|
97157
97314
|
* Search for string matches in editor content
|
|
97158
97315
|
* @category Command
|
|
97159
97316
|
* @param {String|RegExp} patternInput - Search string or pattern
|
|
97317
|
+
* @param {SearchCommandOptions} [options={}] - Options to control search behavior
|
|
97160
97318
|
* @example
|
|
97319
|
+
* // Basic search with highlighting (default)
|
|
97161
97320
|
* const matches = editor.commands.search('test string')
|
|
97321
|
+
*
|
|
97322
|
+
* // Regex search
|
|
97162
97323
|
* const regexMatches = editor.commands.search(/test/i)
|
|
97324
|
+
*
|
|
97325
|
+
* // Search without visual highlighting
|
|
97326
|
+
* const silentMatches = editor.commands.search('test', { highlight: false })
|
|
97163
97327
|
* @note Returns array of SearchMatch objects with positions and IDs
|
|
97164
97328
|
*/
|
|
97165
|
-
search: (patternInput) => (
|
|
97329
|
+
search: (patternInput, options = {}) => (
|
|
97166
97330
|
/** @returns {SearchMatch[]} */
|
|
97167
97331
|
(({ state: state2, dispatch }) => {
|
|
97332
|
+
if (options != null && (typeof options !== "object" || Array.isArray(options))) {
|
|
97333
|
+
throw new TypeError("Search options must be an object");
|
|
97334
|
+
}
|
|
97335
|
+
const highlight = typeof options?.highlight === "boolean" ? options.highlight : true;
|
|
97168
97336
|
let pattern;
|
|
97169
97337
|
let caseSensitive = false;
|
|
97170
97338
|
let regexp = false;
|
|
@@ -97191,7 +97359,7 @@ ${l}
|
|
|
97191
97359
|
regexp,
|
|
97192
97360
|
wholeWord
|
|
97193
97361
|
});
|
|
97194
|
-
const tr = setSearchState(state2.tr, query);
|
|
97362
|
+
const tr = setSearchState(state2.tr, query, null, { highlight });
|
|
97195
97363
|
dispatch(tr);
|
|
97196
97364
|
const newState = state2.apply(tr);
|
|
97197
97365
|
const decoSet = getMatchHighlights(newState);
|
|
@@ -131046,7 +131214,7 @@ ${style2}
|
|
|
131046
131214
|
this.config.colors = shuffleArray(this.config.colors);
|
|
131047
131215
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
131048
131216
|
this.colorIndex = 0;
|
|
131049
|
-
this.version = "1.0.0-beta.
|
|
131217
|
+
this.version = "1.0.0-beta.5";
|
|
131050
131218
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
131051
131219
|
this.superdocId = config2.superdocId || v4();
|
|
131052
131220
|
this.colors = this.config.colors;
|
|
@@ -133489,7 +133657,7 @@ ${style2}
|
|
|
133489
133657
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
133490
133658
|
);
|
|
133491
133659
|
}
|
|
133492
|
-
const
|
|
133660
|
+
const indexD653XgvV = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
133493
133661
|
__proto__: null,
|
|
133494
133662
|
unified
|
|
133495
133663
|
}, Symbol.toStringTag, { value: "Module" }));
|