@harbour-enterprises/superdoc 0.19.0-next.6 → 0.19.0-next.8
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-BlV8_l4e.cjs → PdfViewer-HREDD6qb.cjs} +1 -1
- package/dist/chunks/{PdfViewer-oqYWe1FJ.es.js → PdfViewer-fT3KFJal.es.js} +1 -1
- package/dist/chunks/{index-CeockUQz.es.js → index-CSvNxbRW.es.js} +2 -2
- package/dist/chunks/{index-DHyh73q4.cjs → index-wEO3Mdf3.cjs} +2 -2
- package/dist/chunks/{super-editor.es-BRBU19lM.es.js → super-editor.es-C_ozmHgp.es.js} +11015 -10830
- package/dist/chunks/{super-editor.es-bu-RKSWh.cjs → super-editor.es-D4jQmQ_2.cjs} +11015 -10830
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BFq1XXek.js → converter-B0DE5RlJ.js} +11842 -11777
- package/dist/super-editor/chunks/{docx-zipper-BahUy6FS.js → docx-zipper-CynIq8Em.js} +1 -1
- package/dist/super-editor/chunks/{editor-BdLd21gy.js → editor-W_wtetmC.js} +138 -18
- package/dist/super-editor/chunks/{toolbar-DoJY1zlM.js → toolbar-BzRxJlN2.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/inputRules/html/transform-copied-lists.d.ts +3 -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/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +11138 -10953
- 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-B0DE5RlJ.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, 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;
|
|
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, registerCopyHandler_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-B0DE5RlJ.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-CynIq8Em.js";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
20
20
|
};
|
|
@@ -13893,6 +13893,77 @@ 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
|
+
};
|
|
13896
13967
|
const _Editor = class _Editor extends EventEmitter {
|
|
13897
13968
|
/**
|
|
13898
13969
|
* Create a new Editor instance
|
|
@@ -14471,6 +14542,8 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14471
14542
|
}
|
|
14472
14543
|
/**
|
|
14473
14544
|
* 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
|
|
14474
14547
|
* @returns {string} Editor content as HTML
|
|
14475
14548
|
*/
|
|
14476
14549
|
getHTML({ unflattenLists = false } = {}) {
|
|
@@ -14919,6 +14992,7 @@ init_fn = function() {
|
|
|
14919
14992
|
}
|
|
14920
14993
|
}
|
|
14921
14994
|
__privateMethod(this, _Editor_instances, initDevTools_fn).call(this);
|
|
14995
|
+
__privateMethod(this, _Editor_instances, registerCopyHandler_fn).call(this);
|
|
14922
14996
|
};
|
|
14923
14997
|
/**
|
|
14924
14998
|
* Initialize the editor in rich text mode
|
|
@@ -14974,6 +15048,21 @@ checkHeadless_fn = function(options) {
|
|
|
14974
15048
|
global.window = options.mockWindow;
|
|
14975
15049
|
}
|
|
14976
15050
|
};
|
|
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
|
+
};
|
|
14977
15066
|
/**
|
|
14978
15067
|
* Replace the current document with new data. Necessary for initializing a new collaboration file,
|
|
14979
15068
|
* since we need to insert the data only after the provider has synced.
|
|
@@ -18602,13 +18691,30 @@ const Paragraph = OxmlNode.create({
|
|
|
18602
18691
|
{
|
|
18603
18692
|
tag: "p",
|
|
18604
18693
|
getAttrs: (node) => {
|
|
18605
|
-
|
|
18694
|
+
const { styleid, ...extraAttrs } = Array.from(node.attributes).reduce((acc, attr) => {
|
|
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 = {};
|
|
18606
18708
|
Array.from(node.attributes).forEach((attr) => {
|
|
18607
18709
|
extra[attr.name] = attr.value;
|
|
18608
18710
|
});
|
|
18609
18711
|
return { extraAttrs: extra };
|
|
18610
18712
|
}
|
|
18611
18713
|
},
|
|
18714
|
+
{
|
|
18715
|
+
tag: "blockquote",
|
|
18716
|
+
attrs: { styleId: "BlockQuote" }
|
|
18717
|
+
},
|
|
18612
18718
|
...this.options.headingLevels.map((level) => ({
|
|
18613
18719
|
tag: `h${level}`,
|
|
18614
18720
|
attrs: { level, styleId: `Heading${level}` }
|
|
@@ -24994,7 +25100,9 @@ class AutoPageNumberNodeView {
|
|
|
24994
25100
|
this.dom = __privateMethod(this, _AutoPageNumberNodeView_instances, renderDom_fn).call(this, node, htmlAttributes);
|
|
24995
25101
|
}
|
|
24996
25102
|
update(node) {
|
|
24997
|
-
|
|
25103
|
+
const incomingType = node?.type?.name;
|
|
25104
|
+
const currentType = this.node?.type?.name;
|
|
25105
|
+
if (!incomingType || incomingType !== currentType) return false;
|
|
24998
25106
|
this.node = node;
|
|
24999
25107
|
return true;
|
|
25000
25108
|
}
|
|
@@ -25341,18 +25449,24 @@ const StructuredContent = Node$1.create({
|
|
|
25341
25449
|
}
|
|
25342
25450
|
};
|
|
25343
25451
|
},
|
|
25344
|
-
parseDOM() {
|
|
25345
|
-
return [{ tag: `span.${this.options.structuredContentClass}` }];
|
|
25346
|
-
},
|
|
25347
|
-
renderDOM({ htmlAttributes }) {
|
|
25348
|
-
return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
25349
|
-
},
|
|
25350
25452
|
addAttributes() {
|
|
25351
25453
|
return {
|
|
25352
25454
|
sdtPr: {
|
|
25353
25455
|
rendered: false
|
|
25354
25456
|
}
|
|
25355
25457
|
};
|
|
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
|
+
];
|
|
25356
25470
|
}
|
|
25357
25471
|
});
|
|
25358
25472
|
const StructuredContentBlock = Node$1.create({
|
|
@@ -25361,24 +25475,30 @@ const StructuredContentBlock = Node$1.create({
|
|
|
25361
25475
|
content: "block*",
|
|
25362
25476
|
addOptions() {
|
|
25363
25477
|
return {
|
|
25364
|
-
structuredContentClass: "sd-structured-content-tag",
|
|
25478
|
+
structuredContentClass: "sd-structured-content-block-tag",
|
|
25365
25479
|
htmlAttributes: {
|
|
25366
25480
|
"aria-label": "Structured content block node"
|
|
25367
25481
|
}
|
|
25368
25482
|
};
|
|
25369
25483
|
},
|
|
25370
|
-
parseDOM() {
|
|
25371
|
-
return [{ tag: `div.${this.options.structuredContentClass}` }];
|
|
25372
|
-
},
|
|
25373
|
-
renderDOM({ htmlAttributes }) {
|
|
25374
|
-
return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
25375
|
-
},
|
|
25376
25484
|
addAttributes() {
|
|
25377
25485
|
return {
|
|
25378
25486
|
sdtPr: {
|
|
25379
25487
|
rendered: false
|
|
25380
25488
|
}
|
|
25381
25489
|
};
|
|
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
|
+
];
|
|
25382
25502
|
}
|
|
25383
25503
|
});
|
|
25384
25504
|
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-B0DE5RlJ.js";
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-W_wtetmC.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-W_wtetmC.js";
|
|
2
|
+
import "./chunks/converter-B0DE5RlJ.js";
|
|
3
|
+
import "./chunks/docx-zipper-CynIq8Em.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";
|
|
@@ -10,7 +10,7 @@ export const TranslatorTypes: Readonly<{
|
|
|
10
10
|
* @typedef {keyof typeof TranslatorTypes} TranslatorTypeKey
|
|
11
11
|
* @typedef {typeof TranslatorTypes[TranslatorTypeKey]} TranslatorType
|
|
12
12
|
* @typedef {string} XmlNodeName
|
|
13
|
-
* @typedef {string} SuperDocNodeOrKeyName
|
|
13
|
+
* @typedef {string|string[]} SuperDocNodeOrKeyName
|
|
14
14
|
*/
|
|
15
15
|
/**
|
|
16
16
|
* @typedef {Object} AttrConfig
|
|
@@ -46,7 +46,7 @@ export const TranslatorTypes: Readonly<{
|
|
|
46
46
|
/**
|
|
47
47
|
* @typedef {Object} NodeTranslatorConfig
|
|
48
48
|
* @property {string} xmlName - The name of the node in OOXML
|
|
49
|
-
* @property {
|
|
49
|
+
* @property {SuperDocNodeOrKeyName} sdNodeOrKeyName - The name of the node in SuperDoc
|
|
50
50
|
* @property {TranslatorType} [type="node"] - The type of the translator.
|
|
51
51
|
* @property {NodeTranslatorEncodeFn} encode - The function to encode the data.
|
|
52
52
|
* @property {NodeTranslatorDecodeFn} [decode] - The function to decode the data.
|
|
@@ -66,7 +66,7 @@ export class NodeTranslator {
|
|
|
66
66
|
static from(config: NodeTranslatorConfig): NodeTranslator;
|
|
67
67
|
/**
|
|
68
68
|
* @param {string} xmlName
|
|
69
|
-
* @param {
|
|
69
|
+
* @param {SuperDocNodeOrKeyName} sdNodeOrKeyName
|
|
70
70
|
* @param {NodeTranslatorEncodeFn} encode
|
|
71
71
|
* @param {NodeTranslatorDecodeFn} decode
|
|
72
72
|
* @param {number} [priority]
|
|
@@ -74,11 +74,11 @@ export class NodeTranslator {
|
|
|
74
74
|
* @param {MatchesDecodeFn} [matchesDecode]
|
|
75
75
|
* @param {AttrConfig[]} [attributes]
|
|
76
76
|
*/
|
|
77
|
-
constructor(xmlName: string, sdNodeOrKeyName:
|
|
77
|
+
constructor(xmlName: string, sdNodeOrKeyName: SuperDocNodeOrKeyName, encode: NodeTranslatorEncodeFn, decode: NodeTranslatorDecodeFn, priority?: number, matchesEncode?: MatchesEncodeFn, matchesDecode?: MatchesDecodeFn, attributes?: AttrConfig[]);
|
|
78
78
|
/** @type {string} */
|
|
79
79
|
xmlName: string;
|
|
80
|
-
/** @type {
|
|
81
|
-
sdNodeOrKeyName:
|
|
80
|
+
/** @type {SuperDocNodeOrKeyName} */
|
|
81
|
+
sdNodeOrKeyName: SuperDocNodeOrKeyName;
|
|
82
82
|
/** @type {number} */
|
|
83
83
|
priority: number;
|
|
84
84
|
/** @type {NodeTranslatorEncodeFn} */
|
|
@@ -124,7 +124,7 @@ export class NodeTranslator {
|
|
|
124
124
|
export type TranslatorTypeKey = keyof typeof TranslatorTypes;
|
|
125
125
|
export type TranslatorType = (typeof TranslatorTypes)[TranslatorTypeKey];
|
|
126
126
|
export type XmlNodeName = string;
|
|
127
|
-
export type SuperDocNodeOrKeyName = string;
|
|
127
|
+
export type SuperDocNodeOrKeyName = string | string[];
|
|
128
128
|
export type AttrConfig = {
|
|
129
129
|
/**
|
|
130
130
|
* - The name of the attribute in OOXML
|
|
@@ -173,7 +173,7 @@ export type NodeTranslatorConfig = {
|
|
|
173
173
|
/**
|
|
174
174
|
* - The name of the node in SuperDoc
|
|
175
175
|
*/
|
|
176
|
-
sdNodeOrKeyName:
|
|
176
|
+
sdNodeOrKeyName: SuperDocNodeOrKeyName;
|
|
177
177
|
/**
|
|
178
178
|
* - The type of the translator.
|
|
179
179
|
*/
|
|
@@ -9,14 +9,14 @@ 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 __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
11
11
|
var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
|
|
12
|
-
import { ax as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aA as vClickOutside, H as findParentNode, aB as getActiveFormatting, ar as isInTable, aC as readFromClipboard, aD as handleClipboardPaste, aE as getFileObject, aF as translator, aG as translator$1, aH as translator$2, a as Plugin } from "./chunks/converter-
|
|
13
|
-
import { aI, a5, i, a2 } from "./chunks/converter-
|
|
14
|
-
import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, s as startImageUpload, y as yUndoPluginKey, d as undoDepth, r as redoDepth, S as SlashMenuPluginKey, E as Editor, e as getStarterExtensions, P as Placeholder, f as getRichTextExtensions, M as Mark, h as Extension, A as Attribute, N as Node } from "./chunks/editor-
|
|
15
|
-
import { k, C, l, T, i as i2, m, j } from "./chunks/editor-
|
|
12
|
+
import { ax as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aA as vClickOutside, H as findParentNode, aB as getActiveFormatting, ar as isInTable, aC as readFromClipboard, aD as handleClipboardPaste, aE as getFileObject, aF as translator, aG as translator$1, aH as translator$2, a as Plugin } from "./chunks/converter-B0DE5RlJ.js";
|
|
13
|
+
import { aI, a5, i, a2 } from "./chunks/converter-B0DE5RlJ.js";
|
|
14
|
+
import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, s as startImageUpload, y as yUndoPluginKey, d as undoDepth, r as redoDepth, S as SlashMenuPluginKey, E as Editor, e as getStarterExtensions, P as Placeholder, f as getRichTextExtensions, M as Mark, h as Extension, A as Attribute, N as Node } from "./chunks/editor-W_wtetmC.js";
|
|
15
|
+
import { k, C, l, T, i as i2, m, j } from "./chunks/editor-W_wtetmC.js";
|
|
16
16
|
import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
|
|
17
|
-
import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-
|
|
17
|
+
import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-BzRxJlN2.js";
|
|
18
18
|
import AIWriter from "./ai-writer.es.js";
|
|
19
|
-
import { D } from "./chunks/docx-zipper-
|
|
19
|
+
import { D } from "./chunks/docx-zipper-CynIq8Em.js";
|
|
20
20
|
import { createZip } from "./file-zipper.es.js";
|
|
21
21
|
var eventemitter3 = { exports: {} };
|
|
22
22
|
var hasRequiredEventemitter3;
|
package/dist/super-editor.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./chunks/super-editor.es-
|
|
3
|
+
const superEditor_es = require("./chunks/super-editor.es-D4jQmQ_2.cjs");
|
|
4
4
|
require("./chunks/vue-DWle4Cai.cjs");
|
|
5
5
|
exports.AIWriter = superEditor_es.AIWriter;
|
|
6
6
|
exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
|