@harbour-enterprises/superdoc 0.19.0-next.8 → 0.19.0
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-fT3KFJal.es.js → PdfViewer-D0lSSW0x.es.js} +1 -1
- package/dist/chunks/{PdfViewer-HREDD6qb.cjs → PdfViewer-DJb0akn3.cjs} +1 -1
- package/dist/chunks/{index-CSvNxbRW.es.js → index-BZOsYVVo.es.js} +2 -3
- package/dist/chunks/{index-wEO3Mdf3.cjs → index-CeLW_JxI.cjs} +2 -3
- package/dist/chunks/{super-editor.es-C_ozmHgp.es.js → super-editor.es-B1rC4GHL.es.js} +13874 -14077
- package/dist/chunks/{super-editor.es-D4jQmQ_2.cjs → super-editor.es-FNewwzSy.cjs} +13874 -14077
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/style.css +6 -6
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-B0DE5RlJ.js → converter-CFVPKGqT.js} +12977 -13047
- package/dist/super-editor/chunks/{docx-zipper-CynIq8Em.js → docx-zipper-CGdYHGDa.js} +1 -1
- package/dist/super-editor/chunks/{editor-W_wtetmC.js → editor-DrhZRXX9.js} +99 -227
- package/dist/super-editor/chunks/{toolbar-BzRxJlN2.js → toolbar-CKQ-GucL.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/src/core/Editor.d.ts +0 -2
- package/dist/super-editor/src/core/super-converter/exporter.d.ts +1 -19
- package/dist/super-editor/src/core/super-converter/v2/exporter/documentSectionExporter.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v2/exporter/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/annotationImporter.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/docPartGalleryImporter.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/docPartObjImporter.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/structuredDocumentNodeImporter.d.ts +8 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +8 -8
- package/dist/super-editor/style.css +6 -6
- package/dist/super-editor/super-editor.es.js +8 -13
- 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 +13997 -14201
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/super-editor/src/core/inputRules/html/transform-copied-lists.d.ts +0 -3
- package/dist/super-editor/src/core/super-converter/v2/importer/sdtNodeImporter.d.ts +0 -8
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-annotation-node.d.ts +0 -22
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-doc-part-obj.d.ts +0 -6
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-document-section-node.d.ts +0 -6
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-structured-content-node.d.ts +0 -5
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/parse-tag-value-json.d.ts +0 -5
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/sdt-node-type-strategy.d.ts +0 -9
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-document-section.d.ts +0 -7
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-field-annotation.d.ts +0 -80
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-structured-content.d.ts +0 -5
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/index.d.ts +0 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/sdt-translator.d.ts +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as process$1, aw as commonjsGlobal, B as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-
|
|
1
|
+
import { p as process$1, aw as commonjsGlobal, B as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-CFVPKGqT.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
|
}
|
|
@@ -9,12 +9,12 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
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,
|
|
12
|
+
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, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_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, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_fn;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as StepMap, ao as getColStyleDeclaration, ap as SelectionRange, aq as Transform, ar as isInTable$1, as as createColGroup, at as generateDocxRandomId, au as insertNewRelationship, av as htmlHandler } from "./converter-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as StepMap, ao as getColStyleDeclaration, ap as SelectionRange, aq as Transform, ar as isInTable$1, as as createColGroup, at as generateDocxRandomId, au as insertNewRelationship, av as htmlHandler } from "./converter-CFVPKGqT.js";
|
|
16
16
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
17
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
17
|
+
import { D as DocxZipper } from "./docx-zipper-CGdYHGDa.js";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
20
20
|
};
|
|
@@ -13893,77 +13893,6 @@ analyzeDocument_fn = function() {
|
|
|
13893
13893
|
doc2.descendants(collectElements);
|
|
13894
13894
|
return analysis;
|
|
13895
13895
|
};
|
|
13896
|
-
const transformListsInCopiedContent = (html) => {
|
|
13897
|
-
const container = document.createElement("div");
|
|
13898
|
-
container.innerHTML = html;
|
|
13899
|
-
const result = [];
|
|
13900
|
-
const stack = [];
|
|
13901
|
-
const flushStackUntil = (level) => {
|
|
13902
|
-
while (stack.length && stack[stack.length - 1].level >= level) {
|
|
13903
|
-
const top2 = stack.pop();
|
|
13904
|
-
if (stack.length) {
|
|
13905
|
-
stack[stack.length - 1].el.appendChild(top2.el);
|
|
13906
|
-
} else {
|
|
13907
|
-
result.push(top2.el.outerHTML);
|
|
13908
|
-
}
|
|
13909
|
-
}
|
|
13910
|
-
};
|
|
13911
|
-
Array.from(container.childNodes).forEach((node) => {
|
|
13912
|
-
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
13913
|
-
result.push(node.outerHTML || node.textContent);
|
|
13914
|
-
return;
|
|
13915
|
-
}
|
|
13916
|
-
if (node.tagName.toLowerCase() === "ol" || node.tagName.toLowerCase() === "ul") {
|
|
13917
|
-
const child = getFirstElementChild(node);
|
|
13918
|
-
const level = getLevel(child);
|
|
13919
|
-
const numFmt = child.getAttribute("data-num-fmt");
|
|
13920
|
-
const lvlText = child.getAttribute("data-lvl-text");
|
|
13921
|
-
const tag = node.tagName.toLowerCase();
|
|
13922
|
-
const li = child.cloneNode(true);
|
|
13923
|
-
li.setAttribute("aria-level", level + 1);
|
|
13924
|
-
li.style["list-style-type"] = getListStyleType(numFmt, lvlText);
|
|
13925
|
-
if (!stack.length || stack[stack.length - 1].level < level) {
|
|
13926
|
-
const newList = document.createElement(tag);
|
|
13927
|
-
stack.push({ tag, level, el: newList });
|
|
13928
|
-
} else if (stack[stack.length - 1].level > level) {
|
|
13929
|
-
flushStackUntil(level + 1);
|
|
13930
|
-
} else if (stack[stack.length - 1].tag !== tag) {
|
|
13931
|
-
flushStackUntil(level);
|
|
13932
|
-
const newList = document.createElement(tag);
|
|
13933
|
-
stack.push({ tag, level, el: newList });
|
|
13934
|
-
}
|
|
13935
|
-
stack[stack.length - 1].el.appendChild(li);
|
|
13936
|
-
} else {
|
|
13937
|
-
flushStackUntil(0);
|
|
13938
|
-
result.push(node.outerHTML);
|
|
13939
|
-
}
|
|
13940
|
-
});
|
|
13941
|
-
flushStackUntil(0);
|
|
13942
|
-
return result.join("");
|
|
13943
|
-
};
|
|
13944
|
-
const getListStyleType = (numFmt, lvlText) => {
|
|
13945
|
-
const bulletFmtMap = /* @__PURE__ */ new Map([
|
|
13946
|
-
["●", "disc"],
|
|
13947
|
-
["◦", "circle"],
|
|
13948
|
-
["▪", "square"]
|
|
13949
|
-
]);
|
|
13950
|
-
if (numFmt === "bullet") return bulletFmtMap.get(lvlText) || "disc";
|
|
13951
|
-
const fmtMap = /* @__PURE__ */ new Map([
|
|
13952
|
-
["decimal", "decimal"],
|
|
13953
|
-
["lowerLetter", "lower-alpha"],
|
|
13954
|
-
["upperLetter", "upper-alpha"],
|
|
13955
|
-
["lowerRoman", "lower-roman"],
|
|
13956
|
-
["upperRoman", "upper-roman"]
|
|
13957
|
-
]);
|
|
13958
|
-
return lvlText.startsWith("0") ? "decimal-leading-zero" : fmtMap.get(numFmt);
|
|
13959
|
-
};
|
|
13960
|
-
function getFirstElementChild(node) {
|
|
13961
|
-
return Array.from(node.childNodes).find((n) => n.nodeType === Node.ELEMENT_NODE) || null;
|
|
13962
|
-
}
|
|
13963
|
-
const getLevel = (node) => {
|
|
13964
|
-
const lvl = node.getAttribute("data-level");
|
|
13965
|
-
return lvl ? parseInt(lvl, 10) : 0;
|
|
13966
|
-
};
|
|
13967
13896
|
const _Editor = class _Editor extends EventEmitter {
|
|
13968
13897
|
/**
|
|
13969
13898
|
* Create a new Editor instance
|
|
@@ -14542,8 +14471,6 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14542
14471
|
}
|
|
14543
14472
|
/**
|
|
14544
14473
|
* Get the editor content as HTML
|
|
14545
|
-
* @param {Object} options - Options for the HTML serializer
|
|
14546
|
-
* @param {boolean} [options.unflattenLists] - Whether to unflatten lists in the HTML
|
|
14547
14474
|
* @returns {string} Editor content as HTML
|
|
14548
14475
|
*/
|
|
14549
14476
|
getHTML({ unflattenLists = false } = {}) {
|
|
@@ -14622,89 +14549,85 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14622
14549
|
getUpdatedDocs = false,
|
|
14623
14550
|
fieldsHighlightColor = null
|
|
14624
14551
|
} = {}) {
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
updatedHeadersFooters[name] = String(resultXml);
|
|
14650
|
-
}
|
|
14651
|
-
});
|
|
14652
|
-
const numberingData = this.converter.convertedXml["word/numbering.xml"];
|
|
14653
|
-
const numbering = this.converter.schemaToXml(numberingData.elements[0]);
|
|
14654
|
-
const updatedDocs = {
|
|
14655
|
-
...this.options.customUpdatedFiles,
|
|
14656
|
-
"word/document.xml": String(documentXml),
|
|
14657
|
-
"docProps/custom.xml": String(customXml),
|
|
14658
|
-
"word/settings.xml": String(customSettings),
|
|
14659
|
-
"word/_rels/document.xml.rels": String(rels),
|
|
14660
|
-
"word/numbering.xml": String(numbering),
|
|
14661
|
-
// Replace & with & in styles.xml as DOCX viewers can't handle it
|
|
14662
|
-
"word/styles.xml": String(styles).replace(/&/gi, "&"),
|
|
14663
|
-
...updatedHeadersFooters
|
|
14664
|
-
};
|
|
14665
|
-
if (comments.length) {
|
|
14666
|
-
const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
|
|
14667
|
-
const commentsExtendedXml = this.converter.schemaToXml(
|
|
14668
|
-
this.converter.convertedXml["word/commentsExtended.xml"].elements[0]
|
|
14669
|
-
);
|
|
14670
|
-
const commentsExtensibleXml = this.converter.schemaToXml(
|
|
14671
|
-
this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]
|
|
14672
|
-
);
|
|
14673
|
-
const commentsIdsXml = this.converter.schemaToXml(
|
|
14674
|
-
this.converter.convertedXml["word/commentsIds.xml"].elements[0]
|
|
14675
|
-
);
|
|
14676
|
-
updatedDocs["word/comments.xml"] = String(commentsXml);
|
|
14677
|
-
updatedDocs["word/commentsExtended.xml"] = String(commentsExtendedXml);
|
|
14678
|
-
updatedDocs["word/commentsExtensible.xml"] = String(commentsExtensibleXml);
|
|
14679
|
-
updatedDocs["word/commentsIds.xml"] = String(commentsIdsXml);
|
|
14680
|
-
}
|
|
14681
|
-
const zipper = new DocxZipper();
|
|
14682
|
-
if (getUpdatedDocs) {
|
|
14683
|
-
updatedDocs["[Content_Types].xml"] = await zipper.updateContentTypes(
|
|
14684
|
-
{
|
|
14685
|
-
files: this.options.content
|
|
14686
|
-
},
|
|
14687
|
-
media,
|
|
14688
|
-
true
|
|
14689
|
-
);
|
|
14690
|
-
return updatedDocs;
|
|
14552
|
+
const json = __privateMethod(this, _Editor_instances, prepareDocumentForExport_fn).call(this, comments);
|
|
14553
|
+
const documentXml = await this.converter.exportToDocx(
|
|
14554
|
+
json,
|
|
14555
|
+
this.schema,
|
|
14556
|
+
this.storage.image.media,
|
|
14557
|
+
isFinalDoc,
|
|
14558
|
+
commentsType,
|
|
14559
|
+
comments,
|
|
14560
|
+
this,
|
|
14561
|
+
exportJsonOnly,
|
|
14562
|
+
fieldsHighlightColor
|
|
14563
|
+
);
|
|
14564
|
+
__privateMethod(this, _Editor_instances, validateDocumentExport_fn).call(this);
|
|
14565
|
+
if (exportXmlOnly || exportJsonOnly) return documentXml;
|
|
14566
|
+
const customXml = this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]);
|
|
14567
|
+
const styles = this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]);
|
|
14568
|
+
const customSettings = this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]);
|
|
14569
|
+
const rels = this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]);
|
|
14570
|
+
const media = this.converter.addedMedia;
|
|
14571
|
+
const updatedHeadersFooters = {};
|
|
14572
|
+
Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
|
|
14573
|
+
if (name.includes("header") || name.includes("footer")) {
|
|
14574
|
+
const resultXml = this.converter.schemaToXml(json2.elements[0]);
|
|
14575
|
+
updatedHeadersFooters[name] = String(resultXml);
|
|
14691
14576
|
}
|
|
14692
|
-
|
|
14693
|
-
|
|
14694
|
-
|
|
14695
|
-
|
|
14577
|
+
});
|
|
14578
|
+
const numberingData = this.converter.convertedXml["word/numbering.xml"];
|
|
14579
|
+
const numbering = this.converter.schemaToXml(numberingData.elements[0]);
|
|
14580
|
+
const updatedDocs = {
|
|
14581
|
+
...this.options.customUpdatedFiles,
|
|
14582
|
+
"word/document.xml": String(documentXml),
|
|
14583
|
+
"docProps/custom.xml": String(customXml),
|
|
14584
|
+
"word/settings.xml": String(customSettings),
|
|
14585
|
+
"word/_rels/document.xml.rels": String(rels),
|
|
14586
|
+
"word/numbering.xml": String(numbering),
|
|
14587
|
+
// Replace & with & in styles.xml as DOCX viewers can't handle it
|
|
14588
|
+
"word/styles.xml": String(styles).replace(/&/gi, "&"),
|
|
14589
|
+
...updatedHeadersFooters
|
|
14590
|
+
};
|
|
14591
|
+
if (comments.length) {
|
|
14592
|
+
const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
|
|
14593
|
+
const commentsExtendedXml = this.converter.schemaToXml(
|
|
14594
|
+
this.converter.convertedXml["word/commentsExtended.xml"].elements[0]
|
|
14595
|
+
);
|
|
14596
|
+
const commentsExtensibleXml = this.converter.schemaToXml(
|
|
14597
|
+
this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]
|
|
14598
|
+
);
|
|
14599
|
+
const commentsIdsXml = this.converter.schemaToXml(
|
|
14600
|
+
this.converter.convertedXml["word/commentsIds.xml"].elements[0]
|
|
14601
|
+
);
|
|
14602
|
+
updatedDocs["word/comments.xml"] = String(commentsXml);
|
|
14603
|
+
updatedDocs["word/commentsExtended.xml"] = String(commentsExtendedXml);
|
|
14604
|
+
updatedDocs["word/commentsExtensible.xml"] = String(commentsExtensibleXml);
|
|
14605
|
+
updatedDocs["word/commentsIds.xml"] = String(commentsIdsXml);
|
|
14606
|
+
}
|
|
14607
|
+
const zipper = new DocxZipper();
|
|
14608
|
+
if (getUpdatedDocs) {
|
|
14609
|
+
updatedDocs["[Content_Types].xml"] = await zipper.updateContentTypes(
|
|
14610
|
+
{
|
|
14611
|
+
files: this.options.content
|
|
14612
|
+
},
|
|
14696
14613
|
media,
|
|
14697
|
-
|
|
14698
|
-
|
|
14699
|
-
|
|
14700
|
-
this.options.telemetry?.trackUsage("document_export", {
|
|
14701
|
-
documentType: "docx",
|
|
14702
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
14703
|
-
});
|
|
14704
|
-
return result;
|
|
14705
|
-
} catch (error) {
|
|
14706
|
-
this.emit("exception", { error, editor: this });
|
|
14614
|
+
true
|
|
14615
|
+
);
|
|
14616
|
+
return updatedDocs;
|
|
14707
14617
|
}
|
|
14618
|
+
const result = await zipper.updateZip({
|
|
14619
|
+
docx: this.options.content,
|
|
14620
|
+
updatedDocs,
|
|
14621
|
+
originalDocxFile: this.options.fileSource,
|
|
14622
|
+
media,
|
|
14623
|
+
fonts: this.options.fonts,
|
|
14624
|
+
isHeadless: this.options.isHeadless
|
|
14625
|
+
});
|
|
14626
|
+
this.options.telemetry?.trackUsage("document_export", {
|
|
14627
|
+
documentType: "docx",
|
|
14628
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
14629
|
+
});
|
|
14630
|
+
return result;
|
|
14708
14631
|
}
|
|
14709
14632
|
/**
|
|
14710
14633
|
* Destroy the editor and clean up resources
|
|
@@ -14725,8 +14648,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14725
14648
|
}
|
|
14726
14649
|
this.converter.headerEditors.length = 0;
|
|
14727
14650
|
this.converter.footerEditors.length = 0;
|
|
14728
|
-
} catch
|
|
14729
|
-
this.emit("exception", { error, editor: this });
|
|
14651
|
+
} catch {
|
|
14730
14652
|
}
|
|
14731
14653
|
}
|
|
14732
14654
|
/**
|
|
@@ -14791,7 +14713,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14791
14713
|
this.initDefaultStyles();
|
|
14792
14714
|
if (this.options.ydoc && this.options.collaborationProvider) {
|
|
14793
14715
|
updateYdocDocxData(this);
|
|
14794
|
-
this.initializeCollaborationData();
|
|
14716
|
+
this.initializeCollaborationData(true);
|
|
14795
14717
|
} else {
|
|
14796
14718
|
__privateMethod(this, _Editor_instances, insertNewFileData_fn).call(this);
|
|
14797
14719
|
}
|
|
@@ -14960,6 +14882,7 @@ init_fn = function() {
|
|
|
14960
14882
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
14961
14883
|
this.emit("beforeCreate", { editor: this });
|
|
14962
14884
|
this.on("contentError", this.options.onContentError);
|
|
14885
|
+
this.on("exception", this.options.onException);
|
|
14963
14886
|
this.mount(this.options.element);
|
|
14964
14887
|
this.on("create", this.options.onCreate);
|
|
14965
14888
|
this.on("update", this.options.onUpdate);
|
|
@@ -14977,7 +14900,6 @@ init_fn = function() {
|
|
|
14977
14900
|
this.on("paginationUpdate", this.options.onPaginationUpdate);
|
|
14978
14901
|
this.on("comment-positions", this.options.onCommentLocationsUpdate);
|
|
14979
14902
|
this.on("list-definitions-change", this.options.onListDefinitionsChange);
|
|
14980
|
-
this.on("exception", this.options.onException);
|
|
14981
14903
|
if (!this.options.isHeadless) {
|
|
14982
14904
|
this.initializeCollaborationData();
|
|
14983
14905
|
this.initDefaultStyles();
|
|
@@ -14992,7 +14914,6 @@ init_fn = function() {
|
|
|
14992
14914
|
}
|
|
14993
14915
|
}
|
|
14994
14916
|
__privateMethod(this, _Editor_instances, initDevTools_fn).call(this);
|
|
14995
|
-
__privateMethod(this, _Editor_instances, registerCopyHandler_fn).call(this);
|
|
14996
14917
|
};
|
|
14997
14918
|
/**
|
|
14998
14919
|
* Initialize the editor in rich text mode
|
|
@@ -15048,21 +14969,6 @@ checkHeadless_fn = function(options) {
|
|
|
15048
14969
|
global.window = options.mockWindow;
|
|
15049
14970
|
}
|
|
15050
14971
|
};
|
|
15051
|
-
registerCopyHandler_fn = function() {
|
|
15052
|
-
this.view.dom.addEventListener("copy", (event) => {
|
|
15053
|
-
const clipboardData = event.clipboardData;
|
|
15054
|
-
if (!clipboardData) return;
|
|
15055
|
-
event.preventDefault();
|
|
15056
|
-
const { from: from2, to } = this.view.state.selection;
|
|
15057
|
-
const slice2 = this.view.state.doc.slice(from2, to);
|
|
15058
|
-
const fragment = slice2.content;
|
|
15059
|
-
const div2 = document.createElement("div");
|
|
15060
|
-
const serializer = DOMSerializer.fromSchema(this.view.state.schema);
|
|
15061
|
-
div2.appendChild(serializer.serializeFragment(fragment));
|
|
15062
|
-
const html = transformListsInCopiedContent(div2.innerHTML);
|
|
15063
|
-
clipboardData.setData("text/html", html);
|
|
15064
|
-
});
|
|
15065
|
-
};
|
|
15066
14972
|
/**
|
|
15067
14973
|
* Replace the current document with new data. Necessary for initializing a new collaboration file,
|
|
15068
14974
|
* since we need to insert the data only after the provider has synced.
|
|
@@ -15420,8 +15326,7 @@ endCollaboration_fn = function() {
|
|
|
15420
15326
|
console.debug("🔗 [super-editor] Ending collaboration");
|
|
15421
15327
|
if (this.options.collaborationProvider) this.options.collaborationProvider.disconnect();
|
|
15422
15328
|
if (this.options.ydoc) this.options.ydoc.destroy();
|
|
15423
|
-
} catch
|
|
15424
|
-
this.emit("exception", { error, editor: this });
|
|
15329
|
+
} catch {
|
|
15425
15330
|
}
|
|
15426
15331
|
};
|
|
15427
15332
|
/**
|
|
@@ -18691,30 +18596,13 @@ const Paragraph = OxmlNode.create({
|
|
|
18691
18596
|
{
|
|
18692
18597
|
tag: "p",
|
|
18693
18598
|
getAttrs: (node) => {
|
|
18694
|
-
|
|
18695
|
-
acc[attr.name] = attr.value;
|
|
18696
|
-
return acc;
|
|
18697
|
-
}, {});
|
|
18698
|
-
return {
|
|
18699
|
-
styleId: styleid || null,
|
|
18700
|
-
extraAttrs
|
|
18701
|
-
};
|
|
18702
|
-
}
|
|
18703
|
-
},
|
|
18704
|
-
{
|
|
18705
|
-
tag: "div",
|
|
18706
|
-
getAttrs: (node) => {
|
|
18707
|
-
const extra = {};
|
|
18599
|
+
let extra = {};
|
|
18708
18600
|
Array.from(node.attributes).forEach((attr) => {
|
|
18709
18601
|
extra[attr.name] = attr.value;
|
|
18710
18602
|
});
|
|
18711
18603
|
return { extraAttrs: extra };
|
|
18712
18604
|
}
|
|
18713
18605
|
},
|
|
18714
|
-
{
|
|
18715
|
-
tag: "blockquote",
|
|
18716
|
-
attrs: { styleId: "BlockQuote" }
|
|
18717
|
-
},
|
|
18718
18606
|
...this.options.headingLevels.map((level) => ({
|
|
18719
18607
|
tag: `h${level}`,
|
|
18720
18608
|
attrs: { level, styleId: `Heading${level}` }
|
|
@@ -24735,7 +24623,6 @@ const startImageUpload = async ({ editor, view, file }) => {
|
|
|
24735
24623
|
file = processedImageResult.file;
|
|
24736
24624
|
} catch (err) {
|
|
24737
24625
|
console.warn("Error processing image:", err);
|
|
24738
|
-
editor.emit("exception", { error: err, editor });
|
|
24739
24626
|
return;
|
|
24740
24627
|
}
|
|
24741
24628
|
await uploadImage({
|
|
@@ -24790,10 +24677,9 @@ async function uploadImage({ editor, view, file, size, uploadHandler }) {
|
|
|
24790
24677
|
view.dispatch(
|
|
24791
24678
|
view.state.tr.replaceWith(placeholderPos, placeholderPos, imageNode).setMeta(ImagePlaceholderPluginKey, removeMeta)
|
|
24792
24679
|
);
|
|
24793
|
-
} catch
|
|
24680
|
+
} catch {
|
|
24794
24681
|
let removeMeta = { type: "remove", id };
|
|
24795
24682
|
view.dispatch(tr.setMeta(ImagePlaceholderPluginKey, removeMeta));
|
|
24796
|
-
editor.emit("exception", { error, editor });
|
|
24797
24683
|
}
|
|
24798
24684
|
}
|
|
24799
24685
|
function addImageRelationship({ editor, path }) {
|
|
@@ -25100,9 +24986,7 @@ class AutoPageNumberNodeView {
|
|
|
25100
24986
|
this.dom = __privateMethod(this, _AutoPageNumberNodeView_instances, renderDom_fn).call(this, node, htmlAttributes);
|
|
25101
24987
|
}
|
|
25102
24988
|
update(node) {
|
|
25103
|
-
|
|
25104
|
-
const currentType = this.node?.type?.name;
|
|
25105
|
-
if (!incomingType || incomingType !== currentType) return false;
|
|
24989
|
+
if (node.type !== this.node.type) return false;
|
|
25106
24990
|
this.node = node;
|
|
25107
24991
|
return true;
|
|
25108
24992
|
}
|
|
@@ -25449,24 +25333,18 @@ const StructuredContent = Node$1.create({
|
|
|
25449
25333
|
}
|
|
25450
25334
|
};
|
|
25451
25335
|
},
|
|
25336
|
+
parseDOM() {
|
|
25337
|
+
return [{ tag: `span.${this.options.structuredContentClass}` }];
|
|
25338
|
+
},
|
|
25339
|
+
renderDOM({ htmlAttributes }) {
|
|
25340
|
+
return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
25341
|
+
},
|
|
25452
25342
|
addAttributes() {
|
|
25453
25343
|
return {
|
|
25454
25344
|
sdtPr: {
|
|
25455
25345
|
rendered: false
|
|
25456
25346
|
}
|
|
25457
25347
|
};
|
|
25458
|
-
},
|
|
25459
|
-
parseDOM() {
|
|
25460
|
-
return [{ tag: `span.${this.options.structuredContentClass}` }];
|
|
25461
|
-
},
|
|
25462
|
-
renderDOM({ htmlAttributes }) {
|
|
25463
|
-
return [
|
|
25464
|
-
"span",
|
|
25465
|
-
Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
|
|
25466
|
-
class: this.options.structuredContentClass
|
|
25467
|
-
}),
|
|
25468
|
-
0
|
|
25469
|
-
];
|
|
25470
25348
|
}
|
|
25471
25349
|
});
|
|
25472
25350
|
const StructuredContentBlock = Node$1.create({
|
|
@@ -25475,30 +25353,24 @@ const StructuredContentBlock = Node$1.create({
|
|
|
25475
25353
|
content: "block*",
|
|
25476
25354
|
addOptions() {
|
|
25477
25355
|
return {
|
|
25478
|
-
structuredContentClass: "sd-structured-content-
|
|
25356
|
+
structuredContentClass: "sd-structured-content-tag",
|
|
25479
25357
|
htmlAttributes: {
|
|
25480
25358
|
"aria-label": "Structured content block node"
|
|
25481
25359
|
}
|
|
25482
25360
|
};
|
|
25483
25361
|
},
|
|
25362
|
+
parseDOM() {
|
|
25363
|
+
return [{ tag: `div.${this.options.structuredContentClass}` }];
|
|
25364
|
+
},
|
|
25365
|
+
renderDOM({ htmlAttributes }) {
|
|
25366
|
+
return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
25367
|
+
},
|
|
25484
25368
|
addAttributes() {
|
|
25485
25369
|
return {
|
|
25486
25370
|
sdtPr: {
|
|
25487
25371
|
rendered: false
|
|
25488
25372
|
}
|
|
25489
25373
|
};
|
|
25490
|
-
},
|
|
25491
|
-
parseDOM() {
|
|
25492
|
-
return [{ tag: `div.${this.options.structuredContentClass}` }];
|
|
25493
|
-
},
|
|
25494
|
-
renderDOM({ htmlAttributes }) {
|
|
25495
|
-
return [
|
|
25496
|
-
"div",
|
|
25497
|
-
Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
|
|
25498
|
-
class: this.options.structuredContentClass
|
|
25499
|
-
}),
|
|
25500
|
-
0
|
|
25501
|
-
];
|
|
25502
25374
|
}
|
|
25503
25375
|
});
|
|
25504
25376
|
class DocumentSectionView {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
|
|
2
|
-
import { p as process$1 } from "./converter-
|
|
3
|
-
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-
|
|
2
|
+
import { p as process$1 } from "./converter-CFVPKGqT.js";
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DrhZRXX9.js";
|
|
4
4
|
const sanitizeNumber = (value, defaultNumber) => {
|
|
5
5
|
let sanitized = value.replace(/[^0-9.]/g, "");
|
|
6
6
|
sanitized = parseFloat(sanitized);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E } from "./chunks/editor-
|
|
2
|
-
import "./chunks/converter-
|
|
3
|
-
import "./chunks/docx-zipper-
|
|
1
|
+
import { E } from "./chunks/editor-DrhZRXX9.js";
|
|
2
|
+
import "./chunks/converter-CFVPKGqT.js";
|
|
3
|
+
import "./chunks/docx-zipper-CGdYHGDa.js";
|
|
4
4
|
export {
|
|
5
5
|
E as Editor
|
|
6
6
|
};
|
|
@@ -406,8 +406,6 @@ export class Editor extends EventEmitter {
|
|
|
406
406
|
getJSON(): any;
|
|
407
407
|
/**
|
|
408
408
|
* Get the editor content as HTML
|
|
409
|
-
* @param {Object} options - Options for the HTML serializer
|
|
410
|
-
* @param {boolean} [options.unflattenLists] - Whether to unflatten lists in the HTML
|
|
411
409
|
* @returns {string} Editor content as HTML
|
|
412
410
|
*/
|
|
413
411
|
getHTML({ unflattenLists }?: {
|
|
@@ -44,15 +44,6 @@ export function exportSchemaToJson(params: ExportParams): XmlReadyNode;
|
|
|
44
44
|
* @returns {XmlReadyNode} JSON of the XML-ready paragraph node
|
|
45
45
|
*/
|
|
46
46
|
export function translateParagraphNode(params: any): XmlReadyNode;
|
|
47
|
-
/**
|
|
48
|
-
* Helper function to be used for text node translation
|
|
49
|
-
* Also used for transforming text annotations for the final submit
|
|
50
|
-
*
|
|
51
|
-
* @param {String} text Text node's content
|
|
52
|
-
* @param {Object[]} marks The marks to add to the run properties
|
|
53
|
-
* @returns {XmlReadyNode} The translated text node
|
|
54
|
-
*/
|
|
55
|
-
export function getTextNodeForExport(text: string, marks: any[], params: any): XmlReadyNode;
|
|
56
47
|
/**
|
|
57
48
|
* Generate a w:rPr node (run properties) from marks
|
|
58
49
|
*
|
|
@@ -70,16 +61,6 @@ export function generateRunProps(marks?: any[]): {
|
|
|
70
61
|
* @returns
|
|
71
62
|
*/
|
|
72
63
|
export function processOutputMarks(marks?: MarkType[]): any[];
|
|
73
|
-
export function processLinkContentNode(node: any): any;
|
|
74
|
-
/**
|
|
75
|
-
* Create a new link relationship and add it to the relationships array
|
|
76
|
-
*
|
|
77
|
-
* @param {ExportParams} params
|
|
78
|
-
* @param {string} link The URL of this link
|
|
79
|
-
* @returns {string} The new relationship ID
|
|
80
|
-
*/
|
|
81
|
-
export function addNewLinkRelationship(params: ExportParams, link: string): string;
|
|
82
|
-
export function translateImageNode(params: any, imageSize: any): any;
|
|
83
64
|
export function translateHardBreak(params: any): {
|
|
84
65
|
name: string;
|
|
85
66
|
elements: {
|
|
@@ -96,6 +77,7 @@ export class DocxExporter {
|
|
|
96
77
|
schemaToXml(data: any, debug?: boolean): string;
|
|
97
78
|
#private;
|
|
98
79
|
}
|
|
80
|
+
export function getFieldHighlightJson(fieldsHighlightColor: string): any;
|
|
99
81
|
export type ExportParams = {
|
|
100
82
|
/**
|
|
101
83
|
* JSON node to translate (from PM schema)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function translateDocumentSection(params: any): any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type {import("docxImporter").NodeHandler}
|
|
3
|
+
*/
|
|
4
|
+
export const handleAnnotationNode: any;
|
|
5
|
+
export function parseAnnotationMarks(content?: any): any;
|
|
6
|
+
/**
|
|
7
|
+
* @type {import("docxImporter").NodeHandlerEntry}
|
|
8
|
+
*/
|
|
9
|
+
export const annotationNodeHandlerEntity: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function tableOfContentsHandler(params: any): any[];
|