@harbour-enterprises/superdoc 0.19.0-next.5 → 0.19.0-next.7
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-C2898kqZ.es.js → PdfViewer-BUcY_aLU.es.js} +1 -1
- package/dist/chunks/{PdfViewer-DaZtoNpm.cjs → PdfViewer-DtzjcoY1.cjs} +1 -1
- package/dist/chunks/{index-CkJ5hnvC.es.js → index-BfPgSGCT.es.js} +35 -3
- package/dist/chunks/{index-Di9R4Aas.cjs → index-Dic-WukZ.cjs} +35 -3
- package/dist/chunks/{super-editor.es-DG-S6GN9.cjs → super-editor.es-BxWpMXrO.cjs} +11034 -10912
- package/dist/chunks/{super-editor.es-kuaVTS8t.es.js → super-editor.es-ZzKFiBVd.es.js} +11034 -10912
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/stores/superdoc-store.d.ts +3 -0
- package/dist/stores/superdoc-store.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-CrJvpQ8J.js → converter-D7JstO1X.js} +11850 -11774
- package/dist/super-editor/chunks/{docx-zipper-CHHaFCfj.js → docx-zipper-CxuVkw7R.js} +1 -1
- package/dist/super-editor/chunks/{editor-DlzGbfD-.js → editor-C3cafdFa.js} +140 -99
- package/dist/super-editor/chunks/{toolbar-DeKOVf4h.js → toolbar-BSez2SLg.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 +2 -0
- package/dist/super-editor/src/core/super-converter/exporter.d.ts +19 -1
- package/dist/super-editor/src/core/super-converter/v2/exporter/index.d.ts +0 -1
- package/dist/super-editor/src/core/super-converter/v2/importer/sdtNodeImporter.d.ts +8 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-annotation-node.d.ts +22 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-doc-part-obj.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-document-section-node.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-structured-content-node.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/parse-tag-value-json.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/sdt-node-type-strategy.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-document-section.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-field-annotation.d.ts +80 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-structured-content.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/sdt-translator.d.ts +6 -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 +13 -8
- 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 +11190 -11036
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/super-editor/src/core/super-converter/v2/exporter/documentSectionExporter.d.ts +0 -1
- package/dist/super-editor/src/core/super-converter/v2/importer/annotationImporter.d.ts +0 -9
- package/dist/super-editor/src/core/super-converter/v2/importer/docPartGalleryImporter.d.ts +0 -1
- package/dist/super-editor/src/core/super-converter/v2/importer/docPartObjImporter.d.ts +0 -4
- package/dist/super-editor/src/core/super-converter/v2/importer/structuredDocumentNodeImporter.d.ts +0 -8
|
@@ -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-D7JstO1X.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
|
}
|
|
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
12
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-D7JstO1X.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-CxuVkw7R.js";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
20
20
|
};
|
|
@@ -13509,7 +13509,7 @@ function validateRelationshipsRoot(relsTree, relsKey, results) {
|
|
|
13509
13509
|
}
|
|
13510
13510
|
return { root, wasFixed };
|
|
13511
13511
|
}
|
|
13512
|
-
function cleanupRootChildren(root
|
|
13512
|
+
function cleanupRootChildren(root) {
|
|
13513
13513
|
const validChildren = root.elements?.filter((child) => child?.type === "element" && child.name === "Relationship") || [];
|
|
13514
13514
|
if (root.elements?.length !== validChildren.length) {
|
|
13515
13515
|
root.elements = validChildren;
|
|
@@ -14471,6 +14471,8 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14471
14471
|
}
|
|
14472
14472
|
/**
|
|
14473
14473
|
* Get the editor content as HTML
|
|
14474
|
+
* @param {Object} options - Options for the HTML serializer
|
|
14475
|
+
* @param {boolean} [options.unflattenLists] - Whether to unflatten lists in the HTML
|
|
14474
14476
|
* @returns {string} Editor content as HTML
|
|
14475
14477
|
*/
|
|
14476
14478
|
getHTML({ unflattenLists = false } = {}) {
|
|
@@ -14549,85 +14551,89 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14549
14551
|
getUpdatedDocs = false,
|
|
14550
14552
|
fieldsHighlightColor = null
|
|
14551
14553
|
} = {}) {
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
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);
|
|
14576
|
-
}
|
|
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]
|
|
14554
|
+
try {
|
|
14555
|
+
const json = __privateMethod(this, _Editor_instances, prepareDocumentForExport_fn).call(this, comments);
|
|
14556
|
+
const documentXml = await this.converter.exportToDocx(
|
|
14557
|
+
json,
|
|
14558
|
+
this.schema,
|
|
14559
|
+
this.storage.image.media,
|
|
14560
|
+
isFinalDoc,
|
|
14561
|
+
commentsType,
|
|
14562
|
+
comments,
|
|
14563
|
+
this,
|
|
14564
|
+
exportJsonOnly,
|
|
14565
|
+
fieldsHighlightColor
|
|
14601
14566
|
);
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14567
|
+
__privateMethod(this, _Editor_instances, validateDocumentExport_fn).call(this);
|
|
14568
|
+
if (exportXmlOnly || exportJsonOnly) return documentXml;
|
|
14569
|
+
const customXml = this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]);
|
|
14570
|
+
const styles = this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]);
|
|
14571
|
+
const customSettings = this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]);
|
|
14572
|
+
const rels = this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]);
|
|
14573
|
+
const media = this.converter.addedMedia;
|
|
14574
|
+
const updatedHeadersFooters = {};
|
|
14575
|
+
Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
|
|
14576
|
+
if (name.includes("header") || name.includes("footer")) {
|
|
14577
|
+
const resultXml = this.converter.schemaToXml(json2.elements[0]);
|
|
14578
|
+
updatedHeadersFooters[name] = String(resultXml);
|
|
14579
|
+
}
|
|
14580
|
+
});
|
|
14581
|
+
const numberingData = this.converter.convertedXml["word/numbering.xml"];
|
|
14582
|
+
const numbering = this.converter.schemaToXml(numberingData.elements[0]);
|
|
14583
|
+
const updatedDocs = {
|
|
14584
|
+
...this.options.customUpdatedFiles,
|
|
14585
|
+
"word/document.xml": String(documentXml),
|
|
14586
|
+
"docProps/custom.xml": String(customXml),
|
|
14587
|
+
"word/settings.xml": String(customSettings),
|
|
14588
|
+
"word/_rels/document.xml.rels": String(rels),
|
|
14589
|
+
"word/numbering.xml": String(numbering),
|
|
14590
|
+
// Replace & with & in styles.xml as DOCX viewers can't handle it
|
|
14591
|
+
"word/styles.xml": String(styles).replace(/&/gi, "&"),
|
|
14592
|
+
...updatedHeadersFooters
|
|
14593
|
+
};
|
|
14594
|
+
if (comments.length) {
|
|
14595
|
+
const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
|
|
14596
|
+
const commentsExtendedXml = this.converter.schemaToXml(
|
|
14597
|
+
this.converter.convertedXml["word/commentsExtended.xml"].elements[0]
|
|
14598
|
+
);
|
|
14599
|
+
const commentsExtensibleXml = this.converter.schemaToXml(
|
|
14600
|
+
this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]
|
|
14601
|
+
);
|
|
14602
|
+
const commentsIdsXml = this.converter.schemaToXml(
|
|
14603
|
+
this.converter.convertedXml["word/commentsIds.xml"].elements[0]
|
|
14604
|
+
);
|
|
14605
|
+
updatedDocs["word/comments.xml"] = String(commentsXml);
|
|
14606
|
+
updatedDocs["word/commentsExtended.xml"] = String(commentsExtendedXml);
|
|
14607
|
+
updatedDocs["word/commentsExtensible.xml"] = String(commentsExtensibleXml);
|
|
14608
|
+
updatedDocs["word/commentsIds.xml"] = String(commentsIdsXml);
|
|
14609
|
+
}
|
|
14610
|
+
const zipper = new DocxZipper();
|
|
14611
|
+
if (getUpdatedDocs) {
|
|
14612
|
+
updatedDocs["[Content_Types].xml"] = await zipper.updateContentTypes(
|
|
14613
|
+
{
|
|
14614
|
+
files: this.options.content
|
|
14615
|
+
},
|
|
14616
|
+
media,
|
|
14617
|
+
true
|
|
14618
|
+
);
|
|
14619
|
+
return updatedDocs;
|
|
14620
|
+
}
|
|
14621
|
+
const result = await zipper.updateZip({
|
|
14622
|
+
docx: this.options.content,
|
|
14623
|
+
updatedDocs,
|
|
14624
|
+
originalDocxFile: this.options.fileSource,
|
|
14613
14625
|
media,
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14626
|
+
fonts: this.options.fonts,
|
|
14627
|
+
isHeadless: this.options.isHeadless
|
|
14628
|
+
});
|
|
14629
|
+
this.options.telemetry?.trackUsage("document_export", {
|
|
14630
|
+
documentType: "docx",
|
|
14631
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
14632
|
+
});
|
|
14633
|
+
return result;
|
|
14634
|
+
} catch (error) {
|
|
14635
|
+
this.emit("exception", { error, editor: this });
|
|
14617
14636
|
}
|
|
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;
|
|
14631
14637
|
}
|
|
14632
14638
|
/**
|
|
14633
14639
|
* Destroy the editor and clean up resources
|
|
@@ -14648,7 +14654,8 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14648
14654
|
}
|
|
14649
14655
|
this.converter.headerEditors.length = 0;
|
|
14650
14656
|
this.converter.footerEditors.length = 0;
|
|
14651
|
-
} catch {
|
|
14657
|
+
} catch (error) {
|
|
14658
|
+
this.emit("exception", { error, editor: this });
|
|
14652
14659
|
}
|
|
14653
14660
|
}
|
|
14654
14661
|
/**
|
|
@@ -14713,7 +14720,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14713
14720
|
this.initDefaultStyles();
|
|
14714
14721
|
if (this.options.ydoc && this.options.collaborationProvider) {
|
|
14715
14722
|
updateYdocDocxData(this);
|
|
14716
|
-
this.initializeCollaborationData(
|
|
14723
|
+
this.initializeCollaborationData();
|
|
14717
14724
|
} else {
|
|
14718
14725
|
__privateMethod(this, _Editor_instances, insertNewFileData_fn).call(this);
|
|
14719
14726
|
}
|
|
@@ -14882,7 +14889,6 @@ init_fn = function() {
|
|
|
14882
14889
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
14883
14890
|
this.emit("beforeCreate", { editor: this });
|
|
14884
14891
|
this.on("contentError", this.options.onContentError);
|
|
14885
|
-
this.on("exception", this.options.onException);
|
|
14886
14892
|
this.mount(this.options.element);
|
|
14887
14893
|
this.on("create", this.options.onCreate);
|
|
14888
14894
|
this.on("update", this.options.onUpdate);
|
|
@@ -14900,6 +14906,7 @@ init_fn = function() {
|
|
|
14900
14906
|
this.on("paginationUpdate", this.options.onPaginationUpdate);
|
|
14901
14907
|
this.on("comment-positions", this.options.onCommentLocationsUpdate);
|
|
14902
14908
|
this.on("list-definitions-change", this.options.onListDefinitionsChange);
|
|
14909
|
+
this.on("exception", this.options.onException);
|
|
14903
14910
|
if (!this.options.isHeadless) {
|
|
14904
14911
|
this.initializeCollaborationData();
|
|
14905
14912
|
this.initDefaultStyles();
|
|
@@ -15326,7 +15333,8 @@ endCollaboration_fn = function() {
|
|
|
15326
15333
|
console.debug("🔗 [super-editor] Ending collaboration");
|
|
15327
15334
|
if (this.options.collaborationProvider) this.options.collaborationProvider.disconnect();
|
|
15328
15335
|
if (this.options.ydoc) this.options.ydoc.destroy();
|
|
15329
|
-
} catch {
|
|
15336
|
+
} catch (error) {
|
|
15337
|
+
this.emit("exception", { error, editor: this });
|
|
15330
15338
|
}
|
|
15331
15339
|
};
|
|
15332
15340
|
/**
|
|
@@ -18596,13 +18604,30 @@ const Paragraph = OxmlNode.create({
|
|
|
18596
18604
|
{
|
|
18597
18605
|
tag: "p",
|
|
18598
18606
|
getAttrs: (node) => {
|
|
18599
|
-
|
|
18607
|
+
const { styleid, ...extraAttrs } = Array.from(node.attributes).reduce((acc, attr) => {
|
|
18608
|
+
acc[attr.name] = attr.value;
|
|
18609
|
+
return acc;
|
|
18610
|
+
}, {});
|
|
18611
|
+
return {
|
|
18612
|
+
styleId: styleid || null,
|
|
18613
|
+
extraAttrs
|
|
18614
|
+
};
|
|
18615
|
+
}
|
|
18616
|
+
},
|
|
18617
|
+
{
|
|
18618
|
+
tag: "div",
|
|
18619
|
+
getAttrs: (node) => {
|
|
18620
|
+
const extra = {};
|
|
18600
18621
|
Array.from(node.attributes).forEach((attr) => {
|
|
18601
18622
|
extra[attr.name] = attr.value;
|
|
18602
18623
|
});
|
|
18603
18624
|
return { extraAttrs: extra };
|
|
18604
18625
|
}
|
|
18605
18626
|
},
|
|
18627
|
+
{
|
|
18628
|
+
tag: "blockquote",
|
|
18629
|
+
attrs: { styleId: "BlockQuote" }
|
|
18630
|
+
},
|
|
18606
18631
|
...this.options.headingLevels.map((level) => ({
|
|
18607
18632
|
tag: `h${level}`,
|
|
18608
18633
|
attrs: { level, styleId: `Heading${level}` }
|
|
@@ -24623,6 +24648,7 @@ const startImageUpload = async ({ editor, view, file }) => {
|
|
|
24623
24648
|
file = processedImageResult.file;
|
|
24624
24649
|
} catch (err) {
|
|
24625
24650
|
console.warn("Error processing image:", err);
|
|
24651
|
+
editor.emit("exception", { error: err, editor });
|
|
24626
24652
|
return;
|
|
24627
24653
|
}
|
|
24628
24654
|
await uploadImage({
|
|
@@ -24677,9 +24703,10 @@ async function uploadImage({ editor, view, file, size, uploadHandler }) {
|
|
|
24677
24703
|
view.dispatch(
|
|
24678
24704
|
view.state.tr.replaceWith(placeholderPos, placeholderPos, imageNode).setMeta(ImagePlaceholderPluginKey, removeMeta)
|
|
24679
24705
|
);
|
|
24680
|
-
} catch {
|
|
24706
|
+
} catch (error) {
|
|
24681
24707
|
let removeMeta = { type: "remove", id };
|
|
24682
24708
|
view.dispatch(tr.setMeta(ImagePlaceholderPluginKey, removeMeta));
|
|
24709
|
+
editor.emit("exception", { error, editor });
|
|
24683
24710
|
}
|
|
24684
24711
|
}
|
|
24685
24712
|
function addImageRelationship({ editor, path }) {
|
|
@@ -24986,7 +25013,9 @@ class AutoPageNumberNodeView {
|
|
|
24986
25013
|
this.dom = __privateMethod(this, _AutoPageNumberNodeView_instances, renderDom_fn).call(this, node, htmlAttributes);
|
|
24987
25014
|
}
|
|
24988
25015
|
update(node) {
|
|
24989
|
-
|
|
25016
|
+
const incomingType = node?.type?.name;
|
|
25017
|
+
const currentType = this.node?.type?.name;
|
|
25018
|
+
if (!incomingType || incomingType !== currentType) return false;
|
|
24990
25019
|
this.node = node;
|
|
24991
25020
|
return true;
|
|
24992
25021
|
}
|
|
@@ -25333,18 +25362,24 @@ const StructuredContent = Node$1.create({
|
|
|
25333
25362
|
}
|
|
25334
25363
|
};
|
|
25335
25364
|
},
|
|
25336
|
-
parseDOM() {
|
|
25337
|
-
return [{ tag: `span.${this.options.structuredContentClass}` }];
|
|
25338
|
-
},
|
|
25339
|
-
renderDOM({ htmlAttributes }) {
|
|
25340
|
-
return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
25341
|
-
},
|
|
25342
25365
|
addAttributes() {
|
|
25343
25366
|
return {
|
|
25344
25367
|
sdtPr: {
|
|
25345
25368
|
rendered: false
|
|
25346
25369
|
}
|
|
25347
25370
|
};
|
|
25371
|
+
},
|
|
25372
|
+
parseDOM() {
|
|
25373
|
+
return [{ tag: `span.${this.options.structuredContentClass}` }];
|
|
25374
|
+
},
|
|
25375
|
+
renderDOM({ htmlAttributes }) {
|
|
25376
|
+
return [
|
|
25377
|
+
"span",
|
|
25378
|
+
Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
|
|
25379
|
+
class: this.options.structuredContentClass
|
|
25380
|
+
}),
|
|
25381
|
+
0
|
|
25382
|
+
];
|
|
25348
25383
|
}
|
|
25349
25384
|
});
|
|
25350
25385
|
const StructuredContentBlock = Node$1.create({
|
|
@@ -25353,24 +25388,30 @@ const StructuredContentBlock = Node$1.create({
|
|
|
25353
25388
|
content: "block*",
|
|
25354
25389
|
addOptions() {
|
|
25355
25390
|
return {
|
|
25356
|
-
structuredContentClass: "sd-structured-content-tag",
|
|
25391
|
+
structuredContentClass: "sd-structured-content-block-tag",
|
|
25357
25392
|
htmlAttributes: {
|
|
25358
25393
|
"aria-label": "Structured content block node"
|
|
25359
25394
|
}
|
|
25360
25395
|
};
|
|
25361
25396
|
},
|
|
25362
|
-
parseDOM() {
|
|
25363
|
-
return [{ tag: `div.${this.options.structuredContentClass}` }];
|
|
25364
|
-
},
|
|
25365
|
-
renderDOM({ htmlAttributes }) {
|
|
25366
|
-
return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
25367
|
-
},
|
|
25368
25397
|
addAttributes() {
|
|
25369
25398
|
return {
|
|
25370
25399
|
sdtPr: {
|
|
25371
25400
|
rendered: false
|
|
25372
25401
|
}
|
|
25373
25402
|
};
|
|
25403
|
+
},
|
|
25404
|
+
parseDOM() {
|
|
25405
|
+
return [{ tag: `div.${this.options.structuredContentClass}` }];
|
|
25406
|
+
},
|
|
25407
|
+
renderDOM({ htmlAttributes }) {
|
|
25408
|
+
return [
|
|
25409
|
+
"div",
|
|
25410
|
+
Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
|
|
25411
|
+
class: this.options.structuredContentClass
|
|
25412
|
+
}),
|
|
25413
|
+
0
|
|
25414
|
+
];
|
|
25374
25415
|
}
|
|
25375
25416
|
});
|
|
25376
25417
|
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-D7JstO1X.js";
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-C3cafdFa.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-C3cafdFa.js";
|
|
2
|
+
import "./chunks/converter-D7JstO1X.js";
|
|
3
|
+
import "./chunks/docx-zipper-CxuVkw7R.js";
|
|
4
4
|
export {
|
|
5
5
|
E as Editor
|
|
6
6
|
};
|
|
@@ -406,6 +406,8 @@ 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
|
|
409
411
|
* @returns {string} Editor content as HTML
|
|
410
412
|
*/
|
|
411
413
|
getHTML({ unflattenLists }?: {
|
|
@@ -44,6 +44,15 @@ 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;
|
|
47
56
|
/**
|
|
48
57
|
* Generate a w:rPr node (run properties) from marks
|
|
49
58
|
*
|
|
@@ -61,6 +70,16 @@ export function generateRunProps(marks?: any[]): {
|
|
|
61
70
|
* @returns
|
|
62
71
|
*/
|
|
63
72
|
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;
|
|
64
83
|
export function translateHardBreak(params: any): {
|
|
65
84
|
name: string;
|
|
66
85
|
elements: {
|
|
@@ -77,7 +96,6 @@ export class DocxExporter {
|
|
|
77
96
|
schemaToXml(data: any, debug?: boolean): string;
|
|
78
97
|
#private;
|
|
79
98
|
}
|
|
80
|
-
export function getFieldHighlightJson(fieldsHighlightColor: string): any;
|
|
81
99
|
export type ExportParams = {
|
|
82
100
|
/**
|
|
83
101
|
* JSON node to translate (from PM schema)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {Object} params
|
|
3
|
+
* @returns {Object|null}
|
|
4
|
+
*/
|
|
5
|
+
export function handleAnnotationNode(params: any): any | null;
|
|
6
|
+
export function getAttrsFromElements({ sdtPr, tag, alias }: {
|
|
7
|
+
sdtPr: any;
|
|
8
|
+
tag: any;
|
|
9
|
+
alias: any;
|
|
10
|
+
}): {
|
|
11
|
+
type: any;
|
|
12
|
+
fieldId: any;
|
|
13
|
+
displayLabel: any;
|
|
14
|
+
fieldType: any;
|
|
15
|
+
fieldColor: any;
|
|
16
|
+
multipleImage: boolean;
|
|
17
|
+
fontFamily: any;
|
|
18
|
+
fontSize: any;
|
|
19
|
+
textColor: any;
|
|
20
|
+
textHighlight: any;
|
|
21
|
+
};
|
|
22
|
+
export function parseAnnotationMarks(content?: any): any;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handle document section node. Special case of w:sdt nodes
|
|
3
|
+
* @param {Object} params - The parameters containing nodes and nodeListHandler
|
|
4
|
+
* @returns {Object|null} An object containing the processed node and consumed count
|
|
5
|
+
*/
|
|
6
|
+
export function handleDocumentSectionNode(params: any): any | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* There are multiple types of w:sdt nodes.
|
|
3
|
+
* We need to route to the correct handler depending on certain properties.
|
|
4
|
+
* Example: If tag has documentSection type, we handle it as a document section node.
|
|
5
|
+
* If it has structuredContent type, we handle it as a structured content node.
|
|
6
|
+
* @param {Object} node
|
|
7
|
+
* @returns {Object}
|
|
8
|
+
*/
|
|
9
|
+
export function sdtNodeTypeStrategy(node: any): any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translate a structured content block node to its XML representation.
|
|
3
|
+
* @param {Object} params - The parameters for translation.
|
|
4
|
+
* @returns {Object} The XML representation of the structured content block.
|
|
5
|
+
*/
|
|
6
|
+
export function translateDocumentSection(params: any): any;
|
|
7
|
+
export function generateSdtPrTagForDocumentSection(id: string, title: string, tag: string): any;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translate a field annotation node
|
|
3
|
+
* @param {Object} params - The parameters for translation.
|
|
4
|
+
* @returns {Object} The XML representation.
|
|
5
|
+
*/
|
|
6
|
+
export function translateFieldAnnotation(params: any): any;
|
|
7
|
+
/**
|
|
8
|
+
* Returns node handler based on annotation type
|
|
9
|
+
*
|
|
10
|
+
* @param {String} annotationType
|
|
11
|
+
* @returns {Function} handler for provided annotation type
|
|
12
|
+
*/
|
|
13
|
+
export function getTranslationByAnnotationType(annotationType: string, annotationFieldType: any): Function;
|
|
14
|
+
/**
|
|
15
|
+
* Translates text annotations
|
|
16
|
+
* @param {Object} params
|
|
17
|
+
* @returns {Object}
|
|
18
|
+
*/
|
|
19
|
+
export function prepareTextAnnotation(params: any): any;
|
|
20
|
+
/**
|
|
21
|
+
* Translates image annotations
|
|
22
|
+
* @param {Object} params
|
|
23
|
+
* @param {Object} imageSize Object contains width and height for image in EMU
|
|
24
|
+
* @returns {Object} The translated image node
|
|
25
|
+
*/
|
|
26
|
+
export function prepareImageAnnotation(params: any, imageSize: any): any;
|
|
27
|
+
/**
|
|
28
|
+
* Translates checkbox annotations
|
|
29
|
+
* @param {Object} params
|
|
30
|
+
* @returns {Object} The translated checkbox node
|
|
31
|
+
*/
|
|
32
|
+
export function prepareCheckboxAnnotation(params: any): any;
|
|
33
|
+
/**
|
|
34
|
+
* Translates html annotations
|
|
35
|
+
* @param {Object} params
|
|
36
|
+
* @returns {Object} The translated html node
|
|
37
|
+
*/
|
|
38
|
+
export function prepareHtmlAnnotation(params: any): any;
|
|
39
|
+
/**
|
|
40
|
+
* Translates URL annotations
|
|
41
|
+
* @param {Object} params
|
|
42
|
+
* @returns {Object} The translated URL node
|
|
43
|
+
*/
|
|
44
|
+
export function prepareUrlAnnotation(params: any): any;
|
|
45
|
+
export function translateFieldAttrsToMarks(attrs?: {}): ({
|
|
46
|
+
type: string;
|
|
47
|
+
attrs: {
|
|
48
|
+
fontFamily: any;
|
|
49
|
+
fontSize?: undefined;
|
|
50
|
+
color?: undefined;
|
|
51
|
+
};
|
|
52
|
+
} | {
|
|
53
|
+
type: string;
|
|
54
|
+
attrs: {
|
|
55
|
+
fontSize: any;
|
|
56
|
+
fontFamily?: undefined;
|
|
57
|
+
color?: undefined;
|
|
58
|
+
};
|
|
59
|
+
} | {
|
|
60
|
+
type: string;
|
|
61
|
+
attrs: {
|
|
62
|
+
fontFamily?: undefined;
|
|
63
|
+
fontSize?: undefined;
|
|
64
|
+
color?: undefined;
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
type: string;
|
|
68
|
+
attrs: {
|
|
69
|
+
color: any;
|
|
70
|
+
fontFamily?: undefined;
|
|
71
|
+
fontSize?: undefined;
|
|
72
|
+
};
|
|
73
|
+
})[];
|
|
74
|
+
export function applyMarksToHtmlAnnotation(state: any, marks: any): any;
|
|
75
|
+
/**
|
|
76
|
+
* Get the JSON representation of the field highlight
|
|
77
|
+
* @param {string} fieldsHighlightColor - The highlight color for the field. Must be valid HEX.
|
|
78
|
+
* @returns {Object} The JSON representation of the field highlight
|
|
79
|
+
*/
|
|
80
|
+
export function getFieldHighlightJson(fieldsHighlightColor: string): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./sdt-translator";
|