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
|
@@ -35580,7 +35580,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
35580
35580
|
static getStoredSuperdocVersion(docx) {
|
|
35581
35581
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35582
35582
|
}
|
|
35583
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
35583
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.5") {
|
|
35584
35584
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35585
35585
|
}
|
|
35586
35586
|
/**
|
|
@@ -52287,7 +52287,7 @@ const isHeadless = (editor) => {
|
|
|
52287
52287
|
const shouldSkipNodeView = (editor) => {
|
|
52288
52288
|
return isHeadless(editor);
|
|
52289
52289
|
};
|
|
52290
|
-
const summaryVersion = "1.0.0-beta.
|
|
52290
|
+
const summaryVersion = "1.0.0-beta.5";
|
|
52291
52291
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
52292
52292
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
52293
52293
|
function mapAttributes(attrs) {
|
|
@@ -53066,7 +53066,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53066
53066
|
{ default: remarkStringify },
|
|
53067
53067
|
{ default: remarkGfm }
|
|
53068
53068
|
] = await Promise.all([
|
|
53069
|
-
Promise.resolve().then(() => require("./index-
|
|
53069
|
+
Promise.resolve().then(() => require("./index-D653XgvV-BN--CbY4.cjs")),
|
|
53070
53070
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
53071
53071
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
53072
53072
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -53271,7 +53271,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53271
53271
|
* Process collaboration migrations
|
|
53272
53272
|
*/
|
|
53273
53273
|
processCollaborationMigrations() {
|
|
53274
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
53274
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.5");
|
|
53275
53275
|
if (!this.options.ydoc) return;
|
|
53276
53276
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
53277
53277
|
let docVersion = metaMap.get("version");
|
|
@@ -55102,6 +55102,19 @@ const sanitizeFontFamily = (fontFamily2) => {
|
|
|
55102
55102
|
}
|
|
55103
55103
|
return sanitized;
|
|
55104
55104
|
};
|
|
55105
|
+
const normalizeFontSizePx = (value) => {
|
|
55106
|
+
if (isFiniteNumber(value)) return value;
|
|
55107
|
+
if (typeof value !== "string") return void 0;
|
|
55108
|
+
const trimmed = value.trim();
|
|
55109
|
+
if (!trimmed) return void 0;
|
|
55110
|
+
const numeric = Number.parseFloat(trimmed);
|
|
55111
|
+
if (!Number.isFinite(numeric)) return void 0;
|
|
55112
|
+
const unit = trimmed.match(/[a-zA-Z%]+$/)?.[0]?.toLowerCase();
|
|
55113
|
+
if (unit === "pt") {
|
|
55114
|
+
return ptToPx(numeric);
|
|
55115
|
+
}
|
|
55116
|
+
return numeric;
|
|
55117
|
+
};
|
|
55105
55118
|
const applyTextStyleMark = (run2, attrs, themeColors) => {
|
|
55106
55119
|
const resolvedColor = resolveColorFromAttributes(attrs, themeColors);
|
|
55107
55120
|
if (resolvedColor) {
|
|
@@ -55113,9 +55126,9 @@ const applyTextStyleMark = (run2, attrs, themeColors) => {
|
|
|
55113
55126
|
run2.fontFamily = sanitized;
|
|
55114
55127
|
}
|
|
55115
55128
|
}
|
|
55116
|
-
const
|
|
55117
|
-
if (
|
|
55118
|
-
run2.fontSize =
|
|
55129
|
+
const fontSizePx = normalizeFontSizePx(attrs.fontSize);
|
|
55130
|
+
if (fontSizePx !== void 0 && fontSizePx >= 1 && fontSizePx <= 1e3) {
|
|
55131
|
+
run2.fontSize = fontSizePx;
|
|
55119
55132
|
}
|
|
55120
55133
|
if (isFiniteNumber(attrs.letterSpacing)) {
|
|
55121
55134
|
const spacing = Number(attrs.letterSpacing);
|
|
@@ -65375,8 +65388,59 @@ const _DomPainter = class _DomPainter2 {
|
|
|
65375
65388
|
this.headerProvider = header;
|
|
65376
65389
|
this.footerProvider = footer;
|
|
65377
65390
|
}
|
|
65378
|
-
|
|
65391
|
+
/**
|
|
65392
|
+
* Updates the painter's block and measure data.
|
|
65393
|
+
*
|
|
65394
|
+
* @param blocks - Main document blocks
|
|
65395
|
+
* @param measures - Measures corresponding to main document blocks
|
|
65396
|
+
* @param headerBlocks - Optional header blocks from header/footer layout results
|
|
65397
|
+
* @param headerMeasures - Optional measures corresponding to header blocks
|
|
65398
|
+
* @param footerBlocks - Optional footer blocks from header/footer layout results
|
|
65399
|
+
* @param footerMeasures - Optional measures corresponding to footer blocks
|
|
65400
|
+
*/
|
|
65401
|
+
setData(blocks, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures) {
|
|
65402
|
+
if (blocks.length !== measures.length) {
|
|
65403
|
+
throw new Error(
|
|
65404
|
+
`setData: blocks and measures arrays must have the same length. Got blocks.length=${blocks.length}, measures.length=${measures.length}`
|
|
65405
|
+
);
|
|
65406
|
+
}
|
|
65407
|
+
const hasHeaderBlocks = headerBlocks !== void 0;
|
|
65408
|
+
const hasHeaderMeasures = headerMeasures !== void 0;
|
|
65409
|
+
if (hasHeaderBlocks !== hasHeaderMeasures) {
|
|
65410
|
+
throw new Error(
|
|
65411
|
+
`setData: headerBlocks and headerMeasures must both be provided or both be omitted. Got headerBlocks=${hasHeaderBlocks ? "provided" : "omitted"}, headerMeasures=${hasHeaderMeasures ? "provided" : "omitted"}`
|
|
65412
|
+
);
|
|
65413
|
+
}
|
|
65414
|
+
if (hasHeaderBlocks && hasHeaderMeasures && headerBlocks.length !== headerMeasures.length) {
|
|
65415
|
+
throw new Error(
|
|
65416
|
+
`setData: headerBlocks and headerMeasures arrays must have the same length. Got headerBlocks.length=${headerBlocks.length}, headerMeasures.length=${headerMeasures.length}`
|
|
65417
|
+
);
|
|
65418
|
+
}
|
|
65419
|
+
const hasFooterBlocks = footerBlocks !== void 0;
|
|
65420
|
+
const hasFooterMeasures = footerMeasures !== void 0;
|
|
65421
|
+
if (hasFooterBlocks !== hasFooterMeasures) {
|
|
65422
|
+
throw new Error(
|
|
65423
|
+
`setData: footerBlocks and footerMeasures must both be provided or both be omitted. Got footerBlocks=${hasFooterBlocks ? "provided" : "omitted"}, footerMeasures=${hasFooterMeasures ? "provided" : "omitted"}`
|
|
65424
|
+
);
|
|
65425
|
+
}
|
|
65426
|
+
if (hasFooterBlocks && hasFooterMeasures && footerBlocks.length !== footerMeasures.length) {
|
|
65427
|
+
throw new Error(
|
|
65428
|
+
`setData: footerBlocks and footerMeasures arrays must have the same length. Got footerBlocks.length=${footerBlocks.length}, footerMeasures.length=${footerMeasures.length}`
|
|
65429
|
+
);
|
|
65430
|
+
}
|
|
65379
65431
|
const nextLookup = this.buildBlockLookup(blocks, measures);
|
|
65432
|
+
if (headerBlocks && headerMeasures) {
|
|
65433
|
+
const headerLookup = this.buildBlockLookup(headerBlocks, headerMeasures);
|
|
65434
|
+
headerLookup.forEach((entry, id) => {
|
|
65435
|
+
nextLookup.set(id, entry);
|
|
65436
|
+
});
|
|
65437
|
+
}
|
|
65438
|
+
if (footerBlocks && footerMeasures) {
|
|
65439
|
+
const footerLookup = this.buildBlockLookup(footerBlocks, footerMeasures);
|
|
65440
|
+
footerLookup.forEach((entry, id) => {
|
|
65441
|
+
nextLookup.set(id, entry);
|
|
65442
|
+
});
|
|
65443
|
+
}
|
|
65380
65444
|
const changed = /* @__PURE__ */ new Set();
|
|
65381
65445
|
nextLookup.forEach((entry, id) => {
|
|
65382
65446
|
const previous = this.blockLookup.get(id);
|
|
@@ -65699,6 +65763,14 @@ const _DomPainter = class _DomPainter2 {
|
|
|
65699
65763
|
container.style.height = `${data.height}px`;
|
|
65700
65764
|
container.style.top = `${Math.max(0, offset2)}px`;
|
|
65701
65765
|
container.style.zIndex = "1";
|
|
65766
|
+
let footerYOffset = 0;
|
|
65767
|
+
if (kind === "footer" && data.fragments.length > 0) {
|
|
65768
|
+
const contentHeight = typeof data.contentHeight === "number" ? data.contentHeight : data.fragments.reduce((max2, f2) => {
|
|
65769
|
+
const fragHeight = "height" in f2 && typeof f2.height === "number" ? f2.height : this.estimateFragmentHeight(f2);
|
|
65770
|
+
return Math.max(max2, f2.y + Math.max(0, fragHeight));
|
|
65771
|
+
}, 0);
|
|
65772
|
+
footerYOffset = Math.max(0, data.height - contentHeight);
|
|
65773
|
+
}
|
|
65702
65774
|
const context = {
|
|
65703
65775
|
pageNumber: page.number,
|
|
65704
65776
|
totalPages: this.totalPages,
|
|
@@ -65707,6 +65779,10 @@ const _DomPainter = class _DomPainter2 {
|
|
|
65707
65779
|
};
|
|
65708
65780
|
data.fragments.forEach((fragment) => {
|
|
65709
65781
|
const fragEl = this.renderFragment(fragment, context);
|
|
65782
|
+
if (footerYOffset > 0) {
|
|
65783
|
+
const currentTop = parseFloat(fragEl.style.top) || fragment.y;
|
|
65784
|
+
fragEl.style.top = `${currentTop + footerYOffset}px`;
|
|
65785
|
+
}
|
|
65710
65786
|
container.appendChild(fragEl);
|
|
65711
65787
|
});
|
|
65712
65788
|
if (!existing) {
|
|
@@ -66018,13 +66094,13 @@ const _DomPainter = class _DomPainter2 {
|
|
|
66018
66094
|
const markerEl = this.doc.createElement("span");
|
|
66019
66095
|
markerEl.classList.add("superdoc-list-marker");
|
|
66020
66096
|
const wordLayout = item.paragraph.attrs?.wordLayout;
|
|
66021
|
-
|
|
66022
|
-
|
|
66023
|
-
markerEl.textContent = marker.markerText;
|
|
66097
|
+
const marker = wordLayout?.marker;
|
|
66098
|
+
if (marker) {
|
|
66099
|
+
markerEl.textContent = marker.markerText ?? null;
|
|
66024
66100
|
markerEl.style.display = "inline-block";
|
|
66025
66101
|
markerEl.style.width = `${Math.max(0, fragment.markerWidth - LIST_MARKER_GAP$1)}px`;
|
|
66026
66102
|
markerEl.style.paddingRight = `${LIST_MARKER_GAP$1}px`;
|
|
66027
|
-
markerEl.style.textAlign = marker.justification;
|
|
66103
|
+
markerEl.style.textAlign = marker.justification ?? "";
|
|
66028
66104
|
markerEl.style.fontFamily = marker.run.fontFamily;
|
|
66029
66105
|
markerEl.style.fontSize = `${marker.run.fontSize}px`;
|
|
66030
66106
|
if (marker.run.bold) markerEl.style.fontWeight = "bold";
|
|
@@ -66773,6 +66849,33 @@ const _DomPainter = class _DomPainter2 {
|
|
|
66773
66849
|
}
|
|
66774
66850
|
}
|
|
66775
66851
|
}
|
|
66852
|
+
/**
|
|
66853
|
+
* Estimates the height of a fragment when explicit height is not available.
|
|
66854
|
+
*
|
|
66855
|
+
* This method provides fallback height calculations for footer bottom-alignment
|
|
66856
|
+
* by consulting measure data for paragraphs and list items, or using the
|
|
66857
|
+
* fragment's height property for tables, images, and drawings.
|
|
66858
|
+
*
|
|
66859
|
+
* @param fragment - The fragment to estimate height for
|
|
66860
|
+
* @returns Estimated height in pixels, or 0 if height cannot be determined
|
|
66861
|
+
*/
|
|
66862
|
+
estimateFragmentHeight(fragment) {
|
|
66863
|
+
const lookup2 = this.blockLookup.get(fragment.blockId);
|
|
66864
|
+
const measure = lookup2?.measure;
|
|
66865
|
+
if (fragment.kind === "para" && measure?.kind === "paragraph") {
|
|
66866
|
+
return measure.totalHeight;
|
|
66867
|
+
}
|
|
66868
|
+
if (fragment.kind === "list-item" && measure?.kind === "list") {
|
|
66869
|
+
return measure.totalHeight;
|
|
66870
|
+
}
|
|
66871
|
+
if (fragment.kind === "table") {
|
|
66872
|
+
return fragment.height;
|
|
66873
|
+
}
|
|
66874
|
+
if (fragment.kind === "image" || fragment.kind === "drawing") {
|
|
66875
|
+
return fragment.height;
|
|
66876
|
+
}
|
|
66877
|
+
return 0;
|
|
66878
|
+
}
|
|
66776
66879
|
buildBlockLookup(blocks, measures) {
|
|
66777
66880
|
if (blocks.length !== measures.length) {
|
|
66778
66881
|
throw new Error("DomPainter requires the same number of blocks and measures");
|
|
@@ -67241,8 +67344,8 @@ const createDomPainter = (options) => {
|
|
|
67241
67344
|
paint(layout, mount2) {
|
|
67242
67345
|
painter.paint(layout, mount2);
|
|
67243
67346
|
},
|
|
67244
|
-
setData(blocks, measures) {
|
|
67245
|
-
painter.setData(blocks, measures);
|
|
67347
|
+
setData(blocks, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures) {
|
|
67348
|
+
painter.setData(blocks, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures);
|
|
67246
67349
|
},
|
|
67247
67350
|
// Non-standard extension for demo app to avoid re-instantiating on provider changes
|
|
67248
67351
|
setProviders(header, footer) {
|
|
@@ -70631,7 +70734,30 @@ rerender_fn = async function() {
|
|
|
70631
70734
|
if (typeof painter.setProviders === "function") {
|
|
70632
70735
|
painter.setProviders(__privateGet$1(this, _headerDecorationProvider), __privateGet$1(this, _footerDecorationProvider));
|
|
70633
70736
|
}
|
|
70634
|
-
|
|
70737
|
+
const headerBlocks = [];
|
|
70738
|
+
const headerMeasures = [];
|
|
70739
|
+
if (headerLayouts) {
|
|
70740
|
+
for (const headerResult of headerLayouts) {
|
|
70741
|
+
headerBlocks.push(...headerResult.blocks);
|
|
70742
|
+
headerMeasures.push(...headerResult.measures);
|
|
70743
|
+
}
|
|
70744
|
+
}
|
|
70745
|
+
const footerBlocks = [];
|
|
70746
|
+
const footerMeasures = [];
|
|
70747
|
+
if (footerLayouts) {
|
|
70748
|
+
for (const footerResult of footerLayouts) {
|
|
70749
|
+
footerBlocks.push(...footerResult.blocks);
|
|
70750
|
+
footerMeasures.push(...footerResult.measures);
|
|
70751
|
+
}
|
|
70752
|
+
}
|
|
70753
|
+
painter.setData?.(
|
|
70754
|
+
blocks,
|
|
70755
|
+
measures,
|
|
70756
|
+
headerBlocks.length > 0 ? headerBlocks : void 0,
|
|
70757
|
+
headerMeasures.length > 0 ? headerMeasures : void 0,
|
|
70758
|
+
footerBlocks.length > 0 ? footerBlocks : void 0,
|
|
70759
|
+
footerMeasures.length > 0 ? footerMeasures : void 0
|
|
70760
|
+
);
|
|
70635
70761
|
painter.paint(layout, __privateGet$1(this, _painterHost));
|
|
70636
70762
|
__privateSet(this, _layoutError, null);
|
|
70637
70763
|
__privateSet(this, _layoutErrorState, "healthy");
|
|
@@ -70801,7 +70927,8 @@ createDecorationProvider_fn = function(kind, layout) {
|
|
|
70801
70927
|
const finalHeaderId = headerId ?? fallbackId ?? void 0;
|
|
70802
70928
|
return {
|
|
70803
70929
|
fragments: slotPage.fragments,
|
|
70804
|
-
height:
|
|
70930
|
+
height: box.height,
|
|
70931
|
+
contentHeight: variant.layout.height ?? box.height,
|
|
70805
70932
|
offset: box.offset,
|
|
70806
70933
|
marginLeft: box.x,
|
|
70807
70934
|
contentWidth: box.width,
|
|
@@ -70828,18 +70955,19 @@ computeDecorationBox_fn = function(kind, pageMargins, pageHeight) {
|
|
|
70828
70955
|
const left2 = margins.left ?? DEFAULT_MARGINS.left;
|
|
70829
70956
|
const right2 = margins.right ?? DEFAULT_MARGINS.right;
|
|
70830
70957
|
const width = Math.max(pageSize.w - (left2 + right2), 1);
|
|
70831
|
-
const defaultHeight = kind === "header" ? margins.top ?? DEFAULT_MARGINS.top : margins.bottom ?? DEFAULT_MARGINS.bottom;
|
|
70832
|
-
const { headerSpace, footerSpace } = extractHeaderFooterSpace(margins);
|
|
70833
|
-
const target = kind === "header" ? headerSpace : footerSpace;
|
|
70834
|
-
const height = Math.max(target || defaultHeight || 1, 1);
|
|
70835
70958
|
const totalHeight = pageHeight ?? pageSize.h;
|
|
70836
|
-
|
|
70837
|
-
|
|
70838
|
-
|
|
70839
|
-
|
|
70840
|
-
height,
|
|
70841
|
-
|
|
70842
|
-
|
|
70959
|
+
if (kind === "header") {
|
|
70960
|
+
const headerMargin = margins.header ?? 0;
|
|
70961
|
+
const topMargin = margins.top ?? DEFAULT_MARGINS.top ?? 0;
|
|
70962
|
+
const height = Math.max(topMargin - headerMargin, 1);
|
|
70963
|
+
return { x: left2, width, height, offset: headerMargin };
|
|
70964
|
+
} else {
|
|
70965
|
+
const footerMargin = margins.footer ?? 0;
|
|
70966
|
+
const bottomMargin = margins.bottom ?? DEFAULT_MARGINS.bottom ?? 0;
|
|
70967
|
+
const height = Math.max(bottomMargin - footerMargin, 1);
|
|
70968
|
+
const offset2 = Math.max(0, totalHeight - footerMargin - height);
|
|
70969
|
+
return { x: left2, width, height, offset: offset2 };
|
|
70970
|
+
}
|
|
70843
70971
|
};
|
|
70844
70972
|
rebuildHeaderFooterRegions_fn = function(layout) {
|
|
70845
70973
|
__privateGet$1(this, _headerRegions).clear();
|
|
@@ -89260,13 +89388,22 @@ function checkWordBoundary(state2, pos) {
|
|
|
89260
89388
|
return !/\p{L}$/u.test(before.text) || !/^\p{L}/u.test(after.text);
|
|
89261
89389
|
}
|
|
89262
89390
|
class SearchState {
|
|
89263
|
-
|
|
89391
|
+
/**
|
|
89392
|
+
* Create a new SearchState instance.
|
|
89393
|
+
*
|
|
89394
|
+
* @param {SearchQuery} query - The search query to execute
|
|
89395
|
+
* @param {{from: number, to: number}|null} range - Optional range to restrict search to, or null for entire document
|
|
89396
|
+
* @param {boolean} highlight - Whether to apply CSS classes for visual highlighting of matches
|
|
89397
|
+
* @param {DecorationSet} deco - The decoration set containing match highlights
|
|
89398
|
+
*/
|
|
89399
|
+
constructor(query, range2, highlight, deco) {
|
|
89264
89400
|
this.query = query;
|
|
89265
89401
|
this.range = range2;
|
|
89402
|
+
this.highlight = highlight;
|
|
89266
89403
|
this.deco = deco;
|
|
89267
89404
|
}
|
|
89268
89405
|
}
|
|
89269
|
-
function buildMatchDeco(state2, query, range2) {
|
|
89406
|
+
function buildMatchDeco(state2, query, range2, highlight = true) {
|
|
89270
89407
|
if (!query.valid) return DecorationSet.empty;
|
|
89271
89408
|
let deco = [];
|
|
89272
89409
|
let sel = state2.selection;
|
|
@@ -89274,7 +89411,8 @@ function buildMatchDeco(state2, query, range2) {
|
|
|
89274
89411
|
let next = query.findNext(state2, pos, end2);
|
|
89275
89412
|
if (!next) break;
|
|
89276
89413
|
let cls = next.from == sel.from && next.to == sel.to ? "ProseMirror-active-search-match" : "ProseMirror-search-match";
|
|
89277
|
-
|
|
89414
|
+
const attrs = highlight ? { class: cls } : {};
|
|
89415
|
+
deco.push(Decoration.inline(next.from, next.to, attrs));
|
|
89278
89416
|
pos = next.to;
|
|
89279
89417
|
}
|
|
89280
89418
|
return DecorationSet.create(state2.doc, deco);
|
|
@@ -89287,11 +89425,20 @@ function search(options = {}) {
|
|
|
89287
89425
|
init(_config, state2) {
|
|
89288
89426
|
let query = options.initialQuery || new SearchQuery({ search: "" });
|
|
89289
89427
|
let range2 = options.initialRange || null;
|
|
89290
|
-
|
|
89428
|
+
const highlight = options.initialHighlight ?? true;
|
|
89429
|
+
return new SearchState(query, range2, highlight, buildMatchDeco(state2, query, range2, highlight));
|
|
89291
89430
|
},
|
|
89292
89431
|
apply(tr, search2, _oldState, state2) {
|
|
89293
89432
|
let set = tr.getMeta(searchKey);
|
|
89294
|
-
if (set)
|
|
89433
|
+
if (set) {
|
|
89434
|
+
const highlight = typeof set.highlight === "boolean" ? set.highlight : true;
|
|
89435
|
+
return new SearchState(
|
|
89436
|
+
set.query,
|
|
89437
|
+
set.range,
|
|
89438
|
+
highlight,
|
|
89439
|
+
buildMatchDeco(state2, set.query, set.range, highlight)
|
|
89440
|
+
);
|
|
89441
|
+
}
|
|
89295
89442
|
if (tr.docChanged || tr.selectionSet) {
|
|
89296
89443
|
let range2 = search2.range;
|
|
89297
89444
|
if (range2) {
|
|
@@ -89299,7 +89446,13 @@ function search(options = {}) {
|
|
|
89299
89446
|
let to = tr.mapping.map(range2.to, -1);
|
|
89300
89447
|
range2 = from2 < to ? { from: from2, to } : null;
|
|
89301
89448
|
}
|
|
89302
|
-
|
|
89449
|
+
const highlight = typeof search2.highlight === "boolean" ? search2.highlight : true;
|
|
89450
|
+
search2 = new SearchState(
|
|
89451
|
+
search2.query,
|
|
89452
|
+
range2,
|
|
89453
|
+
highlight,
|
|
89454
|
+
buildMatchDeco(state2, search2.query, range2, highlight)
|
|
89455
|
+
);
|
|
89303
89456
|
}
|
|
89304
89457
|
return search2;
|
|
89305
89458
|
}
|
|
@@ -89313,8 +89466,12 @@ function getMatchHighlights(state2) {
|
|
|
89313
89466
|
let search2 = searchKey.getState(state2);
|
|
89314
89467
|
return search2 ? search2.deco : DecorationSet.empty;
|
|
89315
89468
|
}
|
|
89316
|
-
function setSearchState(tr, query, range2 = null) {
|
|
89317
|
-
|
|
89469
|
+
function setSearchState(tr, query, range2 = null, options = {}) {
|
|
89470
|
+
if (options != null && (typeof options !== "object" || Array.isArray(options))) {
|
|
89471
|
+
throw new TypeError("setSearchState options must be an object");
|
|
89472
|
+
}
|
|
89473
|
+
const highlight = typeof options?.highlight === "boolean" ? options.highlight : true;
|
|
89474
|
+
return tr.setMeta(searchKey, { query, range: range2, highlight });
|
|
89318
89475
|
}
|
|
89319
89476
|
const isRegExp = (value) => Object.prototype.toString.call(value) === "[object RegExp]";
|
|
89320
89477
|
const Search = Extension.create({
|
|
@@ -89375,14 +89532,25 @@ const Search = Extension.create({
|
|
|
89375
89532
|
* Search for string matches in editor content
|
|
89376
89533
|
* @category Command
|
|
89377
89534
|
* @param {String|RegExp} patternInput - Search string or pattern
|
|
89535
|
+
* @param {SearchCommandOptions} [options={}] - Options to control search behavior
|
|
89378
89536
|
* @example
|
|
89537
|
+
* // Basic search with highlighting (default)
|
|
89379
89538
|
* const matches = editor.commands.search('test string')
|
|
89539
|
+
*
|
|
89540
|
+
* // Regex search
|
|
89380
89541
|
* const regexMatches = editor.commands.search(/test/i)
|
|
89542
|
+
*
|
|
89543
|
+
* // Search without visual highlighting
|
|
89544
|
+
* const silentMatches = editor.commands.search('test', { highlight: false })
|
|
89381
89545
|
* @note Returns array of SearchMatch objects with positions and IDs
|
|
89382
89546
|
*/
|
|
89383
|
-
search: (patternInput) => (
|
|
89547
|
+
search: (patternInput, options = {}) => (
|
|
89384
89548
|
/** @returns {SearchMatch[]} */
|
|
89385
89549
|
(({ state: state2, dispatch }) => {
|
|
89550
|
+
if (options != null && (typeof options !== "object" || Array.isArray(options))) {
|
|
89551
|
+
throw new TypeError("Search options must be an object");
|
|
89552
|
+
}
|
|
89553
|
+
const highlight = typeof options?.highlight === "boolean" ? options.highlight : true;
|
|
89386
89554
|
let pattern;
|
|
89387
89555
|
let caseSensitive = false;
|
|
89388
89556
|
let regexp = false;
|
|
@@ -89409,7 +89577,7 @@ const Search = Extension.create({
|
|
|
89409
89577
|
regexp,
|
|
89410
89578
|
wholeWord
|
|
89411
89579
|
});
|
|
89412
|
-
const tr = setSearchState(state2.tr, query);
|
|
89580
|
+
const tr = setSearchState(state2.tr, query, null, { highlight });
|
|
89413
89581
|
dispatch(tr);
|
|
89414
89582
|
const newState = state2.apply(tr);
|
|
89415
89583
|
const decoSet = getMatchHighlights(newState);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
|
|
2
|
-
import { T as TextSelection } from "./chunks/converter-
|
|
3
|
-
import { _ as _export_sfc } from "./chunks/editor-
|
|
2
|
+
import { T as TextSelection } from "./chunks/converter-BiUZIOjP.js";
|
|
3
|
+
import { _ as _export_sfc } from "./chunks/editor-BtePjrrv.js";
|
|
4
4
|
const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
|
|
5
5
|
const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
|
|
6
6
|
async function baseInsightsFetch(payload, options = {}) {
|
|
@@ -35844,7 +35844,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
35844
35844
|
static getStoredSuperdocVersion(docx) {
|
|
35845
35845
|
return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35846
35846
|
}
|
|
35847
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.
|
|
35847
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.5") {
|
|
35848
35848
|
return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
35849
35849
|
}
|
|
35850
35850
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as process$1, aI as commonjsGlobal, B as Buffer, aJ as getDefaultExportFromCjs, aK as getContentTypesFromXml, aL as xmljs } from "./converter-
|
|
1
|
+
import { p as process$1, aI as commonjsGlobal, B as Buffer, aJ as getDefaultExportFromCjs, aK as getContentTypesFromXml, aL as xmljs } from "./converter-BiUZIOjP.js";
|
|
2
2
|
function commonjsRequire(path) {
|
|
3
3
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
4
4
|
}
|