@superdoc-dev/mcp 0.3.0-next.41 → 0.3.0-next.43
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/index.js +90 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51837,7 +51837,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
51837
51837
|
emptyOptions2 = {};
|
|
51838
51838
|
});
|
|
51839
51839
|
|
|
51840
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
51840
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-DFi0X147.es.js
|
|
51841
51841
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
51842
51842
|
const fieldValue = extension$1.config[field];
|
|
51843
51843
|
if (typeof fieldValue === "function")
|
|
@@ -72569,8 +72569,8 @@ function rewriteImageSrcsInSliceJsonTree(node2, pathRemap) {
|
|
|
72569
72569
|
for (const child of content$2)
|
|
72570
72570
|
rewriteImageSrcsInSliceJsonTree(child, pathRemap);
|
|
72571
72571
|
}
|
|
72572
|
-
function applySuperdocClipboardMedia(editor, clipboardData, sliceJson = null) {
|
|
72573
|
-
const raw = clipboardData?.getData?.(
|
|
72572
|
+
function applySuperdocClipboardMedia(editor, clipboardData, sliceJson = null, mediaJson = "") {
|
|
72573
|
+
const raw = clipboardData?.getData?.("application/x-superdoc-media") || mediaJson;
|
|
72574
72574
|
if (!editor?.storage?.image || !raw || typeof raw !== "string")
|
|
72575
72575
|
return sliceJson;
|
|
72576
72576
|
let map5;
|
|
@@ -72649,10 +72649,12 @@ function bodySectPrShouldEmbed(bodySectPr) {
|
|
|
72649
72649
|
const cols = getSectPrColumns(bodySectPr);
|
|
72650
72650
|
return !!(cols?.count && cols.count > 1);
|
|
72651
72651
|
}
|
|
72652
|
-
function embedSliceInHtml(html2, sliceJson, bodySectPrJson = "") {
|
|
72652
|
+
function embedSliceInHtml(html2, sliceJson, bodySectPrJson = "", mediaJson = "") {
|
|
72653
72653
|
let out = html2;
|
|
72654
72654
|
if (bodySectPrJson)
|
|
72655
72655
|
out = `<div ${SUPERDOC_BODY_SECT_PR_ATTR} style="display:none">${encodeUtf8Base64(bodySectPrJson)}</div>${out}`;
|
|
72656
|
+
if (mediaJson)
|
|
72657
|
+
out = `<div ${SUPERDOC_MEDIA_ATTR} style="display:none">${encodeUtf8Base64(mediaJson)}</div>${out}`;
|
|
72656
72658
|
if (!sliceJson)
|
|
72657
72659
|
return out;
|
|
72658
72660
|
return `<div ${SUPERDOC_SLICE_ATTR} style="display:none">${encodeUtf8Base64(sliceJson)}</div>${out}`;
|
|
@@ -72684,8 +72686,27 @@ function stripSliceFromHtml(html2) {
|
|
|
72684
72686
|
out = out.replace(/<div[^>]*data-superdoc-slice[^>]*>[\s\S]*?<\/div>/gi, "");
|
|
72685
72687
|
if (out.includes("data-sd-body-sect-pr"))
|
|
72686
72688
|
out = out.replace(/<div[^>]*data-sd-body-sect-pr[^>]*>[\s\S]*?<\/div>/gi, "");
|
|
72689
|
+
if (out.includes("data-sd-superdoc-media"))
|
|
72690
|
+
out = out.replace(/<div[^>]*data-sd-superdoc-media[^>]*>[\s\S]*?<\/div>/gi, "");
|
|
72687
72691
|
return out;
|
|
72688
72692
|
}
|
|
72693
|
+
function extractMediaFromHtml(html2) {
|
|
72694
|
+
if (!html2 || !html2.includes("data-sd-superdoc-media"))
|
|
72695
|
+
return null;
|
|
72696
|
+
if (typeof DOMParser === "undefined")
|
|
72697
|
+
return null;
|
|
72698
|
+
try {
|
|
72699
|
+
const el = new DOMParser().parseFromString(html2, "text/html").querySelector(`[${SUPERDOC_MEDIA_ATTR}]`);
|
|
72700
|
+
if (!el)
|
|
72701
|
+
return null;
|
|
72702
|
+
const b64 = el.textContent?.trim() ?? "";
|
|
72703
|
+
if (!b64)
|
|
72704
|
+
return null;
|
|
72705
|
+
return decodeUtf8Base64(b64) || null;
|
|
72706
|
+
} catch {
|
|
72707
|
+
return null;
|
|
72708
|
+
}
|
|
72709
|
+
}
|
|
72689
72710
|
function extractBodySectPrFromHtml(html2) {
|
|
72690
72711
|
if (!html2 || !html2.includes("data-sd-body-sect-pr"))
|
|
72691
72712
|
return null;
|
|
@@ -72802,7 +72823,7 @@ function annotatePmNodeOnClipboardDom(domEl, pmNode, editor) {
|
|
|
72802
72823
|
function isSuperdocOriginClipboardHtml(html2) {
|
|
72803
72824
|
if (!html2 || typeof html2 !== "string")
|
|
72804
72825
|
return false;
|
|
72805
|
-
if (html2.includes("data-superdoc-slice") || html2.includes("data-sd-body-sect-pr"))
|
|
72826
|
+
if (html2.includes("data-superdoc-slice") || html2.includes("data-sd-body-sect-pr") || html2.includes("data-sd-superdoc-media"))
|
|
72806
72827
|
return true;
|
|
72807
72828
|
if (/data-sd-sect-pr\s*=/i.test(html2))
|
|
72808
72829
|
return true;
|
|
@@ -73002,12 +73023,29 @@ function sanitizeHtml(html2, forbiddenTags = [
|
|
|
73002
73023
|
return container;
|
|
73003
73024
|
}
|
|
73004
73025
|
function handleClipboardPaste({ editor, view }, html2, plainText) {
|
|
73026
|
+
const rawHtml = html2 || "";
|
|
73027
|
+
const isSuperdocHtml = isSuperdocOriginClipboardHtml(rawHtml);
|
|
73028
|
+
const embeddedBodySectPr = isSuperdocHtml ? extractBodySectPrFromHtml(rawHtml) : null;
|
|
73029
|
+
const embeddedMedia = isSuperdocHtml ? extractMediaFromHtml(rawHtml) : "";
|
|
73030
|
+
let pasteHtml = rawHtml;
|
|
73031
|
+
let superdocSliceData = extractSliceFromHtml(rawHtml);
|
|
73032
|
+
if (superdocSliceData) {
|
|
73033
|
+
superdocSliceData = applySuperdocClipboardMedia(editor, null, superdocSliceData, embeddedMedia);
|
|
73034
|
+
try {
|
|
73035
|
+
if (handleSuperdocSlicePaste(superdocSliceData, editor, view, embeddedBodySectPr))
|
|
73036
|
+
return true;
|
|
73037
|
+
} catch (err$1) {
|
|
73038
|
+
console.warn("Failed to paste SuperDoc slice, falling back to HTML:", err$1);
|
|
73039
|
+
}
|
|
73040
|
+
}
|
|
73041
|
+
if (isSuperdocHtml)
|
|
73042
|
+
pasteHtml = stripSliceFromHtml(rawHtml);
|
|
73005
73043
|
let source;
|
|
73006
|
-
if (!
|
|
73044
|
+
if (!pasteHtml)
|
|
73007
73045
|
source = "plain-text";
|
|
73008
|
-
else if (isWordHtml(
|
|
73046
|
+
else if (isWordHtml(pasteHtml))
|
|
73009
73047
|
source = "word-html";
|
|
73010
|
-
else if (isGoogleDocsHtml(
|
|
73048
|
+
else if (isGoogleDocsHtml(pasteHtml))
|
|
73011
73049
|
source = "google-docs";
|
|
73012
73050
|
else
|
|
73013
73051
|
source = "browser-html";
|
|
@@ -73019,13 +73057,26 @@ function handleClipboardPaste({ editor, view }, html2, plainText) {
|
|
|
73019
73057
|
return handlePlainTextUrlPaste(editor, view, plainText, detected);
|
|
73020
73058
|
}
|
|
73021
73059
|
case "word-html":
|
|
73022
|
-
if (editor.options.mode === "docx" && !
|
|
73023
|
-
return handleDocxPaste(
|
|
73024
|
-
|
|
73025
|
-
|
|
73026
|
-
|
|
73027
|
-
|
|
73028
|
-
|
|
73060
|
+
if (editor.options.mode === "docx" && !isSuperdocHtml)
|
|
73061
|
+
return handleDocxPaste(pasteHtml, editor, view);
|
|
73062
|
+
{
|
|
73063
|
+
const ok3 = handleHtmlPaste(pasteHtml, editor);
|
|
73064
|
+
if (ok3 && embeddedBodySectPr)
|
|
73065
|
+
tryApplyEmbeddedBodySectPr(editor, view, embeddedBodySectPr);
|
|
73066
|
+
return ok3;
|
|
73067
|
+
}
|
|
73068
|
+
case "google-docs": {
|
|
73069
|
+
const ok3 = handleGoogleDocsHtml(pasteHtml, editor, view);
|
|
73070
|
+
if (ok3 && embeddedBodySectPr)
|
|
73071
|
+
tryApplyEmbeddedBodySectPr(editor, view, embeddedBodySectPr);
|
|
73072
|
+
return ok3;
|
|
73073
|
+
}
|
|
73074
|
+
case "browser-html": {
|
|
73075
|
+
const ok3 = handleHtmlPaste(pasteHtml, editor);
|
|
73076
|
+
if (ok3 && embeddedBodySectPr)
|
|
73077
|
+
tryApplyEmbeddedBodySectPr(editor, view, embeddedBodySectPr);
|
|
73078
|
+
return ok3;
|
|
73079
|
+
}
|
|
73029
73080
|
}
|
|
73030
73081
|
return false;
|
|
73031
73082
|
}
|
|
@@ -73051,7 +73102,7 @@ function handleCutEvent(view, event, editor) {
|
|
|
73051
73102
|
const html2 = unflattenListsInHtml(div.innerHTML);
|
|
73052
73103
|
const bodySectPr = view.state.doc.attrs?.bodySectPr;
|
|
73053
73104
|
const bodySectPrJson = bodySectPr && bodySectPrShouldEmbed(bodySectPr) ? JSON.stringify(bodySectPr) : "";
|
|
73054
|
-
clipboardData.setData("text/html", embedSliceInHtml(html2, sliceJson, bodySectPrJson));
|
|
73105
|
+
clipboardData.setData("text/html", embedSliceInHtml(html2, sliceJson, bodySectPrJson, mediaJson));
|
|
73055
73106
|
clipboardData.setData("text/plain", fragment.textBetween(0, fragment.size, `
|
|
73056
73107
|
|
|
73057
73108
|
`));
|
|
@@ -99651,7 +99702,7 @@ var isRegExp = (value) => {
|
|
|
99651
99702
|
normalizePastedLinks(tr, editor);
|
|
99652
99703
|
dispatch(tr);
|
|
99653
99704
|
return true;
|
|
99654
|
-
}, SUPERDOC_SLICE_MIME = "application/x-superdoc-slice", SUPERDOC_MEDIA_MIME = "application/x-superdoc-media", SUPERDOC_SLICE_ATTR = "data-superdoc-slice", SUPERDOC_BODY_SECT_PR_ATTR = "data-sd-body-sect-pr", PARAGRAPH_CLIPBOARD_ATTRS, InputRule = class {
|
|
99705
|
+
}, SUPERDOC_SLICE_MIME = "application/x-superdoc-slice", SUPERDOC_MEDIA_MIME = "application/x-superdoc-media", SUPERDOC_SLICE_ATTR = "data-superdoc-slice", SUPERDOC_BODY_SECT_PR_ATTR = "data-sd-body-sect-pr", SUPERDOC_MEDIA_ATTR = "data-sd-superdoc-media", PARAGRAPH_CLIPBOARD_ATTRS, InputRule = class {
|
|
99655
99706
|
match;
|
|
99656
99707
|
handler;
|
|
99657
99708
|
constructor(config$40) {
|
|
@@ -99790,9 +99841,10 @@ var isRegExp = (value) => {
|
|
|
99790
99841
|
const rawHtml = clipboard.getData("text/html");
|
|
99791
99842
|
const isSuperdocHtml = isSuperdocOriginClipboardHtml(rawHtml);
|
|
99792
99843
|
const embeddedBodySectPr = isSuperdocHtml ? extractBodySectPrFromHtml(rawHtml) : null;
|
|
99844
|
+
const embeddedMedia = isSuperdocHtml ? extractMediaFromHtml(rawHtml) : "";
|
|
99793
99845
|
let superdocSliceData = clipboard.getData("application/x-superdoc-slice") || extractSliceFromHtml(rawHtml);
|
|
99794
99846
|
if (isSuperdocHtml || superdocSliceData)
|
|
99795
|
-
superdocSliceData = applySuperdocClipboardMedia(editor, clipboard, superdocSliceData || null);
|
|
99847
|
+
superdocSliceData = applySuperdocClipboardMedia(editor, clipboard, superdocSliceData || null, embeddedMedia);
|
|
99796
99848
|
if (superdocSliceData)
|
|
99797
99849
|
try {
|
|
99798
99850
|
if (handleSuperdocSlicePaste(superdocSliceData, editor, view, embeddedBodySectPr))
|
|
@@ -104302,7 +104354,7 @@ var isRegExp = (value) => {
|
|
|
104302
104354
|
state.kern = kernNode.attributes["w:val"];
|
|
104303
104355
|
}
|
|
104304
104356
|
}, SuperConverter;
|
|
104305
|
-
var
|
|
104357
|
+
var init_SuperConverter_DFi0X147_es = __esm(() => {
|
|
104306
104358
|
init_rolldown_runtime_Bg48TavK_es();
|
|
104307
104359
|
init_jszip_C49i9kUs_es();
|
|
104308
104360
|
init_xml_js_CqGKpaft_es();
|
|
@@ -141903,7 +141955,7 @@ var init_SuperConverter_CkLY_4Vz_es = __esm(() => {
|
|
|
141903
141955
|
};
|
|
141904
141956
|
});
|
|
141905
141957
|
|
|
141906
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
141958
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-C9nvGdZQ.es.js
|
|
141907
141959
|
function parseSizeUnit(val = "0") {
|
|
141908
141960
|
const length = val.toString() || "0";
|
|
141909
141961
|
const value = Number.parseFloat(length);
|
|
@@ -144539,8 +144591,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
144539
144591
|
}
|
|
144540
144592
|
};
|
|
144541
144593
|
};
|
|
144542
|
-
var
|
|
144543
|
-
|
|
144594
|
+
var init_create_headless_toolbar_C9nvGdZQ_es = __esm(() => {
|
|
144595
|
+
init_SuperConverter_DFi0X147_es();
|
|
144544
144596
|
init_constants_DrU4EASo_es();
|
|
144545
144597
|
init_dist_B8HfvhaK_es();
|
|
144546
144598
|
CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
|
|
@@ -198748,7 +198800,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
198748
198800
|
init_remark_gfm_BhnWr3yf_es();
|
|
198749
198801
|
});
|
|
198750
198802
|
|
|
198751
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
198803
|
+
// ../../packages/superdoc/dist/chunks/src-LSTnLsUi.es.js
|
|
198752
198804
|
function deleteProps(obj, propOrProps) {
|
|
198753
198805
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
198754
198806
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -273864,11 +273916,12 @@ var Node$13 = class Node$14 {
|
|
|
273864
273916
|
return;
|
|
273865
273917
|
const { from: from$1, to } = this.view.state.selection;
|
|
273866
273918
|
let sliceJson = "";
|
|
273919
|
+
let mediaJson = "";
|
|
273867
273920
|
if (from$1 !== to) {
|
|
273868
273921
|
const slice2 = this.view.state.doc.slice(from$1, to);
|
|
273869
273922
|
sliceJson = JSON.stringify(slice2.toJSON());
|
|
273870
273923
|
clipboardData.setData("application/x-superdoc-slice", sliceJson);
|
|
273871
|
-
|
|
273924
|
+
mediaJson = collectReferencedImageMediaForClipboard(sliceJson, editor);
|
|
273872
273925
|
if (mediaJson)
|
|
273873
273926
|
clipboardData.setData(SUPERDOC_MEDIA_MIME, mediaJson);
|
|
273874
273927
|
}
|
|
@@ -273876,7 +273929,7 @@ var Node$13 = class Node$14 {
|
|
|
273876
273929
|
const bodySectPr = this.view.state.doc.attrs?.bodySectPr;
|
|
273877
273930
|
const bodySectPrJson = bodySectPr && bodySectPrShouldEmbed(bodySectPr) ? JSON.stringify(bodySectPr) : "";
|
|
273878
273931
|
if (richHtml) {
|
|
273879
|
-
clipboardData.setData("text/html", embedSliceInHtml(richHtml, sliceJson, bodySectPrJson));
|
|
273932
|
+
clipboardData.setData("text/html", embedSliceInHtml(richHtml, sliceJson, bodySectPrJson, mediaJson));
|
|
273880
273933
|
clipboardData.setData("text/plain", getSelectionFromViewRoot(this.view.root)?.toString() ?? "");
|
|
273881
273934
|
return;
|
|
273882
273935
|
}
|
|
@@ -273886,7 +273939,7 @@ var Node$13 = class Node$14 {
|
|
|
273886
273939
|
div$1.appendChild(serializer2.serializeFragment(fragment));
|
|
273887
273940
|
annotateFragmentDomWithClipboardData(div$1, fragment, editor);
|
|
273888
273941
|
const html3 = transformListsInCopiedContent(div$1.innerHTML);
|
|
273889
|
-
clipboardData.setData("text/html", embedSliceInHtml(html3, sliceJson, bodySectPrJson));
|
|
273942
|
+
clipboardData.setData("text/html", embedSliceInHtml(html3, sliceJson, bodySectPrJson, mediaJson));
|
|
273890
273943
|
clipboardData.setData("text/plain", this.view.state.doc.textBetween(from$1, to, `
|
|
273891
273944
|
`));
|
|
273892
273945
|
} catch (error48) {
|
|
@@ -290010,12 +290063,12 @@ menclose::after {
|
|
|
290010
290063
|
return;
|
|
290011
290064
|
console.log(...args$1);
|
|
290012
290065
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
|
|
290013
|
-
var
|
|
290066
|
+
var init_src_LSTnLsUi_es = __esm(() => {
|
|
290014
290067
|
init_rolldown_runtime_Bg48TavK_es();
|
|
290015
|
-
|
|
290068
|
+
init_SuperConverter_DFi0X147_es();
|
|
290016
290069
|
init_jszip_C49i9kUs_es();
|
|
290017
290070
|
init_uuid_qzgm05fK_es();
|
|
290018
|
-
|
|
290071
|
+
init_create_headless_toolbar_C9nvGdZQ_es();
|
|
290019
290072
|
init_constants_DrU4EASo_es();
|
|
290020
290073
|
init_dist_B8HfvhaK_es();
|
|
290021
290074
|
init_unified_Dsuw2be5_es();
|
|
@@ -327408,11 +327461,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327408
327461
|
];
|
|
327409
327462
|
});
|
|
327410
327463
|
|
|
327411
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
327464
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-Cx0pa6em.es.js
|
|
327412
327465
|
var RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
|
|
327413
|
-
var
|
|
327414
|
-
|
|
327415
|
-
|
|
327466
|
+
var init_create_super_doc_ui_Cx0pa6em_es = __esm(() => {
|
|
327467
|
+
init_SuperConverter_DFi0X147_es();
|
|
327468
|
+
init_create_headless_toolbar_C9nvGdZQ_es();
|
|
327416
327469
|
RESERVED_PROXY_PROPERTY_NAMES = new Set([
|
|
327417
327470
|
"register",
|
|
327418
327471
|
"get",
|
|
@@ -327436,16 +327489,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
|
|
|
327436
327489
|
|
|
327437
327490
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
327438
327491
|
var init_super_editor_es = __esm(() => {
|
|
327439
|
-
|
|
327440
|
-
|
|
327492
|
+
init_src_LSTnLsUi_es();
|
|
327493
|
+
init_SuperConverter_DFi0X147_es();
|
|
327441
327494
|
init_jszip_C49i9kUs_es();
|
|
327442
327495
|
init_xml_js_CqGKpaft_es();
|
|
327443
|
-
|
|
327496
|
+
init_create_headless_toolbar_C9nvGdZQ_es();
|
|
327444
327497
|
init_constants_DrU4EASo_es();
|
|
327445
327498
|
init_dist_B8HfvhaK_es();
|
|
327446
327499
|
init_unified_Dsuw2be5_es();
|
|
327447
327500
|
init_DocxZipper_CUX64E5K_es();
|
|
327448
|
-
|
|
327501
|
+
init_create_super_doc_ui_Cx0pa6em_es();
|
|
327449
327502
|
init_ui_CGB3qmy3_es();
|
|
327450
327503
|
init_eventemitter3_UwU_CLPU_es();
|
|
327451
327504
|
init_errors_C_DoKMoN_es();
|