@harbour-enterprises/superdoc 0.25.0-next.3 → 0.25.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-DDL0V0l5.cjs → PdfViewer-BETK3Bs4.cjs} +1 -1
- package/dist/chunks/{PdfViewer-Y13XRanw.es.js → PdfViewer-D4F3H-Ay.es.js} +1 -1
- package/dist/chunks/{index-Bo5YCvD5.cjs → index-BHS2aLqo.cjs} +2 -2
- package/dist/chunks/{index-DKNVSdr6.es.js → index-D9KYAvvg.es.js} +2 -2
- package/dist/chunks/{super-editor.es-Ct2sXbNV.cjs → super-editor.es-BJzqCihw.cjs} +107 -116
- package/dist/chunks/{super-editor.es-CYtLh0Ob.es.js → super-editor.es-Beeng5kU.es.js} +107 -116
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-gSy6s2VK.js → converter-DOkexB95.js} +89 -72
- package/dist/super-editor/chunks/{docx-zipper-CceGxV02.js → docx-zipper-Ci5JbfjE.js} +1 -1
- package/dist/super-editor/chunks/{editor-CoX24lXQ.js → editor-DC9ZOqdt.js} +23 -58
- package/dist/super-editor/chunks/{toolbar-BTw9-jfX.js → toolbar-SPGEoEi0.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/src/core/super-converter/v3/handlers/mc/altermateContent/alternate-content-translator.d.ts +11 -0
- package/dist/super-editor/super-editor/src/index.d.ts +8 -2
- package/dist/super-editor/super-editor.es.js +16 -12
- 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 +107 -116
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -40057,8 +40057,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40057
40057
|
handlerName: "w:bookmarkEndTranslator",
|
|
40058
40058
|
handler: handleBookmarkEndNode
|
|
40059
40059
|
};
|
|
40060
|
-
const
|
|
40061
|
-
const SUPPORTED_REQUIRES = /* @__PURE__ */ new Set([
|
|
40060
|
+
const SUPPORTED_ALTERNATE_CONTENT_REQUIRES = /* @__PURE__ */ new Set([
|
|
40062
40061
|
"wps",
|
|
40063
40062
|
"wp14",
|
|
40064
40063
|
"w14",
|
|
@@ -40071,22 +40070,85 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40071
40070
|
"w16sdtfl",
|
|
40072
40071
|
"w16se"
|
|
40073
40072
|
]);
|
|
40073
|
+
const XML_NODE_NAME$1 = "mc:AlternateContent";
|
|
40074
|
+
const SD_NODE_NAME$1 = [];
|
|
40075
|
+
const validXmlAttributes$1 = [];
|
|
40076
|
+
function encode$1(params2) {
|
|
40077
|
+
const { nodeListHandler } = params2;
|
|
40078
|
+
const { node } = params2.extraParams;
|
|
40079
|
+
if (!node || !node.type) {
|
|
40080
|
+
return null;
|
|
40081
|
+
}
|
|
40082
|
+
const { branch, elements } = selectAlternateContentElements(node);
|
|
40083
|
+
if (!elements) {
|
|
40084
|
+
return null;
|
|
40085
|
+
}
|
|
40086
|
+
return nodeListHandler.handler({
|
|
40087
|
+
...params2,
|
|
40088
|
+
nodes: elements,
|
|
40089
|
+
path: buildPath(params2.path, node, branch)
|
|
40090
|
+
});
|
|
40091
|
+
}
|
|
40092
|
+
function decode$1(params2) {
|
|
40093
|
+
const { node } = params2;
|
|
40094
|
+
const { drawingContent } = node.attrs;
|
|
40095
|
+
const drawing = {
|
|
40096
|
+
name: "w:drawing",
|
|
40097
|
+
elements: [...drawingContent ? [...drawingContent.elements || []] : []]
|
|
40098
|
+
};
|
|
40099
|
+
const choice = {
|
|
40100
|
+
name: "mc:Choice",
|
|
40101
|
+
attributes: { Requires: "wps" },
|
|
40102
|
+
elements: [drawing]
|
|
40103
|
+
};
|
|
40104
|
+
return {
|
|
40105
|
+
name: "mc:AlternateContent",
|
|
40106
|
+
elements: [choice]
|
|
40107
|
+
};
|
|
40108
|
+
}
|
|
40109
|
+
const config$1 = {
|
|
40110
|
+
xmlName: XML_NODE_NAME$1,
|
|
40111
|
+
sdNodeOrKeyName: SD_NODE_NAME$1,
|
|
40112
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
40113
|
+
encode: encode$1,
|
|
40114
|
+
decode: decode$1,
|
|
40115
|
+
attributes: validXmlAttributes$1
|
|
40116
|
+
};
|
|
40117
|
+
function selectAlternateContentElements(node) {
|
|
40118
|
+
if (!node?.elements?.length) {
|
|
40119
|
+
return { branch: null, elements: null };
|
|
40120
|
+
}
|
|
40121
|
+
const choices = node.elements.filter((el) => el?.name === "mc:Choice");
|
|
40122
|
+
const fallback = node.elements.find((el) => el?.name === "mc:Fallback");
|
|
40123
|
+
const supportedChoice = choices.find((choice) => {
|
|
40124
|
+
const requiresAttr = choice?.attributes?.Requires || choice?.attributes?.requires;
|
|
40125
|
+
if (!requiresAttr) return false;
|
|
40126
|
+
return requiresAttr.split(/\s+/).filter(Boolean).some((namespace2) => SUPPORTED_ALTERNATE_CONTENT_REQUIRES.has(namespace2));
|
|
40127
|
+
});
|
|
40128
|
+
const branch = supportedChoice || fallback || choices[0] || null;
|
|
40129
|
+
const selectedElements = branch?.elements;
|
|
40130
|
+
if (!selectedElements) {
|
|
40131
|
+
return { branch, elements: null };
|
|
40132
|
+
}
|
|
40133
|
+
return {
|
|
40134
|
+
branch,
|
|
40135
|
+
elements: carbonCopy(selectedElements)
|
|
40136
|
+
};
|
|
40137
|
+
}
|
|
40138
|
+
const translator$1 = NodeTranslator.from(config$1);
|
|
40139
|
+
function buildPath(existingPath = [], node, branch) {
|
|
40140
|
+
const path = [...existingPath];
|
|
40141
|
+
if (node) path.push(node);
|
|
40142
|
+
if (branch) path.push(branch);
|
|
40143
|
+
return path;
|
|
40144
|
+
}
|
|
40145
|
+
const ALTERNATE_CONTENT_NODE = "mc:AlternateContent";
|
|
40074
40146
|
const skipHandlerResponse = { nodes: [], consumed: 0 };
|
|
40075
40147
|
const isAlternateContentNode = (node) => node?.name === ALTERNATE_CONTENT_NODE;
|
|
40076
|
-
const isSupportedChoice = (choice) => {
|
|
40077
|
-
if (!choice?.attributes) return false;
|
|
40078
|
-
const requires = choice.attributes.Requires || choice.attributes.requires;
|
|
40079
|
-
if (!requires) return false;
|
|
40080
|
-
return requires.split(/\s+/).filter(Boolean).some((namespace2) => SUPPORTED_REQUIRES.has(namespace2));
|
|
40081
|
-
};
|
|
40082
40148
|
const resolveAlternateContentElements = (alternateContent) => {
|
|
40083
|
-
|
|
40084
|
-
|
|
40085
|
-
|
|
40086
|
-
const supportedChoice = choices.find(isSupportedChoice);
|
|
40087
|
-
const selectedElements = supportedChoice?.elements || fallback?.elements || choices[0]?.elements;
|
|
40088
|
-
if (!selectedElements) return null;
|
|
40089
|
-
return carbonCopy(selectedElements);
|
|
40149
|
+
const { elements } = selectAlternateContentElements(alternateContent);
|
|
40150
|
+
if (!elements) return null;
|
|
40151
|
+
return elements;
|
|
40090
40152
|
};
|
|
40091
40153
|
const buildNodeWithoutAlternateContent = (node) => {
|
|
40092
40154
|
const { elements } = node || {};
|
|
@@ -40118,16 +40180,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40118
40180
|
}
|
|
40119
40181
|
const [currentNode] = nodes;
|
|
40120
40182
|
if (isAlternateContentNode(currentNode)) {
|
|
40121
|
-
const
|
|
40122
|
-
|
|
40123
|
-
|
|
40124
|
-
}
|
|
40125
|
-
const
|
|
40183
|
+
const nodeForTranslator = currentNode?.type ? currentNode : {
|
|
40184
|
+
...currentNode,
|
|
40185
|
+
type: "element"
|
|
40186
|
+
};
|
|
40187
|
+
const translated = translator$1.encode({
|
|
40126
40188
|
...params2,
|
|
40127
|
-
nodes:
|
|
40128
|
-
|
|
40189
|
+
nodes: [nodeForTranslator],
|
|
40190
|
+
extraParams: { ...params2.extraParams || {}, node: nodeForTranslator }
|
|
40129
40191
|
});
|
|
40130
|
-
|
|
40192
|
+
if (!translated) {
|
|
40193
|
+
return skipHandlerResponse;
|
|
40194
|
+
}
|
|
40195
|
+
const nodesArray = Array.isArray(translated) ? translated : [translated];
|
|
40196
|
+
return { nodes: nodesArray, consumed: 1 };
|
|
40131
40197
|
}
|
|
40132
40198
|
const sanitizedNode = buildNodeWithoutAlternateContent(currentNode);
|
|
40133
40199
|
if (!sanitizedNode) {
|
|
@@ -41398,55 +41464,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
41398
41464
|
};
|
|
41399
41465
|
return textbox;
|
|
41400
41466
|
}
|
|
41401
|
-
const XML_NODE_NAME$1 = "mc:AlternateContent";
|
|
41402
|
-
const SD_NODE_NAME$1 = [];
|
|
41403
|
-
const validXmlAttributes$1 = [];
|
|
41404
|
-
function encode$1(params2) {
|
|
41405
|
-
const { nodeListHandler } = params2;
|
|
41406
|
-
const { node } = params2.extraParams;
|
|
41407
|
-
if (!node || !node.type) {
|
|
41408
|
-
return null;
|
|
41409
|
-
}
|
|
41410
|
-
const allowedNamespaces = ["wps", "wp14", "w14", "w15"];
|
|
41411
|
-
const wpsNode = node.elements.find(
|
|
41412
|
-
(el) => el.name === "mc:Choice" && allowedNamespaces.includes(el.attributes["Requires"])
|
|
41413
|
-
);
|
|
41414
|
-
if (!wpsNode) {
|
|
41415
|
-
return null;
|
|
41416
|
-
}
|
|
41417
|
-
const contents = wpsNode.elements;
|
|
41418
|
-
return nodeListHandler.handler({
|
|
41419
|
-
...params2,
|
|
41420
|
-
nodes: contents,
|
|
41421
|
-
path: [...params2.path || [], wpsNode]
|
|
41422
|
-
});
|
|
41423
|
-
}
|
|
41424
|
-
function decode$1(params2) {
|
|
41425
|
-
const { node } = params2;
|
|
41426
|
-
const { drawingContent } = node.attrs;
|
|
41427
|
-
const drawing = {
|
|
41428
|
-
name: "w:drawing",
|
|
41429
|
-
elements: [...drawingContent ? [...drawingContent.elements || []] : []]
|
|
41430
|
-
};
|
|
41431
|
-
const choice = {
|
|
41432
|
-
name: "mc:Choice",
|
|
41433
|
-
attributes: { Requires: "wps" },
|
|
41434
|
-
elements: [drawing]
|
|
41435
|
-
};
|
|
41436
|
-
return {
|
|
41437
|
-
name: "mc:AlternateContent",
|
|
41438
|
-
elements: [choice]
|
|
41439
|
-
};
|
|
41440
|
-
}
|
|
41441
|
-
const config$1 = {
|
|
41442
|
-
xmlName: XML_NODE_NAME$1,
|
|
41443
|
-
sdNodeOrKeyName: SD_NODE_NAME$1,
|
|
41444
|
-
type: NodeTranslator.translatorTypes.NODE,
|
|
41445
|
-
encode: encode$1,
|
|
41446
|
-
decode: decode$1,
|
|
41447
|
-
attributes: validXmlAttributes$1
|
|
41448
|
-
};
|
|
41449
|
-
const translator$1 = NodeTranslator.from(config$1);
|
|
41450
41467
|
function translateContentBlock(params2) {
|
|
41451
41468
|
const { node } = params2;
|
|
41452
41469
|
const { vmlAttributes, horizontalRule } = node.attrs;
|
|
@@ -46050,7 +46067,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
46050
46067
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
46051
46068
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
46052
46069
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
46053
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn,
|
|
46070
|
+
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
46054
46071
|
var GOOD_LEAF_SIZE = 200;
|
|
46055
46072
|
var RopeSequence = function RopeSequence2() {
|
|
46056
46073
|
};
|
|
@@ -61233,9 +61250,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61233
61250
|
this.emit("beforeCreate", { editor: this });
|
|
61234
61251
|
this.on("contentError", this.options.onContentError);
|
|
61235
61252
|
this.mount(this.options.element);
|
|
61236
|
-
if (!this.options.isHeadless) {
|
|
61237
|
-
__privateMethod$1(this, _Editor_instances, checkFonts_fn).call(this);
|
|
61238
|
-
}
|
|
61239
61253
|
this.on("create", this.options.onCreate);
|
|
61240
61254
|
this.on("update", this.options.onUpdate);
|
|
61241
61255
|
this.on("selectionUpdate", this.options.onSelectionUpdate);
|
|
@@ -61257,8 +61271,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61257
61271
|
if (!this.options.isHeadless) {
|
|
61258
61272
|
this.initializeCollaborationData();
|
|
61259
61273
|
this.initDefaultStyles();
|
|
61274
|
+
__privateMethod$1(this, _Editor_instances, checkFonts_fn).call(this);
|
|
61260
61275
|
}
|
|
61261
|
-
|
|
61276
|
+
const shouldMigrateListsOnInit = Boolean(
|
|
61277
|
+
this.options.markdown || this.options.html || this.options.loadFromSchema || this.options.jsonOverride || this.options.mode === "html" || this.options.mode === "text"
|
|
61278
|
+
);
|
|
61279
|
+
if (shouldMigrateListsOnInit) {
|
|
61262
61280
|
this.migrateListsToV2();
|
|
61263
61281
|
}
|
|
61264
61282
|
this.setDocumentMode(this.options.documentMode);
|
|
@@ -61399,52 +61417,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61399
61417
|
if (this.options.isHeadless) {
|
|
61400
61418
|
return;
|
|
61401
61419
|
}
|
|
61402
|
-
const fontsUsedInDocument = this.converter.getDocumentFonts();
|
|
61403
|
-
if (!("queryLocalFonts" in window)) {
|
|
61404
|
-
console.warn("[SuperDoc] Could not get access to local fonts. Using fallback solution.");
|
|
61405
|
-
const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
|
|
61406
|
-
this.emit("fonts-resolved", {
|
|
61407
|
-
documentFonts: fontsUsedInDocument,
|
|
61408
|
-
unsupportedFonts
|
|
61409
|
-
});
|
|
61410
|
-
return;
|
|
61411
|
-
}
|
|
61412
|
-
const localFontAccess = await navigator.permissions.query({ name: "local-fonts" });
|
|
61413
|
-
if (localFontAccess.state === "denied") {
|
|
61414
|
-
console.warn("[SuperDoc] Could not get access to local fonts. Using fallback solution.");
|
|
61415
|
-
const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
|
|
61416
|
-
this.emit("fonts-resolved", {
|
|
61417
|
-
documentFonts: fontsUsedInDocument,
|
|
61418
|
-
unsupportedFonts
|
|
61419
|
-
});
|
|
61420
|
-
return;
|
|
61421
|
-
}
|
|
61422
61420
|
try {
|
|
61423
|
-
const
|
|
61424
|
-
const
|
|
61425
|
-
const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFontsWithLocalFonts_fn).call(this, fontsUsedInDocument, uniqueLocalFonts);
|
|
61421
|
+
const fontsUsedInDocument = this.converter.getDocumentFonts();
|
|
61422
|
+
const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFonts_fn).call(this, fontsUsedInDocument);
|
|
61426
61423
|
this.emit("fonts-resolved", {
|
|
61427
61424
|
documentFonts: fontsUsedInDocument,
|
|
61428
61425
|
unsupportedFonts
|
|
61429
61426
|
});
|
|
61430
61427
|
} catch {
|
|
61431
|
-
console.warn("[SuperDoc] Could not
|
|
61432
|
-
const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFontsWithCanvas_fn).call(this, fontsUsedInDocument);
|
|
61433
|
-
this.emit("fonts-resolved", {
|
|
61434
|
-
documentFonts: fontsUsedInDocument,
|
|
61435
|
-
unsupportedFonts
|
|
61436
|
-
});
|
|
61428
|
+
console.warn("[SuperDoc] Could not determine document fonts and unsupported fonts");
|
|
61437
61429
|
}
|
|
61438
61430
|
};
|
|
61439
|
-
|
|
61440
|
-
const unsupportedFonts = fonts.filter((font) => {
|
|
61441
|
-
const isLocalFont = localFonts.includes(font);
|
|
61442
|
-
const isFontImported = this.fontsImported.includes(font);
|
|
61443
|
-
return !isLocalFont && !isFontImported;
|
|
61444
|
-
});
|
|
61445
|
-
return unsupportedFonts;
|
|
61446
|
-
};
|
|
61447
|
-
determineUnsupportedFontsWithCanvas_fn = function(fonts) {
|
|
61431
|
+
determineUnsupportedFonts_fn = function(fonts) {
|
|
61448
61432
|
const unsupportedFonts = fonts.filter((font) => {
|
|
61449
61433
|
const canRender = canRenderFont(font);
|
|
61450
61434
|
const isFontImported = this.fontsImported.includes(font);
|
|
@@ -61532,6 +61516,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61532
61516
|
if (this.options.collaborationIsReady) return;
|
|
61533
61517
|
console.debug("🔗 [super-editor] Collaboration ready");
|
|
61534
61518
|
__privateMethod$1(this, _Editor_instances, validateDocumentInit_fn).call(this);
|
|
61519
|
+
if (this.options.ydoc) {
|
|
61520
|
+
this.migrateListsToV2();
|
|
61521
|
+
}
|
|
61535
61522
|
this.options.onCollaborationReady({ editor, ydoc });
|
|
61536
61523
|
this.options.collaborationIsReady = true;
|
|
61537
61524
|
this.options.initialState = this.state;
|
|
@@ -96689,8 +96676,12 @@ ${style2}
|
|
|
96689
96676
|
Node: Node$1,
|
|
96690
96677
|
Attribute,
|
|
96691
96678
|
Extension,
|
|
96679
|
+
Mark,
|
|
96680
|
+
//
|
|
96692
96681
|
Plugin,
|
|
96693
|
-
|
|
96682
|
+
PluginKey,
|
|
96683
|
+
Decoration,
|
|
96684
|
+
DecorationSet
|
|
96694
96685
|
};
|
|
96695
96686
|
const DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
96696
96687
|
const PDF = "application/pdf";
|