@harbour-enterprises/superdoc 0.22.1 → 0.23.0-next.10
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-D2BPnEBG.cjs → PdfViewer-BsnSIYxD.cjs} +2 -2
- package/dist/chunks/{PdfViewer-CBmOiHsj.es.js → PdfViewer-CPZ7QD5u.es.js} +2 -2
- package/dist/chunks/{eventemitter3-CZv6vEhA.es.js → eventemitter3-CR2eBWft.es.js} +1 -1
- package/dist/chunks/{eventemitter3-B_kO1Pxm.cjs → eventemitter3-DSRogsNq.cjs} +1 -1
- package/dist/chunks/{index-BSDcfSFc.es.js → index-Cd9h9gMj.es.js} +32 -22
- package/dist/chunks/{index-B0CI50e4.cjs → index-DOd9uvCv.cjs} +32 -22
- package/dist/chunks/{jszip-b7l8QkfH.cjs → jszip-B4LDL19y.cjs} +1 -1
- package/dist/chunks/{jszip-B8KIZSNe.es.js → jszip-DAXEPCUv.es.js} +1 -1
- package/dist/chunks/{super-editor.es-DOOwW-Iv.cjs → super-editor.es-DAS3_Nt9.cjs} +1786 -1085
- package/dist/chunks/{super-editor.es-BW1T3N2-.es.js → super-editor.es-l3dTZlZX.es.js} +1786 -1085
- package/dist/chunks/{vue-DWle4Cai.cjs → vue-DKMj1I9B.cjs} +39 -42
- package/dist/chunks/{vue-CXxsqYcP.es.js → vue-ZWZLQtoU.es.js} +39 -42
- package/dist/chunks/xml-js-Bbc0NeKa.es.js +2 -0
- package/dist/chunks/xml-js-CWV8R-ek.cjs +3 -0
- package/dist/core/SuperDoc.d.ts +5 -18
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +29 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/stores/superdoc-store.d.ts.map +1 -1
- package/dist/style.css +76 -54
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-UuZxU-p8.js → converter-ClnqoStR.js} +1476 -1043
- package/dist/super-editor/chunks/{docx-zipper-Bss48sB0.js → docx-zipper-DC28ucAi.js} +1 -1
- package/dist/super-editor/chunks/{editor--v3HbUU0.js → editor-B2aHhS9B.js} +310 -42
- package/dist/super-editor/chunks/{toolbar-BeXlvdV8.js → toolbar-Cgyf_4bW.js} +4 -4
- 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/Attribute.d.ts +2 -2
- package/dist/super-editor/src/core/Schema.d.ts +2 -2
- package/dist/super-editor/src/core/super-converter/exporter.d.ts +4 -4
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/hyperlink-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/num-pages-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-ref-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/toc-preprocessor.d.ts +8 -0
- package/dist/super-editor/src/core/super-converter/field-references/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/field-references/preProcessNodesForFldChar.d.ts +21 -0
- package/dist/super-editor/src/core/super-converter/v2/exporter/helpers/translateChildNodes.d.ts +3 -3
- package/dist/super-editor/src/core/super-converter/v2/importer/pageReferenceImporter.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/tableOfContentsImporter.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v2/types/index.d.ts +7 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/pageReference-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/tableOfContents-translator.d.ts +10 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/caps/caps-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts +0 -2
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-doc-part-obj.d.ts +9 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-document-part-obj.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -2
- package/dist/super-editor/src/extensions/image/imageHelpers/handleBase64.d.ts +4 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/imageRegistrationPlugin.d.ts +1 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/startImageUpload.d.ts +5 -0
- package/dist/super-editor/src/extensions/page-reference/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/page-reference/page-reference.d.ts +2 -0
- package/dist/super-editor/src/extensions/structured-content/document-part-object.d.ts +2 -0
- package/dist/super-editor/src/extensions/structured-content/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTagsByAlias.d.ts +8 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +2 -2
- package/dist/super-editor/src/extensions/table-of-contents/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts +2 -0
- package/dist/super-editor/style.css +49 -27
- package/dist/super-editor/super-editor.es.js +10 -8
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +4 -4
- package/dist/superdoc.es.js +4 -4
- package/dist/superdoc.umd.js +1846 -1135
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/xml-js-CX8FH0He.cjs +0 -3
- package/dist/chunks/xml-js-D0tLGmKu.es.js +0 -2
package/dist/superdoc.umd.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
const Y__namespace = /* @__PURE__ */ _interopNamespaceDefault(Y);
|
|
22
22
|
/**
|
|
23
|
-
* @vue/shared v3.5.
|
|
23
|
+
* @vue/shared v3.5.22
|
|
24
24
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
25
25
|
* @license MIT
|
|
26
26
|
**/
|
|
@@ -915,7 +915,7 @@
|
|
|
915
915
|
iter._next = iter.next;
|
|
916
916
|
iter.next = () => {
|
|
917
917
|
const result = iter._next();
|
|
918
|
-
if (result.
|
|
918
|
+
if (!result.done) {
|
|
919
919
|
result.value = wrapValue(result.value);
|
|
920
920
|
}
|
|
921
921
|
return result;
|
|
@@ -1041,7 +1041,8 @@
|
|
|
1041
1041
|
return res;
|
|
1042
1042
|
}
|
|
1043
1043
|
if (isRef(res)) {
|
|
1044
|
-
|
|
1044
|
+
const value = targetIsArray && isIntegerKey(key2) ? res : res.value;
|
|
1045
|
+
return isReadonly2 && isObject$3(value) ? readonly(value) : value;
|
|
1045
1046
|
}
|
|
1046
1047
|
if (isObject$3(res)) {
|
|
1047
1048
|
return isReadonly2 ? readonly(res) : reactive(res);
|
|
@@ -2214,9 +2215,6 @@
|
|
|
2214
2215
|
insert(mainAnchor, container, anchor);
|
|
2215
2216
|
const mount2 = (container2, anchor2) => {
|
|
2216
2217
|
if (shapeFlag & 16) {
|
|
2217
|
-
if (parentComponent && parentComponent.isCE) {
|
|
2218
|
-
parentComponent.ce._teleportTarget = container2;
|
|
2219
|
-
}
|
|
2220
2218
|
mountChildren(
|
|
2221
2219
|
children,
|
|
2222
2220
|
container2,
|
|
@@ -2238,6 +2236,9 @@
|
|
|
2238
2236
|
} else if (namespace2 !== "mathml" && isTargetMathML(target)) {
|
|
2239
2237
|
namespace2 = "mathml";
|
|
2240
2238
|
}
|
|
2239
|
+
if (parentComponent && parentComponent.isCE) {
|
|
2240
|
+
(parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
2241
|
+
}
|
|
2241
2242
|
if (!disabled) {
|
|
2242
2243
|
mount2(target, targetAnchor);
|
|
2243
2244
|
updateCssVars(n2, false);
|
|
@@ -3326,11 +3327,12 @@
|
|
|
3326
3327
|
}
|
|
3327
3328
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
3328
3329
|
if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
|
|
3330
|
+
const hasProps = Object.keys(props).length > 0;
|
|
3329
3331
|
return openBlock(), createBlock(
|
|
3330
3332
|
Fragment$1,
|
|
3331
3333
|
null,
|
|
3332
3334
|
[createVNode("slot", props, fallback)],
|
|
3333
|
-
64
|
|
3335
|
+
hasProps ? -2 : 64
|
|
3334
3336
|
);
|
|
3335
3337
|
}
|
|
3336
3338
|
let slot = slots[name];
|
|
@@ -6720,34 +6722,31 @@
|
|
|
6720
6722
|
return c2;
|
|
6721
6723
|
};
|
|
6722
6724
|
function h$1(type2, propsOrChildren, children) {
|
|
6723
|
-
|
|
6725
|
+
try {
|
|
6724
6726
|
setBlockTracking(-1);
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
if (isVNode(propsOrChildren)) {
|
|
6735
|
-
return doCreateVNode(type2, null, [propsOrChildren]);
|
|
6727
|
+
const l = arguments.length;
|
|
6728
|
+
if (l === 2) {
|
|
6729
|
+
if (isObject$3(propsOrChildren) && !isArray$3(propsOrChildren)) {
|
|
6730
|
+
if (isVNode(propsOrChildren)) {
|
|
6731
|
+
return createVNode(type2, null, [propsOrChildren]);
|
|
6732
|
+
}
|
|
6733
|
+
return createVNode(type2, propsOrChildren);
|
|
6734
|
+
} else {
|
|
6735
|
+
return createVNode(type2, null, propsOrChildren);
|
|
6736
6736
|
}
|
|
6737
|
-
return doCreateVNode(type2, propsOrChildren);
|
|
6738
6737
|
} else {
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
children = [children];
|
|
6738
|
+
if (l > 3) {
|
|
6739
|
+
children = Array.prototype.slice.call(arguments, 2);
|
|
6740
|
+
} else if (l === 3 && isVNode(children)) {
|
|
6741
|
+
children = [children];
|
|
6742
|
+
}
|
|
6743
|
+
return createVNode(type2, propsOrChildren, children);
|
|
6746
6744
|
}
|
|
6747
|
-
|
|
6745
|
+
} finally {
|
|
6746
|
+
setBlockTracking(1);
|
|
6748
6747
|
}
|
|
6749
6748
|
}
|
|
6750
|
-
const version$1 = "3.5.
|
|
6749
|
+
const version$1 = "3.5.22";
|
|
6751
6750
|
let policy = void 0;
|
|
6752
6751
|
const tt = typeof window !== "undefined" && window.trustedTypes;
|
|
6753
6752
|
if (tt) {
|
|
@@ -6953,11 +6952,11 @@
|
|
|
6953
6952
|
const resolve2 = () => finishLeave(el, done);
|
|
6954
6953
|
addTransitionClass(el, leaveFromClass);
|
|
6955
6954
|
if (!el._enterCancelled) {
|
|
6956
|
-
forceReflow();
|
|
6955
|
+
forceReflow(el);
|
|
6957
6956
|
addTransitionClass(el, leaveActiveClass);
|
|
6958
6957
|
} else {
|
|
6959
6958
|
addTransitionClass(el, leaveActiveClass);
|
|
6960
|
-
forceReflow();
|
|
6959
|
+
forceReflow(el);
|
|
6961
6960
|
}
|
|
6962
6961
|
nextFrame(() => {
|
|
6963
6962
|
if (!el._isLeaving) {
|
|
@@ -7100,8 +7099,9 @@
|
|
|
7100
7099
|
if (s === "auto") return 0;
|
|
7101
7100
|
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
7102
7101
|
}
|
|
7103
|
-
function forceReflow() {
|
|
7104
|
-
|
|
7102
|
+
function forceReflow(el) {
|
|
7103
|
+
const targetDocument = el ? el.ownerDocument : document;
|
|
7104
|
+
return targetDocument.body.offsetHeight;
|
|
7105
7105
|
}
|
|
7106
7106
|
function patchClass(el, value, isSVG2) {
|
|
7107
7107
|
const transitionClasses = el[vtcKey];
|
|
@@ -7487,7 +7487,7 @@
|
|
|
7487
7487
|
prevChildren.forEach(callPendingCbs);
|
|
7488
7488
|
prevChildren.forEach(recordPosition);
|
|
7489
7489
|
const movedChildren = prevChildren.filter(applyTranslation);
|
|
7490
|
-
forceReflow();
|
|
7490
|
+
forceReflow(instance.vnode.el);
|
|
7491
7491
|
movedChildren.forEach((c2) => {
|
|
7492
7492
|
const el = c2.el;
|
|
7493
7493
|
const style2 = el.style;
|
|
@@ -12836,6 +12836,19 @@
|
|
|
12836
12836
|
};
|
|
12837
12837
|
return safeRegexTest;
|
|
12838
12838
|
}
|
|
12839
|
+
var generatorFunction;
|
|
12840
|
+
var hasRequiredGeneratorFunction;
|
|
12841
|
+
function requireGeneratorFunction() {
|
|
12842
|
+
if (hasRequiredGeneratorFunction) return generatorFunction;
|
|
12843
|
+
hasRequiredGeneratorFunction = 1;
|
|
12844
|
+
const cached = (
|
|
12845
|
+
/** @type {GeneratorFunctionConstructor} */
|
|
12846
|
+
function* () {
|
|
12847
|
+
}.constructor
|
|
12848
|
+
);
|
|
12849
|
+
generatorFunction = () => cached;
|
|
12850
|
+
return generatorFunction;
|
|
12851
|
+
}
|
|
12839
12852
|
var isGeneratorFunction;
|
|
12840
12853
|
var hasRequiredIsGeneratorFunction;
|
|
12841
12854
|
function requireIsGeneratorFunction() {
|
|
@@ -12848,16 +12861,7 @@
|
|
|
12848
12861
|
var getProto2 = requireGetProto();
|
|
12849
12862
|
var toStr = callBound2("Object.prototype.toString");
|
|
12850
12863
|
var fnToStr = callBound2("Function.prototype.toString");
|
|
12851
|
-
var
|
|
12852
|
-
if (!hasToStringTag) {
|
|
12853
|
-
return false;
|
|
12854
|
-
}
|
|
12855
|
-
try {
|
|
12856
|
-
return Function("return function*() {}")();
|
|
12857
|
-
} catch (e) {
|
|
12858
|
-
}
|
|
12859
|
-
};
|
|
12860
|
-
var GeneratorFunction;
|
|
12864
|
+
var getGeneratorFunction = /* @__PURE__ */ requireGeneratorFunction();
|
|
12861
12865
|
isGeneratorFunction = function isGeneratorFunction2(fn) {
|
|
12862
12866
|
if (typeof fn !== "function") {
|
|
12863
12867
|
return false;
|
|
@@ -12872,14 +12876,8 @@
|
|
|
12872
12876
|
if (!getProto2) {
|
|
12873
12877
|
return false;
|
|
12874
12878
|
}
|
|
12875
|
-
|
|
12876
|
-
|
|
12877
|
-
GeneratorFunction = generatorFunc ? (
|
|
12878
|
-
/** @type {GeneratorFunctionConstructor} */
|
|
12879
|
-
getProto2(generatorFunc)
|
|
12880
|
-
) : false;
|
|
12881
|
-
}
|
|
12882
|
-
return getProto2(fn) === GeneratorFunction;
|
|
12879
|
+
var GeneratorFunction = getGeneratorFunction();
|
|
12880
|
+
return GeneratorFunction && getProto2(fn) === GeneratorFunction.prototype;
|
|
12883
12881
|
};
|
|
12884
12882
|
return isGeneratorFunction;
|
|
12885
12883
|
}
|
|
@@ -30710,13 +30708,56 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
30710
30708
|
const { content: nodes } = params2.node;
|
|
30711
30709
|
if (!nodes) return [];
|
|
30712
30710
|
const translatedNodes = [];
|
|
30713
|
-
|
|
30711
|
+
const hyperlinkGroup = [];
|
|
30712
|
+
let index2 = 0;
|
|
30713
|
+
while (index2 < nodes.length) {
|
|
30714
|
+
const node = nodes[index2];
|
|
30715
|
+
const linkMark = _isLinkNode(node);
|
|
30716
|
+
if (linkMark) {
|
|
30717
|
+
hyperlinkGroup.push(node);
|
|
30718
|
+
const nextNode = index2 + 1 < nodes.length ? nodes[index2 + 1] : null;
|
|
30719
|
+
const nextIsLink = _isLinkNode(nextNode, linkMark);
|
|
30720
|
+
if (nextIsLink) {
|
|
30721
|
+
index2++;
|
|
30722
|
+
continue;
|
|
30723
|
+
} else {
|
|
30724
|
+
let translatedLinkGroup = exportSchemaToJson({
|
|
30725
|
+
...params2,
|
|
30726
|
+
node: hyperlinkGroup[0],
|
|
30727
|
+
extraParams: { ...params2.extraParams || {}, hyperlinkGroup: hyperlinkGroup.slice() }
|
|
30728
|
+
});
|
|
30729
|
+
if (translatedLinkGroup instanceof Array) translatedNodes.push(...translatedLinkGroup);
|
|
30730
|
+
else translatedNodes.push(translatedLinkGroup);
|
|
30731
|
+
hyperlinkGroup.length = 0;
|
|
30732
|
+
index2++;
|
|
30733
|
+
continue;
|
|
30734
|
+
}
|
|
30735
|
+
}
|
|
30714
30736
|
let translatedNode = exportSchemaToJson({ ...params2, node });
|
|
30715
30737
|
if (translatedNode instanceof Array) translatedNodes.push(...translatedNode);
|
|
30716
30738
|
else translatedNodes.push(translatedNode);
|
|
30717
|
-
|
|
30739
|
+
index2++;
|
|
30740
|
+
}
|
|
30718
30741
|
return translatedNodes.filter((n) => n);
|
|
30719
30742
|
}
|
|
30743
|
+
function _isLinkNode(node, referenceMark = null) {
|
|
30744
|
+
if (!node || !node.marks && !node.attrs?.marksAsAttrs) return null;
|
|
30745
|
+
const marks = node.marks || node.attrs.marksAsAttrs;
|
|
30746
|
+
const linkMark = marks.find((mark) => mark.type === "link");
|
|
30747
|
+
if (!linkMark) return null;
|
|
30748
|
+
if (referenceMark) {
|
|
30749
|
+
return _isSameLinkMark(linkMark.attrs, referenceMark.attrs) ? linkMark : null;
|
|
30750
|
+
}
|
|
30751
|
+
return linkMark;
|
|
30752
|
+
}
|
|
30753
|
+
function _isSameLinkMark(attrsA, attrsB) {
|
|
30754
|
+
for (let key2 of ["anchor", "docLocation", "history", "href", "rId", "target"]) {
|
|
30755
|
+
if (attrsA[key2] != attrsB[key2]) {
|
|
30756
|
+
return false;
|
|
30757
|
+
}
|
|
30758
|
+
}
|
|
30759
|
+
return true;
|
|
30760
|
+
}
|
|
30720
30761
|
const baseNumbering = {
|
|
30721
30762
|
declaration: {
|
|
30722
30763
|
attributes: {
|
|
@@ -32063,37 +32104,37 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32063
32104
|
};
|
|
32064
32105
|
__publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
|
|
32065
32106
|
let NodeTranslator = _NodeTranslator;
|
|
32066
|
-
const encode$
|
|
32107
|
+
const encode$1b = (attributes) => {
|
|
32067
32108
|
return attributes["w:type"];
|
|
32068
32109
|
};
|
|
32069
|
-
const decode
|
|
32110
|
+
const decode$11 = (attrs) => {
|
|
32070
32111
|
const { lineBreakType } = attrs;
|
|
32071
32112
|
return lineBreakType;
|
|
32072
32113
|
};
|
|
32073
32114
|
const attrConfig$F = Object.freeze({
|
|
32074
32115
|
xmlName: "w:type",
|
|
32075
32116
|
sdName: "lineBreakType",
|
|
32076
|
-
encode: encode$
|
|
32077
|
-
decode: decode
|
|
32117
|
+
encode: encode$1b,
|
|
32118
|
+
decode: decode$11
|
|
32078
32119
|
});
|
|
32079
|
-
const encode$
|
|
32120
|
+
const encode$1a = (attributes) => {
|
|
32080
32121
|
const xmlAttrValue = attributes["w:clear"];
|
|
32081
32122
|
return xmlAttrValue;
|
|
32082
32123
|
};
|
|
32083
|
-
const decode$
|
|
32124
|
+
const decode$10 = (attrs) => {
|
|
32084
32125
|
const { clear } = attrs;
|
|
32085
32126
|
return clear;
|
|
32086
32127
|
};
|
|
32087
32128
|
const attrConfig$E = Object.freeze({
|
|
32088
32129
|
xmlName: "w:clear",
|
|
32089
32130
|
sdName: "clear",
|
|
32090
|
-
encode: encode$
|
|
32091
|
-
decode: decode$
|
|
32131
|
+
encode: encode$1a,
|
|
32132
|
+
decode: decode$10
|
|
32092
32133
|
});
|
|
32093
32134
|
const validXmlAttributes$m = [attrConfig$F, attrConfig$E];
|
|
32094
|
-
const XML_NODE_NAME$
|
|
32095
|
-
const SD_NODE_NAME$
|
|
32096
|
-
const encode$
|
|
32135
|
+
const XML_NODE_NAME$x = "w:br";
|
|
32136
|
+
const SD_NODE_NAME$f = "lineBreak";
|
|
32137
|
+
const encode$19 = (_2, encodedAttrs) => {
|
|
32097
32138
|
const isPageBreak = encodedAttrs?.lineBreakType === "page";
|
|
32098
32139
|
const translated = {
|
|
32099
32140
|
type: isPageBreak ? "hardBreak" : "lineBreak"
|
|
@@ -32103,7 +32144,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32103
32144
|
}
|
|
32104
32145
|
return translated;
|
|
32105
32146
|
};
|
|
32106
|
-
const decode
|
|
32147
|
+
const decode$$ = (params2, decodedAttrs) => {
|
|
32107
32148
|
const { node } = params2;
|
|
32108
32149
|
if (!node) return;
|
|
32109
32150
|
const wBreak = { name: "w:br" };
|
|
@@ -32120,39 +32161,39 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32120
32161
|
};
|
|
32121
32162
|
return translated;
|
|
32122
32163
|
};
|
|
32123
|
-
const config$
|
|
32124
|
-
xmlName: XML_NODE_NAME$
|
|
32125
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
32164
|
+
const config$v = {
|
|
32165
|
+
xmlName: XML_NODE_NAME$x,
|
|
32166
|
+
sdNodeOrKeyName: SD_NODE_NAME$f,
|
|
32126
32167
|
type: NodeTranslator.translatorTypes.NODE,
|
|
32127
|
-
encode: encode$
|
|
32128
|
-
decode: decode
|
|
32168
|
+
encode: encode$19,
|
|
32169
|
+
decode: decode$$,
|
|
32129
32170
|
attributes: validXmlAttributes$m
|
|
32130
32171
|
};
|
|
32131
|
-
const translator$
|
|
32132
|
-
const encode$
|
|
32133
|
-
const decode$
|
|
32172
|
+
const translator$19 = NodeTranslator.from(config$v);
|
|
32173
|
+
const encode$18 = (attributes) => attributes?.["w:val"];
|
|
32174
|
+
const decode$_ = (attrs) => attrs?.highlight;
|
|
32134
32175
|
const attrConfig$D = Object.freeze({
|
|
32135
32176
|
xmlName: "w:val",
|
|
32136
32177
|
sdName: "highlight",
|
|
32137
|
-
encode: encode$
|
|
32138
|
-
decode: decode$
|
|
32178
|
+
encode: encode$18,
|
|
32179
|
+
decode: decode$_
|
|
32139
32180
|
});
|
|
32140
32181
|
const validXmlAttributes$l = [attrConfig$D];
|
|
32141
|
-
const XML_NODE_NAME$
|
|
32142
|
-
const SD_ATTR_KEY$
|
|
32182
|
+
const XML_NODE_NAME$w = "w:highlight";
|
|
32183
|
+
const SD_ATTR_KEY$g = "highlight";
|
|
32143
32184
|
const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
|
|
32144
|
-
const encode$
|
|
32185
|
+
const encode$17 = (params2, encodedAttrs = {}) => {
|
|
32145
32186
|
const { nodes } = params2;
|
|
32146
32187
|
const node = nodes?.[0];
|
|
32147
32188
|
const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
|
|
32148
32189
|
return {
|
|
32149
32190
|
type: "attr",
|
|
32150
|
-
xmlName: XML_NODE_NAME$
|
|
32151
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
32191
|
+
xmlName: XML_NODE_NAME$w,
|
|
32192
|
+
sdNodeOrKeyName: SD_ATTR_KEY$g,
|
|
32152
32193
|
attributes: { "w:val": value ?? null }
|
|
32153
32194
|
};
|
|
32154
32195
|
};
|
|
32155
|
-
const decode$
|
|
32196
|
+
const decode$Z = (params2) => {
|
|
32156
32197
|
const attrs = params2?.node?.attrs || {};
|
|
32157
32198
|
const highlightValue = attrs.highlight ?? attrs.color ?? null;
|
|
32158
32199
|
if (!highlightValue) return void 0;
|
|
@@ -32160,14 +32201,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32160
32201
|
if (!normalizedValue) return void 0;
|
|
32161
32202
|
if (DISABLED_TOKENS.has(normalizedValue)) {
|
|
32162
32203
|
return {
|
|
32163
|
-
name: XML_NODE_NAME$
|
|
32204
|
+
name: XML_NODE_NAME$w,
|
|
32164
32205
|
attributes: { "w:val": "none" }
|
|
32165
32206
|
};
|
|
32166
32207
|
}
|
|
32167
32208
|
const keyword = getDocxHighlightKeywordFromHex(highlightValue);
|
|
32168
32209
|
if (keyword) {
|
|
32169
32210
|
return {
|
|
32170
|
-
name: XML_NODE_NAME$
|
|
32211
|
+
name: XML_NODE_NAME$w,
|
|
32171
32212
|
attributes: { "w:val": keyword }
|
|
32172
32213
|
};
|
|
32173
32214
|
}
|
|
@@ -32182,63 +32223,63 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32182
32223
|
}
|
|
32183
32224
|
};
|
|
32184
32225
|
};
|
|
32185
|
-
const config$
|
|
32186
|
-
xmlName: XML_NODE_NAME$
|
|
32187
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
32226
|
+
const config$u = {
|
|
32227
|
+
xmlName: XML_NODE_NAME$w,
|
|
32228
|
+
sdNodeOrKeyName: SD_ATTR_KEY$g,
|
|
32188
32229
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
32189
|
-
encode: encode$
|
|
32190
|
-
decode: decode$
|
|
32230
|
+
encode: encode$17,
|
|
32231
|
+
decode: decode$Z,
|
|
32191
32232
|
attributes: validXmlAttributes$l
|
|
32192
32233
|
};
|
|
32193
|
-
const translator$
|
|
32194
|
-
const encode$
|
|
32234
|
+
const translator$18 = NodeTranslator.from(config$u);
|
|
32235
|
+
const encode$16 = (attributes) => {
|
|
32195
32236
|
return attributes["w:val"];
|
|
32196
32237
|
};
|
|
32197
|
-
const decode$
|
|
32238
|
+
const decode$Y = (attrs) => {
|
|
32198
32239
|
const { tabSize } = attrs || {};
|
|
32199
32240
|
return tabSize;
|
|
32200
32241
|
};
|
|
32201
32242
|
const attrConfig$C = Object.freeze({
|
|
32202
32243
|
xmlName: "w:val",
|
|
32203
32244
|
sdName: "tabSize",
|
|
32204
|
-
encode: encode$
|
|
32205
|
-
decode: decode$
|
|
32245
|
+
encode: encode$16,
|
|
32246
|
+
decode: decode$Y
|
|
32206
32247
|
});
|
|
32207
|
-
const encode$
|
|
32248
|
+
const encode$15 = (attributes) => {
|
|
32208
32249
|
return attributes["w:leader"];
|
|
32209
32250
|
};
|
|
32210
|
-
const decode$
|
|
32251
|
+
const decode$X = (attrs) => {
|
|
32211
32252
|
const { leader } = attrs || {};
|
|
32212
32253
|
return leader;
|
|
32213
32254
|
};
|
|
32214
32255
|
const attrConfig$B = Object.freeze({
|
|
32215
32256
|
xmlName: "w:leader",
|
|
32216
32257
|
sdName: "leader",
|
|
32217
|
-
encode: encode$
|
|
32218
|
-
decode: decode$
|
|
32258
|
+
encode: encode$15,
|
|
32259
|
+
decode: decode$X
|
|
32219
32260
|
});
|
|
32220
|
-
const encode$
|
|
32261
|
+
const encode$14 = (attributes) => {
|
|
32221
32262
|
return attributes["w:pos"];
|
|
32222
32263
|
};
|
|
32223
|
-
const decode$
|
|
32264
|
+
const decode$W = (attrs) => {
|
|
32224
32265
|
const { pos } = attrs || {};
|
|
32225
32266
|
return pos;
|
|
32226
32267
|
};
|
|
32227
32268
|
const attrConfig$A = Object.freeze({
|
|
32228
32269
|
xmlName: "w:pos",
|
|
32229
32270
|
sdName: "pos",
|
|
32230
|
-
encode: encode$
|
|
32231
|
-
decode: decode$
|
|
32271
|
+
encode: encode$14,
|
|
32272
|
+
decode: decode$W
|
|
32232
32273
|
});
|
|
32233
32274
|
const validXmlAttributes$k = [attrConfig$C, attrConfig$A, attrConfig$B];
|
|
32234
|
-
const XML_NODE_NAME$
|
|
32235
|
-
const SD_NODE_NAME$
|
|
32236
|
-
const encode$
|
|
32275
|
+
const XML_NODE_NAME$v = "w:tab";
|
|
32276
|
+
const SD_NODE_NAME$e = "tab";
|
|
32277
|
+
const encode$13 = (_2, encodedAttrs = {}) => {
|
|
32237
32278
|
const translated = { type: "tab" };
|
|
32238
32279
|
if (encodedAttrs) translated.attrs = { ...encodedAttrs };
|
|
32239
32280
|
return translated;
|
|
32240
32281
|
};
|
|
32241
|
-
const decode$
|
|
32282
|
+
const decode$V = (params2, decodedAttrs = {}) => {
|
|
32242
32283
|
const { node } = params2 || {};
|
|
32243
32284
|
if (!node) return;
|
|
32244
32285
|
const wTab = { name: "w:tab" };
|
|
@@ -32254,15 +32295,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32254
32295
|
}
|
|
32255
32296
|
return translated;
|
|
32256
32297
|
};
|
|
32257
|
-
const config$
|
|
32258
|
-
xmlName: XML_NODE_NAME$
|
|
32259
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
32298
|
+
const config$t = {
|
|
32299
|
+
xmlName: XML_NODE_NAME$v,
|
|
32300
|
+
sdNodeOrKeyName: SD_NODE_NAME$e,
|
|
32260
32301
|
type: NodeTranslator.translatorTypes.NODE,
|
|
32261
|
-
encode: encode$
|
|
32262
|
-
decode: decode$
|
|
32302
|
+
encode: encode$13,
|
|
32303
|
+
decode: decode$V,
|
|
32263
32304
|
attributes: validXmlAttributes$k
|
|
32264
32305
|
};
|
|
32265
|
-
const translator$
|
|
32306
|
+
const translator$17 = NodeTranslator.from(config$t);
|
|
32266
32307
|
const mergeTextNodes = (nodes) => {
|
|
32267
32308
|
if (!nodes || !Array.isArray(nodes)) {
|
|
32268
32309
|
return nodes;
|
|
@@ -32636,104 +32677,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32636
32677
|
justify: pPrByIdJcAttr
|
|
32637
32678
|
};
|
|
32638
32679
|
};
|
|
32639
|
-
const preProcessNodesForFldChar = (nodes = []) => {
|
|
32640
|
-
const processedNodes = [];
|
|
32641
|
-
let buffer2 = [];
|
|
32642
|
-
let collecting = false;
|
|
32643
|
-
for (const node of nodes) {
|
|
32644
|
-
const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
|
|
32645
|
-
const fldType = fldCharEl?.attributes?.["w:fldCharType"];
|
|
32646
|
-
if (fldType === "begin") {
|
|
32647
|
-
buffer2 = [node];
|
|
32648
|
-
collecting = true;
|
|
32649
|
-
continue;
|
|
32650
|
-
}
|
|
32651
|
-
if (fldType === "separate" && collecting) {
|
|
32652
|
-
buffer2.push(node);
|
|
32653
|
-
continue;
|
|
32654
|
-
}
|
|
32655
|
-
if (fldType === "end" && collecting) {
|
|
32656
|
-
buffer2.push(node);
|
|
32657
|
-
processedNodes.push(...processCombinedNodesForFldChar(buffer2));
|
|
32658
|
-
buffer2 = [];
|
|
32659
|
-
collecting = false;
|
|
32660
|
-
continue;
|
|
32661
|
-
}
|
|
32662
|
-
if (collecting) {
|
|
32663
|
-
buffer2.push(node);
|
|
32664
|
-
} else {
|
|
32665
|
-
processedNodes.push(node);
|
|
32666
|
-
}
|
|
32667
|
-
}
|
|
32668
|
-
if (buffer2.length) {
|
|
32669
|
-
processedNodes.push(...buffer2);
|
|
32670
|
-
}
|
|
32671
|
-
return processedNodes;
|
|
32672
|
-
};
|
|
32673
|
-
const processCombinedNodesForFldChar = (nodesToCombine = []) => {
|
|
32674
|
-
let processedNodes = [];
|
|
32675
|
-
let hasPageMarker = false;
|
|
32676
|
-
let isNumPages = false;
|
|
32677
|
-
const textStart = nodesToCombine.findIndex(
|
|
32678
|
-
(n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "separate")
|
|
32679
|
-
);
|
|
32680
|
-
const textEnd = nodesToCombine.findIndex(
|
|
32681
|
-
(n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "end")
|
|
32682
|
-
);
|
|
32683
|
-
const textNodes = nodesToCombine.slice(textStart + 1, textEnd);
|
|
32684
|
-
const instrTextContainer = nodesToCombine.find((n) => n.elements?.some((el) => el.name === "w:instrText"));
|
|
32685
|
-
const instrTextNode = instrTextContainer?.elements?.find((el) => el.name === "w:instrText");
|
|
32686
|
-
const instrText = instrTextNode?.elements[0].text;
|
|
32687
|
-
if (!hasPageMarker) hasPageMarker = instrText?.trim().startsWith("PAGE");
|
|
32688
|
-
if (!isNumPages) isNumPages = instrText?.trim().startsWith("NUMPAGES");
|
|
32689
|
-
const urlMatch = instrText?.match(/HYPERLINK\s+"([^"]+)"/);
|
|
32690
|
-
if (hasPageMarker) {
|
|
32691
|
-
const pageNumNode = {
|
|
32692
|
-
name: "sd:autoPageNumber",
|
|
32693
|
-
type: "element"
|
|
32694
|
-
};
|
|
32695
|
-
nodesToCombine.forEach((n) => {
|
|
32696
|
-
const rPrNode = n.elements.find((el) => el.name === "w:rPr");
|
|
32697
|
-
if (rPrNode) pageNumNode.elements = [rPrNode];
|
|
32698
|
-
});
|
|
32699
|
-
processedNodes.push(pageNumNode);
|
|
32700
|
-
} else if (isNumPages) {
|
|
32701
|
-
const totalPageNumNode = {
|
|
32702
|
-
name: "sd:totalPageNumber",
|
|
32703
|
-
type: "element"
|
|
32704
|
-
};
|
|
32705
|
-
nodesToCombine.forEach((n) => {
|
|
32706
|
-
const rPrNode = n.elements.find((el) => el.name === "w:rPr");
|
|
32707
|
-
if (rPrNode) totalPageNumNode.elements = [rPrNode];
|
|
32708
|
-
});
|
|
32709
|
-
processedNodes.push(totalPageNumNode);
|
|
32710
|
-
} else if (urlMatch && urlMatch?.length >= 2) {
|
|
32711
|
-
const url = urlMatch[1];
|
|
32712
|
-
const textMarks = [];
|
|
32713
|
-
textNodes.forEach((n) => {
|
|
32714
|
-
const rPr2 = n.elements.find((el) => el.name === "w:rPr");
|
|
32715
|
-
if (!rPr2) return;
|
|
32716
|
-
const { elements } = rPr2;
|
|
32717
|
-
elements.forEach((el) => {
|
|
32718
|
-
textMarks.push(el);
|
|
32719
|
-
});
|
|
32720
|
-
});
|
|
32721
|
-
const linkMark = { name: "link", attributes: { href: url } };
|
|
32722
|
-
const rPr = { name: "w:rPr", type: "element", elements: [linkMark, ...textMarks] };
|
|
32723
|
-
processedNodes.push({
|
|
32724
|
-
name: "w:r",
|
|
32725
|
-
type: "element",
|
|
32726
|
-
elements: [rPr, ...textNodes]
|
|
32727
|
-
});
|
|
32728
|
-
}
|
|
32729
|
-
return processedNodes;
|
|
32730
|
-
};
|
|
32731
32680
|
const handleParagraphNode$1 = (params2) => {
|
|
32732
32681
|
const { nodes, docx, nodeListHandler, filename } = params2;
|
|
32733
32682
|
const node = carbonCopy(nodes[0]);
|
|
32734
32683
|
let schemaNode;
|
|
32735
|
-
let processedElements = preProcessNodesForFldChar(node.elements);
|
|
32736
|
-
node.elements = processedElements;
|
|
32737
32684
|
const handleStandardNode2 = nodeListHandler.handlerEntities.find(
|
|
32738
32685
|
(e) => e.handlerName === "standardNodeHandler"
|
|
32739
32686
|
)?.handler;
|
|
@@ -32874,89 +32821,89 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32874
32821
|
}
|
|
32875
32822
|
return schemaNode;
|
|
32876
32823
|
};
|
|
32877
|
-
const encode
|
|
32824
|
+
const encode$12 = (attributes) => {
|
|
32878
32825
|
return attributes["w:rsidDel"];
|
|
32879
32826
|
};
|
|
32880
|
-
const decode$
|
|
32827
|
+
const decode$U = (attrs) => {
|
|
32881
32828
|
return attrs.rsidDel;
|
|
32882
32829
|
};
|
|
32883
32830
|
const attrConfig$z = Object.freeze({
|
|
32884
32831
|
xmlName: "w:rsidDel",
|
|
32885
32832
|
sdName: "rsidDel",
|
|
32886
|
-
encode: encode
|
|
32887
|
-
decode: decode$
|
|
32833
|
+
encode: encode$12,
|
|
32834
|
+
decode: decode$U
|
|
32888
32835
|
});
|
|
32889
|
-
const encode$
|
|
32836
|
+
const encode$11 = (attributes) => {
|
|
32890
32837
|
return attributes["w:rsidP"];
|
|
32891
32838
|
};
|
|
32892
|
-
const decode$
|
|
32839
|
+
const decode$T = (attrs) => {
|
|
32893
32840
|
return attrs.rsidP;
|
|
32894
32841
|
};
|
|
32895
32842
|
const attrConfig$y = Object.freeze({
|
|
32896
32843
|
xmlName: "w:rsidP",
|
|
32897
32844
|
sdName: "rsidP",
|
|
32898
|
-
encode: encode$
|
|
32899
|
-
decode: decode$
|
|
32845
|
+
encode: encode$11,
|
|
32846
|
+
decode: decode$T
|
|
32900
32847
|
});
|
|
32901
|
-
const encode$
|
|
32848
|
+
const encode$10 = (attributes) => {
|
|
32902
32849
|
return attributes["w:rsidR"];
|
|
32903
32850
|
};
|
|
32904
|
-
const decode$
|
|
32851
|
+
const decode$S = (attrs) => {
|
|
32905
32852
|
return attrs.rsidR;
|
|
32906
32853
|
};
|
|
32907
32854
|
const attrConfig$x = Object.freeze({
|
|
32908
32855
|
xmlName: "w:rsidR",
|
|
32909
32856
|
sdName: "rsidR",
|
|
32910
|
-
encode: encode$
|
|
32911
|
-
decode: decode$
|
|
32857
|
+
encode: encode$10,
|
|
32858
|
+
decode: decode$S
|
|
32912
32859
|
});
|
|
32913
|
-
const encode
|
|
32860
|
+
const encode$$ = (attributes) => {
|
|
32914
32861
|
return attributes["w:rsidRPr"];
|
|
32915
32862
|
};
|
|
32916
|
-
const decode$
|
|
32863
|
+
const decode$R = (attrs) => {
|
|
32917
32864
|
return attrs.rsidRPr;
|
|
32918
32865
|
};
|
|
32919
32866
|
const attrConfig$w = Object.freeze({
|
|
32920
32867
|
xmlName: "w:rsidRPr",
|
|
32921
32868
|
sdName: "rsidRPr",
|
|
32922
|
-
encode: encode
|
|
32923
|
-
decode: decode$
|
|
32869
|
+
encode: encode$$,
|
|
32870
|
+
decode: decode$R
|
|
32924
32871
|
});
|
|
32925
|
-
const encode$
|
|
32872
|
+
const encode$_ = (attributes) => {
|
|
32926
32873
|
return attributes["w:rsidRDefault"];
|
|
32927
32874
|
};
|
|
32928
|
-
const decode$
|
|
32875
|
+
const decode$Q = (attrs) => {
|
|
32929
32876
|
return attrs.rsidRDefault;
|
|
32930
32877
|
};
|
|
32931
32878
|
const attrConfig$v = Object.freeze({
|
|
32932
32879
|
xmlName: "w:rsidRDefault",
|
|
32933
32880
|
sdName: "rsidRDefault",
|
|
32934
|
-
encode: encode$
|
|
32935
|
-
decode: decode$
|
|
32881
|
+
encode: encode$_,
|
|
32882
|
+
decode: decode$Q
|
|
32936
32883
|
});
|
|
32937
|
-
const encode$
|
|
32884
|
+
const encode$Z = (attributes) => {
|
|
32938
32885
|
return attributes["w14:paraId"];
|
|
32939
32886
|
};
|
|
32940
|
-
const decode$
|
|
32887
|
+
const decode$P = (attrs) => {
|
|
32941
32888
|
return attrs.paraId;
|
|
32942
32889
|
};
|
|
32943
32890
|
const attrConfig$u = Object.freeze({
|
|
32944
32891
|
xmlName: "w14:paraId",
|
|
32945
32892
|
sdName: "paraId",
|
|
32946
|
-
encode: encode$
|
|
32947
|
-
decode: decode$
|
|
32893
|
+
encode: encode$Z,
|
|
32894
|
+
decode: decode$P
|
|
32948
32895
|
});
|
|
32949
|
-
const encode$
|
|
32896
|
+
const encode$Y = (attributes) => {
|
|
32950
32897
|
return attributes["w14:textId"];
|
|
32951
32898
|
};
|
|
32952
|
-
const decode$
|
|
32899
|
+
const decode$O = (attrs) => {
|
|
32953
32900
|
return attrs.textId;
|
|
32954
32901
|
};
|
|
32955
32902
|
const attrConfig$t = Object.freeze({
|
|
32956
32903
|
xmlName: "w14:textId",
|
|
32957
32904
|
sdName: "textId",
|
|
32958
|
-
encode: encode$
|
|
32959
|
-
decode: decode$
|
|
32905
|
+
encode: encode$Y,
|
|
32906
|
+
decode: decode$O
|
|
32960
32907
|
});
|
|
32961
32908
|
const validXmlAttributes$j = [
|
|
32962
32909
|
attrConfig$u,
|
|
@@ -32967,9 +32914,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32967
32914
|
attrConfig$w,
|
|
32968
32915
|
attrConfig$z
|
|
32969
32916
|
];
|
|
32970
|
-
const XML_NODE_NAME$
|
|
32971
|
-
const SD_NODE_NAME$
|
|
32972
|
-
const encode$
|
|
32917
|
+
const XML_NODE_NAME$u = "w:p";
|
|
32918
|
+
const SD_NODE_NAME$d = "paragraph";
|
|
32919
|
+
const encode$X = (params2, encodedAttrs = {}) => {
|
|
32973
32920
|
const node = handleParagraphNode$1(params2);
|
|
32974
32921
|
if (!node) return void 0;
|
|
32975
32922
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
@@ -32977,7 +32924,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32977
32924
|
}
|
|
32978
32925
|
return node;
|
|
32979
32926
|
};
|
|
32980
|
-
const decode$
|
|
32927
|
+
const decode$N = (params2, decodedAttrs = {}) => {
|
|
32981
32928
|
const translated = translateParagraphNode(params2);
|
|
32982
32929
|
if (!translated) return void 0;
|
|
32983
32930
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
@@ -32985,16 +32932,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32985
32932
|
}
|
|
32986
32933
|
return translated;
|
|
32987
32934
|
};
|
|
32988
|
-
const config$
|
|
32989
|
-
xmlName: XML_NODE_NAME$
|
|
32990
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
32935
|
+
const config$s = {
|
|
32936
|
+
xmlName: XML_NODE_NAME$u,
|
|
32937
|
+
sdNodeOrKeyName: SD_NODE_NAME$d,
|
|
32991
32938
|
type: NodeTranslator.translatorTypes.NODE,
|
|
32992
|
-
encode: encode$
|
|
32993
|
-
decode: decode$
|
|
32939
|
+
encode: encode$X,
|
|
32940
|
+
decode: decode$N,
|
|
32994
32941
|
attributes: validXmlAttributes$j
|
|
32995
32942
|
};
|
|
32996
|
-
const translator$
|
|
32997
|
-
const encode$
|
|
32943
|
+
const translator$16 = NodeTranslator.from(config$s);
|
|
32944
|
+
const encode$W = (attributes) => {
|
|
32998
32945
|
const raw = attributes?.["w:val"];
|
|
32999
32946
|
if (raw === void 0 || raw === null) return void 0;
|
|
33000
32947
|
if (typeof raw === "boolean") return raw;
|
|
@@ -33004,24 +32951,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33004
32951
|
if (val === "1" || val === "true" || val === "on") return true;
|
|
33005
32952
|
return void 0;
|
|
33006
32953
|
};
|
|
33007
|
-
const decode$
|
|
32954
|
+
const decode$M = (runProps) => {
|
|
33008
32955
|
if (runProps?.bold === false) return "0";
|
|
33009
32956
|
return void 0;
|
|
33010
32957
|
};
|
|
33011
32958
|
const attrConfig$s = Object.freeze({
|
|
33012
32959
|
xmlName: "w:val",
|
|
33013
32960
|
sdName: "bold",
|
|
33014
|
-
encode: encode$
|
|
33015
|
-
decode: decode$
|
|
32961
|
+
encode: encode$W,
|
|
32962
|
+
decode: decode$M
|
|
33016
32963
|
});
|
|
33017
32964
|
const validXmlAttributes$i = [attrConfig$s];
|
|
33018
|
-
const XML_NODE_NAME$
|
|
33019
|
-
const SD_ATTR_KEY$
|
|
33020
|
-
const encode$
|
|
32965
|
+
const XML_NODE_NAME$t = "w:b";
|
|
32966
|
+
const SD_ATTR_KEY$f = "bold";
|
|
32967
|
+
const encode$V = (params2, encodedAttrs = {}) => {
|
|
33021
32968
|
const { nodes } = params2;
|
|
33022
32969
|
const node = nodes[0];
|
|
33023
32970
|
if (!node) return void 0;
|
|
33024
|
-
const val = encodedAttrs?.[SD_ATTR_KEY$
|
|
32971
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$f];
|
|
33025
32972
|
let attributes;
|
|
33026
32973
|
if (val === false) attributes = { "w:val": "0" };
|
|
33027
32974
|
else if (val === true)
|
|
@@ -33029,85 +32976,85 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33029
32976
|
else attributes = node.attributes || {};
|
|
33030
32977
|
return {
|
|
33031
32978
|
type: "attr",
|
|
33032
|
-
xmlName: XML_NODE_NAME$
|
|
33033
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
32979
|
+
xmlName: XML_NODE_NAME$t,
|
|
32980
|
+
sdNodeOrKeyName: SD_ATTR_KEY$f,
|
|
33034
32981
|
attributes
|
|
33035
32982
|
};
|
|
33036
32983
|
};
|
|
33037
|
-
const config$
|
|
33038
|
-
xmlName: XML_NODE_NAME$
|
|
33039
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
32984
|
+
const config$r = {
|
|
32985
|
+
xmlName: XML_NODE_NAME$t,
|
|
32986
|
+
sdNodeOrKeyName: SD_ATTR_KEY$f,
|
|
33040
32987
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33041
|
-
encode: encode$
|
|
32988
|
+
encode: encode$V,
|
|
33042
32989
|
attributes: validXmlAttributes$i
|
|
33043
32990
|
};
|
|
33044
|
-
const translator$
|
|
33045
|
-
const XML_NODE_NAME$
|
|
33046
|
-
const SD_ATTR_KEY$
|
|
33047
|
-
const encode$
|
|
32991
|
+
const translator$15 = NodeTranslator.from(config$r);
|
|
32992
|
+
const XML_NODE_NAME$s = "w:i";
|
|
32993
|
+
const SD_ATTR_KEY$e = "italic";
|
|
32994
|
+
const encode$U = (params2) => {
|
|
33048
32995
|
const { nodes } = params2;
|
|
33049
32996
|
const node = nodes?.[0];
|
|
33050
32997
|
if (!node) return void 0;
|
|
33051
32998
|
return {
|
|
33052
32999
|
type: "attr",
|
|
33053
|
-
xmlName: XML_NODE_NAME$
|
|
33054
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33000
|
+
xmlName: XML_NODE_NAME$s,
|
|
33001
|
+
sdNodeOrKeyName: SD_ATTR_KEY$e,
|
|
33055
33002
|
attributes: {
|
|
33056
33003
|
"w:val": node.attributes?.["w:val"] ?? null
|
|
33057
33004
|
}
|
|
33058
33005
|
};
|
|
33059
33006
|
};
|
|
33060
|
-
const config$
|
|
33061
|
-
xmlName: XML_NODE_NAME$
|
|
33062
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33007
|
+
const config$q = {
|
|
33008
|
+
xmlName: XML_NODE_NAME$s,
|
|
33009
|
+
sdNodeOrKeyName: SD_ATTR_KEY$e,
|
|
33063
33010
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33064
|
-
encode: encode$
|
|
33011
|
+
encode: encode$U
|
|
33065
33012
|
};
|
|
33066
|
-
const translator$
|
|
33067
|
-
const encode$
|
|
33068
|
-
const decode$
|
|
33013
|
+
const translator$14 = NodeTranslator.from(config$q);
|
|
33014
|
+
const encode$T = (attributes) => attributes?.["w:val"];
|
|
33015
|
+
const decode$L = (attrs) => attrs?.underline;
|
|
33069
33016
|
const attrConfig$r = Object.freeze({
|
|
33070
33017
|
xmlName: "w:val",
|
|
33071
33018
|
sdName: "underline",
|
|
33072
|
-
encode: encode$
|
|
33073
|
-
decode: decode$
|
|
33019
|
+
encode: encode$T,
|
|
33020
|
+
decode: decode$L
|
|
33074
33021
|
});
|
|
33075
|
-
const encode$
|
|
33076
|
-
const decode$
|
|
33022
|
+
const encode$S = (attributes) => attributes?.["w:color"];
|
|
33023
|
+
const decode$K = (attrs) => attrs?.color;
|
|
33077
33024
|
const attrConfig$q = Object.freeze({
|
|
33078
33025
|
xmlName: "w:color",
|
|
33079
33026
|
sdName: "color",
|
|
33080
|
-
encode: encode$
|
|
33081
|
-
decode: decode$
|
|
33027
|
+
encode: encode$S,
|
|
33028
|
+
decode: decode$K
|
|
33082
33029
|
});
|
|
33083
|
-
const encode$
|
|
33084
|
-
const decode$
|
|
33030
|
+
const encode$R = (attributes) => attributes?.["w:themeColor"];
|
|
33031
|
+
const decode$J = (attrs) => attrs?.themeColor;
|
|
33085
33032
|
const attrConfig$p = Object.freeze({
|
|
33086
33033
|
xmlName: "w:themeColor",
|
|
33087
33034
|
sdName: "themeColor",
|
|
33088
|
-
encode: encode$
|
|
33089
|
-
decode: decode$
|
|
33035
|
+
encode: encode$R,
|
|
33036
|
+
decode: decode$J
|
|
33090
33037
|
});
|
|
33091
|
-
const encode$
|
|
33092
|
-
const decode$
|
|
33038
|
+
const encode$Q = (attributes) => attributes?.["w:themeTint"];
|
|
33039
|
+
const decode$I = (attrs) => attrs?.themeTint;
|
|
33093
33040
|
const attrConfig$o = Object.freeze({
|
|
33094
33041
|
xmlName: "w:themeTint",
|
|
33095
33042
|
sdName: "themeTint",
|
|
33096
|
-
encode: encode$
|
|
33097
|
-
decode: decode$
|
|
33043
|
+
encode: encode$Q,
|
|
33044
|
+
decode: decode$I
|
|
33098
33045
|
});
|
|
33099
|
-
const encode$
|
|
33100
|
-
const decode$
|
|
33046
|
+
const encode$P = (attributes) => attributes?.["w:themeShade"];
|
|
33047
|
+
const decode$H = (attrs) => attrs?.themeShade;
|
|
33101
33048
|
const attrConfig$n = Object.freeze({
|
|
33102
33049
|
xmlName: "w:themeShade",
|
|
33103
33050
|
sdName: "themeShade",
|
|
33104
|
-
encode: encode$
|
|
33105
|
-
decode: decode$
|
|
33051
|
+
encode: encode$P,
|
|
33052
|
+
decode: decode$H
|
|
33106
33053
|
});
|
|
33107
33054
|
const validXmlAttributes$h = [attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o, attrConfig$n];
|
|
33108
|
-
const XML_NODE_NAME$
|
|
33109
|
-
const SD_ATTR_KEY$
|
|
33110
|
-
const encode$
|
|
33055
|
+
const XML_NODE_NAME$r = "w:u";
|
|
33056
|
+
const SD_ATTR_KEY$d = "underline";
|
|
33057
|
+
const encode$O = (params2, encodedAttrs = {}) => {
|
|
33111
33058
|
const { nodes } = params2;
|
|
33112
33059
|
const node = nodes?.[0];
|
|
33113
33060
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -33123,12 +33070,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33123
33070
|
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
33124
33071
|
return {
|
|
33125
33072
|
type: "attr",
|
|
33126
|
-
xmlName: XML_NODE_NAME$
|
|
33127
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33073
|
+
xmlName: XML_NODE_NAME$r,
|
|
33074
|
+
sdNodeOrKeyName: SD_ATTR_KEY$d,
|
|
33128
33075
|
attributes
|
|
33129
33076
|
};
|
|
33130
33077
|
};
|
|
33131
|
-
const decode$
|
|
33078
|
+
const decode$G = (params2) => {
|
|
33132
33079
|
const attrs = params2?.node?.attrs || {};
|
|
33133
33080
|
const underlineType = attrs.underlineType ?? attrs.underline ?? null;
|
|
33134
33081
|
const color = attrs.underlineColor ?? attrs.color ?? null;
|
|
@@ -33146,20 +33093,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33146
33093
|
if (themeTint) attributes["w:themeTint"] = themeTint;
|
|
33147
33094
|
if (themeShade) attributes["w:themeShade"] = themeShade;
|
|
33148
33095
|
return {
|
|
33149
|
-
name: XML_NODE_NAME$
|
|
33096
|
+
name: XML_NODE_NAME$r,
|
|
33150
33097
|
attributes
|
|
33151
33098
|
};
|
|
33152
33099
|
};
|
|
33153
|
-
const config$
|
|
33154
|
-
xmlName: XML_NODE_NAME$
|
|
33155
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33100
|
+
const config$p = {
|
|
33101
|
+
xmlName: XML_NODE_NAME$r,
|
|
33102
|
+
sdNodeOrKeyName: SD_ATTR_KEY$d,
|
|
33156
33103
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33157
|
-
encode: encode$
|
|
33158
|
-
decode: decode$
|
|
33104
|
+
encode: encode$O,
|
|
33105
|
+
decode: decode$G,
|
|
33159
33106
|
attributes: validXmlAttributes$h
|
|
33160
33107
|
};
|
|
33161
|
-
const translator$
|
|
33162
|
-
const encode$
|
|
33108
|
+
const translator$13 = NodeTranslator.from(config$p);
|
|
33109
|
+
const encode$N = (attributes) => {
|
|
33163
33110
|
const raw = attributes?.["w:val"];
|
|
33164
33111
|
if (raw === void 0 || raw === null) return void 0;
|
|
33165
33112
|
if (typeof raw === "boolean") return raw;
|
|
@@ -33169,24 +33116,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33169
33116
|
if (val === "1" || val === "true" || val === "on") return true;
|
|
33170
33117
|
return void 0;
|
|
33171
33118
|
};
|
|
33172
|
-
const decode$
|
|
33119
|
+
const decode$F = (attrs) => {
|
|
33173
33120
|
if (attrs?.strike === false) return "0";
|
|
33174
33121
|
return void 0;
|
|
33175
33122
|
};
|
|
33176
33123
|
const attrConfig$m = Object.freeze({
|
|
33177
33124
|
xmlName: "w:val",
|
|
33178
33125
|
sdName: "strike",
|
|
33179
|
-
encode: encode$
|
|
33180
|
-
decode: decode$
|
|
33126
|
+
encode: encode$N,
|
|
33127
|
+
decode: decode$F
|
|
33181
33128
|
});
|
|
33182
33129
|
const validXmlAttributes$g = [attrConfig$m];
|
|
33183
|
-
const XML_NODE_NAME$
|
|
33184
|
-
const SD_ATTR_KEY$
|
|
33185
|
-
const encode$
|
|
33130
|
+
const XML_NODE_NAME$q = "w:strike";
|
|
33131
|
+
const SD_ATTR_KEY$c = "strike";
|
|
33132
|
+
const encode$M = (params2, encodedAttrs = {}) => {
|
|
33186
33133
|
const { nodes } = params2;
|
|
33187
33134
|
const node = nodes?.[0];
|
|
33188
33135
|
if (!node) return void 0;
|
|
33189
|
-
const val = encodedAttrs?.[SD_ATTR_KEY$
|
|
33136
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$c];
|
|
33190
33137
|
let attributes;
|
|
33191
33138
|
if (val === false) attributes = { "w:val": "0" };
|
|
33192
33139
|
else if (val === true) attributes = {};
|
|
@@ -33195,55 +33142,55 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33195
33142
|
else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
33196
33143
|
return {
|
|
33197
33144
|
type: "attr",
|
|
33198
|
-
xmlName: XML_NODE_NAME$
|
|
33199
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33145
|
+
xmlName: XML_NODE_NAME$q,
|
|
33146
|
+
sdNodeOrKeyName: SD_ATTR_KEY$c,
|
|
33200
33147
|
attributes
|
|
33201
33148
|
};
|
|
33202
33149
|
};
|
|
33203
|
-
const config$
|
|
33204
|
-
xmlName: XML_NODE_NAME$
|
|
33205
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33150
|
+
const config$o = {
|
|
33151
|
+
xmlName: XML_NODE_NAME$q,
|
|
33152
|
+
sdNodeOrKeyName: SD_ATTR_KEY$c,
|
|
33206
33153
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33207
|
-
encode: encode$
|
|
33154
|
+
encode: encode$M,
|
|
33208
33155
|
attributes: validXmlAttributes$g
|
|
33209
33156
|
};
|
|
33210
|
-
const translator
|
|
33211
|
-
const encode$
|
|
33212
|
-
const decode$
|
|
33157
|
+
const translator$12 = NodeTranslator.from(config$o);
|
|
33158
|
+
const encode$L = (attributes) => attributes?.["w:val"];
|
|
33159
|
+
const decode$E = (attrs) => attrs?.color;
|
|
33213
33160
|
const attrConfig$l = Object.freeze({
|
|
33214
33161
|
xmlName: "w:val",
|
|
33215
33162
|
sdName: "color",
|
|
33216
|
-
encode: encode$
|
|
33217
|
-
decode: decode$
|
|
33163
|
+
encode: encode$L,
|
|
33164
|
+
decode: decode$E
|
|
33218
33165
|
});
|
|
33219
|
-
const encode$
|
|
33220
|
-
const decode$
|
|
33166
|
+
const encode$K = (attributes) => attributes?.["w:themeColor"];
|
|
33167
|
+
const decode$D = (attrs) => attrs?.themeColor;
|
|
33221
33168
|
const attrConfig$k = Object.freeze({
|
|
33222
33169
|
xmlName: "w:themeColor",
|
|
33223
33170
|
sdName: "themeColor",
|
|
33224
|
-
encode: encode$
|
|
33225
|
-
decode: decode$
|
|
33171
|
+
encode: encode$K,
|
|
33172
|
+
decode: decode$D
|
|
33226
33173
|
});
|
|
33227
|
-
const encode$
|
|
33228
|
-
const decode$
|
|
33174
|
+
const encode$J = (attributes) => attributes?.["w:themeTint"];
|
|
33175
|
+
const decode$C = (attrs) => attrs?.themeTint;
|
|
33229
33176
|
const attrConfig$j = Object.freeze({
|
|
33230
33177
|
xmlName: "w:themeTint",
|
|
33231
33178
|
sdName: "themeTint",
|
|
33232
|
-
encode: encode$
|
|
33233
|
-
decode: decode$
|
|
33179
|
+
encode: encode$J,
|
|
33180
|
+
decode: decode$C
|
|
33234
33181
|
});
|
|
33235
|
-
const encode$
|
|
33236
|
-
const decode$
|
|
33182
|
+
const encode$I = (attributes) => attributes?.["w:themeShade"];
|
|
33183
|
+
const decode$B = (attrs) => attrs?.themeShade;
|
|
33237
33184
|
const attrConfig$i = Object.freeze({
|
|
33238
33185
|
xmlName: "w:themeShade",
|
|
33239
33186
|
sdName: "themeShade",
|
|
33240
|
-
encode: encode$
|
|
33241
|
-
decode: decode$
|
|
33187
|
+
encode: encode$I,
|
|
33188
|
+
decode: decode$B
|
|
33242
33189
|
});
|
|
33243
33190
|
const validXmlAttributes$f = [attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
|
|
33244
|
-
const XML_NODE_NAME$
|
|
33245
|
-
const SD_ATTR_KEY$
|
|
33246
|
-
const encode$
|
|
33191
|
+
const XML_NODE_NAME$p = "w:color";
|
|
33192
|
+
const SD_ATTR_KEY$b = "color";
|
|
33193
|
+
const encode$H = (params2, encodedAttrs = {}) => {
|
|
33247
33194
|
const { nodes } = params2;
|
|
33248
33195
|
const node = nodes?.[0];
|
|
33249
33196
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -33258,63 +33205,63 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33258
33205
|
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
33259
33206
|
return {
|
|
33260
33207
|
type: "attr",
|
|
33261
|
-
xmlName: XML_NODE_NAME$
|
|
33262
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33208
|
+
xmlName: XML_NODE_NAME$p,
|
|
33209
|
+
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
33263
33210
|
attributes
|
|
33264
33211
|
};
|
|
33265
33212
|
};
|
|
33266
|
-
const config$
|
|
33267
|
-
xmlName: XML_NODE_NAME$
|
|
33268
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33213
|
+
const config$n = {
|
|
33214
|
+
xmlName: XML_NODE_NAME$p,
|
|
33215
|
+
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
33269
33216
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33270
|
-
encode: encode$
|
|
33217
|
+
encode: encode$H,
|
|
33271
33218
|
attributes: validXmlAttributes$f
|
|
33272
33219
|
};
|
|
33273
|
-
const translator$
|
|
33274
|
-
const encode$
|
|
33275
|
-
const decode$
|
|
33220
|
+
const translator$11 = NodeTranslator.from(config$n);
|
|
33221
|
+
const encode$G = (attributes) => attributes?.["w:eastAsia"];
|
|
33222
|
+
const decode$A = (attrs) => attrs?.eastAsia;
|
|
33276
33223
|
const attrConfig$h = Object.freeze({
|
|
33277
33224
|
xmlName: "w:eastAsia",
|
|
33278
33225
|
sdName: "eastAsia",
|
|
33279
|
-
encode: encode$
|
|
33280
|
-
decode: decode$
|
|
33226
|
+
encode: encode$G,
|
|
33227
|
+
decode: decode$A
|
|
33281
33228
|
});
|
|
33282
|
-
const encode$
|
|
33283
|
-
const decode$
|
|
33229
|
+
const encode$F = (attributes) => attributes?.["w:ascii"];
|
|
33230
|
+
const decode$z = (attrs) => attrs?.ascii;
|
|
33284
33231
|
const attrConfig$g = Object.freeze({
|
|
33285
33232
|
xmlName: "w:ascii",
|
|
33286
33233
|
sdName: "ascii",
|
|
33287
|
-
encode: encode$
|
|
33288
|
-
decode: decode$
|
|
33234
|
+
encode: encode$F,
|
|
33235
|
+
decode: decode$z
|
|
33289
33236
|
});
|
|
33290
|
-
const encode$
|
|
33291
|
-
const decode$
|
|
33237
|
+
const encode$E = (attributes) => attributes?.["w:hAnsi"];
|
|
33238
|
+
const decode$y = (attrs) => attrs?.hAnsi;
|
|
33292
33239
|
const attrConfig$f = Object.freeze({
|
|
33293
33240
|
xmlName: "w:hAnsi",
|
|
33294
33241
|
sdName: "hAnsi",
|
|
33295
|
-
encode: encode$
|
|
33296
|
-
decode: decode$
|
|
33242
|
+
encode: encode$E,
|
|
33243
|
+
decode: decode$y
|
|
33297
33244
|
});
|
|
33298
|
-
const encode$
|
|
33299
|
-
const decode$
|
|
33245
|
+
const encode$D = (attributes) => attributes?.["w:cs"];
|
|
33246
|
+
const decode$x = (attrs) => attrs?.cs;
|
|
33300
33247
|
const attrConfig$e = Object.freeze({
|
|
33301
33248
|
xmlName: "w:cs",
|
|
33302
33249
|
sdName: "cs",
|
|
33303
|
-
encode: encode$
|
|
33304
|
-
decode: decode$
|
|
33250
|
+
encode: encode$D,
|
|
33251
|
+
decode: decode$x
|
|
33305
33252
|
});
|
|
33306
|
-
const encode$
|
|
33307
|
-
const decode$
|
|
33253
|
+
const encode$C = (attributes) => attributes?.["w:val"];
|
|
33254
|
+
const decode$w = (attrs) => attrs?.value;
|
|
33308
33255
|
const attrConfig$d = Object.freeze({
|
|
33309
33256
|
xmlName: "w:val",
|
|
33310
33257
|
sdName: "value",
|
|
33311
|
-
encode: encode$
|
|
33312
|
-
decode: decode$
|
|
33258
|
+
encode: encode$C,
|
|
33259
|
+
decode: decode$w
|
|
33313
33260
|
});
|
|
33314
33261
|
const validXmlAttributes$e = [attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e, attrConfig$d];
|
|
33315
|
-
const XML_NODE_NAME$
|
|
33316
|
-
const SD_ATTR_KEY$
|
|
33317
|
-
const encode$
|
|
33262
|
+
const XML_NODE_NAME$o = "w:rFonts";
|
|
33263
|
+
const SD_ATTR_KEY$a = "fontFamily";
|
|
33264
|
+
const encode$B = (params2, encodedAttrs = {}) => {
|
|
33318
33265
|
const { nodes } = params2;
|
|
33319
33266
|
const node = nodes?.[0];
|
|
33320
33267
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -33340,120 +33287,281 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33340
33287
|
if (attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
33341
33288
|
return {
|
|
33342
33289
|
type: "attr",
|
|
33343
|
-
xmlName: XML_NODE_NAME$
|
|
33344
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33290
|
+
xmlName: XML_NODE_NAME$o,
|
|
33291
|
+
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
33345
33292
|
attributes
|
|
33346
33293
|
};
|
|
33347
33294
|
};
|
|
33348
|
-
const config$
|
|
33349
|
-
xmlName: XML_NODE_NAME$
|
|
33350
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33295
|
+
const config$m = {
|
|
33296
|
+
xmlName: XML_NODE_NAME$o,
|
|
33297
|
+
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
33351
33298
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33352
|
-
encode: encode$
|
|
33299
|
+
encode: encode$B,
|
|
33353
33300
|
attributes: validXmlAttributes$e
|
|
33354
33301
|
};
|
|
33355
|
-
const translator$
|
|
33356
|
-
const encode$
|
|
33357
|
-
const decode$
|
|
33302
|
+
const translator$10 = NodeTranslator.from(config$m);
|
|
33303
|
+
const encode$A = (attributes) => attributes?.["w:val"];
|
|
33304
|
+
const decode$v = (attrs) => attrs?.styleId;
|
|
33358
33305
|
const attrConfig$c = Object.freeze({
|
|
33359
33306
|
xmlName: "w:val",
|
|
33360
33307
|
sdName: "styleId",
|
|
33361
|
-
encode: encode$
|
|
33362
|
-
decode: decode$
|
|
33308
|
+
encode: encode$A,
|
|
33309
|
+
decode: decode$v
|
|
33363
33310
|
});
|
|
33364
33311
|
const validXmlAttributes$d = [attrConfig$c];
|
|
33365
|
-
const XML_NODE_NAME$
|
|
33366
|
-
const SD_ATTR_KEY$
|
|
33367
|
-
const encode$
|
|
33312
|
+
const XML_NODE_NAME$n = "w:rStyle";
|
|
33313
|
+
const SD_ATTR_KEY$9 = "styleId";
|
|
33314
|
+
const encode$z = (params2, encodedAttrs = {}) => {
|
|
33368
33315
|
const { nodes } = params2;
|
|
33369
33316
|
const node = nodes?.[0];
|
|
33370
33317
|
const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
|
|
33371
33318
|
return {
|
|
33372
33319
|
type: "attr",
|
|
33373
|
-
xmlName: XML_NODE_NAME$
|
|
33374
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33320
|
+
xmlName: XML_NODE_NAME$n,
|
|
33321
|
+
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
33375
33322
|
attributes: { "w:val": value ?? null }
|
|
33376
33323
|
};
|
|
33377
33324
|
};
|
|
33378
|
-
const config$
|
|
33379
|
-
xmlName: XML_NODE_NAME$
|
|
33380
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33325
|
+
const config$l = {
|
|
33326
|
+
xmlName: XML_NODE_NAME$n,
|
|
33327
|
+
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
33381
33328
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33382
|
-
encode: encode$
|
|
33329
|
+
encode: encode$z,
|
|
33383
33330
|
attributes: validXmlAttributes$d
|
|
33384
33331
|
};
|
|
33385
|
-
const translator
|
|
33386
|
-
const encode$
|
|
33387
|
-
const decode$
|
|
33332
|
+
const translator$$ = NodeTranslator.from(config$l);
|
|
33333
|
+
const encode$y = (attributes) => attributes?.["w:val"];
|
|
33334
|
+
const decode$u = (attrs) => attrs?.fontSize;
|
|
33388
33335
|
const attrConfig$b = Object.freeze({
|
|
33389
33336
|
xmlName: "w:val",
|
|
33390
33337
|
sdName: "fontSize",
|
|
33391
|
-
encode: encode$
|
|
33392
|
-
decode: decode$
|
|
33338
|
+
encode: encode$y,
|
|
33339
|
+
decode: decode$u
|
|
33393
33340
|
});
|
|
33394
33341
|
const validXmlAttributes$c = [attrConfig$b];
|
|
33395
|
-
const XML_NODE_NAME$
|
|
33396
|
-
const SD_ATTR_KEY$
|
|
33397
|
-
const encode$
|
|
33342
|
+
const XML_NODE_NAME$m = "w:sz";
|
|
33343
|
+
const SD_ATTR_KEY$8 = "fontSize";
|
|
33344
|
+
const encode$x = (params2, encodedAttrs = {}) => {
|
|
33398
33345
|
const { nodes } = params2;
|
|
33399
33346
|
const node = nodes?.[0];
|
|
33400
33347
|
const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
|
|
33401
33348
|
return {
|
|
33402
33349
|
type: "attr",
|
|
33403
|
-
xmlName: XML_NODE_NAME$
|
|
33404
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33350
|
+
xmlName: XML_NODE_NAME$m,
|
|
33351
|
+
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
33405
33352
|
attributes: { "w:val": value ?? null }
|
|
33406
33353
|
};
|
|
33407
33354
|
};
|
|
33408
|
-
const config$
|
|
33409
|
-
xmlName: XML_NODE_NAME$
|
|
33410
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33355
|
+
const config$k = {
|
|
33356
|
+
xmlName: XML_NODE_NAME$m,
|
|
33357
|
+
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
33411
33358
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33412
|
-
encode: encode$
|
|
33359
|
+
encode: encode$x,
|
|
33413
33360
|
attributes: validXmlAttributes$c
|
|
33414
33361
|
};
|
|
33415
|
-
const translator$
|
|
33416
|
-
const encode$
|
|
33417
|
-
const decode$
|
|
33362
|
+
const translator$_ = NodeTranslator.from(config$k);
|
|
33363
|
+
const encode$w = (attributes) => attributes?.["w:val"];
|
|
33364
|
+
const decode$t = (attrs) => attrs?.fontSizeCs;
|
|
33418
33365
|
const attrConfig$a = Object.freeze({
|
|
33419
33366
|
xmlName: "w:val",
|
|
33420
33367
|
sdName: "fontSizeCs",
|
|
33421
|
-
encode: encode$
|
|
33422
|
-
decode: decode$
|
|
33368
|
+
encode: encode$w,
|
|
33369
|
+
decode: decode$t
|
|
33423
33370
|
});
|
|
33424
33371
|
const validXmlAttributes$b = [attrConfig$a];
|
|
33425
|
-
const XML_NODE_NAME$
|
|
33426
|
-
const SD_ATTR_KEY$
|
|
33427
|
-
const encode$
|
|
33372
|
+
const XML_NODE_NAME$l = "w:szCs";
|
|
33373
|
+
const SD_ATTR_KEY$7 = "fontSizeCs";
|
|
33374
|
+
const encode$v = (params2, encodedAttrs = {}) => {
|
|
33428
33375
|
const { nodes } = params2;
|
|
33429
33376
|
const node = nodes?.[0];
|
|
33430
33377
|
const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
|
|
33431
33378
|
return {
|
|
33432
33379
|
type: "attr",
|
|
33433
|
-
xmlName: XML_NODE_NAME$
|
|
33434
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33380
|
+
xmlName: XML_NODE_NAME$l,
|
|
33381
|
+
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
33435
33382
|
attributes: { "w:val": value ?? null }
|
|
33436
33383
|
};
|
|
33437
33384
|
};
|
|
33438
|
-
const config$
|
|
33439
|
-
xmlName: XML_NODE_NAME$
|
|
33440
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
33385
|
+
const config$j = {
|
|
33386
|
+
xmlName: XML_NODE_NAME$l,
|
|
33387
|
+
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
33441
33388
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33442
|
-
encode: encode$
|
|
33389
|
+
encode: encode$v,
|
|
33443
33390
|
attributes: validXmlAttributes$b
|
|
33444
33391
|
};
|
|
33445
|
-
const translator$
|
|
33392
|
+
const translator$Z = NodeTranslator.from(config$j);
|
|
33393
|
+
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
33394
|
+
handlerName,
|
|
33395
|
+
handler: (params2) => {
|
|
33396
|
+
const { nodes } = params2;
|
|
33397
|
+
if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
|
|
33398
|
+
return { nodes: [], consumed: 0 };
|
|
33399
|
+
}
|
|
33400
|
+
const result = translator2.encode(params2);
|
|
33401
|
+
if (!result) return { nodes: [], consumed: 0 };
|
|
33402
|
+
return {
|
|
33403
|
+
nodes: Array.isArray(result) ? result : [result],
|
|
33404
|
+
consumed: 1
|
|
33405
|
+
};
|
|
33406
|
+
}
|
|
33407
|
+
});
|
|
33408
|
+
function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
|
|
33409
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
33410
|
+
if (!transformEncode) transformEncode = (v2) => v2;
|
|
33411
|
+
if (!transformDecode) transformDecode = (v2) => v2;
|
|
33412
|
+
return {
|
|
33413
|
+
xmlName,
|
|
33414
|
+
sdNodeOrKeyName: sdName,
|
|
33415
|
+
encode: ({ nodes }) => {
|
|
33416
|
+
return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
|
|
33417
|
+
},
|
|
33418
|
+
decode: ({ node }) => {
|
|
33419
|
+
const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
|
|
33420
|
+
return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
|
|
33421
|
+
}
|
|
33422
|
+
};
|
|
33423
|
+
}
|
|
33424
|
+
function createMeasurementPropertyHandler(xmlName, sdName = null) {
|
|
33425
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
33426
|
+
return {
|
|
33427
|
+
xmlName,
|
|
33428
|
+
sdNodeOrKeyName: sdName,
|
|
33429
|
+
attributes: [
|
|
33430
|
+
createAttributeHandler("w:w", "value", parseInteger, integerToString),
|
|
33431
|
+
createAttributeHandler("w:type")
|
|
33432
|
+
],
|
|
33433
|
+
encode: (_2, encodedAttrs) => {
|
|
33434
|
+
return encodedAttrs["value"] != null ? encodedAttrs : void 0;
|
|
33435
|
+
},
|
|
33436
|
+
decode: function({ node }) {
|
|
33437
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
33438
|
+
return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
|
|
33439
|
+
}
|
|
33440
|
+
};
|
|
33441
|
+
}
|
|
33442
|
+
function createBorderPropertyHandler(xmlName, sdName = null) {
|
|
33443
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
33444
|
+
return {
|
|
33445
|
+
xmlName,
|
|
33446
|
+
sdNodeOrKeyName: sdName,
|
|
33447
|
+
attributes: [
|
|
33448
|
+
createAttributeHandler("w:val"),
|
|
33449
|
+
createAttributeHandler("w:color"),
|
|
33450
|
+
createAttributeHandler("w:themeColor"),
|
|
33451
|
+
createAttributeHandler("w:themeTint"),
|
|
33452
|
+
createAttributeHandler("w:themeShade"),
|
|
33453
|
+
createAttributeHandler("w:sz", "size", parseInteger, integerToString),
|
|
33454
|
+
createAttributeHandler("w:space", null, parseInteger, integerToString),
|
|
33455
|
+
createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
|
|
33456
|
+
createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
|
|
33457
|
+
],
|
|
33458
|
+
encode: (params2, encodedAttrs) => {
|
|
33459
|
+
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
33460
|
+
},
|
|
33461
|
+
decode: function({ node }, context) {
|
|
33462
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
33463
|
+
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
33464
|
+
}
|
|
33465
|
+
};
|
|
33466
|
+
}
|
|
33467
|
+
const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
|
|
33468
|
+
if (!transformEncode) transformEncode = (v2) => v2;
|
|
33469
|
+
if (!transformDecode) transformDecode = (v2) => v2;
|
|
33470
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
33471
|
+
return {
|
|
33472
|
+
xmlName,
|
|
33473
|
+
sdName,
|
|
33474
|
+
encode: (attributes) => transformEncode(attributes[xmlName]),
|
|
33475
|
+
decode: (attributes) => transformDecode(attributes[sdName])
|
|
33476
|
+
};
|
|
33477
|
+
};
|
|
33478
|
+
function encodeProperties(node, translatorsByXmlName, asArray = false) {
|
|
33479
|
+
if (!node?.elements || node.elements.length === 0) {
|
|
33480
|
+
return asArray ? [] : {};
|
|
33481
|
+
}
|
|
33482
|
+
const attributes = asArray ? [] : {};
|
|
33483
|
+
node.elements.forEach((el) => {
|
|
33484
|
+
const translator2 = translatorsByXmlName[el.name];
|
|
33485
|
+
if (translator2) {
|
|
33486
|
+
const encodedAttr = translator2.encode({ nodes: [el] });
|
|
33487
|
+
if (encodedAttr != null) {
|
|
33488
|
+
if (asArray) {
|
|
33489
|
+
attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
|
|
33490
|
+
} else {
|
|
33491
|
+
attributes[translator2.sdNodeOrKeyName] = encodedAttr;
|
|
33492
|
+
}
|
|
33493
|
+
}
|
|
33494
|
+
}
|
|
33495
|
+
});
|
|
33496
|
+
return attributes;
|
|
33497
|
+
}
|
|
33498
|
+
function decodeProperties(translatorsBySdName, properties) {
|
|
33499
|
+
if (!properties || typeof properties !== "object") {
|
|
33500
|
+
return [];
|
|
33501
|
+
}
|
|
33502
|
+
const elements = [];
|
|
33503
|
+
Object.keys(properties).forEach((key2) => {
|
|
33504
|
+
const translator2 = translatorsBySdName[key2];
|
|
33505
|
+
if (translator2) {
|
|
33506
|
+
const result = translator2.decode({ node: { attrs: { [key2]: properties[key2] } } });
|
|
33507
|
+
if (result != null) {
|
|
33508
|
+
result.name = translator2.xmlName;
|
|
33509
|
+
elements.push(result);
|
|
33510
|
+
}
|
|
33511
|
+
}
|
|
33512
|
+
});
|
|
33513
|
+
return elements;
|
|
33514
|
+
}
|
|
33515
|
+
const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
|
|
33516
|
+
const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
|
|
33517
|
+
const parseInteger = (value) => {
|
|
33518
|
+
if (value == null) return void 0;
|
|
33519
|
+
const intValue = parseInt(value, 10);
|
|
33520
|
+
return isNaN(intValue) ? void 0 : intValue;
|
|
33521
|
+
};
|
|
33522
|
+
const integerToString = (value) => {
|
|
33523
|
+
const intValue = parseInteger(value);
|
|
33524
|
+
return intValue != void 0 ? String(intValue) : void 0;
|
|
33525
|
+
};
|
|
33526
|
+
const XML_NODE_NAME$k = "w:caps";
|
|
33527
|
+
const SD_ATTR_KEY$6 = "textTransform";
|
|
33528
|
+
const encode$u = (params2, encodedAttrs = {}) => {
|
|
33529
|
+
const { nodes } = params2;
|
|
33530
|
+
const node = nodes[0];
|
|
33531
|
+
if (!node) return void 0;
|
|
33532
|
+
let result;
|
|
33533
|
+
if (!["false", "0"].includes(encodedAttrs.val)) {
|
|
33534
|
+
result = "uppercase";
|
|
33535
|
+
} else {
|
|
33536
|
+
return void 0;
|
|
33537
|
+
}
|
|
33538
|
+
return {
|
|
33539
|
+
type: "attr",
|
|
33540
|
+
xmlName: XML_NODE_NAME$k,
|
|
33541
|
+
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
33542
|
+
attributes: { [SD_ATTR_KEY$6]: result }
|
|
33543
|
+
};
|
|
33544
|
+
};
|
|
33545
|
+
const config$i = {
|
|
33546
|
+
xmlName: XML_NODE_NAME$k,
|
|
33547
|
+
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
33548
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33549
|
+
encode: encode$u,
|
|
33550
|
+
attributes: [createAttributeHandler("w:val")]
|
|
33551
|
+
};
|
|
33552
|
+
const translator$Y = NodeTranslator.from(config$i);
|
|
33446
33553
|
const runPropertyTranslators = Object.freeze({
|
|
33447
|
-
"w:b": translator$
|
|
33448
|
-
"w:i": translator$
|
|
33449
|
-
"w:u": translator$
|
|
33450
|
-
"w:strike": translator
|
|
33451
|
-
"w:color": translator$
|
|
33452
|
-
"w:highlight": translator$
|
|
33453
|
-
"w:rFonts": translator$
|
|
33454
|
-
"w:rStyle": translator
|
|
33455
|
-
"w:sz": translator$
|
|
33456
|
-
"w:szCs": translator$
|
|
33554
|
+
"w:b": translator$15,
|
|
33555
|
+
"w:i": translator$14,
|
|
33556
|
+
"w:u": translator$13,
|
|
33557
|
+
"w:strike": translator$12,
|
|
33558
|
+
"w:color": translator$11,
|
|
33559
|
+
"w:highlight": translator$18,
|
|
33560
|
+
"w:rFonts": translator$10,
|
|
33561
|
+
"w:rStyle": translator$$,
|
|
33562
|
+
"w:sz": translator$_,
|
|
33563
|
+
"w:szCs": translator$Z,
|
|
33564
|
+
"w:caps": translator$Y
|
|
33457
33565
|
});
|
|
33458
33566
|
const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
|
|
33459
33567
|
const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
|
|
@@ -33467,9 +33575,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33467
33575
|
attributes: { ...candidate.attributes || {} }
|
|
33468
33576
|
};
|
|
33469
33577
|
};
|
|
33470
|
-
const XML_NODE_NAME$
|
|
33578
|
+
const XML_NODE_NAME$j = "w:rPr";
|
|
33471
33579
|
const SD_ATTR_KEY$5 = "runProperties";
|
|
33472
|
-
const encode$
|
|
33580
|
+
const encode$t = (params2) => {
|
|
33473
33581
|
const { nodes } = params2;
|
|
33474
33582
|
const node = nodes?.[0] || {};
|
|
33475
33583
|
const contents = Array.isArray(node.elements) ? node.elements : [];
|
|
@@ -33503,16 +33611,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33503
33611
|
attributes: runPropsArray
|
|
33504
33612
|
};
|
|
33505
33613
|
};
|
|
33506
|
-
const config$
|
|
33507
|
-
xmlName: XML_NODE_NAME$
|
|
33614
|
+
const config$h = {
|
|
33615
|
+
xmlName: XML_NODE_NAME$j,
|
|
33508
33616
|
sdNodeOrKeyName: SD_ATTR_KEY$5,
|
|
33509
33617
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33510
|
-
encode: encode$
|
|
33618
|
+
encode: encode$t
|
|
33511
33619
|
};
|
|
33512
|
-
const translator$
|
|
33620
|
+
const translator$X = NodeTranslator.from(config$h);
|
|
33513
33621
|
const EAST_ASIAN_CHARACTER_REGEX = /[\u1100-\u11FF\u2E80-\u2EFF\u2F00-\u2FDF\u3040-\u30FF\u3100-\u312F\u3130-\u318F\u31A0-\u31BF\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/u;
|
|
33514
33622
|
const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
|
|
33515
|
-
const collectRunProperties = (params2, rPrNode, translator2 = translator$
|
|
33623
|
+
const collectRunProperties = (params2, rPrNode, translator2 = translator$X) => {
|
|
33516
33624
|
if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
|
|
33517
33625
|
const result = translator2.encode({ ...params2, nodes: [rPrNode] }) || {};
|
|
33518
33626
|
let entries = [];
|
|
@@ -33581,7 +33689,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33581
33689
|
};
|
|
33582
33690
|
const deriveStyleMarks = ({ docx, paragraphStyleId, runStyleId }) => {
|
|
33583
33691
|
const paragraphStyleMarks = collectStyleMarks(paragraphStyleId, docx);
|
|
33584
|
-
|
|
33692
|
+
if (paragraphStyleId?.startsWith("TOC")) {
|
|
33693
|
+
return paragraphStyleMarks;
|
|
33694
|
+
}
|
|
33695
|
+
let runStyleMarks = collectStyleMarks(runStyleId, docx);
|
|
33585
33696
|
const inlineMarks = mergeInlineMarkSets(paragraphStyleMarks.inlineMarks, runStyleMarks.inlineMarks);
|
|
33586
33697
|
const textStyleAttrs = mergeTextStyleAttrs(paragraphStyleMarks.textStyleAttrs, runStyleMarks.textStyleAttrs);
|
|
33587
33698
|
return { inlineMarks, textStyleAttrs };
|
|
@@ -33807,6 +33918,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33807
33918
|
}
|
|
33808
33919
|
break;
|
|
33809
33920
|
}
|
|
33921
|
+
case "w:caps": {
|
|
33922
|
+
if (attributes["textTransform"] != null) {
|
|
33923
|
+
hasTextStyle = true;
|
|
33924
|
+
textStyleAttrs.textTransform = attributes["textTransform"];
|
|
33925
|
+
}
|
|
33926
|
+
break;
|
|
33927
|
+
}
|
|
33810
33928
|
case "w:rFonts": {
|
|
33811
33929
|
const asciiFamily = attributes["w:ascii"] || attributes["w:hAnsi"] || (attributes["w:eastAsia"] ? void 0 : attributes["w:val"]);
|
|
33812
33930
|
const eastAsiaFamily = attributes["w:eastAsia"];
|
|
@@ -33826,9 +33944,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33826
33944
|
case "w:sz":
|
|
33827
33945
|
case "w:szCs": {
|
|
33828
33946
|
const rawSize = Number(attributes["w:val"]);
|
|
33947
|
+
const attrName = entry.xmlName === "w:sz" ? "fontSize" : "fontSizeCs";
|
|
33829
33948
|
if (Number.isFinite(rawSize) && rawSize > 0) {
|
|
33830
33949
|
hasTextStyle = true;
|
|
33831
|
-
textStyleAttrs
|
|
33950
|
+
textStyleAttrs[attrName] = `${rawSize / 2}pt`;
|
|
33832
33951
|
}
|
|
33833
33952
|
break;
|
|
33834
33953
|
}
|
|
@@ -33974,46 +34093,166 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33974
34093
|
}
|
|
33975
34094
|
return runs;
|
|
33976
34095
|
};
|
|
33977
|
-
const
|
|
34096
|
+
const XML_NODE_NAME$i = "w:hyperlink";
|
|
34097
|
+
const SD_NODE_NAME$c = "link";
|
|
34098
|
+
const _createAttributeHandler = (xmlName, sdName) => ({
|
|
34099
|
+
xmlName,
|
|
34100
|
+
sdName,
|
|
34101
|
+
encode: (attributes) => attributes[xmlName],
|
|
34102
|
+
decode: (attributes) => attributes[sdName]
|
|
34103
|
+
});
|
|
34104
|
+
const validXmlAttributes$a = [
|
|
34105
|
+
_createAttributeHandler("w:anchor", "anchor"),
|
|
34106
|
+
_createAttributeHandler("w:docLocation", "docLocation"),
|
|
34107
|
+
{
|
|
34108
|
+
xmlName: "w:history",
|
|
34109
|
+
sdName: "history",
|
|
34110
|
+
encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
|
|
34111
|
+
decode: (attributes) => attributes["history"] ? "1" : "0"
|
|
34112
|
+
},
|
|
34113
|
+
_createAttributeHandler("w:tooltip", "tooltip"),
|
|
34114
|
+
_createAttributeHandler("r:id", "rId"),
|
|
34115
|
+
_createAttributeHandler("w:tgtFrame", "target")
|
|
34116
|
+
];
|
|
34117
|
+
const encode$s = (params2, encodedAttrs) => {
|
|
34118
|
+
const { nodes, docx, nodeListHandler } = params2;
|
|
34119
|
+
const node = nodes[0];
|
|
34120
|
+
let href = _resolveHref(docx, encodedAttrs);
|
|
34121
|
+
const linkMark = { type: "link", attrs: { ...encodedAttrs, href } };
|
|
34122
|
+
const referenceNodeTypes = ["sd:pageReference", "sd:autoPageNumber", "sd:totalPageNumber"];
|
|
34123
|
+
const contentNodes = node.elements.filter((el) => el.name === "w:r" || referenceNodeTypes.includes(el.name));
|
|
34124
|
+
contentNodes.forEach((contentNode) => {
|
|
34125
|
+
const existingMarks = Array.isArray(contentNode.marks) ? contentNode.marks : [];
|
|
34126
|
+
const marksWithoutLink = existingMarks.filter((mark) => mark?.type !== "link");
|
|
34127
|
+
contentNode.marks = [...marksWithoutLink, linkMark];
|
|
34128
|
+
});
|
|
34129
|
+
const updatedNode = nodeListHandler.handler({
|
|
34130
|
+
...params2,
|
|
34131
|
+
nodes: contentNodes,
|
|
34132
|
+
path: [...params2.path || [], node]
|
|
34133
|
+
});
|
|
34134
|
+
return updatedNode;
|
|
34135
|
+
};
|
|
34136
|
+
const _resolveHref = (docx, encodedAttrs) => {
|
|
34137
|
+
const rels = docx["word/_rels/document.xml.rels"];
|
|
34138
|
+
const relationships = rels.elements.find((el) => el.name === "Relationships");
|
|
34139
|
+
const { elements } = relationships;
|
|
34140
|
+
const { rId, anchor } = encodedAttrs;
|
|
34141
|
+
let href;
|
|
34142
|
+
if (!rId && anchor) {
|
|
34143
|
+
href = `#${anchor}`;
|
|
34144
|
+
} else if (rId) {
|
|
34145
|
+
const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
|
|
34146
|
+
const { attributes: relAttributes = {} } = rel;
|
|
34147
|
+
href = relAttributes["Target"];
|
|
34148
|
+
}
|
|
34149
|
+
return href;
|
|
34150
|
+
};
|
|
34151
|
+
function decode$s(params2) {
|
|
34152
|
+
const { hyperlinkGroup = [params2.node] } = params2.extraParams || {};
|
|
34153
|
+
const node = hyperlinkGroup[0];
|
|
34154
|
+
const linkMark = node.marks.find((m2) => m2.type === "link");
|
|
34155
|
+
const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
|
|
34156
|
+
let { anchor, href: link } = linkMark.attrs;
|
|
34157
|
+
const isExternalLink = !anchor;
|
|
34158
|
+
if (isExternalLink) {
|
|
34159
|
+
linkAttrs["r:id"] = _addNewLinkRelationship(params2, link, linkAttrs["r:id"]);
|
|
34160
|
+
}
|
|
34161
|
+
let contentNodes = [];
|
|
34162
|
+
hyperlinkGroup.forEach((linkNode) => {
|
|
34163
|
+
if ("marks" in linkNode) {
|
|
34164
|
+
linkNode.marks = linkNode.marks.filter((m2) => m2.type !== "link");
|
|
34165
|
+
} else {
|
|
34166
|
+
linkNode.attrs.marksAsAttrs = linkNode.attrs.marksAsAttrs.filter((m2) => m2.type !== "link");
|
|
34167
|
+
}
|
|
34168
|
+
const outputNode = exportSchemaToJson({ ...params2, node: linkNode });
|
|
34169
|
+
if (outputNode) {
|
|
34170
|
+
if (outputNode instanceof Array) contentNodes.push(...outputNode);
|
|
34171
|
+
else contentNodes.push(outputNode);
|
|
34172
|
+
}
|
|
34173
|
+
});
|
|
34174
|
+
const newNode = {
|
|
34175
|
+
name: "w:hyperlink",
|
|
34176
|
+
type: "element",
|
|
34177
|
+
attributes: {
|
|
34178
|
+
...linkAttrs
|
|
34179
|
+
},
|
|
34180
|
+
elements: contentNodes
|
|
34181
|
+
};
|
|
34182
|
+
return newNode;
|
|
34183
|
+
}
|
|
34184
|
+
function _addNewLinkRelationship(params2, link, rId) {
|
|
34185
|
+
if (!rId) rId = generateDocxRandomId();
|
|
34186
|
+
if (!params2.relationships || !Array.isArray(params2.relationships)) {
|
|
34187
|
+
params2.relationships = [];
|
|
34188
|
+
}
|
|
34189
|
+
const existingRel = params2.relationships.find(
|
|
34190
|
+
(rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
|
|
34191
|
+
);
|
|
34192
|
+
if (existingRel) {
|
|
34193
|
+
return rId;
|
|
34194
|
+
}
|
|
34195
|
+
params2.relationships.push({
|
|
34196
|
+
type: "element",
|
|
34197
|
+
name: "Relationship",
|
|
34198
|
+
attributes: {
|
|
34199
|
+
Id: rId,
|
|
34200
|
+
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
34201
|
+
Target: link,
|
|
34202
|
+
TargetMode: "External"
|
|
34203
|
+
}
|
|
34204
|
+
});
|
|
34205
|
+
return rId;
|
|
34206
|
+
}
|
|
34207
|
+
const config$g = {
|
|
34208
|
+
xmlName: XML_NODE_NAME$i,
|
|
34209
|
+
sdNodeOrKeyName: SD_NODE_NAME$c,
|
|
34210
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
34211
|
+
encode: encode$s,
|
|
34212
|
+
decode: decode$s,
|
|
34213
|
+
attributes: validXmlAttributes$a
|
|
34214
|
+
};
|
|
34215
|
+
const translator$W = NodeTranslator.from(config$g);
|
|
34216
|
+
const encode$r = (attributes) => {
|
|
33978
34217
|
return attributes["w:rsidR"];
|
|
33979
34218
|
};
|
|
33980
|
-
const decode$
|
|
34219
|
+
const decode$r = (attrs) => {
|
|
33981
34220
|
return attrs.rsidR;
|
|
33982
34221
|
};
|
|
33983
34222
|
const attrConfig$9 = Object.freeze({
|
|
33984
34223
|
xmlName: "w:rsidR",
|
|
33985
34224
|
sdName: "rsidR",
|
|
33986
|
-
encode: encode$
|
|
33987
|
-
decode: decode$
|
|
34225
|
+
encode: encode$r,
|
|
34226
|
+
decode: decode$r
|
|
33988
34227
|
});
|
|
33989
|
-
const encode$
|
|
34228
|
+
const encode$q = (attributes) => {
|
|
33990
34229
|
return attributes["w:rsidRPr"];
|
|
33991
34230
|
};
|
|
33992
|
-
const decode$
|
|
34231
|
+
const decode$q = (attrs) => {
|
|
33993
34232
|
return attrs.rsidRPr;
|
|
33994
34233
|
};
|
|
33995
34234
|
const attrConfig$8 = Object.freeze({
|
|
33996
34235
|
xmlName: "w:rsidRPr",
|
|
33997
34236
|
sdName: "rsidRPr",
|
|
33998
|
-
encode: encode$
|
|
33999
|
-
decode: decode$
|
|
34237
|
+
encode: encode$q,
|
|
34238
|
+
decode: decode$q
|
|
34000
34239
|
});
|
|
34001
|
-
const encode$
|
|
34240
|
+
const encode$p = (attributes) => {
|
|
34002
34241
|
return attributes["w:rsidDel"];
|
|
34003
34242
|
};
|
|
34004
|
-
const decode$
|
|
34243
|
+
const decode$p = (attrs) => {
|
|
34005
34244
|
return attrs.rsidDel;
|
|
34006
34245
|
};
|
|
34007
34246
|
const attrConfig$7 = Object.freeze({
|
|
34008
34247
|
xmlName: "w:rsidDel",
|
|
34009
34248
|
sdName: "rsidDel",
|
|
34010
|
-
encode: encode$
|
|
34011
|
-
decode: decode$
|
|
34249
|
+
encode: encode$p,
|
|
34250
|
+
decode: decode$p
|
|
34012
34251
|
});
|
|
34013
|
-
const validXmlAttributes$
|
|
34014
|
-
const XML_NODE_NAME$
|
|
34252
|
+
const validXmlAttributes$9 = [attrConfig$9, attrConfig$8, attrConfig$7];
|
|
34253
|
+
const XML_NODE_NAME$h = "w:r";
|
|
34015
34254
|
const SD_KEY_NAME = "run";
|
|
34016
|
-
const encode$
|
|
34255
|
+
const encode$o = (params2, encodedAttrs = {}) => {
|
|
34017
34256
|
const { nodes = [], nodeListHandler } = params2 || {};
|
|
34018
34257
|
const runNode = nodes[0];
|
|
34019
34258
|
if (!runNode) return void 0;
|
|
@@ -34061,9 +34300,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34061
34300
|
}
|
|
34062
34301
|
return runNodeResult;
|
|
34063
34302
|
};
|
|
34064
|
-
const decode$
|
|
34303
|
+
const decode$o = (params2, decodedAttrs = {}) => {
|
|
34065
34304
|
const { node } = params2 || {};
|
|
34066
34305
|
if (!node) return void 0;
|
|
34306
|
+
const isLinkNode = node.marks?.some((m2) => m2.type === "link");
|
|
34307
|
+
if (isLinkNode) return translator$W.decode(params2);
|
|
34067
34308
|
const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
|
|
34068
34309
|
const runAttrs = runNodeForExport.attrs || {};
|
|
34069
34310
|
const runProperties = Array.isArray(runAttrs.runProperties) ? runAttrs.runProperties : [];
|
|
@@ -34118,7 +34359,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34118
34359
|
runs.push(trackedClone);
|
|
34119
34360
|
return;
|
|
34120
34361
|
}
|
|
34121
|
-
const runWrapper = { name: XML_NODE_NAME$
|
|
34362
|
+
const runWrapper = { name: XML_NODE_NAME$h, elements: [] };
|
|
34122
34363
|
applyBaseRunProps(runWrapper);
|
|
34123
34364
|
if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
|
|
34124
34365
|
runWrapper.elements.push(cloneXmlNode(child));
|
|
@@ -34126,7 +34367,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34126
34367
|
});
|
|
34127
34368
|
const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
|
|
34128
34369
|
if (!trackedRuns.length) {
|
|
34129
|
-
const emptyRun = { name: XML_NODE_NAME$
|
|
34370
|
+
const emptyRun = { name: XML_NODE_NAME$h, elements: [] };
|
|
34130
34371
|
applyBaseRunProps(emptyRun);
|
|
34131
34372
|
trackedRuns.push(emptyRun);
|
|
34132
34373
|
}
|
|
@@ -34140,148 +34381,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34140
34381
|
}
|
|
34141
34382
|
return trackedRuns;
|
|
34142
34383
|
};
|
|
34143
|
-
const config$
|
|
34144
|
-
xmlName: XML_NODE_NAME$
|
|
34384
|
+
const config$f = {
|
|
34385
|
+
xmlName: XML_NODE_NAME$h,
|
|
34145
34386
|
sdNodeOrKeyName: SD_KEY_NAME,
|
|
34146
34387
|
type: NodeTranslator.translatorTypes.NODE,
|
|
34147
|
-
encode: encode$
|
|
34148
|
-
decode: decode$
|
|
34149
|
-
attributes: validXmlAttributes$
|
|
34150
|
-
};
|
|
34151
|
-
const translator$U = NodeTranslator.from(config$e);
|
|
34152
|
-
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
34153
|
-
handlerName,
|
|
34154
|
-
handler: (params2) => {
|
|
34155
|
-
const { nodes } = params2;
|
|
34156
|
-
if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
|
|
34157
|
-
return { nodes: [], consumed: 0 };
|
|
34158
|
-
}
|
|
34159
|
-
const result = translator2.encode(params2);
|
|
34160
|
-
if (!result) return { nodes: [], consumed: 0 };
|
|
34161
|
-
return {
|
|
34162
|
-
nodes: Array.isArray(result) ? result : [result],
|
|
34163
|
-
consumed: 1
|
|
34164
|
-
};
|
|
34165
|
-
}
|
|
34166
|
-
});
|
|
34167
|
-
function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
|
|
34168
|
-
if (!sdName) sdName = xmlName.split(":")[1];
|
|
34169
|
-
if (!transformEncode) transformEncode = (v2) => v2;
|
|
34170
|
-
if (!transformDecode) transformDecode = (v2) => v2;
|
|
34171
|
-
return {
|
|
34172
|
-
xmlName,
|
|
34173
|
-
sdNodeOrKeyName: sdName,
|
|
34174
|
-
encode: ({ nodes }) => {
|
|
34175
|
-
return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
|
|
34176
|
-
},
|
|
34177
|
-
decode: ({ node }) => {
|
|
34178
|
-
const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
|
|
34179
|
-
return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
|
|
34180
|
-
}
|
|
34181
|
-
};
|
|
34182
|
-
}
|
|
34183
|
-
function createMeasurementPropertyHandler(xmlName, sdName = null) {
|
|
34184
|
-
if (!sdName) sdName = xmlName.split(":")[1];
|
|
34185
|
-
return {
|
|
34186
|
-
xmlName,
|
|
34187
|
-
sdNodeOrKeyName: sdName,
|
|
34188
|
-
attributes: [
|
|
34189
|
-
createAttributeHandler("w:w", "value", parseInteger, integerToString),
|
|
34190
|
-
createAttributeHandler("w:type")
|
|
34191
|
-
],
|
|
34192
|
-
encode: (_2, encodedAttrs) => {
|
|
34193
|
-
return encodedAttrs["value"] != null ? encodedAttrs : void 0;
|
|
34194
|
-
},
|
|
34195
|
-
decode: function({ node }) {
|
|
34196
|
-
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
34197
|
-
return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
|
|
34198
|
-
}
|
|
34199
|
-
};
|
|
34200
|
-
}
|
|
34201
|
-
function createBorderPropertyHandler(xmlName, sdName = null) {
|
|
34202
|
-
if (!sdName) sdName = xmlName.split(":")[1];
|
|
34203
|
-
return {
|
|
34204
|
-
xmlName,
|
|
34205
|
-
sdNodeOrKeyName: sdName,
|
|
34206
|
-
attributes: [
|
|
34207
|
-
createAttributeHandler("w:val"),
|
|
34208
|
-
createAttributeHandler("w:color"),
|
|
34209
|
-
createAttributeHandler("w:themeColor"),
|
|
34210
|
-
createAttributeHandler("w:themeTint"),
|
|
34211
|
-
createAttributeHandler("w:themeShade"),
|
|
34212
|
-
createAttributeHandler("w:sz", "size", parseInteger, integerToString),
|
|
34213
|
-
createAttributeHandler("w:space", null, parseInteger, integerToString),
|
|
34214
|
-
createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
|
|
34215
|
-
createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
|
|
34216
|
-
],
|
|
34217
|
-
encode: (params2, encodedAttrs) => {
|
|
34218
|
-
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
34219
|
-
},
|
|
34220
|
-
decode: function({ node }, context) {
|
|
34221
|
-
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
34222
|
-
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
34223
|
-
}
|
|
34224
|
-
};
|
|
34225
|
-
}
|
|
34226
|
-
const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
|
|
34227
|
-
if (!transformEncode) transformEncode = (v2) => v2;
|
|
34228
|
-
if (!transformDecode) transformDecode = (v2) => v2;
|
|
34229
|
-
if (!sdName) sdName = xmlName.split(":")[1];
|
|
34230
|
-
return {
|
|
34231
|
-
xmlName,
|
|
34232
|
-
sdName,
|
|
34233
|
-
encode: (attributes) => transformEncode(attributes[xmlName]),
|
|
34234
|
-
decode: (attributes) => transformDecode(attributes[sdName])
|
|
34235
|
-
};
|
|
34236
|
-
};
|
|
34237
|
-
function encodeProperties(node, translatorsByXmlName, asArray = false) {
|
|
34238
|
-
if (!node?.elements || node.elements.length === 0) {
|
|
34239
|
-
return asArray ? [] : {};
|
|
34240
|
-
}
|
|
34241
|
-
const attributes = asArray ? [] : {};
|
|
34242
|
-
node.elements.forEach((el) => {
|
|
34243
|
-
const translator2 = translatorsByXmlName[el.name];
|
|
34244
|
-
if (translator2) {
|
|
34245
|
-
const encodedAttr = translator2.encode({ nodes: [el] });
|
|
34246
|
-
if (encodedAttr != null) {
|
|
34247
|
-
if (asArray) {
|
|
34248
|
-
attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
|
|
34249
|
-
} else {
|
|
34250
|
-
attributes[translator2.sdNodeOrKeyName] = encodedAttr;
|
|
34251
|
-
}
|
|
34252
|
-
}
|
|
34253
|
-
}
|
|
34254
|
-
});
|
|
34255
|
-
return attributes;
|
|
34256
|
-
}
|
|
34257
|
-
function decodeProperties(translatorsBySdName, properties) {
|
|
34258
|
-
if (!properties || typeof properties !== "object") {
|
|
34259
|
-
return [];
|
|
34260
|
-
}
|
|
34261
|
-
const elements = [];
|
|
34262
|
-
Object.keys(properties).forEach((key2) => {
|
|
34263
|
-
const translator2 = translatorsBySdName[key2];
|
|
34264
|
-
if (translator2) {
|
|
34265
|
-
const result = translator2.decode({ node: { attrs: { [key2]: properties[key2] } } });
|
|
34266
|
-
if (result != null) {
|
|
34267
|
-
result.name = translator2.xmlName;
|
|
34268
|
-
elements.push(result);
|
|
34269
|
-
}
|
|
34270
|
-
}
|
|
34271
|
-
});
|
|
34272
|
-
return elements;
|
|
34273
|
-
}
|
|
34274
|
-
const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
|
|
34275
|
-
const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
|
|
34276
|
-
const parseInteger = (value) => {
|
|
34277
|
-
if (value == null) return void 0;
|
|
34278
|
-
const intValue = parseInt(value, 10);
|
|
34279
|
-
return isNaN(intValue) ? void 0 : intValue;
|
|
34280
|
-
};
|
|
34281
|
-
const integerToString = (value) => {
|
|
34282
|
-
const intValue = parseInteger(value);
|
|
34283
|
-
return intValue != void 0 ? String(intValue) : void 0;
|
|
34388
|
+
encode: encode$o,
|
|
34389
|
+
decode: decode$o,
|
|
34390
|
+
attributes: validXmlAttributes$9
|
|
34284
34391
|
};
|
|
34392
|
+
const translator$V = NodeTranslator.from(config$f);
|
|
34285
34393
|
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
34286
34394
|
if (!table || !Array.isArray(table.content)) {
|
|
34287
34395
|
return table;
|
|
@@ -34322,13 +34430,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34322
34430
|
}
|
|
34323
34431
|
return table;
|
|
34324
34432
|
}
|
|
34325
|
-
const translator$
|
|
34433
|
+
const translator$U = NodeTranslator.from({
|
|
34326
34434
|
xmlName: "w:cantSplit",
|
|
34327
34435
|
sdNodeOrKeyName: "cantSplit",
|
|
34328
34436
|
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34329
34437
|
decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
|
|
34330
34438
|
});
|
|
34331
|
-
const translator$
|
|
34439
|
+
const translator$T = NodeTranslator.from({
|
|
34332
34440
|
xmlName: "w:cnfStyle",
|
|
34333
34441
|
sdNodeOrKeyName: "cnfStyle",
|
|
34334
34442
|
attributes: [
|
|
@@ -34354,8 +34462,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34354
34462
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
34355
34463
|
}
|
|
34356
34464
|
});
|
|
34357
|
-
const translator$
|
|
34358
|
-
const translator$
|
|
34465
|
+
const translator$S = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
34466
|
+
const translator$R = NodeTranslator.from(
|
|
34359
34467
|
createSingleAttrPropertyHandler(
|
|
34360
34468
|
"w:gridAfter",
|
|
34361
34469
|
null,
|
|
@@ -34364,7 +34472,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34364
34472
|
(v2) => integerToString(v2)
|
|
34365
34473
|
)
|
|
34366
34474
|
);
|
|
34367
|
-
const translator$
|
|
34475
|
+
const translator$Q = NodeTranslator.from(
|
|
34368
34476
|
createSingleAttrPropertyHandler(
|
|
34369
34477
|
"w:gridBefore",
|
|
34370
34478
|
null,
|
|
@@ -34373,21 +34481,21 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34373
34481
|
(v2) => integerToString(v2)
|
|
34374
34482
|
)
|
|
34375
34483
|
);
|
|
34376
|
-
const translator$
|
|
34484
|
+
const translator$P = NodeTranslator.from({
|
|
34377
34485
|
xmlName: "w:hidden",
|
|
34378
34486
|
sdNodeOrKeyName: "hidden",
|
|
34379
34487
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34380
34488
|
decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
|
|
34381
34489
|
});
|
|
34382
|
-
const translator$
|
|
34383
|
-
const translator$
|
|
34384
|
-
const translator$
|
|
34490
|
+
const translator$O = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
|
|
34491
|
+
const translator$N = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
|
|
34492
|
+
const translator$M = NodeTranslator.from({
|
|
34385
34493
|
xmlName: "w:tblHeader",
|
|
34386
34494
|
sdNodeOrKeyName: "repeatHeader",
|
|
34387
34495
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34388
34496
|
decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
|
|
34389
34497
|
});
|
|
34390
|
-
const translator$
|
|
34498
|
+
const translator$L = NodeTranslator.from({
|
|
34391
34499
|
xmlName: "w:trHeight",
|
|
34392
34500
|
sdNodeOrKeyName: "rowHeight",
|
|
34393
34501
|
encode: ({ nodes }) => {
|
|
@@ -34414,11 +34522,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34414
34522
|
return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
|
|
34415
34523
|
}
|
|
34416
34524
|
});
|
|
34417
|
-
const translator$
|
|
34418
|
-
const translator$
|
|
34419
|
-
const XML_NODE_NAME$
|
|
34525
|
+
const translator$K = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
34526
|
+
const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
34527
|
+
const XML_NODE_NAME$g = "w:trPr";
|
|
34420
34528
|
const SD_ATTR_KEY$4 = "tableRowProperties";
|
|
34421
|
-
const encode$
|
|
34529
|
+
const encode$n = (params2) => {
|
|
34422
34530
|
const { nodes } = params2;
|
|
34423
34531
|
const node = nodes[0];
|
|
34424
34532
|
let attributes = {
|
|
@@ -34432,12 +34540,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34432
34540
|
};
|
|
34433
34541
|
return {
|
|
34434
34542
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
34435
|
-
xmlName: XML_NODE_NAME$
|
|
34543
|
+
xmlName: XML_NODE_NAME$g,
|
|
34436
34544
|
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
34437
34545
|
attributes
|
|
34438
34546
|
};
|
|
34439
34547
|
};
|
|
34440
|
-
const decode$
|
|
34548
|
+
const decode$n = (params2) => {
|
|
34441
34549
|
const { tableRowProperties = {} } = params2.node.attrs || {};
|
|
34442
34550
|
const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
|
|
34443
34551
|
const newNode = {
|
|
@@ -34449,6 +34557,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34449
34557
|
return newNode;
|
|
34450
34558
|
};
|
|
34451
34559
|
const propertyTranslators$3 = [
|
|
34560
|
+
translator$U,
|
|
34452
34561
|
translator$T,
|
|
34453
34562
|
translator$S,
|
|
34454
34563
|
translator$R,
|
|
@@ -34459,8 +34568,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34459
34568
|
translator$M,
|
|
34460
34569
|
translator$L,
|
|
34461
34570
|
translator$K,
|
|
34462
|
-
translator$J
|
|
34463
|
-
translator$I
|
|
34571
|
+
translator$J
|
|
34464
34572
|
];
|
|
34465
34573
|
const propertyTranslatorsByXmlName$2 = {};
|
|
34466
34574
|
propertyTranslators$3.forEach((translator2) => {
|
|
@@ -34470,25 +34578,25 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34470
34578
|
propertyTranslators$3.forEach((translator2) => {
|
|
34471
34579
|
propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
|
|
34472
34580
|
});
|
|
34473
|
-
const config$
|
|
34474
|
-
xmlName: XML_NODE_NAME$
|
|
34581
|
+
const config$e = {
|
|
34582
|
+
xmlName: XML_NODE_NAME$g,
|
|
34475
34583
|
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
34476
34584
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
34477
|
-
encode: encode$
|
|
34478
|
-
decode: decode$
|
|
34585
|
+
encode: encode$n,
|
|
34586
|
+
decode: decode$n
|
|
34479
34587
|
};
|
|
34480
|
-
const translator$
|
|
34481
|
-
const XML_NODE_NAME$
|
|
34482
|
-
const SD_NODE_NAME$
|
|
34483
|
-
const validXmlAttributes$
|
|
34588
|
+
const translator$I = NodeTranslator.from(config$e);
|
|
34589
|
+
const XML_NODE_NAME$f = "w:tr";
|
|
34590
|
+
const SD_NODE_NAME$b = "tableRow";
|
|
34591
|
+
const validXmlAttributes$8 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
34484
34592
|
(xmlName) => createAttributeHandler(xmlName)
|
|
34485
34593
|
);
|
|
34486
|
-
const encode$
|
|
34594
|
+
const encode$m = (params2, encodedAttrs) => {
|
|
34487
34595
|
const { row } = params2.extraParams;
|
|
34488
34596
|
let tableRowProperties = {};
|
|
34489
34597
|
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
34490
34598
|
if (tPr) {
|
|
34491
|
-
({ attributes: tableRowProperties } = translator$
|
|
34599
|
+
({ attributes: tableRowProperties } = translator$I.encode({
|
|
34492
34600
|
...params2,
|
|
34493
34601
|
nodes: [tPr]
|
|
34494
34602
|
}));
|
|
@@ -34501,7 +34609,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34501
34609
|
let currentColumnIndex = 0;
|
|
34502
34610
|
const content = cellNodes?.map((n) => {
|
|
34503
34611
|
let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
|
|
34504
|
-
const result = translator$
|
|
34612
|
+
const result = translator$9.encode({
|
|
34505
34613
|
...params2,
|
|
34506
34614
|
extraParams: {
|
|
34507
34615
|
...params2.extraParams,
|
|
@@ -34523,7 +34631,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34523
34631
|
};
|
|
34524
34632
|
return newNode;
|
|
34525
34633
|
};
|
|
34526
|
-
const decode$
|
|
34634
|
+
const decode$m = (params2, decodedAttrs) => {
|
|
34527
34635
|
const { node } = params2;
|
|
34528
34636
|
const elements = translateChildNodes(params2);
|
|
34529
34637
|
if (node.attrs?.tableRowProperties) {
|
|
@@ -34535,7 +34643,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34535
34643
|
}
|
|
34536
34644
|
}
|
|
34537
34645
|
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
34538
|
-
const trPr = translator$
|
|
34646
|
+
const trPr = translator$I.decode({
|
|
34539
34647
|
...params2,
|
|
34540
34648
|
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
34541
34649
|
});
|
|
@@ -34547,22 +34655,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34547
34655
|
elements
|
|
34548
34656
|
};
|
|
34549
34657
|
};
|
|
34550
|
-
const config$
|
|
34551
|
-
xmlName: XML_NODE_NAME$
|
|
34552
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
34658
|
+
const config$d = {
|
|
34659
|
+
xmlName: XML_NODE_NAME$f,
|
|
34660
|
+
sdNodeOrKeyName: SD_NODE_NAME$b,
|
|
34553
34661
|
type: NodeTranslator.translatorTypes.NODE,
|
|
34554
|
-
encode: encode$
|
|
34555
|
-
decode: decode$
|
|
34556
|
-
attributes: validXmlAttributes$
|
|
34662
|
+
encode: encode$m,
|
|
34663
|
+
decode: decode$m,
|
|
34664
|
+
attributes: validXmlAttributes$8
|
|
34557
34665
|
};
|
|
34558
|
-
const translator$
|
|
34559
|
-
const translator$
|
|
34666
|
+
const translator$H = NodeTranslator.from(config$d);
|
|
34667
|
+
const translator$G = NodeTranslator.from({
|
|
34560
34668
|
xmlName: "w:bidiVisual",
|
|
34561
34669
|
sdNodeOrKeyName: "rightToLeft",
|
|
34562
34670
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34563
34671
|
decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
|
|
34564
34672
|
});
|
|
34565
|
-
const translator$
|
|
34673
|
+
const translator$F = NodeTranslator.from({
|
|
34566
34674
|
xmlName: "w:shd",
|
|
34567
34675
|
sdNodeOrKeyName: "shading",
|
|
34568
34676
|
attributes: [
|
|
@@ -34584,11 +34692,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34584
34692
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
34585
34693
|
}
|
|
34586
34694
|
});
|
|
34587
|
-
const translator$
|
|
34588
|
-
const translator$
|
|
34589
|
-
const translator$
|
|
34590
|
-
const translator$
|
|
34591
|
-
const translator$
|
|
34695
|
+
const translator$E = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
|
|
34696
|
+
const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
|
|
34697
|
+
const translator$C = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
|
|
34698
|
+
const translator$B = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
|
|
34699
|
+
const translator$A = NodeTranslator.from({
|
|
34592
34700
|
xmlName: "w:tblLook",
|
|
34593
34701
|
sdNodeOrKeyName: "tblLook",
|
|
34594
34702
|
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
@@ -34600,16 +34708,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34600
34708
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
34601
34709
|
}
|
|
34602
34710
|
});
|
|
34603
|
-
const translator$
|
|
34604
|
-
const translator$
|
|
34605
|
-
const translator$
|
|
34711
|
+
const translator$z = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
|
|
34712
|
+
const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
|
|
34713
|
+
const translator$x = NodeTranslator.from(
|
|
34606
34714
|
createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
|
|
34607
34715
|
);
|
|
34608
|
-
const translator$
|
|
34716
|
+
const translator$w = NodeTranslator.from(
|
|
34609
34717
|
createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
|
|
34610
34718
|
);
|
|
34611
|
-
const translator$
|
|
34612
|
-
const translator$
|
|
34719
|
+
const translator$v = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
|
|
34720
|
+
const translator$u = NodeTranslator.from({
|
|
34613
34721
|
xmlName: "w:tblpPr",
|
|
34614
34722
|
sdNodeOrKeyName: "floatingTableProperties",
|
|
34615
34723
|
attributes: ["w:leftFromText", "w:rightFromText", "w:topFromText", "w:bottomFromText", "w:tblpX", "w:tblpY"].map((attr) => createAttributeHandler(attr, null, parseInteger, integerToString)).concat(["w:horzAnchor", "w:vertAnchor", "w:tblpXSpec", "w:tblpYSpec"].map((attr) => createAttributeHandler(attr))),
|
|
@@ -34621,29 +34729,29 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34621
34729
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
34622
34730
|
}
|
|
34623
34731
|
});
|
|
34624
|
-
const translator$
|
|
34625
|
-
const translator$
|
|
34626
|
-
const translator$
|
|
34627
|
-
const translator$
|
|
34628
|
-
const translator$
|
|
34629
|
-
const translator$
|
|
34630
|
-
const translator$
|
|
34631
|
-
const translator$
|
|
34632
|
-
const translator$
|
|
34633
|
-
const translator$
|
|
34634
|
-
const translator$
|
|
34635
|
-
const translator$
|
|
34636
|
-
const translator$
|
|
34637
|
-
const translator$
|
|
34638
|
-
const XML_NODE_NAME$
|
|
34732
|
+
const translator$t = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
|
|
34733
|
+
const translator$s = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
|
|
34734
|
+
const translator$r = NodeTranslator.from(createBorderPropertyHandler("w:end"));
|
|
34735
|
+
const translator$q = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
|
|
34736
|
+
const translator$p = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
|
|
34737
|
+
const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
|
|
34738
|
+
const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:left"));
|
|
34739
|
+
const translator$m = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
|
|
34740
|
+
const translator$l = NodeTranslator.from(createBorderPropertyHandler("w:right"));
|
|
34741
|
+
const translator$k = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
|
|
34742
|
+
const translator$j = NodeTranslator.from(createBorderPropertyHandler("w:start"));
|
|
34743
|
+
const translator$i = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
|
|
34744
|
+
const translator$h = NodeTranslator.from(createBorderPropertyHandler("w:top"));
|
|
34745
|
+
const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
|
|
34746
|
+
const XML_NODE_NAME$e = "w:tblBorders";
|
|
34639
34747
|
const SD_ATTR_KEY$3 = "borders";
|
|
34640
|
-
const encode$
|
|
34748
|
+
const encode$l = (params2) => {
|
|
34641
34749
|
const { nodes } = params2;
|
|
34642
34750
|
const node = nodes[0];
|
|
34643
34751
|
const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
|
|
34644
34752
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
34645
34753
|
};
|
|
34646
|
-
const decode$
|
|
34754
|
+
const decode$l = (params2) => {
|
|
34647
34755
|
const { borders = {} } = params2.node.attrs || {};
|
|
34648
34756
|
const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
|
|
34649
34757
|
const newNode = {
|
|
@@ -34655,14 +34763,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34655
34763
|
return newNode;
|
|
34656
34764
|
};
|
|
34657
34765
|
const propertyTranslators$2 = [
|
|
34658
|
-
translator$
|
|
34659
|
-
translator$
|
|
34766
|
+
translator$t,
|
|
34767
|
+
translator$r,
|
|
34768
|
+
translator$p,
|
|
34660
34769
|
translator$o,
|
|
34661
34770
|
translator$n,
|
|
34662
|
-
translator$
|
|
34663
|
-
translator$
|
|
34664
|
-
translator$
|
|
34665
|
-
translator$g
|
|
34771
|
+
translator$l,
|
|
34772
|
+
translator$j,
|
|
34773
|
+
translator$h
|
|
34666
34774
|
];
|
|
34667
34775
|
const tblBordersTranslatorsByXmlName = {};
|
|
34668
34776
|
const tblBordersTranslatorsBySdName = {};
|
|
@@ -34670,27 +34778,27 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34670
34778
|
tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
34671
34779
|
tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
34672
34780
|
});
|
|
34673
|
-
const translator$
|
|
34674
|
-
xmlName: XML_NODE_NAME$
|
|
34781
|
+
const translator$f = NodeTranslator.from({
|
|
34782
|
+
xmlName: XML_NODE_NAME$e,
|
|
34675
34783
|
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
34676
34784
|
type: NodeTranslator.translatorTypes.NODE,
|
|
34677
34785
|
attributes: [],
|
|
34678
|
-
encode: encode$
|
|
34679
|
-
decode: decode$
|
|
34786
|
+
encode: encode$l,
|
|
34787
|
+
decode: decode$l
|
|
34680
34788
|
});
|
|
34681
|
-
const XML_NODE_NAME$
|
|
34789
|
+
const XML_NODE_NAME$d = "w:tblCellMar";
|
|
34682
34790
|
const SD_ATTR_KEY$2 = "cellMargins";
|
|
34683
|
-
const encode$
|
|
34791
|
+
const encode$k = (params2) => {
|
|
34684
34792
|
const { nodes } = params2;
|
|
34685
34793
|
const node = nodes[0];
|
|
34686
34794
|
const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
|
|
34687
34795
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
34688
34796
|
};
|
|
34689
|
-
const decode$
|
|
34797
|
+
const decode$k = (params2) => {
|
|
34690
34798
|
const { cellMargins = {} } = params2.node.attrs || {};
|
|
34691
34799
|
const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
|
|
34692
34800
|
const newNode = {
|
|
34693
|
-
name: XML_NODE_NAME$
|
|
34801
|
+
name: XML_NODE_NAME$d,
|
|
34694
34802
|
type: "element",
|
|
34695
34803
|
attributes: {},
|
|
34696
34804
|
elements
|
|
@@ -34698,12 +34806,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34698
34806
|
return newNode;
|
|
34699
34807
|
};
|
|
34700
34808
|
const propertyTranslators$1 = [
|
|
34701
|
-
translator$
|
|
34702
|
-
translator$
|
|
34703
|
-
translator$
|
|
34704
|
-
translator$
|
|
34705
|
-
translator$
|
|
34706
|
-
translator$
|
|
34809
|
+
translator$s,
|
|
34810
|
+
translator$q,
|
|
34811
|
+
translator$m,
|
|
34812
|
+
translator$k,
|
|
34813
|
+
translator$i,
|
|
34814
|
+
translator$g
|
|
34707
34815
|
];
|
|
34708
34816
|
const propertyTranslatorsByXmlName$1 = {};
|
|
34709
34817
|
const propertyTranslatorsBySdName$1 = {};
|
|
@@ -34711,27 +34819,27 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34711
34819
|
propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
|
|
34712
34820
|
propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
|
|
34713
34821
|
});
|
|
34714
|
-
const translator$
|
|
34715
|
-
xmlName: XML_NODE_NAME$
|
|
34822
|
+
const translator$e = NodeTranslator.from({
|
|
34823
|
+
xmlName: XML_NODE_NAME$d,
|
|
34716
34824
|
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
34717
34825
|
type: NodeTranslator.translatorTypes.NODE,
|
|
34718
34826
|
attributes: [],
|
|
34719
|
-
encode: encode$
|
|
34720
|
-
decode: decode$
|
|
34827
|
+
encode: encode$k,
|
|
34828
|
+
decode: decode$k
|
|
34721
34829
|
});
|
|
34722
|
-
const XML_NODE_NAME$
|
|
34830
|
+
const XML_NODE_NAME$c = "w:tblPr";
|
|
34723
34831
|
const SD_ATTR_KEY$1 = "tableProperties";
|
|
34724
|
-
const encode$
|
|
34832
|
+
const encode$j = (params2) => {
|
|
34725
34833
|
const { nodes } = params2;
|
|
34726
34834
|
const node = nodes[0];
|
|
34727
34835
|
const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
|
|
34728
34836
|
return {
|
|
34729
|
-
xmlName: XML_NODE_NAME$
|
|
34837
|
+
xmlName: XML_NODE_NAME$c,
|
|
34730
34838
|
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
34731
34839
|
attributes
|
|
34732
34840
|
};
|
|
34733
34841
|
};
|
|
34734
|
-
const decode$
|
|
34842
|
+
const decode$j = (params2) => {
|
|
34735
34843
|
const { tableProperties = {} } = params2.node.attrs || {};
|
|
34736
34844
|
const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
|
|
34737
34845
|
const newNode = {
|
|
@@ -34743,11 +34851,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34743
34851
|
return newNode;
|
|
34744
34852
|
};
|
|
34745
34853
|
const propertyTranslators = [
|
|
34854
|
+
translator$G,
|
|
34855
|
+
translator$O,
|
|
34746
34856
|
translator$F,
|
|
34747
|
-
translator$N,
|
|
34748
34857
|
translator$E,
|
|
34858
|
+
translator$N,
|
|
34749
34859
|
translator$D,
|
|
34750
|
-
translator$M,
|
|
34751
34860
|
translator$C,
|
|
34752
34861
|
translator$B,
|
|
34753
34862
|
translator$A,
|
|
@@ -34757,9 +34866,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34757
34866
|
translator$w,
|
|
34758
34867
|
translator$v,
|
|
34759
34868
|
translator$u,
|
|
34760
|
-
translator$
|
|
34761
|
-
translator$e
|
|
34762
|
-
translator$d
|
|
34869
|
+
translator$f,
|
|
34870
|
+
translator$e
|
|
34763
34871
|
];
|
|
34764
34872
|
const propertyTranslatorsByXmlName = {};
|
|
34765
34873
|
const propertyTranslatorsBySdName = {};
|
|
@@ -34767,14 +34875,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34767
34875
|
propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
34768
34876
|
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
34769
34877
|
});
|
|
34770
|
-
const config$
|
|
34771
|
-
xmlName: XML_NODE_NAME$
|
|
34878
|
+
const config$c = {
|
|
34879
|
+
xmlName: XML_NODE_NAME$c,
|
|
34772
34880
|
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
34773
|
-
encode: encode$
|
|
34774
|
-
decode: decode$
|
|
34881
|
+
encode: encode$j,
|
|
34882
|
+
decode: decode$j
|
|
34775
34883
|
};
|
|
34776
|
-
const translator$
|
|
34777
|
-
const translator$
|
|
34884
|
+
const translator$d = NodeTranslator.from(config$c);
|
|
34885
|
+
const translator$c = NodeTranslator.from(
|
|
34778
34886
|
createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
|
|
34779
34887
|
);
|
|
34780
34888
|
const DEFAULT_COLUMN_WIDTH_PX = 100;
|
|
@@ -34824,20 +34932,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34824
34932
|
}
|
|
34825
34933
|
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
34826
34934
|
};
|
|
34827
|
-
const XML_NODE_NAME$
|
|
34935
|
+
const XML_NODE_NAME$b = "w:tblGrid";
|
|
34828
34936
|
const SD_ATTR_KEY = "grid";
|
|
34829
34937
|
const cellMinWidth = pixelsToTwips(10);
|
|
34830
|
-
const encode$
|
|
34938
|
+
const encode$i = (params2) => {
|
|
34831
34939
|
const { nodes } = params2;
|
|
34832
34940
|
const node = nodes[0];
|
|
34833
|
-
const attributes = encodeProperties(node, { [translator$
|
|
34941
|
+
const attributes = encodeProperties(node, { [translator$c.xmlName]: translator$c }, true);
|
|
34834
34942
|
return {
|
|
34835
|
-
xmlName: XML_NODE_NAME$
|
|
34943
|
+
xmlName: XML_NODE_NAME$b,
|
|
34836
34944
|
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
34837
34945
|
attributes
|
|
34838
34946
|
};
|
|
34839
34947
|
};
|
|
34840
|
-
const decode$
|
|
34948
|
+
const decode$i = (params2) => {
|
|
34841
34949
|
const { grid: rawGrid } = params2.node.attrs || {};
|
|
34842
34950
|
const grid = Array.isArray(rawGrid) ? rawGrid : [];
|
|
34843
34951
|
const { firstRow = {} } = params2.extraParams || {};
|
|
@@ -34856,10 +34964,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34856
34964
|
numericWidth = fallbackColumnWidthTwips;
|
|
34857
34965
|
}
|
|
34858
34966
|
numericWidth = Math.max(numericWidth, cellMinWidth);
|
|
34859
|
-
const decoded = translator$
|
|
34967
|
+
const decoded = translator$c.decode({
|
|
34860
34968
|
node: { type: (
|
|
34861
34969
|
/** @type {string} */
|
|
34862
|
-
translator$
|
|
34970
|
+
translator$c.sdNodeOrKeyName
|
|
34863
34971
|
), attrs: { col: numericWidth } }
|
|
34864
34972
|
});
|
|
34865
34973
|
if (decoded) elements.push(decoded);
|
|
@@ -34894,19 +35002,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34894
35002
|
columnIndex++;
|
|
34895
35003
|
}
|
|
34896
35004
|
const newNode = {
|
|
34897
|
-
name: XML_NODE_NAME$
|
|
35005
|
+
name: XML_NODE_NAME$b,
|
|
34898
35006
|
attributes: {},
|
|
34899
35007
|
elements
|
|
34900
35008
|
};
|
|
34901
35009
|
return newNode;
|
|
34902
35010
|
};
|
|
34903
|
-
const config$
|
|
34904
|
-
xmlName: XML_NODE_NAME$
|
|
35011
|
+
const config$b = {
|
|
35012
|
+
xmlName: XML_NODE_NAME$b,
|
|
34905
35013
|
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
34906
|
-
encode: encode$
|
|
34907
|
-
decode: decode$
|
|
35014
|
+
encode: encode$i,
|
|
35015
|
+
decode: decode$i
|
|
34908
35016
|
};
|
|
34909
|
-
const translator$
|
|
35017
|
+
const translator$b = NodeTranslator.from(config$b);
|
|
34910
35018
|
const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
|
|
34911
35019
|
const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
|
|
34912
35020
|
const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
|
|
@@ -34969,19 +35077,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34969
35077
|
columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
|
|
34970
35078
|
};
|
|
34971
35079
|
};
|
|
34972
|
-
const XML_NODE_NAME$
|
|
34973
|
-
const SD_NODE_NAME$
|
|
34974
|
-
const encode$
|
|
35080
|
+
const XML_NODE_NAME$a = "w:tbl";
|
|
35081
|
+
const SD_NODE_NAME$a = "table";
|
|
35082
|
+
const encode$h = (params2, encodedAttrs) => {
|
|
34975
35083
|
const { nodes } = params2;
|
|
34976
35084
|
const node = nodes[0];
|
|
34977
35085
|
const tblPr = node.elements.find((el) => el.name === "w:tblPr");
|
|
34978
35086
|
if (tblPr) {
|
|
34979
|
-
const encodedProperties = translator$
|
|
35087
|
+
const encodedProperties = translator$d.encode({ ...params2, nodes: [tblPr] });
|
|
34980
35088
|
encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
|
|
34981
35089
|
}
|
|
34982
35090
|
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
34983
35091
|
if (tblGrid) {
|
|
34984
|
-
encodedAttrs["grid"] = translator$
|
|
35092
|
+
encodedAttrs["grid"] = translator$b.encode({ ...params2, nodes: [tblGrid] }).attributes;
|
|
34985
35093
|
}
|
|
34986
35094
|
[
|
|
34987
35095
|
"tableStyleId",
|
|
@@ -35048,7 +35156,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35048
35156
|
}
|
|
35049
35157
|
const content = [];
|
|
35050
35158
|
rows.forEach((row) => {
|
|
35051
|
-
const result = translator$
|
|
35159
|
+
const result = translator$H.encode({
|
|
35052
35160
|
...params2,
|
|
35053
35161
|
nodes: [row],
|
|
35054
35162
|
extraParams: {
|
|
@@ -35067,13 +35175,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35067
35175
|
attrs: encodedAttrs
|
|
35068
35176
|
};
|
|
35069
35177
|
};
|
|
35070
|
-
const decode$
|
|
35178
|
+
const decode$h = (params2, decodedAttrs) => {
|
|
35071
35179
|
params2.node = preProcessVerticalMergeCells(params2.node, params2);
|
|
35072
35180
|
const { node } = params2;
|
|
35073
35181
|
const elements = translateChildNodes(params2);
|
|
35074
35182
|
const firstRow = node.content?.find((n) => n.type === "tableRow");
|
|
35075
35183
|
const properties = node.attrs.grid;
|
|
35076
|
-
const element = translator$
|
|
35184
|
+
const element = translator$b.decode({
|
|
35077
35185
|
...params2,
|
|
35078
35186
|
node: { ...node, attrs: { ...node.attrs, grid: properties } },
|
|
35079
35187
|
extraParams: {
|
|
@@ -35083,7 +35191,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35083
35191
|
if (element) elements.unshift(element);
|
|
35084
35192
|
if (node.attrs?.tableProperties) {
|
|
35085
35193
|
const properties2 = { ...node.attrs.tableProperties };
|
|
35086
|
-
const element2 = translator$
|
|
35194
|
+
const element2 = translator$d.decode({
|
|
35087
35195
|
...params2,
|
|
35088
35196
|
node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
|
|
35089
35197
|
});
|
|
@@ -35149,7 +35257,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35149
35257
|
if (baseTblPr && baseTblPr.elements) {
|
|
35150
35258
|
tblPr.elements.push(...baseTblPr.elements);
|
|
35151
35259
|
}
|
|
35152
|
-
const tableProperties = translator$
|
|
35260
|
+
const tableProperties = translator$d.encode({ ...params2, nodes: [tblPr] }).attributes;
|
|
35153
35261
|
const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
|
|
35154
35262
|
if (borders) stylesToReturn.borders = borders;
|
|
35155
35263
|
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
@@ -35166,16 +35274,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35166
35274
|
}
|
|
35167
35275
|
return stylesToReturn;
|
|
35168
35276
|
}
|
|
35169
|
-
const config$
|
|
35170
|
-
xmlName: XML_NODE_NAME$
|
|
35171
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
35277
|
+
const config$a = {
|
|
35278
|
+
xmlName: XML_NODE_NAME$a,
|
|
35279
|
+
sdNodeOrKeyName: SD_NODE_NAME$a,
|
|
35172
35280
|
type: NodeTranslator.translatorTypes.NODE,
|
|
35173
|
-
encode: encode$
|
|
35174
|
-
decode: decode$
|
|
35281
|
+
encode: encode$h,
|
|
35282
|
+
decode: decode$h,
|
|
35175
35283
|
attributes: []
|
|
35176
35284
|
};
|
|
35177
|
-
const translator$
|
|
35178
|
-
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$
|
|
35285
|
+
const translator$a = NodeTranslator.from(config$a);
|
|
35286
|
+
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$a);
|
|
35179
35287
|
function getReferencedTableStyles(tblStyleTag, docx) {
|
|
35180
35288
|
if (!tblStyleTag) return null;
|
|
35181
35289
|
const stylesToReturn = {};
|
|
@@ -35537,10 +35645,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35537
35645
|
if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
|
|
35538
35646
|
return elements;
|
|
35539
35647
|
}
|
|
35540
|
-
const XML_NODE_NAME$
|
|
35541
|
-
const SD_NODE_NAME$
|
|
35542
|
-
const validXmlAttributes$
|
|
35543
|
-
function encode$
|
|
35648
|
+
const XML_NODE_NAME$9 = "w:tc";
|
|
35649
|
+
const SD_NODE_NAME$9 = "tableCell";
|
|
35650
|
+
const validXmlAttributes$7 = [];
|
|
35651
|
+
function encode$g(params2, encodedAttrs) {
|
|
35544
35652
|
const {
|
|
35545
35653
|
node,
|
|
35546
35654
|
table,
|
|
@@ -35567,162 +35675,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35567
35675
|
}
|
|
35568
35676
|
return schemaNode;
|
|
35569
35677
|
}
|
|
35570
|
-
function decode$
|
|
35678
|
+
function decode$g(params2, decodedAttrs) {
|
|
35571
35679
|
const translated = translateTableCell(params2);
|
|
35572
35680
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
35573
35681
|
translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
|
|
35574
35682
|
}
|
|
35575
35683
|
return translated;
|
|
35576
35684
|
}
|
|
35577
|
-
const config$
|
|
35578
|
-
xmlName: XML_NODE_NAME$
|
|
35579
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
35580
|
-
type: NodeTranslator.translatorTypes.NODE,
|
|
35581
|
-
encode: encode$f,
|
|
35582
|
-
decode: decode$f,
|
|
35583
|
-
attributes: validXmlAttributes$8
|
|
35584
|
-
};
|
|
35585
|
-
const translator$8 = NodeTranslator.from(config$8);
|
|
35586
|
-
const XML_NODE_NAME$7 = "w:hyperlink";
|
|
35587
|
-
const SD_NODE_NAME$7 = "link";
|
|
35588
|
-
const _createAttributeHandler = (xmlName, sdName) => ({
|
|
35589
|
-
xmlName,
|
|
35590
|
-
sdName,
|
|
35591
|
-
encode: (attributes) => attributes[xmlName],
|
|
35592
|
-
decode: (attributes) => attributes[sdName]
|
|
35593
|
-
});
|
|
35594
|
-
const validXmlAttributes$7 = [
|
|
35595
|
-
_createAttributeHandler("w:anchor", "anchor"),
|
|
35596
|
-
_createAttributeHandler("w:docLocation", "docLocation"),
|
|
35597
|
-
{
|
|
35598
|
-
xmlName: "w:history",
|
|
35599
|
-
sdName: "history",
|
|
35600
|
-
encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
|
|
35601
|
-
decode: (attributes) => attributes["history"] ? "1" : "0"
|
|
35602
|
-
},
|
|
35603
|
-
_createAttributeHandler("w:tooltip", "tooltip"),
|
|
35604
|
-
_createAttributeHandler("r:id", "rId"),
|
|
35605
|
-
_createAttributeHandler("w:tgtFrame", "target")
|
|
35606
|
-
];
|
|
35607
|
-
const encode$e = (params2, encodedAttrs) => {
|
|
35608
|
-
const { nodes, docx, nodeListHandler } = params2;
|
|
35609
|
-
const node = nodes[0];
|
|
35610
|
-
let href = _resolveHref(docx, encodedAttrs);
|
|
35611
|
-
const linkMark = { attrs: { ...encodedAttrs, href } };
|
|
35612
|
-
const runNodes = node.elements.filter((el) => el.name === "w:r");
|
|
35613
|
-
runNodes.forEach((runNode) => {
|
|
35614
|
-
const existingRunMarks = Array.isArray(runNode.marks) ? runNode.marks : [];
|
|
35615
|
-
const runMarksWithoutLink = existingRunMarks.filter((mark) => mark?.type !== "link");
|
|
35616
|
-
runNode.marks = runMarksWithoutLink;
|
|
35617
|
-
});
|
|
35618
|
-
const updatedNode = nodeListHandler.handler({
|
|
35619
|
-
...params2,
|
|
35620
|
-
nodes: runNodes,
|
|
35621
|
-
path: [...params2.path || [], node]
|
|
35622
|
-
});
|
|
35623
|
-
const cloneMark2 = (mark) => {
|
|
35624
|
-
if (!mark || typeof mark !== "object") return mark;
|
|
35625
|
-
if (!mark.attrs) return { ...mark };
|
|
35626
|
-
return { ...mark, attrs: { ...mark.attrs } };
|
|
35627
|
-
};
|
|
35628
|
-
const ensureLinkMark = (child) => {
|
|
35629
|
-
if (!child || typeof child !== "object") return child;
|
|
35630
|
-
if (Array.isArray(child.content)) {
|
|
35631
|
-
const updatedContent = child.content.map((item) => ensureLinkMark(item));
|
|
35632
|
-
if (updatedContent !== child.content) {
|
|
35633
|
-
child = { ...child, content: updatedContent };
|
|
35634
|
-
}
|
|
35635
|
-
}
|
|
35636
|
-
if (child.type === "run") {
|
|
35637
|
-
const existingMarks2 = Array.isArray(child.marks) ? child.marks : [];
|
|
35638
|
-
const filteredMarks = existingMarks2.filter((mark) => mark?.type !== "link").map((mark) => cloneMark2(mark));
|
|
35639
|
-
if (filteredMarks.length !== existingMarks2.length) {
|
|
35640
|
-
if (filteredMarks.length) child = { ...child, marks: filteredMarks };
|
|
35641
|
-
else {
|
|
35642
|
-
const { marks: _removedMarks, ...rest } = child;
|
|
35643
|
-
child = rest;
|
|
35644
|
-
}
|
|
35645
|
-
}
|
|
35646
|
-
return child;
|
|
35647
|
-
}
|
|
35648
|
-
if (child.type !== "text") return child;
|
|
35649
|
-
const existingMarks = Array.isArray(child.marks) ? child.marks.map((mark) => cloneMark2(mark)) : [];
|
|
35650
|
-
const hasLink = existingMarks.some((mark) => mark?.type === "link");
|
|
35651
|
-
if (hasLink) return child;
|
|
35652
|
-
const linkClone = { type: "link", attrs: { ...linkMark.attrs } };
|
|
35653
|
-
return { ...child, marks: [...existingMarks, linkClone] };
|
|
35654
|
-
};
|
|
35655
|
-
if (!Array.isArray(updatedNode)) return updatedNode;
|
|
35656
|
-
return updatedNode.map((child) => ensureLinkMark(child));
|
|
35657
|
-
};
|
|
35658
|
-
const _resolveHref = (docx, encodedAttrs) => {
|
|
35659
|
-
const rels = docx["word/_rels/document.xml.rels"];
|
|
35660
|
-
const relationships = rels.elements.find((el) => el.name === "Relationships");
|
|
35661
|
-
const { elements } = relationships;
|
|
35662
|
-
const { rId, anchor } = encodedAttrs;
|
|
35663
|
-
let href;
|
|
35664
|
-
if (!rId && anchor) {
|
|
35665
|
-
href = `#${anchor}`;
|
|
35666
|
-
} else if (rId) {
|
|
35667
|
-
const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
|
|
35668
|
-
const { attributes: relAttributes = {} } = rel;
|
|
35669
|
-
href = relAttributes["Target"];
|
|
35670
|
-
}
|
|
35671
|
-
return href;
|
|
35672
|
-
};
|
|
35673
|
-
function decode$e(params2) {
|
|
35674
|
-
const { node } = params2;
|
|
35675
|
-
const linkMark = node.marks.find((m2) => m2.type === "link");
|
|
35676
|
-
const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
|
|
35677
|
-
let { anchor, href: link } = linkMark.attrs;
|
|
35678
|
-
const isExternalLink = !anchor;
|
|
35679
|
-
if (isExternalLink) {
|
|
35680
|
-
linkAttrs["r:id"] = _addNewLinkRelationship(params2, link, linkAttrs["r:id"]);
|
|
35681
|
-
}
|
|
35682
|
-
node.marks = node.marks.filter((m2) => m2.type !== "link");
|
|
35683
|
-
const outputNode = exportSchemaToJson({ ...params2, node });
|
|
35684
|
-
const newNode = {
|
|
35685
|
-
name: "w:hyperlink",
|
|
35686
|
-
type: "element",
|
|
35687
|
-
attributes: {
|
|
35688
|
-
...linkAttrs
|
|
35689
|
-
},
|
|
35690
|
-
elements: [outputNode]
|
|
35691
|
-
};
|
|
35692
|
-
return newNode;
|
|
35693
|
-
}
|
|
35694
|
-
function _addNewLinkRelationship(params2, link, rId) {
|
|
35695
|
-
if (!rId) rId = generateDocxRandomId();
|
|
35696
|
-
if (!params2.relationships || !Array.isArray(params2.relationships)) {
|
|
35697
|
-
params2.relationships = [];
|
|
35698
|
-
}
|
|
35699
|
-
const existingRel = params2.relationships.find(
|
|
35700
|
-
(rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
|
|
35701
|
-
);
|
|
35702
|
-
if (existingRel) {
|
|
35703
|
-
return rId;
|
|
35704
|
-
}
|
|
35705
|
-
params2.relationships.push({
|
|
35706
|
-
type: "element",
|
|
35707
|
-
name: "Relationship",
|
|
35708
|
-
attributes: {
|
|
35709
|
-
Id: rId,
|
|
35710
|
-
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
35711
|
-
Target: link,
|
|
35712
|
-
TargetMode: "External"
|
|
35713
|
-
}
|
|
35714
|
-
});
|
|
35715
|
-
return rId;
|
|
35716
|
-
}
|
|
35717
|
-
const config$7 = {
|
|
35718
|
-
xmlName: XML_NODE_NAME$7,
|
|
35719
|
-
sdNodeOrKeyName: SD_NODE_NAME$7,
|
|
35685
|
+
const config$9 = {
|
|
35686
|
+
xmlName: XML_NODE_NAME$9,
|
|
35687
|
+
sdNodeOrKeyName: SD_NODE_NAME$9,
|
|
35720
35688
|
type: NodeTranslator.translatorTypes.NODE,
|
|
35721
|
-
encode: encode$
|
|
35722
|
-
decode: decode$
|
|
35689
|
+
encode: encode$g,
|
|
35690
|
+
decode: decode$g,
|
|
35723
35691
|
attributes: validXmlAttributes$7
|
|
35724
35692
|
};
|
|
35725
|
-
const translator$
|
|
35693
|
+
const translator$9 = NodeTranslator.from(config$9);
|
|
35726
35694
|
function parseTagValueJSON(json) {
|
|
35727
35695
|
if (typeof json !== "string") {
|
|
35728
35696
|
return {};
|
|
@@ -35858,12 +35826,32 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35858
35826
|
}
|
|
35859
35827
|
const content = node?.elements.find((el) => el.name === "w:sdtContent");
|
|
35860
35828
|
const handler2 = validGalleryTypeMap[docPartGalleryType];
|
|
35861
|
-
const result = handler2({
|
|
35829
|
+
const result = handler2({
|
|
35830
|
+
...params2,
|
|
35831
|
+
nodes: [content],
|
|
35832
|
+
extraParams: { ...params2.extraParams || {}, sdtPr }
|
|
35833
|
+
});
|
|
35862
35834
|
return result;
|
|
35863
35835
|
}
|
|
35864
35836
|
const tableOfContentsHandler = (params2) => {
|
|
35865
35837
|
const node = params2.nodes[0];
|
|
35866
|
-
|
|
35838
|
+
const translatedContent = params2.nodeListHandler.handler({
|
|
35839
|
+
...params2,
|
|
35840
|
+
nodes: node.elements,
|
|
35841
|
+
path: [...params2.path || [], node]
|
|
35842
|
+
});
|
|
35843
|
+
const sdtPr = params2.extraParams.sdtPr;
|
|
35844
|
+
const id = sdtPr.elements?.find((el) => el.name === "w:id")?.attributes["w:val"] || "";
|
|
35845
|
+
const result = {
|
|
35846
|
+
type: "documentPartObject",
|
|
35847
|
+
content: translatedContent,
|
|
35848
|
+
attrs: {
|
|
35849
|
+
id,
|
|
35850
|
+
docPartGallery: "Table of Contents",
|
|
35851
|
+
docPartUnique: true
|
|
35852
|
+
}
|
|
35853
|
+
};
|
|
35854
|
+
return result;
|
|
35867
35855
|
};
|
|
35868
35856
|
const validGalleryTypeMap = {
|
|
35869
35857
|
"Table of Contents": tableOfContentsHandler
|
|
@@ -36521,32 +36509,32 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36521
36509
|
elements: [...anchorElements, ...elementsWithWrap]
|
|
36522
36510
|
};
|
|
36523
36511
|
}
|
|
36524
|
-
const XML_NODE_NAME$
|
|
36525
|
-
const SD_NODE_NAME$
|
|
36512
|
+
const XML_NODE_NAME$8 = "wp:anchor";
|
|
36513
|
+
const SD_NODE_NAME$8 = ["image"];
|
|
36526
36514
|
const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
36527
|
-
function encode$
|
|
36515
|
+
function encode$f(params2) {
|
|
36528
36516
|
const { node } = params2.extraParams;
|
|
36529
36517
|
if (!node || !node.type) {
|
|
36530
36518
|
return null;
|
|
36531
36519
|
}
|
|
36532
36520
|
return handleAnchorNode(params2);
|
|
36533
36521
|
}
|
|
36534
|
-
function decode$
|
|
36522
|
+
function decode$f(params2) {
|
|
36535
36523
|
const { node } = params2;
|
|
36536
36524
|
if (!node || !node.type) {
|
|
36537
36525
|
return null;
|
|
36538
36526
|
}
|
|
36539
36527
|
return translateAnchorNode(params2);
|
|
36540
36528
|
}
|
|
36541
|
-
const config$
|
|
36542
|
-
xmlName: XML_NODE_NAME$
|
|
36543
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
36529
|
+
const config$8 = {
|
|
36530
|
+
xmlName: XML_NODE_NAME$8,
|
|
36531
|
+
sdNodeOrKeyName: SD_NODE_NAME$8,
|
|
36544
36532
|
type: NodeTranslator.translatorTypes.NODE,
|
|
36545
|
-
encode: encode$
|
|
36546
|
-
decode: decode$
|
|
36533
|
+
encode: encode$f,
|
|
36534
|
+
decode: decode$f,
|
|
36547
36535
|
attributes: validXmlAttributes$6
|
|
36548
36536
|
};
|
|
36549
|
-
const translator$
|
|
36537
|
+
const translator$8 = NodeTranslator.from(config$8);
|
|
36550
36538
|
function handleInlineNode(params2) {
|
|
36551
36539
|
const { node } = params2.extraParams;
|
|
36552
36540
|
if (node.name !== "wp:inline") {
|
|
@@ -36562,41 +36550,41 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36562
36550
|
elements: nodeElements.elements
|
|
36563
36551
|
};
|
|
36564
36552
|
}
|
|
36565
|
-
const XML_NODE_NAME$
|
|
36566
|
-
const SD_NODE_NAME$
|
|
36553
|
+
const XML_NODE_NAME$7 = "wp:inline";
|
|
36554
|
+
const SD_NODE_NAME$7 = ["image"];
|
|
36567
36555
|
const validXmlAttributes$5 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
36568
|
-
function encode$
|
|
36556
|
+
function encode$e(params2) {
|
|
36569
36557
|
const { node } = params2.extraParams;
|
|
36570
36558
|
if (!node || !node.type) {
|
|
36571
36559
|
return null;
|
|
36572
36560
|
}
|
|
36573
36561
|
return handleInlineNode(params2);
|
|
36574
36562
|
}
|
|
36575
|
-
function decode$
|
|
36563
|
+
function decode$e(params2) {
|
|
36576
36564
|
const { node } = params2;
|
|
36577
36565
|
if (!node || !node.type) {
|
|
36578
36566
|
return null;
|
|
36579
36567
|
}
|
|
36580
36568
|
return translateInlineNode(params2);
|
|
36581
36569
|
}
|
|
36582
|
-
const config$
|
|
36583
|
-
xmlName: XML_NODE_NAME$
|
|
36584
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
36570
|
+
const config$7 = {
|
|
36571
|
+
xmlName: XML_NODE_NAME$7,
|
|
36572
|
+
sdNodeOrKeyName: SD_NODE_NAME$7,
|
|
36585
36573
|
type: NodeTranslator.translatorTypes.NODE,
|
|
36586
|
-
encode: encode$
|
|
36587
|
-
decode: decode$
|
|
36574
|
+
encode: encode$e,
|
|
36575
|
+
decode: decode$e,
|
|
36588
36576
|
attributes: validXmlAttributes$5
|
|
36589
36577
|
};
|
|
36590
|
-
const translator$
|
|
36591
|
-
const XML_NODE_NAME$
|
|
36592
|
-
const SD_NODE_NAME$
|
|
36578
|
+
const translator$7 = NodeTranslator.from(config$7);
|
|
36579
|
+
const XML_NODE_NAME$6 = "w:drawing";
|
|
36580
|
+
const SD_NODE_NAME$6 = [];
|
|
36593
36581
|
const validXmlAttributes$4 = [];
|
|
36594
|
-
function encode$
|
|
36582
|
+
function encode$d(params2) {
|
|
36595
36583
|
const nodes = params2.nodes;
|
|
36596
36584
|
const node = nodes[0];
|
|
36597
36585
|
const translatorByChildName = {
|
|
36598
|
-
"wp:anchor": translator$
|
|
36599
|
-
"wp:inline": translator$
|
|
36586
|
+
"wp:anchor": translator$8,
|
|
36587
|
+
"wp:inline": translator$7
|
|
36600
36588
|
};
|
|
36601
36589
|
return node.elements.reduce((acc, child) => {
|
|
36602
36590
|
if (acc) return acc;
|
|
@@ -36605,12 +36593,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36605
36593
|
return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
|
|
36606
36594
|
}, null);
|
|
36607
36595
|
}
|
|
36608
|
-
function decode$
|
|
36596
|
+
function decode$d(params2) {
|
|
36609
36597
|
const { node } = params2;
|
|
36610
36598
|
if (!node || !node.type) {
|
|
36611
36599
|
return null;
|
|
36612
36600
|
}
|
|
36613
|
-
const childTranslator = node.attrs.isAnchor ? translator$
|
|
36601
|
+
const childTranslator = node.attrs.isAnchor ? translator$8 : translator$7;
|
|
36614
36602
|
const resultNode = childTranslator.decode(params2);
|
|
36615
36603
|
return wrapTextInRun(
|
|
36616
36604
|
{
|
|
@@ -36620,15 +36608,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36620
36608
|
[]
|
|
36621
36609
|
);
|
|
36622
36610
|
}
|
|
36623
|
-
const config$
|
|
36624
|
-
xmlName: XML_NODE_NAME$
|
|
36625
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
36611
|
+
const config$6 = {
|
|
36612
|
+
xmlName: XML_NODE_NAME$6,
|
|
36613
|
+
sdNodeOrKeyName: SD_NODE_NAME$6,
|
|
36626
36614
|
type: NodeTranslator.translatorTypes.NODE,
|
|
36627
|
-
encode: encode$
|
|
36628
|
-
decode: decode$
|
|
36615
|
+
encode: encode$d,
|
|
36616
|
+
decode: decode$d,
|
|
36629
36617
|
attributes: validXmlAttributes$4
|
|
36630
36618
|
};
|
|
36631
|
-
const translator$
|
|
36619
|
+
const translator$6 = NodeTranslator.from(config$6);
|
|
36632
36620
|
class CommandService {
|
|
36633
36621
|
/**
|
|
36634
36622
|
* @param {import('./commands/types/index.js').CommandServiceOptions} props
|
|
@@ -37966,7 +37954,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37966
37954
|
return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params2);
|
|
37967
37955
|
}
|
|
37968
37956
|
function prepareImageAnnotation(params2, imageSize) {
|
|
37969
|
-
return translator$
|
|
37957
|
+
return translator$6.decode({
|
|
37970
37958
|
...params2,
|
|
37971
37959
|
imageSize
|
|
37972
37960
|
});
|
|
@@ -38186,6 +38174,49 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38186
38174
|
]
|
|
38187
38175
|
};
|
|
38188
38176
|
};
|
|
38177
|
+
function translateDocumentPartObj(params2) {
|
|
38178
|
+
const { node } = params2;
|
|
38179
|
+
const { attrs = {} } = node;
|
|
38180
|
+
const childContent = translateChildNodes({ ...params2, nodes: node.content });
|
|
38181
|
+
const nodeElements = [
|
|
38182
|
+
{
|
|
38183
|
+
name: "w:sdtPr",
|
|
38184
|
+
elements: [
|
|
38185
|
+
{
|
|
38186
|
+
name: "w:id",
|
|
38187
|
+
attributes: {
|
|
38188
|
+
"w:val": attrs.id
|
|
38189
|
+
}
|
|
38190
|
+
},
|
|
38191
|
+
{
|
|
38192
|
+
name: "w:docPartObj",
|
|
38193
|
+
elements: [
|
|
38194
|
+
{
|
|
38195
|
+
name: "w:docPartGallery",
|
|
38196
|
+
attributes: {
|
|
38197
|
+
"w:val": attrs.docPartGallery
|
|
38198
|
+
}
|
|
38199
|
+
},
|
|
38200
|
+
...attrs.docPartUnique ? [
|
|
38201
|
+
{
|
|
38202
|
+
name: "w:docPartUnique"
|
|
38203
|
+
}
|
|
38204
|
+
] : []
|
|
38205
|
+
]
|
|
38206
|
+
}
|
|
38207
|
+
]
|
|
38208
|
+
},
|
|
38209
|
+
{
|
|
38210
|
+
name: "w:sdtContent",
|
|
38211
|
+
elements: childContent
|
|
38212
|
+
}
|
|
38213
|
+
];
|
|
38214
|
+
const result = {
|
|
38215
|
+
name: "w:sdt",
|
|
38216
|
+
elements: nodeElements
|
|
38217
|
+
};
|
|
38218
|
+
return result;
|
|
38219
|
+
}
|
|
38189
38220
|
function translateStructuredContent(params2) {
|
|
38190
38221
|
const { node } = params2;
|
|
38191
38222
|
const childContent = translateChildNodes({ ...params2, nodes: node.content });
|
|
@@ -38237,10 +38268,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38237
38268
|
};
|
|
38238
38269
|
return result;
|
|
38239
38270
|
}
|
|
38240
|
-
const XML_NODE_NAME$
|
|
38241
|
-
const SD_NODE_NAME$
|
|
38271
|
+
const XML_NODE_NAME$5 = "w:sdt";
|
|
38272
|
+
const SD_NODE_NAME$5 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
38242
38273
|
const validXmlAttributes$3 = [];
|
|
38243
|
-
function encode$
|
|
38274
|
+
function encode$c(params2) {
|
|
38244
38275
|
const nodes = params2.nodes;
|
|
38245
38276
|
const node = nodes[0];
|
|
38246
38277
|
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
@@ -38250,7 +38281,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38250
38281
|
const result = handler2(params2);
|
|
38251
38282
|
return result;
|
|
38252
38283
|
}
|
|
38253
|
-
function decode$
|
|
38284
|
+
function decode$c(params2) {
|
|
38254
38285
|
const { node } = params2;
|
|
38255
38286
|
if (!node || !node.type) {
|
|
38256
38287
|
return null;
|
|
@@ -38260,91 +38291,93 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38260
38291
|
structuredContent: () => translateStructuredContent(params2),
|
|
38261
38292
|
structuredContentBlock: () => translateStructuredContent(params2),
|
|
38262
38293
|
documentSection: () => translateDocumentSection(params2),
|
|
38294
|
+
documentPartObject: () => translateDocumentPartObj(params2),
|
|
38295
|
+
// Handled in doc-part-obj translator
|
|
38263
38296
|
default: () => null
|
|
38264
38297
|
};
|
|
38265
38298
|
const decoder = types2[node.type] ?? types2.default;
|
|
38266
38299
|
const result = decoder();
|
|
38267
38300
|
return result;
|
|
38268
38301
|
}
|
|
38269
|
-
const config$
|
|
38270
|
-
xmlName: XML_NODE_NAME$
|
|
38271
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
38302
|
+
const config$5 = {
|
|
38303
|
+
xmlName: XML_NODE_NAME$5,
|
|
38304
|
+
sdNodeOrKeyName: SD_NODE_NAME$5,
|
|
38272
38305
|
type: NodeTranslator.translatorTypes.NODE,
|
|
38273
|
-
encode: encode$
|
|
38274
|
-
decode: decode$
|
|
38306
|
+
encode: encode$c,
|
|
38307
|
+
decode: decode$c,
|
|
38275
38308
|
attributes: validXmlAttributes$3
|
|
38276
38309
|
};
|
|
38277
|
-
const translator$
|
|
38278
|
-
const encode$
|
|
38310
|
+
const translator$5 = NodeTranslator.from(config$5);
|
|
38311
|
+
const encode$b = (attributes) => {
|
|
38279
38312
|
return attributes["w:id"];
|
|
38280
38313
|
};
|
|
38281
|
-
const decode$
|
|
38314
|
+
const decode$b = (attrs) => {
|
|
38282
38315
|
return attrs.id;
|
|
38283
38316
|
};
|
|
38284
38317
|
const attrConfig$6 = Object.freeze({
|
|
38285
38318
|
xmlName: "w:id",
|
|
38286
38319
|
sdName: "id",
|
|
38287
|
-
encode: encode$
|
|
38288
|
-
decode: decode$
|
|
38320
|
+
encode: encode$b,
|
|
38321
|
+
decode: decode$b
|
|
38289
38322
|
});
|
|
38290
|
-
const encode$
|
|
38323
|
+
const encode$a = (attributes) => {
|
|
38291
38324
|
return attributes["w:name"];
|
|
38292
38325
|
};
|
|
38293
|
-
const decode$
|
|
38326
|
+
const decode$a = (attrs) => {
|
|
38294
38327
|
return attrs.name;
|
|
38295
38328
|
};
|
|
38296
38329
|
const attrConfig$5 = Object.freeze({
|
|
38297
38330
|
xmlName: "w:name",
|
|
38298
38331
|
sdName: "name",
|
|
38299
|
-
encode: encode$
|
|
38300
|
-
decode: decode$
|
|
38332
|
+
encode: encode$a,
|
|
38333
|
+
decode: decode$a
|
|
38301
38334
|
});
|
|
38302
|
-
const encode$
|
|
38335
|
+
const encode$9 = (attributes) => {
|
|
38303
38336
|
return attributes["w:colFirst"];
|
|
38304
38337
|
};
|
|
38305
|
-
const decode$
|
|
38338
|
+
const decode$9 = (attrs) => {
|
|
38306
38339
|
return attrs.colFirst;
|
|
38307
38340
|
};
|
|
38308
38341
|
const attrConfig$4 = Object.freeze({
|
|
38309
38342
|
xmlName: "w:colFirst",
|
|
38310
38343
|
sdName: "colFirst",
|
|
38311
|
-
encode: encode$
|
|
38312
|
-
decode: decode$
|
|
38344
|
+
encode: encode$9,
|
|
38345
|
+
decode: decode$9
|
|
38313
38346
|
});
|
|
38314
|
-
const encode$
|
|
38347
|
+
const encode$8 = (attributes) => {
|
|
38315
38348
|
return attributes["w:colLast"];
|
|
38316
38349
|
};
|
|
38317
|
-
const decode$
|
|
38350
|
+
const decode$8 = (attrs) => {
|
|
38318
38351
|
return attrs.colLast;
|
|
38319
38352
|
};
|
|
38320
38353
|
const attrConfig$3 = Object.freeze({
|
|
38321
38354
|
xmlName: "w:colLast",
|
|
38322
38355
|
sdName: "colLast",
|
|
38323
|
-
encode: encode$
|
|
38324
|
-
decode: decode$
|
|
38356
|
+
encode: encode$8,
|
|
38357
|
+
decode: decode$8
|
|
38325
38358
|
});
|
|
38326
|
-
const encode$
|
|
38359
|
+
const encode$7 = (attributes) => {
|
|
38327
38360
|
return attributes["w:displacedByCustomXml"];
|
|
38328
38361
|
};
|
|
38329
|
-
const decode$
|
|
38362
|
+
const decode$7 = (attrs) => {
|
|
38330
38363
|
return attrs.displacedByCustomXml;
|
|
38331
38364
|
};
|
|
38332
38365
|
const attrConfig$2 = Object.freeze({
|
|
38333
38366
|
xmlName: "w:displacedByCustomXml",
|
|
38334
38367
|
sdName: "displacedByCustomXml",
|
|
38335
|
-
encode: encode$
|
|
38336
|
-
decode: decode$
|
|
38368
|
+
encode: encode$7,
|
|
38369
|
+
decode: decode$7
|
|
38337
38370
|
});
|
|
38338
38371
|
const validXmlAttributes$2 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
|
|
38339
|
-
const XML_NODE_NAME$
|
|
38340
|
-
const SD_NODE_NAME$
|
|
38341
|
-
const encode$
|
|
38372
|
+
const XML_NODE_NAME$4 = "w:bookmarkStart";
|
|
38373
|
+
const SD_NODE_NAME$4 = "bookmarkStart";
|
|
38374
|
+
const encode$6 = (params2, encodedAttrs = {}) => {
|
|
38342
38375
|
return {
|
|
38343
38376
|
type: "bookmarkStart",
|
|
38344
38377
|
attrs: encodedAttrs
|
|
38345
38378
|
};
|
|
38346
38379
|
};
|
|
38347
|
-
const decode$
|
|
38380
|
+
const decode$6 = (params2, decodedAttrs = {}) => {
|
|
38348
38381
|
const result = {
|
|
38349
38382
|
name: "w:bookmarkStart",
|
|
38350
38383
|
elements: []
|
|
@@ -38354,49 +38387,49 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38354
38387
|
}
|
|
38355
38388
|
return result;
|
|
38356
38389
|
};
|
|
38357
|
-
const config$
|
|
38358
|
-
xmlName: XML_NODE_NAME$
|
|
38359
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
38390
|
+
const config$4 = {
|
|
38391
|
+
xmlName: XML_NODE_NAME$4,
|
|
38392
|
+
sdNodeOrKeyName: SD_NODE_NAME$4,
|
|
38360
38393
|
type: NodeTranslator.translatorTypes.NODE,
|
|
38361
|
-
encode: encode$
|
|
38362
|
-
decode: decode$
|
|
38394
|
+
encode: encode$6,
|
|
38395
|
+
decode: decode$6,
|
|
38363
38396
|
attributes: validXmlAttributes$2
|
|
38364
38397
|
};
|
|
38365
|
-
const translator$
|
|
38366
|
-
const encode$
|
|
38398
|
+
const translator$4 = NodeTranslator.from(config$4);
|
|
38399
|
+
const encode$5 = (attributes) => {
|
|
38367
38400
|
return attributes["w:id"];
|
|
38368
38401
|
};
|
|
38369
|
-
const decode$
|
|
38402
|
+
const decode$5 = (attrs) => {
|
|
38370
38403
|
return attrs.id;
|
|
38371
38404
|
};
|
|
38372
38405
|
const attrConfig$1 = Object.freeze({
|
|
38373
38406
|
xmlName: "w:id",
|
|
38374
38407
|
sdName: "id",
|
|
38375
|
-
encode: encode$
|
|
38376
|
-
decode: decode$
|
|
38408
|
+
encode: encode$5,
|
|
38409
|
+
decode: decode$5
|
|
38377
38410
|
});
|
|
38378
|
-
const encode$
|
|
38411
|
+
const encode$4 = (attributes) => {
|
|
38379
38412
|
return attributes["w:displacedByCustomXml"];
|
|
38380
38413
|
};
|
|
38381
|
-
const decode$
|
|
38414
|
+
const decode$4 = (attrs) => {
|
|
38382
38415
|
return attrs.displacedByCustomXml;
|
|
38383
38416
|
};
|
|
38384
38417
|
const attrConfig = Object.freeze({
|
|
38385
38418
|
xmlName: "w:displacedByCustomXml",
|
|
38386
38419
|
sdName: "displacedByCustomXml",
|
|
38387
|
-
encode: encode$
|
|
38388
|
-
decode: decode$
|
|
38420
|
+
encode: encode$4,
|
|
38421
|
+
decode: decode$4
|
|
38389
38422
|
});
|
|
38390
38423
|
const validXmlAttributes$1 = [attrConfig$1, attrConfig];
|
|
38391
|
-
const XML_NODE_NAME$
|
|
38392
|
-
const SD_NODE_NAME$
|
|
38393
|
-
const encode$
|
|
38424
|
+
const XML_NODE_NAME$3 = "w:bookmarkEnd";
|
|
38425
|
+
const SD_NODE_NAME$3 = "bookmarkEnd";
|
|
38426
|
+
const encode$3 = (params2, encodedAttrs = {}) => {
|
|
38394
38427
|
return {
|
|
38395
38428
|
type: "bookmarkEnd",
|
|
38396
38429
|
attrs: encodedAttrs
|
|
38397
38430
|
};
|
|
38398
38431
|
};
|
|
38399
|
-
const decode$
|
|
38432
|
+
const decode$3 = (params2, decodedAttrs = {}) => {
|
|
38400
38433
|
const result = {
|
|
38401
38434
|
name: "w:bookmarkEnd",
|
|
38402
38435
|
elements: []
|
|
@@ -38406,19 +38439,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38406
38439
|
}
|
|
38407
38440
|
return result;
|
|
38408
38441
|
};
|
|
38409
|
-
const config$
|
|
38410
|
-
xmlName: XML_NODE_NAME$
|
|
38411
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
38442
|
+
const config$3 = {
|
|
38443
|
+
xmlName: XML_NODE_NAME$3,
|
|
38444
|
+
sdNodeOrKeyName: SD_NODE_NAME$3,
|
|
38412
38445
|
type: NodeTranslator.translatorTypes.NODE,
|
|
38413
|
-
encode: encode$
|
|
38414
|
-
decode: decode$
|
|
38446
|
+
encode: encode$3,
|
|
38447
|
+
decode: decode$3,
|
|
38415
38448
|
attributes: validXmlAttributes$1
|
|
38416
38449
|
};
|
|
38417
|
-
const translator$
|
|
38418
|
-
const XML_NODE_NAME = "mc:AlternateContent";
|
|
38419
|
-
const SD_NODE_NAME = [];
|
|
38450
|
+
const translator$3 = NodeTranslator.from(config$3);
|
|
38451
|
+
const XML_NODE_NAME$2 = "mc:AlternateContent";
|
|
38452
|
+
const SD_NODE_NAME$2 = [];
|
|
38420
38453
|
const validXmlAttributes = [];
|
|
38421
|
-
function encode$
|
|
38454
|
+
function encode$2(params2) {
|
|
38422
38455
|
const { nodeListHandler } = params2;
|
|
38423
38456
|
const { node } = params2.extraParams;
|
|
38424
38457
|
if (!node || !node.type) {
|
|
@@ -38438,7 +38471,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38438
38471
|
path: [...params2.path || [], wpsNode]
|
|
38439
38472
|
});
|
|
38440
38473
|
}
|
|
38441
|
-
function decode(params2) {
|
|
38474
|
+
function decode$2(params2) {
|
|
38442
38475
|
const { node } = params2;
|
|
38443
38476
|
const { drawingContent } = node.attrs;
|
|
38444
38477
|
const drawing = {
|
|
@@ -38455,13 +38488,186 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38455
38488
|
elements: [choice]
|
|
38456
38489
|
};
|
|
38457
38490
|
}
|
|
38491
|
+
const config$2 = {
|
|
38492
|
+
xmlName: XML_NODE_NAME$2,
|
|
38493
|
+
sdNodeOrKeyName: SD_NODE_NAME$2,
|
|
38494
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
38495
|
+
encode: encode$2,
|
|
38496
|
+
decode: decode$2,
|
|
38497
|
+
attributes: validXmlAttributes
|
|
38498
|
+
};
|
|
38499
|
+
const translator$2 = NodeTranslator.from(config$2);
|
|
38500
|
+
const XML_NODE_NAME$1 = "sd:pageReference";
|
|
38501
|
+
const SD_NODE_NAME$1 = "pageReference";
|
|
38502
|
+
const encode$1 = (params2, _2) => {
|
|
38503
|
+
const { nodes = [], nodeListHandler } = params2 || {};
|
|
38504
|
+
const node = nodes[0];
|
|
38505
|
+
const processedText = nodeListHandler.handler({
|
|
38506
|
+
...params2,
|
|
38507
|
+
nodes: node.elements
|
|
38508
|
+
});
|
|
38509
|
+
const processedNode = {
|
|
38510
|
+
type: "pageReference",
|
|
38511
|
+
attrs: {
|
|
38512
|
+
instruction: node.attributes?.instruction || "",
|
|
38513
|
+
marksAsAttrs: node.marks || []
|
|
38514
|
+
},
|
|
38515
|
+
content: processedText
|
|
38516
|
+
};
|
|
38517
|
+
return processedNode;
|
|
38518
|
+
};
|
|
38519
|
+
const decode$1 = (params2, _2) => {
|
|
38520
|
+
const { node } = params2;
|
|
38521
|
+
const outputMarks = processOutputMarks(node.attrs?.marksAsAttrs || []);
|
|
38522
|
+
const contentNodes = (node.content ?? []).flatMap((n) => exportSchemaToJson({ ...params2, node: n }));
|
|
38523
|
+
const translated = [
|
|
38524
|
+
{
|
|
38525
|
+
name: "w:r",
|
|
38526
|
+
elements: [
|
|
38527
|
+
{
|
|
38528
|
+
name: "w:rPr",
|
|
38529
|
+
elements: outputMarks
|
|
38530
|
+
},
|
|
38531
|
+
{
|
|
38532
|
+
name: "w:fldChar",
|
|
38533
|
+
attributes: {
|
|
38534
|
+
"w:fldCharType": "begin"
|
|
38535
|
+
}
|
|
38536
|
+
}
|
|
38537
|
+
]
|
|
38538
|
+
},
|
|
38539
|
+
{
|
|
38540
|
+
name: "w:r",
|
|
38541
|
+
elements: [
|
|
38542
|
+
{
|
|
38543
|
+
name: "w:rPr",
|
|
38544
|
+
elements: outputMarks
|
|
38545
|
+
},
|
|
38546
|
+
{
|
|
38547
|
+
name: "w:instrText",
|
|
38548
|
+
attributes: { "xml:space": "preserve" },
|
|
38549
|
+
elements: [
|
|
38550
|
+
{
|
|
38551
|
+
type: "text",
|
|
38552
|
+
text: `${node.attrs.instruction}`
|
|
38553
|
+
}
|
|
38554
|
+
]
|
|
38555
|
+
}
|
|
38556
|
+
]
|
|
38557
|
+
},
|
|
38558
|
+
{
|
|
38559
|
+
name: "w:r",
|
|
38560
|
+
elements: [
|
|
38561
|
+
{
|
|
38562
|
+
name: "w:rPr",
|
|
38563
|
+
elements: outputMarks
|
|
38564
|
+
},
|
|
38565
|
+
{
|
|
38566
|
+
name: "w:fldChar",
|
|
38567
|
+
attributes: {
|
|
38568
|
+
"w:fldCharType": "separate"
|
|
38569
|
+
}
|
|
38570
|
+
}
|
|
38571
|
+
]
|
|
38572
|
+
},
|
|
38573
|
+
...contentNodes,
|
|
38574
|
+
{
|
|
38575
|
+
name: "w:r",
|
|
38576
|
+
elements: [
|
|
38577
|
+
{
|
|
38578
|
+
name: "w:rPr",
|
|
38579
|
+
elements: outputMarks
|
|
38580
|
+
},
|
|
38581
|
+
{
|
|
38582
|
+
name: "w:fldChar",
|
|
38583
|
+
attributes: {
|
|
38584
|
+
"w:fldCharType": "end"
|
|
38585
|
+
}
|
|
38586
|
+
}
|
|
38587
|
+
]
|
|
38588
|
+
}
|
|
38589
|
+
];
|
|
38590
|
+
return translated;
|
|
38591
|
+
};
|
|
38592
|
+
const config$1 = {
|
|
38593
|
+
xmlName: XML_NODE_NAME$1,
|
|
38594
|
+
sdNodeOrKeyName: SD_NODE_NAME$1,
|
|
38595
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
38596
|
+
encode: encode$1,
|
|
38597
|
+
decode: decode$1
|
|
38598
|
+
};
|
|
38599
|
+
const translator$1 = NodeTranslator.from(config$1);
|
|
38600
|
+
const XML_NODE_NAME = "sd:tableOfContents";
|
|
38601
|
+
const SD_NODE_NAME = "tableOfContents";
|
|
38602
|
+
const encode$1c = (params2, _2) => {
|
|
38603
|
+
const { nodes = [], nodeListHandler } = params2 || {};
|
|
38604
|
+
const node = nodes[0];
|
|
38605
|
+
const processedContent = nodeListHandler.handler({
|
|
38606
|
+
...params2,
|
|
38607
|
+
nodes: node.elements || []
|
|
38608
|
+
});
|
|
38609
|
+
const processedNode = {
|
|
38610
|
+
type: "tableOfContents",
|
|
38611
|
+
attrs: {
|
|
38612
|
+
instruction: node.attributes?.instruction || ""
|
|
38613
|
+
},
|
|
38614
|
+
content: processedContent
|
|
38615
|
+
};
|
|
38616
|
+
return processedNode;
|
|
38617
|
+
};
|
|
38618
|
+
const decode = (params2, _2) => {
|
|
38619
|
+
const { node } = params2;
|
|
38620
|
+
const contentNodes = node.content.map((n) => exportSchemaToJson({ ...params2, node: n }));
|
|
38621
|
+
const tocBeginElements = [
|
|
38622
|
+
{
|
|
38623
|
+
name: "w:r",
|
|
38624
|
+
elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "begin" }, elements: [] }]
|
|
38625
|
+
},
|
|
38626
|
+
{
|
|
38627
|
+
name: "w:r",
|
|
38628
|
+
elements: [
|
|
38629
|
+
{
|
|
38630
|
+
name: "w:instrText",
|
|
38631
|
+
attributes: { "xml:space": "preserve" },
|
|
38632
|
+
elements: [{ text: node.attrs?.instruction || "", type: "text", name: "#text", elements: [] }]
|
|
38633
|
+
}
|
|
38634
|
+
]
|
|
38635
|
+
},
|
|
38636
|
+
{ name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "separate" }, elements: [] }] }
|
|
38637
|
+
];
|
|
38638
|
+
if (contentNodes.length > 0) {
|
|
38639
|
+
const firstParagraph = contentNodes[0];
|
|
38640
|
+
let insertIndex = 0;
|
|
38641
|
+
if (firstParagraph.elements) {
|
|
38642
|
+
const pPrIndex = firstParagraph.elements.findIndex((el) => el.name === "w:pPr");
|
|
38643
|
+
insertIndex = pPrIndex >= 0 ? pPrIndex + 1 : 0;
|
|
38644
|
+
} else {
|
|
38645
|
+
firstParagraph.elements = [];
|
|
38646
|
+
}
|
|
38647
|
+
firstParagraph.elements.splice(insertIndex, 0, ...tocBeginElements);
|
|
38648
|
+
} else {
|
|
38649
|
+
contentNodes.push({
|
|
38650
|
+
name: "w:p",
|
|
38651
|
+
elements: tocBeginElements
|
|
38652
|
+
});
|
|
38653
|
+
}
|
|
38654
|
+
const tocEndElements = [
|
|
38655
|
+
{ name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "end" }, elements: [] }] }
|
|
38656
|
+
];
|
|
38657
|
+
const lastParagraph = contentNodes[contentNodes.length - 1];
|
|
38658
|
+
if (lastParagraph.elements) {
|
|
38659
|
+
lastParagraph.elements.push(...tocEndElements);
|
|
38660
|
+
} else {
|
|
38661
|
+
lastParagraph.elements = [...tocEndElements];
|
|
38662
|
+
}
|
|
38663
|
+
return contentNodes;
|
|
38664
|
+
};
|
|
38458
38665
|
const config = {
|
|
38459
38666
|
xmlName: XML_NODE_NAME,
|
|
38460
38667
|
sdNodeOrKeyName: SD_NODE_NAME,
|
|
38461
38668
|
type: NodeTranslator.translatorTypes.NODE,
|
|
38462
|
-
encode: encode$
|
|
38463
|
-
decode
|
|
38464
|
-
attributes: validXmlAttributes
|
|
38669
|
+
encode: encode$1c,
|
|
38670
|
+
decode
|
|
38465
38671
|
};
|
|
38466
38672
|
const translator = NodeTranslator.from(config);
|
|
38467
38673
|
const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
|
|
@@ -38535,32 +38741,35 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38535
38741
|
doc: translateDocumentNode,
|
|
38536
38742
|
body: translateBodyNode,
|
|
38537
38743
|
heading: translateHeadingNode,
|
|
38538
|
-
paragraph: translator$
|
|
38539
|
-
run: translator$
|
|
38744
|
+
paragraph: translator$16,
|
|
38745
|
+
run: translator$V,
|
|
38540
38746
|
text: translateTextNode,
|
|
38541
38747
|
bulletList: translateList,
|
|
38542
38748
|
orderedList: translateList,
|
|
38543
|
-
lineBreak: translator$
|
|
38544
|
-
table: translator$
|
|
38545
|
-
tableRow: translator$
|
|
38546
|
-
tableCell: translator$
|
|
38547
|
-
bookmarkStart: translator$
|
|
38548
|
-
bookmarkEnd: translator$
|
|
38549
|
-
fieldAnnotation: translator$
|
|
38550
|
-
tab: translator$
|
|
38551
|
-
image: translator$
|
|
38552
|
-
hardBreak: translator$
|
|
38749
|
+
lineBreak: translator$19,
|
|
38750
|
+
table: translator$a,
|
|
38751
|
+
tableRow: translator$H,
|
|
38752
|
+
tableCell: translator$9,
|
|
38753
|
+
bookmarkStart: translator$4,
|
|
38754
|
+
bookmarkEnd: translator$3,
|
|
38755
|
+
fieldAnnotation: translator$5,
|
|
38756
|
+
tab: translator$17,
|
|
38757
|
+
image: translator$6,
|
|
38758
|
+
hardBreak: translator$19,
|
|
38553
38759
|
commentRangeStart: () => translateCommentNode(params2, "Start"),
|
|
38554
38760
|
commentRangeEnd: () => translateCommentNode(params2, "End"),
|
|
38555
38761
|
commentReference: () => null,
|
|
38556
38762
|
shapeContainer: translateShapeContainer,
|
|
38557
38763
|
shapeTextbox: translateShapeTextbox,
|
|
38558
38764
|
contentBlock: translateContentBlock,
|
|
38559
|
-
structuredContent: translator$
|
|
38560
|
-
structuredContentBlock: translator$
|
|
38561
|
-
|
|
38765
|
+
structuredContent: translator$5,
|
|
38766
|
+
structuredContentBlock: translator$5,
|
|
38767
|
+
documentPartObject: translator$5,
|
|
38768
|
+
documentSection: translator$5,
|
|
38562
38769
|
"page-number": translatePageNumberNode,
|
|
38563
|
-
"total-page-number": translateTotalPageNumberNode
|
|
38770
|
+
"total-page-number": translateTotalPageNumberNode,
|
|
38771
|
+
pageReference: translator$1,
|
|
38772
|
+
tableOfContents: translator
|
|
38564
38773
|
};
|
|
38565
38774
|
let handler2 = router[type2];
|
|
38566
38775
|
if (handler2 && "decode" in handler2 && typeof handler2.decode === "function") {
|
|
@@ -38898,8 +39107,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38898
39107
|
const trackedMarks = [TrackInsertMarkName, TrackDeleteMarkName];
|
|
38899
39108
|
const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
|
|
38900
39109
|
if (isTrackedNode) return translateTrackedNode(params2);
|
|
38901
|
-
const isLinkNode = node.marks?.some((m2) => m2.type === "link");
|
|
38902
|
-
if (isLinkNode) return translator$7.decode(params2);
|
|
38903
39110
|
const { text, marks = [] } = node;
|
|
38904
39111
|
return getTextNodeForExport(text, marks, params2);
|
|
38905
39112
|
}
|
|
@@ -39205,7 +39412,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39205
39412
|
markElement.type = "element";
|
|
39206
39413
|
break;
|
|
39207
39414
|
case "underline": {
|
|
39208
|
-
const translated = translator$
|
|
39415
|
+
const translated = translator$13.decode({
|
|
39209
39416
|
node: {
|
|
39210
39417
|
attrs: {
|
|
39211
39418
|
underlineType: attrs.underlineType ?? attrs.underline ?? null,
|
|
@@ -39269,7 +39476,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39269
39476
|
break;
|
|
39270
39477
|
case "highlight": {
|
|
39271
39478
|
const highlightValue = attrs.color ?? attrs.highlight ?? null;
|
|
39272
|
-
const translated = translator$
|
|
39479
|
+
const translated = translator$18.decode({ node: { attrs: { highlight: highlightValue } } });
|
|
39273
39480
|
return translated || {};
|
|
39274
39481
|
}
|
|
39275
39482
|
}
|
|
@@ -39329,7 +39536,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39329
39536
|
if (vmlAttributes || horizontalRule) {
|
|
39330
39537
|
return translateVRectContentBlock(params2);
|
|
39331
39538
|
}
|
|
39332
|
-
const alternateContent = translator.decode(params2);
|
|
39539
|
+
const alternateContent = translator$2.decode(params2);
|
|
39333
39540
|
return wrapTextInRun(alternateContent);
|
|
39334
39541
|
}
|
|
39335
39542
|
function translateVRectContentBlock(params2) {
|
|
@@ -39475,6 +39682,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39475
39682
|
},
|
|
39476
39683
|
{
|
|
39477
39684
|
name: "w:instrText",
|
|
39685
|
+
attributes: { "xml:space": "preserve" },
|
|
39478
39686
|
elements: [
|
|
39479
39687
|
{
|
|
39480
39688
|
type: "text",
|
|
@@ -39534,7 +39742,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39534
39742
|
if (mainNode.name === "w:drawing") node = mainNode;
|
|
39535
39743
|
else node = mainNode.elements.find((el) => el.name === "w:drawing");
|
|
39536
39744
|
if (!node) return { nodes: [], consumed: 0 };
|
|
39537
|
-
const schemaNode = translator$
|
|
39745
|
+
const schemaNode = translator$6.encode(params2);
|
|
39538
39746
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
39539
39747
|
return { nodes: newNodes, consumed: 1 };
|
|
39540
39748
|
};
|
|
@@ -39636,8 +39844,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39636
39844
|
handlerName: "trackChangeNodeHandler",
|
|
39637
39845
|
handler: handleTrackChangeNode
|
|
39638
39846
|
};
|
|
39639
|
-
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$
|
|
39640
|
-
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$
|
|
39847
|
+
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$W);
|
|
39848
|
+
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$V);
|
|
39641
39849
|
const handleTextNode = (params2) => {
|
|
39642
39850
|
const { nodes, insideTrackChange } = params2;
|
|
39643
39851
|
if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
|
|
@@ -39678,7 +39886,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39678
39886
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
39679
39887
|
return { nodes: [], consumed: 0 };
|
|
39680
39888
|
}
|
|
39681
|
-
const schemaNode = translator$
|
|
39889
|
+
const schemaNode = translator$16.encode(params2);
|
|
39682
39890
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
39683
39891
|
return { nodes: newNodes, consumed: 1 };
|
|
39684
39892
|
};
|
|
@@ -39691,7 +39899,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39691
39899
|
if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
|
|
39692
39900
|
return { nodes: [], consumed: 0 };
|
|
39693
39901
|
}
|
|
39694
|
-
const result = translator$
|
|
39902
|
+
const result = translator$5.encode(params2);
|
|
39695
39903
|
if (!result) {
|
|
39696
39904
|
return { nodes: [], consumed: 0 };
|
|
39697
39905
|
}
|
|
@@ -39781,7 +39989,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39781
39989
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
39782
39990
|
return { nodes: [], consumed: 0 };
|
|
39783
39991
|
}
|
|
39784
|
-
const result = translator$
|
|
39992
|
+
const result = translator$19.encode(params2);
|
|
39785
39993
|
if (!result) return { nodes: [], consumed: 0 };
|
|
39786
39994
|
return {
|
|
39787
39995
|
nodes: [result],
|
|
@@ -39853,7 +40061,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39853
40061
|
if (isCustomMarkBookmark(nodes[0], params2.editor)) {
|
|
39854
40062
|
return handleBookmarkNode(params2);
|
|
39855
40063
|
}
|
|
39856
|
-
const node = translator$
|
|
40064
|
+
const node = translator$4.encode(params2);
|
|
39857
40065
|
if (!node) return { nodes: [], consumed: 0 };
|
|
39858
40066
|
return { nodes: [node], consumed: 1 };
|
|
39859
40067
|
};
|
|
@@ -39885,7 +40093,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39885
40093
|
if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
|
|
39886
40094
|
return { nodes: [], consumed: 0 };
|
|
39887
40095
|
}
|
|
39888
|
-
const node = translator$
|
|
40096
|
+
const node = translator$3.encode(params2);
|
|
39889
40097
|
if (!node) return { nodes: [], consumed: 0 };
|
|
39890
40098
|
return { nodes: [node], consumed: 1 };
|
|
39891
40099
|
};
|
|
@@ -40018,6 +40226,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40018
40226
|
handlerName: "autoTotalPageCountEntity",
|
|
40019
40227
|
handler: handleAutoTotalPageNumber
|
|
40020
40228
|
};
|
|
40229
|
+
const pageReferenceEntity = generateV2HandlerEntity("pageReferenceNodeHandler", translator$1);
|
|
40021
40230
|
const handlePictNode = (params2) => {
|
|
40022
40231
|
const { nodes } = params2;
|
|
40023
40232
|
if (!nodes.length || nodes[0].name !== "w:p") {
|
|
@@ -40489,6 +40698,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40489
40698
|
const spacing = pPr?.elements?.find((el) => el.name === "w:spacing");
|
|
40490
40699
|
const justify = pPr?.elements?.find((el) => el.name === "w:jc");
|
|
40491
40700
|
const indent = pPr?.elements?.find((el) => el.name === "w:ind");
|
|
40701
|
+
const tabs = pPr?.elements?.find((el) => el.name === "w:tabs");
|
|
40492
40702
|
let lineSpaceBefore, lineSpaceAfter, line;
|
|
40493
40703
|
if (spacing) {
|
|
40494
40704
|
lineSpaceBefore = twipsToPixels(spacing?.attributes["w:before"]);
|
|
@@ -40502,6 +40712,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40502
40712
|
rightIndent = twipsToPixels(indent?.attributes["w:right"]);
|
|
40503
40713
|
firstLine = twipsToPixels(indent?.attributes["w:firstLine"]);
|
|
40504
40714
|
}
|
|
40715
|
+
let tabStops = [];
|
|
40716
|
+
if (tabs) {
|
|
40717
|
+
tabStops = (tabs.elements || []).filter((el) => el.name === "w:tab").map((tab) => {
|
|
40718
|
+
let val = tab.attributes["w:val"];
|
|
40719
|
+
if (val == "left") {
|
|
40720
|
+
val = "start";
|
|
40721
|
+
} else if (val == "right") {
|
|
40722
|
+
val = "end";
|
|
40723
|
+
}
|
|
40724
|
+
return {
|
|
40725
|
+
val,
|
|
40726
|
+
pos: twipsToPixels(tab.attributes["w:pos"]),
|
|
40727
|
+
leader: tab.attributes["w:leader"]
|
|
40728
|
+
};
|
|
40729
|
+
});
|
|
40730
|
+
}
|
|
40505
40731
|
const keepNext = pPr?.elements?.find((el) => el.name === "w:keepNext");
|
|
40506
40732
|
const keepLines = pPr?.elements?.find((el) => el.name === "w:keepLines");
|
|
40507
40733
|
const outlineLevel = pPr?.elements?.find((el) => el.name === "w:outlineLvl");
|
|
@@ -40534,7 +40760,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40534
40760
|
const parsedStyles = {
|
|
40535
40761
|
spacing: { lineSpaceAfter, lineSpaceBefore, line },
|
|
40536
40762
|
textAlign,
|
|
40537
|
-
indent: { leftIndent, rightIndent, firstLine }
|
|
40763
|
+
indent: { leftIndent, rightIndent, firstLine },
|
|
40764
|
+
tabStops: tabStops.length > 0 ? tabStops : null
|
|
40538
40765
|
};
|
|
40539
40766
|
parsedMarks.forEach((mark) => {
|
|
40540
40767
|
const { type: type2, attrs } = mark;
|
|
@@ -40558,13 +40785,213 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40558
40785
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
40559
40786
|
return { nodes: [], consumed: 0 };
|
|
40560
40787
|
}
|
|
40561
|
-
const node = translator$
|
|
40788
|
+
const node = translator$17.encode(params2);
|
|
40562
40789
|
return { nodes: [node], consumed: 1 };
|
|
40563
40790
|
};
|
|
40564
40791
|
const tabNodeEntityHandler = {
|
|
40565
40792
|
handlerName: "w:tabTranslator",
|
|
40566
40793
|
handler: handleTabNode
|
|
40567
40794
|
};
|
|
40795
|
+
const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator);
|
|
40796
|
+
function preProcessPageInstruction(nodesToCombine, _2, __) {
|
|
40797
|
+
const pageNumNode = {
|
|
40798
|
+
name: "sd:autoPageNumber",
|
|
40799
|
+
type: "element"
|
|
40800
|
+
};
|
|
40801
|
+
nodesToCombine.forEach((n) => {
|
|
40802
|
+
const rPrNode = n.elements.find((el) => el.name === "w:rPr");
|
|
40803
|
+
if (rPrNode) pageNumNode.elements = [rPrNode];
|
|
40804
|
+
});
|
|
40805
|
+
return [pageNumNode];
|
|
40806
|
+
}
|
|
40807
|
+
function preProcessNumPagesInstruction(nodesToCombine, _2, __) {
|
|
40808
|
+
const totalPageNumNode = {
|
|
40809
|
+
name: "sd:totalPageNumber",
|
|
40810
|
+
type: "element"
|
|
40811
|
+
};
|
|
40812
|
+
nodesToCombine.forEach((n) => {
|
|
40813
|
+
const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
|
|
40814
|
+
if (rPrNode) totalPageNumNode.elements = [rPrNode];
|
|
40815
|
+
});
|
|
40816
|
+
return [totalPageNumNode];
|
|
40817
|
+
}
|
|
40818
|
+
function preProcessPageRefInstruction(nodesToCombine, instrText, _2) {
|
|
40819
|
+
const pageRefNode = {
|
|
40820
|
+
name: "sd:pageReference",
|
|
40821
|
+
type: "element",
|
|
40822
|
+
attributes: {
|
|
40823
|
+
instruction: instrText
|
|
40824
|
+
},
|
|
40825
|
+
elements: nodesToCombine
|
|
40826
|
+
};
|
|
40827
|
+
return [pageRefNode];
|
|
40828
|
+
}
|
|
40829
|
+
function preProcessHyperlinkInstruction(nodesToCombine, instruction, docx) {
|
|
40830
|
+
const urlMatch = instruction.match(/HYPERLINK\s+"([^"]+)"/);
|
|
40831
|
+
let linkAttributes;
|
|
40832
|
+
if (urlMatch && urlMatch.length >= 2) {
|
|
40833
|
+
const url = urlMatch[1];
|
|
40834
|
+
const rels = docx["word/_rels/document.xml.rels"];
|
|
40835
|
+
const relationships = rels?.elements.find((el) => el.name === "Relationships");
|
|
40836
|
+
if (relationships) {
|
|
40837
|
+
const rId = generateDocxRandomId();
|
|
40838
|
+
relationships.elements.push({
|
|
40839
|
+
type: "element",
|
|
40840
|
+
name: "Relationship",
|
|
40841
|
+
attributes: {
|
|
40842
|
+
Id: rId,
|
|
40843
|
+
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
40844
|
+
Target: url,
|
|
40845
|
+
TargetMode: "External"
|
|
40846
|
+
}
|
|
40847
|
+
});
|
|
40848
|
+
linkAttributes = { "r:id": rId };
|
|
40849
|
+
} else {
|
|
40850
|
+
linkAttributes = { "w:anchor": url };
|
|
40851
|
+
}
|
|
40852
|
+
} else {
|
|
40853
|
+
const availableSwitches = {
|
|
40854
|
+
"w:anchor": `l "(?<value>[^"]+)"`,
|
|
40855
|
+
new_window: `
|
|
40856
|
+
`,
|
|
40857
|
+
"w:tgtFrame": ` "(?<value>[^"]+)"`,
|
|
40858
|
+
"w:tooltip": `o "(?<value>[^"]+)"`
|
|
40859
|
+
};
|
|
40860
|
+
const parsedSwitches = {};
|
|
40861
|
+
for (const [key2, regex] of Object.entries(availableSwitches)) {
|
|
40862
|
+
const match = instruction.match(new RegExp(regex));
|
|
40863
|
+
if (match) {
|
|
40864
|
+
parsedSwitches[key2] = match.groups?.value || true;
|
|
40865
|
+
}
|
|
40866
|
+
}
|
|
40867
|
+
if (parsedSwitches.new_window) {
|
|
40868
|
+
parsedSwitches["w:tgtFrame"] = "_blank";
|
|
40869
|
+
delete parsedSwitches.new_window;
|
|
40870
|
+
}
|
|
40871
|
+
linkAttributes = { ...parsedSwitches };
|
|
40872
|
+
}
|
|
40873
|
+
return [
|
|
40874
|
+
{
|
|
40875
|
+
name: "w:hyperlink",
|
|
40876
|
+
type: "element",
|
|
40877
|
+
attributes: linkAttributes,
|
|
40878
|
+
elements: nodesToCombine
|
|
40879
|
+
}
|
|
40880
|
+
];
|
|
40881
|
+
}
|
|
40882
|
+
function preProcessTocInstruction(nodesToCombine, instrText) {
|
|
40883
|
+
return [
|
|
40884
|
+
{
|
|
40885
|
+
name: "sd:tableOfContents",
|
|
40886
|
+
type: "element",
|
|
40887
|
+
attributes: {
|
|
40888
|
+
instruction: instrText
|
|
40889
|
+
},
|
|
40890
|
+
elements: nodesToCombine
|
|
40891
|
+
}
|
|
40892
|
+
];
|
|
40893
|
+
}
|
|
40894
|
+
const getInstructionPreProcessor = (instruction) => {
|
|
40895
|
+
const instructionType = instruction.split(" ")[0];
|
|
40896
|
+
switch (instructionType) {
|
|
40897
|
+
case "PAGE":
|
|
40898
|
+
return preProcessPageInstruction;
|
|
40899
|
+
case "NUMPAGES":
|
|
40900
|
+
return preProcessNumPagesInstruction;
|
|
40901
|
+
case "PAGEREF":
|
|
40902
|
+
return preProcessPageRefInstruction;
|
|
40903
|
+
case "HYPERLINK":
|
|
40904
|
+
return preProcessHyperlinkInstruction;
|
|
40905
|
+
case "TOC":
|
|
40906
|
+
return preProcessTocInstruction;
|
|
40907
|
+
default:
|
|
40908
|
+
return null;
|
|
40909
|
+
}
|
|
40910
|
+
};
|
|
40911
|
+
const preProcessNodesForFldChar = (nodes = [], docx) => {
|
|
40912
|
+
const processedNodes = [];
|
|
40913
|
+
let collectedNodesStack = [];
|
|
40914
|
+
let currentFieldStack = [];
|
|
40915
|
+
let unpairedEnd = null;
|
|
40916
|
+
let collecting = false;
|
|
40917
|
+
const finalizeField = () => {
|
|
40918
|
+
if (collecting) {
|
|
40919
|
+
const collectedNodes = collectedNodesStack.pop().filter((n) => n !== null);
|
|
40920
|
+
const currentField = currentFieldStack.pop();
|
|
40921
|
+
const combined = _processCombinedNodesForFldChar(collectedNodes, currentField.instrText.trim(), docx);
|
|
40922
|
+
if (collectedNodesStack.length === 0) {
|
|
40923
|
+
processedNodes.push(...combined);
|
|
40924
|
+
} else {
|
|
40925
|
+
collectedNodesStack[collectedNodesStack.length - 1].push(...combined);
|
|
40926
|
+
}
|
|
40927
|
+
} else {
|
|
40928
|
+
unpairedEnd = true;
|
|
40929
|
+
}
|
|
40930
|
+
};
|
|
40931
|
+
for (const node of nodes) {
|
|
40932
|
+
const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
|
|
40933
|
+
const fldType = fldCharEl?.attributes?.["w:fldCharType"];
|
|
40934
|
+
const instrTextEl = node.elements?.find((el) => el.name === "w:instrText");
|
|
40935
|
+
collecting = collectedNodesStack.length > 0;
|
|
40936
|
+
if (fldType === "begin") {
|
|
40937
|
+
collectedNodesStack.push([null]);
|
|
40938
|
+
currentFieldStack.push({ instrText: "" });
|
|
40939
|
+
continue;
|
|
40940
|
+
}
|
|
40941
|
+
if (instrTextEl && collecting && currentFieldStack.length > 0) {
|
|
40942
|
+
currentFieldStack[currentFieldStack.length - 1].instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
|
|
40943
|
+
continue;
|
|
40944
|
+
}
|
|
40945
|
+
if (fldType === "end") {
|
|
40946
|
+
finalizeField();
|
|
40947
|
+
continue;
|
|
40948
|
+
} else if (fldType === "separate") {
|
|
40949
|
+
continue;
|
|
40950
|
+
}
|
|
40951
|
+
if (Array.isArray(node.elements)) {
|
|
40952
|
+
const childResult = preProcessNodesForFldChar(node.elements, docx);
|
|
40953
|
+
node.elements = childResult.processedNodes;
|
|
40954
|
+
if (childResult.unpairedBegin) {
|
|
40955
|
+
childResult.unpairedBegin.forEach((pendingField) => {
|
|
40956
|
+
currentFieldStack.push(pendingField.fieldInfo);
|
|
40957
|
+
collectedNodesStack.push([node]);
|
|
40958
|
+
});
|
|
40959
|
+
} else if (childResult.unpairedEnd) {
|
|
40960
|
+
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
40961
|
+
finalizeField();
|
|
40962
|
+
} else if (collecting) {
|
|
40963
|
+
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
40964
|
+
} else {
|
|
40965
|
+
processedNodes.push(node);
|
|
40966
|
+
}
|
|
40967
|
+
} else if (collecting) {
|
|
40968
|
+
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
40969
|
+
} else {
|
|
40970
|
+
processedNodes.push(node);
|
|
40971
|
+
}
|
|
40972
|
+
}
|
|
40973
|
+
let unpairedBegin = null;
|
|
40974
|
+
if (collectedNodesStack.length > 0) {
|
|
40975
|
+
unpairedBegin = [];
|
|
40976
|
+
for (let i2 = 0; i2 < collectedNodesStack.length; i2++) {
|
|
40977
|
+
processedNodes.push(...collectedNodesStack[i2].filter((n) => n !== null));
|
|
40978
|
+
unpairedBegin.push({
|
|
40979
|
+
nodes: collectedNodesStack[i2],
|
|
40980
|
+
fieldInfo: currentFieldStack[i2]
|
|
40981
|
+
});
|
|
40982
|
+
}
|
|
40983
|
+
}
|
|
40984
|
+
return { processedNodes, unpairedBegin, unpairedEnd };
|
|
40985
|
+
};
|
|
40986
|
+
const _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx) => {
|
|
40987
|
+
const instructionType = instrText.trim().split(" ")[0];
|
|
40988
|
+
const instructionPreProcessor = getInstructionPreProcessor(instructionType);
|
|
40989
|
+
if (instructionPreProcessor) {
|
|
40990
|
+
return instructionPreProcessor(nodesToCombine, instrText, docx);
|
|
40991
|
+
} else {
|
|
40992
|
+
return nodesToCombine;
|
|
40993
|
+
}
|
|
40994
|
+
};
|
|
40568
40995
|
const createDocumentJson = (docx, converter, editor) => {
|
|
40569
40996
|
const json = carbonCopy(getInitialJSON(docx));
|
|
40570
40997
|
if (!json) return null;
|
|
@@ -40594,6 +41021,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40594
41021
|
if (bodyNode) {
|
|
40595
41022
|
ensureSectionProperties(bodyNode);
|
|
40596
41023
|
const node = bodyNode;
|
|
41024
|
+
const { processedNodes } = preProcessNodesForFldChar(node.elements ?? [], docx);
|
|
41025
|
+
node.elements = processedNodes;
|
|
40597
41026
|
const contentElements = node.elements?.filter((n) => n.name !== "w:sectPr") ?? [];
|
|
40598
41027
|
const content = pruneIgnoredNodes(contentElements);
|
|
40599
41028
|
const comments = importCommentData({ docx, converter, editor });
|
|
@@ -40649,8 +41078,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
40649
41078
|
trackChangeNodeHandlerEntity,
|
|
40650
41079
|
tableNodeHandlerEntity,
|
|
40651
41080
|
tabNodeEntityHandler,
|
|
41081
|
+
tableOfContentsHandlerEntity,
|
|
40652
41082
|
autoPageHandlerEntity,
|
|
40653
41083
|
autoTotalPageCountEntity,
|
|
41084
|
+
pageReferenceEntity,
|
|
40654
41085
|
standardNodeHandlerEntity
|
|
40655
41086
|
];
|
|
40656
41087
|
const handler2 = createNodeListHandler(entities);
|
|
@@ -49357,8 +49788,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
49357
49788
|
let $to = parse.doc.resolveNoCache(change.endB - parse.from);
|
|
49358
49789
|
let $fromA = doc2.resolve(change.start);
|
|
49359
49790
|
let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
|
|
49360
|
-
|
|
49361
|
-
if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")) && (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) && nextSel.head > $from.pos) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
|
|
49791
|
+
if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
|
|
49362
49792
|
view.input.lastIOSEnter = 0;
|
|
49363
49793
|
return;
|
|
49364
49794
|
}
|
|
@@ -61502,6 +61932,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61502
61932
|
});
|
|
61503
61933
|
return result;
|
|
61504
61934
|
}
|
|
61935
|
+
function getStructuredContentTagsByAlias(aliasOrAliases, state2) {
|
|
61936
|
+
const result = findChildren$5(state2.doc, (node) => {
|
|
61937
|
+
const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node.type.name);
|
|
61938
|
+
if (Array.isArray(aliasOrAliases)) {
|
|
61939
|
+
return isStructuredContent && aliasOrAliases.includes(node.attrs.alias);
|
|
61940
|
+
} else {
|
|
61941
|
+
return isStructuredContent && node.attrs.alias === aliasOrAliases;
|
|
61942
|
+
}
|
|
61943
|
+
});
|
|
61944
|
+
return result;
|
|
61945
|
+
}
|
|
61505
61946
|
function getStructuredContentTags(state2) {
|
|
61506
61947
|
const result = findChildren$5(state2.doc, (node) => {
|
|
61507
61948
|
return node.type.name === "structuredContent" || node.type.name === "structuredContentBlock";
|
|
@@ -61521,6 +61962,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61521
61962
|
getStructuredContentBlockTags,
|
|
61522
61963
|
getStructuredContentInlineTags,
|
|
61523
61964
|
getStructuredContentTags,
|
|
61965
|
+
getStructuredContentTagsByAlias,
|
|
61524
61966
|
getStructuredContentTagsById
|
|
61525
61967
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
61526
61968
|
const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
|
|
@@ -61609,10 +62051,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61609
62051
|
return true;
|
|
61610
62052
|
},
|
|
61611
62053
|
/**
|
|
61612
|
-
* Updates a structured content
|
|
62054
|
+
* Updates a single structured content field by its unique ID.
|
|
62055
|
+
* IDs are unique identifiers, so this will update at most one field.
|
|
61613
62056
|
* If the updated node does not match the schema, it will not be updated.
|
|
61614
62057
|
* @category Command
|
|
61615
|
-
* @param {string} id
|
|
62058
|
+
* @param {string} id - Unique identifier of the field
|
|
61616
62059
|
* @param {StructuredContentUpdate} options
|
|
61617
62060
|
*/
|
|
61618
62061
|
updateStructuredContentById: (id, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
|
|
@@ -61652,6 +62095,58 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61652
62095
|
}
|
|
61653
62096
|
return true;
|
|
61654
62097
|
},
|
|
62098
|
+
/**
|
|
62099
|
+
* Updates all structured content fields with the same alias.
|
|
62100
|
+
* Unlike IDs (which are unique), aliases can be shared across multiple fields.
|
|
62101
|
+
* This will update every field that matches the given alias.
|
|
62102
|
+
* If any updated node does not match the schema, no updates will be applied.
|
|
62103
|
+
* @category Command
|
|
62104
|
+
* @param {string | string[]} alias - Shared identifier for fields (e.g., "customer_name")
|
|
62105
|
+
* @param {StructuredContentUpdate} options
|
|
62106
|
+
*/
|
|
62107
|
+
updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
|
|
62108
|
+
const structuredContentTags = getStructuredContentTagsByAlias(alias, state2);
|
|
62109
|
+
if (!structuredContentTags.length) {
|
|
62110
|
+
return true;
|
|
62111
|
+
}
|
|
62112
|
+
const { schema } = editor;
|
|
62113
|
+
const createContent = (node) => {
|
|
62114
|
+
if (options.text) {
|
|
62115
|
+
return schema.text(options.text);
|
|
62116
|
+
}
|
|
62117
|
+
if (options.html) {
|
|
62118
|
+
const html = htmlHandler(options.html, editor);
|
|
62119
|
+
const doc2 = DOMParser$1.fromSchema(schema).parse(html);
|
|
62120
|
+
return doc2.content;
|
|
62121
|
+
}
|
|
62122
|
+
if (options.json) {
|
|
62123
|
+
return schema.nodeFromJSON(options.json);
|
|
62124
|
+
}
|
|
62125
|
+
return node.content;
|
|
62126
|
+
};
|
|
62127
|
+
for (const { node } of structuredContentTags) {
|
|
62128
|
+
const content = createContent(node);
|
|
62129
|
+
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
62130
|
+
try {
|
|
62131
|
+
updatedNode.check();
|
|
62132
|
+
} catch {
|
|
62133
|
+
console.error("Updated node does not conform to the schema");
|
|
62134
|
+
return false;
|
|
62135
|
+
}
|
|
62136
|
+
}
|
|
62137
|
+
if (dispatch) {
|
|
62138
|
+
structuredContentTags.forEach(({ pos, node }) => {
|
|
62139
|
+
const mappedPos = tr.mapping.map(pos);
|
|
62140
|
+
const currentNode = tr.doc.nodeAt(mappedPos);
|
|
62141
|
+
if (currentNode && node.eq(currentNode)) {
|
|
62142
|
+
const content = createContent(node);
|
|
62143
|
+
const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
|
|
62144
|
+
tr.replaceWith(mappedPos, mappedPos + node.nodeSize, updatedNode);
|
|
62145
|
+
}
|
|
62146
|
+
});
|
|
62147
|
+
}
|
|
62148
|
+
return true;
|
|
62149
|
+
},
|
|
61655
62150
|
/**
|
|
61656
62151
|
* Removes a structured content.
|
|
61657
62152
|
* @category Command
|
|
@@ -62105,6 +62600,48 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62105
62600
|
};
|
|
62106
62601
|
}
|
|
62107
62602
|
});
|
|
62603
|
+
const DocumentPartObject = Node$1.create({
|
|
62604
|
+
name: "documentPartObject",
|
|
62605
|
+
group: "block",
|
|
62606
|
+
content: "block*",
|
|
62607
|
+
isolating: true,
|
|
62608
|
+
addOptions() {
|
|
62609
|
+
return {
|
|
62610
|
+
htmlAttributes: {
|
|
62611
|
+
class: "sd-document-part-object-block",
|
|
62612
|
+
"aria-label": "Structured document part block"
|
|
62613
|
+
}
|
|
62614
|
+
};
|
|
62615
|
+
},
|
|
62616
|
+
parseDOM() {
|
|
62617
|
+
return [
|
|
62618
|
+
{
|
|
62619
|
+
tag: "div.sd-document-part-object-block",
|
|
62620
|
+
priority: 60
|
|
62621
|
+
}
|
|
62622
|
+
];
|
|
62623
|
+
},
|
|
62624
|
+
renderDOM({ htmlAttributes }) {
|
|
62625
|
+
return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
62626
|
+
},
|
|
62627
|
+
addAttributes() {
|
|
62628
|
+
return {
|
|
62629
|
+
sdBlockId: {
|
|
62630
|
+
default: null,
|
|
62631
|
+
keepOnSplit: false,
|
|
62632
|
+
parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
|
|
62633
|
+
renderDOM: (attrs) => {
|
|
62634
|
+
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
62635
|
+
}
|
|
62636
|
+
},
|
|
62637
|
+
id: {},
|
|
62638
|
+
docPartGallery: {},
|
|
62639
|
+
docPartUnique: {
|
|
62640
|
+
default: true
|
|
62641
|
+
}
|
|
62642
|
+
};
|
|
62643
|
+
}
|
|
62644
|
+
});
|
|
62108
62645
|
const Document = Node$1.create({
|
|
62109
62646
|
name: "doc",
|
|
62110
62647
|
topNode: true,
|
|
@@ -63241,7 +63778,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63241
63778
|
return { ...base2, ...linkedStyle.definition?.styles || {} };
|
|
63242
63779
|
};
|
|
63243
63780
|
const pMap = buildStyleMap(paragraphStyleId);
|
|
63244
|
-
|
|
63781
|
+
let tMap;
|
|
63782
|
+
if (paragraphStyleId?.startsWith("TOC")) {
|
|
63783
|
+
tMap = {};
|
|
63784
|
+
} else {
|
|
63785
|
+
tMap = buildStyleMap(inlineTextStyleId);
|
|
63786
|
+
}
|
|
63245
63787
|
const rMap = buildStyleMap(runStyleId);
|
|
63246
63788
|
const finalStyles = { ...pMap, ...tMap, ...rMap };
|
|
63247
63789
|
if (Object.keys(finalStyles).length === 0) return;
|
|
@@ -64538,7 +65080,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64538
65080
|
});
|
|
64539
65081
|
const defaultTabDistance = 48;
|
|
64540
65082
|
const defaultLineLength = 816;
|
|
64541
|
-
const getTabDecorations = (doc2, view, from2 = 0, to = null) => {
|
|
65083
|
+
const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
64542
65084
|
const decorations = [];
|
|
64543
65085
|
const paragraphCache = /* @__PURE__ */ new Map();
|
|
64544
65086
|
const end2 = to ?? doc2.content.size;
|
|
@@ -64546,7 +65088,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64546
65088
|
if (node.type.name !== "tab") return;
|
|
64547
65089
|
let extraStyles = "";
|
|
64548
65090
|
const $pos = doc2.resolve(pos);
|
|
64549
|
-
const paragraphContext = getParagraphContext($pos, paragraphCache);
|
|
65091
|
+
const paragraphContext = getParagraphContext($pos, paragraphCache, helpers2);
|
|
64550
65092
|
if (!paragraphContext) return;
|
|
64551
65093
|
try {
|
|
64552
65094
|
const { tabStops, flattened, startPos } = paragraphContext;
|
|
@@ -64601,18 +65143,27 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64601
65143
|
});
|
|
64602
65144
|
return decorations;
|
|
64603
65145
|
};
|
|
64604
|
-
function getParagraphContext($pos, cache2) {
|
|
65146
|
+
function getParagraphContext($pos, cache2, helpers2) {
|
|
64605
65147
|
for (let depth = $pos.depth; depth >= 0; depth--) {
|
|
64606
65148
|
const node = $pos.node(depth);
|
|
64607
65149
|
if (node?.type?.name === "paragraph") {
|
|
64608
65150
|
const startPos = $pos.start(depth);
|
|
64609
65151
|
if (!cache2.has(startPos)) {
|
|
65152
|
+
let tabStops = [];
|
|
65153
|
+
if (Array.isArray(node.attrs?.tabStops)) {
|
|
65154
|
+
tabStops = node.attrs.tabStops;
|
|
65155
|
+
} else {
|
|
65156
|
+
const style2 = helpers2.linkedStyles.getStyleById(node.attrs?.styleId);
|
|
65157
|
+
if (Array.isArray(style2?.definition?.styles?.tabStops)) {
|
|
65158
|
+
tabStops = style2.definition.styles.tabStops;
|
|
65159
|
+
}
|
|
65160
|
+
}
|
|
64610
65161
|
cache2.set(startPos, {
|
|
64611
65162
|
paragraph: node,
|
|
64612
65163
|
paragraphDepth: depth,
|
|
64613
65164
|
startPos,
|
|
64614
65165
|
indent: node.attrs?.indent || {},
|
|
64615
|
-
tabStops
|
|
65166
|
+
tabStops,
|
|
64616
65167
|
flattened: flattenParagraph(node, startPos),
|
|
64617
65168
|
accumulatedTabWidth: 0
|
|
64618
65169
|
});
|
|
@@ -64778,7 +65329,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64778
65329
|
};
|
|
64779
65330
|
},
|
|
64780
65331
|
addPmPlugins() {
|
|
64781
|
-
const { view } = this.editor;
|
|
65332
|
+
const { view, helpers: helpers2 } = this.editor;
|
|
64782
65333
|
const tabPlugin = new Plugin({
|
|
64783
65334
|
name: "tabPlugin",
|
|
64784
65335
|
key: new PluginKey("tabPlugin"),
|
|
@@ -64788,7 +65339,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64788
65339
|
},
|
|
64789
65340
|
apply(tr, { decorations }, _oldState, newState) {
|
|
64790
65341
|
if (!decorations) {
|
|
64791
|
-
decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view));
|
|
65342
|
+
decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
|
|
64792
65343
|
}
|
|
64793
65344
|
if (!tr.docChanged) {
|
|
64794
65345
|
return { decorations };
|
|
@@ -64828,7 +65379,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64828
65379
|
rangesToRecalculate.forEach(([start2, end2]) => {
|
|
64829
65380
|
const oldDecorations = decorations.find(start2, end2);
|
|
64830
65381
|
decorations = decorations.remove(oldDecorations);
|
|
64831
|
-
const newDecorations = getTabDecorations(newState.doc, view, start2, end2);
|
|
65382
|
+
const newDecorations = getTabDecorations(newState.doc, view, helpers2, start2, end2);
|
|
64832
65383
|
decorations = decorations.add(newState.doc, newDecorations);
|
|
64833
65384
|
});
|
|
64834
65385
|
return { decorations };
|
|
@@ -69737,6 +70288,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69737
70288
|
}
|
|
69738
70289
|
return formatAttrs;
|
|
69739
70290
|
}
|
|
70291
|
+
const DEFAULT_MIME_TYPE = "application/octet-stream";
|
|
69740
70292
|
const simpleHash = (str) => {
|
|
69741
70293
|
let hash2 = 0;
|
|
69742
70294
|
for (let i2 = 0; i2 < str.length; i2++) {
|
|
@@ -69746,21 +70298,40 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69746
70298
|
}
|
|
69747
70299
|
return Math.abs(hash2).toString();
|
|
69748
70300
|
};
|
|
69749
|
-
const
|
|
69750
|
-
|
|
69751
|
-
|
|
69752
|
-
|
|
69753
|
-
|
|
69754
|
-
|
|
70301
|
+
const decodeBase64ToBinaryString = (data) => {
|
|
70302
|
+
if (!data) return "";
|
|
70303
|
+
if (typeof atob === "function") {
|
|
70304
|
+
return atob(data);
|
|
70305
|
+
}
|
|
70306
|
+
if (typeof Buffer2 !== "undefined" && typeof Buffer2.from === "function") {
|
|
70307
|
+
return Buffer2.from(data, "base64").toString("binary");
|
|
70308
|
+
}
|
|
70309
|
+
throw new Error("Unable to decode base64 payload in the current environment.");
|
|
70310
|
+
};
|
|
70311
|
+
const extractBase64Meta = (base64String) => {
|
|
70312
|
+
const [meta = "", payload = ""] = base64String.split(",");
|
|
70313
|
+
const mimeMatch = meta.match(/:(.*?);/);
|
|
70314
|
+
const rawMimeType = mimeMatch ? mimeMatch[1] : "";
|
|
70315
|
+
const mimeType = rawMimeType || DEFAULT_MIME_TYPE;
|
|
70316
|
+
const binaryString = decodeBase64ToBinaryString(payload);
|
|
69755
70317
|
const hash2 = simpleHash(binaryString);
|
|
69756
70318
|
const extension = mimeType.split("/")[1] || "bin";
|
|
69757
70319
|
const filename = `image-${hash2}.${extension}`;
|
|
70320
|
+
return { mimeType, binaryString, filename };
|
|
70321
|
+
};
|
|
70322
|
+
const getBase64FileMeta = (base64String) => {
|
|
70323
|
+
const { mimeType, filename } = extractBase64Meta(base64String);
|
|
70324
|
+
return { mimeType, filename };
|
|
70325
|
+
};
|
|
70326
|
+
const base64ToFile = (base64String) => {
|
|
70327
|
+
const { mimeType, binaryString, filename } = extractBase64Meta(base64String);
|
|
70328
|
+
const fileType = mimeType || DEFAULT_MIME_TYPE;
|
|
69758
70329
|
const bytes = new Uint8Array(binaryString.length);
|
|
69759
70330
|
for (let i2 = 0; i2 < binaryString.length; i2++) {
|
|
69760
70331
|
bytes[i2] = binaryString.charCodeAt(i2);
|
|
69761
70332
|
}
|
|
69762
|
-
const blob = new Blob([bytes], { type:
|
|
69763
|
-
return new File([blob], filename, { type:
|
|
70333
|
+
const blob = new Blob([bytes], { type: fileType });
|
|
70334
|
+
return new File([blob], filename, { type: fileType });
|
|
69764
70335
|
};
|
|
69765
70336
|
const urlToFile = async (url, filename, mimeType) => {
|
|
69766
70337
|
try {
|
|
@@ -70136,6 +70707,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70136
70707
|
}
|
|
70137
70708
|
}
|
|
70138
70709
|
const key = new PluginKey("ImageRegistration");
|
|
70710
|
+
const WORD_MEDIA_PREFIX = "word/";
|
|
70139
70711
|
const ImageRegistrationPlugin = ({ editor }) => {
|
|
70140
70712
|
const { view } = editor;
|
|
70141
70713
|
return new Plugin({
|
|
@@ -70156,16 +70728,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70156
70728
|
},
|
|
70157
70729
|
appendTransaction: (trs, _oldState, state2) => {
|
|
70158
70730
|
let foundImages = [];
|
|
70159
|
-
trs.forEach((
|
|
70160
|
-
if (
|
|
70161
|
-
|
|
70731
|
+
trs.forEach((tr) => {
|
|
70732
|
+
if (tr.docChanged) {
|
|
70733
|
+
tr.steps.forEach((step, index2) => {
|
|
70162
70734
|
const stepMap = step.getMap();
|
|
70163
70735
|
foundImages = foundImages.map(({ node, pos, id }) => {
|
|
70164
70736
|
const mappedPos = stepMap.map(pos, -1);
|
|
70165
70737
|
return { node, pos: mappedPos, id };
|
|
70166
70738
|
});
|
|
70167
70739
|
if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1) {
|
|
70168
|
-
(
|
|
70740
|
+
(tr.docs[index2 + 1] || tr.doc).nodesBetween(
|
|
70169
70741
|
stepMap.map(step.from, -1),
|
|
70170
70742
|
stepMap.map(step.to, 1),
|
|
70171
70743
|
(node, pos) => {
|
|
@@ -70184,22 +70756,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70184
70756
|
if (!foundImages || foundImages.length === 0) {
|
|
70185
70757
|
return null;
|
|
70186
70758
|
}
|
|
70187
|
-
|
|
70188
|
-
|
|
70189
|
-
|
|
70190
|
-
foundImages
|
|
70191
|
-
let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
|
|
70192
|
-
side: -1,
|
|
70193
|
-
id
|
|
70194
|
-
});
|
|
70195
|
-
set = set.add(tr.doc, [deco]);
|
|
70196
|
-
});
|
|
70197
|
-
foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
|
|
70198
|
-
tr.delete(pos, pos + node.nodeSize);
|
|
70199
|
-
});
|
|
70200
|
-
set = set.map(tr.mapping, tr.doc);
|
|
70201
|
-
tr.setMeta(key, { set });
|
|
70202
|
-
return tr;
|
|
70759
|
+
if (editor.options.isHeadless) {
|
|
70760
|
+
return handleNodePath(foundImages, editor, state2);
|
|
70761
|
+
}
|
|
70762
|
+
return handleBrowserPath(foundImages, editor, view, state2);
|
|
70203
70763
|
},
|
|
70204
70764
|
props: {
|
|
70205
70765
|
decorations(state2) {
|
|
@@ -70209,6 +70769,59 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70209
70769
|
}
|
|
70210
70770
|
});
|
|
70211
70771
|
};
|
|
70772
|
+
const derivePreferredFileName = (src) => {
|
|
70773
|
+
if (typeof src !== "string" || src.length === 0) {
|
|
70774
|
+
return "image.bin";
|
|
70775
|
+
}
|
|
70776
|
+
if (src.startsWith("data:")) {
|
|
70777
|
+
return getBase64FileMeta(src).filename;
|
|
70778
|
+
}
|
|
70779
|
+
const lastSegment = src.split("/").pop() ?? "";
|
|
70780
|
+
const trimmed = lastSegment.split(/[?#]/)[0];
|
|
70781
|
+
return trimmed || "image.bin";
|
|
70782
|
+
};
|
|
70783
|
+
const handleNodePath = (foundImages, editor, state2) => {
|
|
70784
|
+
const { tr } = state2;
|
|
70785
|
+
const mediaStore = editor.storage.image.media ?? {};
|
|
70786
|
+
if (!editor.storage.image.media) {
|
|
70787
|
+
editor.storage.image.media = mediaStore;
|
|
70788
|
+
}
|
|
70789
|
+
const existingFileNames = new Set(Object.keys(mediaStore).map((key2) => key2.split("/").pop()));
|
|
70790
|
+
foundImages.forEach(({ node, pos }) => {
|
|
70791
|
+
const { src } = node.attrs;
|
|
70792
|
+
const preferredFileName = derivePreferredFileName(src);
|
|
70793
|
+
const uniqueFileName = ensureUniqueFileName(preferredFileName, existingFileNames);
|
|
70794
|
+
existingFileNames.add(uniqueFileName);
|
|
70795
|
+
const mediaPath = buildMediaPath(uniqueFileName);
|
|
70796
|
+
mediaStore[mediaPath] = src;
|
|
70797
|
+
const path = mediaPath.startsWith(WORD_MEDIA_PREFIX) ? mediaPath.slice(WORD_MEDIA_PREFIX.length) : mediaPath;
|
|
70798
|
+
const rId = addImageRelationship({ editor, path });
|
|
70799
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
70800
|
+
...node.attrs,
|
|
70801
|
+
src: mediaPath,
|
|
70802
|
+
rId
|
|
70803
|
+
});
|
|
70804
|
+
});
|
|
70805
|
+
return tr;
|
|
70806
|
+
};
|
|
70807
|
+
const handleBrowserPath = (foundImages, editor, view, state2) => {
|
|
70808
|
+
registerImages(foundImages, editor, view);
|
|
70809
|
+
const tr = state2.tr;
|
|
70810
|
+
let { set } = key.getState(state2);
|
|
70811
|
+
foundImages.slice().sort((a, b2) => a.pos - b2.pos).forEach(({ pos, id }) => {
|
|
70812
|
+
let deco = Decoration.widget(pos, () => document.createElement("placeholder"), {
|
|
70813
|
+
side: -1,
|
|
70814
|
+
id
|
|
70815
|
+
});
|
|
70816
|
+
set = set.add(tr.doc, [deco]);
|
|
70817
|
+
});
|
|
70818
|
+
foundImages.slice().sort((a, b2) => b2.pos - a.pos).forEach(({ node, pos }) => {
|
|
70819
|
+
tr.delete(pos, pos + node.nodeSize);
|
|
70820
|
+
});
|
|
70821
|
+
set = set.map(tr.mapping, tr.doc);
|
|
70822
|
+
tr.setMeta(key, { set });
|
|
70823
|
+
return tr;
|
|
70824
|
+
};
|
|
70212
70825
|
const findPlaceholder = (state2, id) => {
|
|
70213
70826
|
let { set } = key.getState(state2);
|
|
70214
70827
|
let found2 = set?.find(null, null, (spec) => spec.id === id);
|
|
@@ -71109,6 +71722,43 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
71109
71722
|
});
|
|
71110
71723
|
return styles;
|
|
71111
71724
|
};
|
|
71725
|
+
const PageReference = Node$1.create({
|
|
71726
|
+
name: "pageReference",
|
|
71727
|
+
group: "inline",
|
|
71728
|
+
inline: true,
|
|
71729
|
+
atom: true,
|
|
71730
|
+
draggable: false,
|
|
71731
|
+
selectable: false,
|
|
71732
|
+
content: "inline*",
|
|
71733
|
+
addOptions() {
|
|
71734
|
+
return {
|
|
71735
|
+
htmlAttributes: {
|
|
71736
|
+
contenteditable: false,
|
|
71737
|
+
"data-id": "auto-page-reference",
|
|
71738
|
+
"aria-label": "Page reference node",
|
|
71739
|
+
class: "sd-editor-page-reference"
|
|
71740
|
+
}
|
|
71741
|
+
};
|
|
71742
|
+
},
|
|
71743
|
+
addAttributes() {
|
|
71744
|
+
return {
|
|
71745
|
+
marksAsAttrs: {
|
|
71746
|
+
default: null,
|
|
71747
|
+
rendered: false
|
|
71748
|
+
},
|
|
71749
|
+
instruction: {
|
|
71750
|
+
default: "",
|
|
71751
|
+
rendered: false
|
|
71752
|
+
}
|
|
71753
|
+
};
|
|
71754
|
+
},
|
|
71755
|
+
parseDOM() {
|
|
71756
|
+
return [{ tag: 'span[data-id="auto-page-reference"]' }];
|
|
71757
|
+
},
|
|
71758
|
+
renderDOM({ htmlAttributes }) {
|
|
71759
|
+
return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
71760
|
+
}
|
|
71761
|
+
});
|
|
71112
71762
|
const ShapeContainer = Node$1.create({
|
|
71113
71763
|
name: "shapeContainer",
|
|
71114
71764
|
group: "block",
|
|
@@ -71522,6 +72172,51 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
71522
72172
|
});
|
|
71523
72173
|
});
|
|
71524
72174
|
};
|
|
72175
|
+
const TableOfContents = Node$1.create({
|
|
72176
|
+
name: "tableOfContents",
|
|
72177
|
+
group: "block",
|
|
72178
|
+
content: "paragraph+",
|
|
72179
|
+
inline: false,
|
|
72180
|
+
addOptions() {
|
|
72181
|
+
return {
|
|
72182
|
+
htmlAttributes: {
|
|
72183
|
+
"data-id": "table-of-contents",
|
|
72184
|
+
"aria-label": "Table of Contents"
|
|
72185
|
+
}
|
|
72186
|
+
};
|
|
72187
|
+
},
|
|
72188
|
+
parseDOM() {
|
|
72189
|
+
return [
|
|
72190
|
+
{
|
|
72191
|
+
tag: 'div[data-id="table-of-contents"]'
|
|
72192
|
+
}
|
|
72193
|
+
];
|
|
72194
|
+
},
|
|
72195
|
+
renderDOM({ htmlAttributes }) {
|
|
72196
|
+
return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
72197
|
+
},
|
|
72198
|
+
addAttributes() {
|
|
72199
|
+
return {
|
|
72200
|
+
instruction: {
|
|
72201
|
+
default: null,
|
|
72202
|
+
rendered: false
|
|
72203
|
+
},
|
|
72204
|
+
/**
|
|
72205
|
+
* @private
|
|
72206
|
+
* @category Attribute
|
|
72207
|
+
* @param {string} [sdBlockId] - Internal block tracking ID (not user-configurable)
|
|
72208
|
+
*/
|
|
72209
|
+
sdBlockId: {
|
|
72210
|
+
default: null,
|
|
72211
|
+
keepOnSplit: false,
|
|
72212
|
+
parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
|
|
72213
|
+
renderDOM: (attrs) => {
|
|
72214
|
+
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
72215
|
+
}
|
|
72216
|
+
}
|
|
72217
|
+
};
|
|
72218
|
+
}
|
|
72219
|
+
});
|
|
71525
72220
|
const TextStyle = Mark.create({
|
|
71526
72221
|
name: "textStyle",
|
|
71527
72222
|
addOptions() {
|
|
@@ -77244,6 +77939,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77244
77939
|
return actualBreak;
|
|
77245
77940
|
}
|
|
77246
77941
|
const onImageLoad = (editor) => {
|
|
77942
|
+
if (typeof requestAnimationFrame !== "function") return;
|
|
77247
77943
|
requestAnimationFrame(() => {
|
|
77248
77944
|
const newTr = editor.view.state.tr;
|
|
77249
77945
|
newTr.setMeta("forceUpdatePagination", true);
|
|
@@ -78128,6 +78824,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
78128
78824
|
SlashMenu,
|
|
78129
78825
|
Strike,
|
|
78130
78826
|
TabNode,
|
|
78827
|
+
TableOfContents,
|
|
78131
78828
|
Text,
|
|
78132
78829
|
TextAlign,
|
|
78133
78830
|
TextIndent,
|
|
@@ -78162,6 +78859,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
78162
78859
|
AiLoaderNode,
|
|
78163
78860
|
PageNumber,
|
|
78164
78861
|
TotalPageCount,
|
|
78862
|
+
PageReference,
|
|
78165
78863
|
ShapeContainer,
|
|
78166
78864
|
ShapeTextbox,
|
|
78167
78865
|
ContentBlock,
|
|
@@ -78170,6 +78868,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
78170
78868
|
StructuredContentBlock,
|
|
78171
78869
|
StructuredContentCommands,
|
|
78172
78870
|
DocumentSection,
|
|
78871
|
+
DocumentPartObject,
|
|
78173
78872
|
NodeResizer,
|
|
78174
78873
|
CustomSelection,
|
|
78175
78874
|
TextTransform
|
|
@@ -78452,7 +79151,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
78452
79151
|
};
|
|
78453
79152
|
const handleInputSubmit = () => {
|
|
78454
79153
|
const value = inlineTextInput.value;
|
|
78455
|
-
const cleanValue = value.
|
|
79154
|
+
const cleanValue = value.match(/^\d+(\.5)?$/) ? value : Math.floor(parseFloat(value)).toString();
|
|
78456
79155
|
emit2("textSubmit", cleanValue);
|
|
78457
79156
|
inlineTextInput.value = cleanValue;
|
|
78458
79157
|
};
|
|
@@ -78534,7 +79233,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
78534
79233
|
};
|
|
78535
79234
|
}
|
|
78536
79235
|
};
|
|
78537
|
-
const ToolbarButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$4$2, [["__scopeId", "data-v-
|
|
79236
|
+
const ToolbarButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$4$2, [["__scopeId", "data-v-cea02a58"]]);
|
|
78538
79237
|
const _hoisted_1$2$2 = {
|
|
78539
79238
|
class: "toolbar-separator",
|
|
78540
79239
|
role: "separator",
|
|
@@ -93706,71 +94405,73 @@ ${style2}
|
|
|
93706
94405
|
};
|
|
93707
94406
|
const SuperInput = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__scopeId", "data-v-4d5cff52"]]);
|
|
93708
94407
|
const additionalHandlers = Object.freeze({
|
|
93709
|
-
"mc:AlternateContent": translator,
|
|
93710
|
-
"
|
|
93711
|
-
"
|
|
93712
|
-
"w:
|
|
93713
|
-
"w:
|
|
93714
|
-
"w:
|
|
93715
|
-
"w:
|
|
93716
|
-
"w:
|
|
93717
|
-
"w:
|
|
93718
|
-
"w:
|
|
93719
|
-
"w:
|
|
93720
|
-
"w:
|
|
93721
|
-
"w:
|
|
93722
|
-
"w:
|
|
93723
|
-
"w:
|
|
93724
|
-
"w:
|
|
93725
|
-
"w:
|
|
93726
|
-
"w:
|
|
93727
|
-
"w:
|
|
93728
|
-
"w:
|
|
93729
|
-
"w:
|
|
93730
|
-
"w:
|
|
93731
|
-
"w:
|
|
93732
|
-
"w:
|
|
93733
|
-
"w:
|
|
93734
|
-
"w:
|
|
93735
|
-
"w:
|
|
93736
|
-
"w:
|
|
93737
|
-
"w:
|
|
93738
|
-
"w:
|
|
93739
|
-
"w:
|
|
93740
|
-
"w:
|
|
93741
|
-
"w:
|
|
93742
|
-
"w:
|
|
93743
|
-
"w:
|
|
93744
|
-
"w:
|
|
93745
|
-
"w:
|
|
93746
|
-
"w:
|
|
93747
|
-
"w:
|
|
93748
|
-
"w:
|
|
93749
|
-
"w:
|
|
93750
|
-
"w:
|
|
93751
|
-
"w:
|
|
93752
|
-
"w:
|
|
93753
|
-
"w:
|
|
93754
|
-
"w:
|
|
93755
|
-
"w:
|
|
93756
|
-
"w:
|
|
93757
|
-
"w:
|
|
93758
|
-
"w:
|
|
93759
|
-
"w:
|
|
93760
|
-
"w:
|
|
93761
|
-
"w:
|
|
93762
|
-
"w:
|
|
93763
|
-
"w:
|
|
93764
|
-
"w:
|
|
93765
|
-
"w:
|
|
93766
|
-
"w:
|
|
93767
|
-
"w:
|
|
93768
|
-
"w:
|
|
93769
|
-
"w:
|
|
93770
|
-
"w:
|
|
93771
|
-
"w:
|
|
93772
|
-
"
|
|
93773
|
-
"
|
|
94408
|
+
"mc:AlternateContent": translator$2,
|
|
94409
|
+
"sd:pageReference": translator$1,
|
|
94410
|
+
"sd:tableOfContents": translator,
|
|
94411
|
+
"w:b": translator$15,
|
|
94412
|
+
"w:bidiVisual": translator$G,
|
|
94413
|
+
"w:bookmarkEnd": translator$3,
|
|
94414
|
+
"w:bookmarkStart": translator$4,
|
|
94415
|
+
"w:bottom": translator$t,
|
|
94416
|
+
"w:br": translator$19,
|
|
94417
|
+
"w:cantSplit": translator$U,
|
|
94418
|
+
"w:cnfStyle": translator$T,
|
|
94419
|
+
"w:color": translator$11,
|
|
94420
|
+
"w:divId": translator$S,
|
|
94421
|
+
"w:drawing": translator$6,
|
|
94422
|
+
"w:end": translator$r,
|
|
94423
|
+
"w:gridAfter": translator$R,
|
|
94424
|
+
"w:gridBefore": translator$Q,
|
|
94425
|
+
"w:gridCol": translator$c,
|
|
94426
|
+
"w:hidden": translator$P,
|
|
94427
|
+
"w:highlight": translator$18,
|
|
94428
|
+
"w:hyperlink": translator$W,
|
|
94429
|
+
"w:i": translator$14,
|
|
94430
|
+
"w:insideH": translator$p,
|
|
94431
|
+
"w:insideV": translator$o,
|
|
94432
|
+
"w:jc": translator$O,
|
|
94433
|
+
"w:left": translator$n,
|
|
94434
|
+
"w:p": translator$16,
|
|
94435
|
+
"w:r": translator$V,
|
|
94436
|
+
"w:rFonts": translator$10,
|
|
94437
|
+
"w:rPr": translator$X,
|
|
94438
|
+
"w:rStyle": translator$$,
|
|
94439
|
+
"w:right": translator$l,
|
|
94440
|
+
"w:sdt": translator$5,
|
|
94441
|
+
"w:shd": translator$F,
|
|
94442
|
+
"w:start": translator$j,
|
|
94443
|
+
"w:strike": translator$12,
|
|
94444
|
+
"w:sz": translator$_,
|
|
94445
|
+
"w:szCs": translator$Z,
|
|
94446
|
+
"w:tab": translator$17,
|
|
94447
|
+
"w:tbl": translator$a,
|
|
94448
|
+
"w:tblBorders": translator$f,
|
|
94449
|
+
"w:tblCaption": translator$E,
|
|
94450
|
+
"w:tblCellMar": translator$e,
|
|
94451
|
+
"w:tblCellSpacing": translator$N,
|
|
94452
|
+
"w:tblDescription": translator$D,
|
|
94453
|
+
"w:tblGrid": translator$b,
|
|
94454
|
+
"w:tblHeader": translator$M,
|
|
94455
|
+
"w:tblInd": translator$C,
|
|
94456
|
+
"w:tblLayout": translator$B,
|
|
94457
|
+
"w:tblLook": translator$A,
|
|
94458
|
+
"w:tblOverlap": translator$z,
|
|
94459
|
+
"w:tblPr": translator$d,
|
|
94460
|
+
"w:tblStyle": translator$y,
|
|
94461
|
+
"w:tblStyleColBandSize": translator$x,
|
|
94462
|
+
"w:tblStyleRowBandSize": translator$w,
|
|
94463
|
+
"w:tblW": translator$v,
|
|
94464
|
+
"w:tblpPr": translator$u,
|
|
94465
|
+
"w:tc": translator$9,
|
|
94466
|
+
"w:top": translator$h,
|
|
94467
|
+
"w:tr": translator$H,
|
|
94468
|
+
"w:trHeight": translator$L,
|
|
94469
|
+
"w:trPr": translator$I,
|
|
94470
|
+
"w:u": translator$13,
|
|
94471
|
+
"w:wAfter": translator$K,
|
|
94472
|
+
"w:wBefore": translator$J,
|
|
94473
|
+
"wp:anchor": translator$8,
|
|
94474
|
+
"wp:inline": translator$7
|
|
93774
94475
|
});
|
|
93775
94476
|
const baseHandlers = {
|
|
93776
94477
|
...runPropertyTranslators,
|
|
@@ -96881,6 +97582,9 @@ ${reason}`);
|
|
|
96881
97582
|
documentUsers.value = configUsers || [];
|
|
96882
97583
|
Object.assign(user, configUser);
|
|
96883
97584
|
Object.assign(modules, configModules);
|
|
97585
|
+
if (!Object.prototype.hasOwnProperty.call(modules, "comments")) {
|
|
97586
|
+
modules.comments = {};
|
|
97587
|
+
}
|
|
96884
97588
|
if (!configDocs?.length && !config2.modules.collaboration) {
|
|
96885
97589
|
const newDoc = await getFileObject(BlankDOCX, "blank.docx", DOCX);
|
|
96886
97590
|
const newDocConfig = {
|
|
@@ -110471,6 +111175,11 @@ ${style2}
|
|
|
110471
111175
|
const { proxy } = getCurrentInstance();
|
|
110472
111176
|
commentsStore.proxy = proxy;
|
|
110473
111177
|
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
111178
|
+
const commentsModuleConfig = computed(() => {
|
|
111179
|
+
const config2 = modules.comments;
|
|
111180
|
+
if (config2 === false || config2 == null) return null;
|
|
111181
|
+
return config2;
|
|
111182
|
+
});
|
|
110474
111183
|
const layers = ref$1(null);
|
|
110475
111184
|
const commentsLayer = ref$1(null);
|
|
110476
111185
|
const toolsMenuPosition = reactive({ top: null, right: "-25px", zIndex: 101 });
|
|
@@ -110618,7 +111327,7 @@ ${style2}
|
|
|
110618
111327
|
rulers: doc2.rulers,
|
|
110619
111328
|
isInternal: proxy.$superdoc.config.isInternal,
|
|
110620
111329
|
annotations: proxy.$superdoc.config.annotations,
|
|
110621
|
-
isCommentsEnabled:
|
|
111330
|
+
isCommentsEnabled: Boolean(commentsModuleConfig.value),
|
|
110622
111331
|
isAiEnabled: proxy.$superdoc.config.modules?.ai,
|
|
110623
111332
|
slashMenuConfig: proxy.$superdoc.config.modules?.slashMenu,
|
|
110624
111333
|
onBeforeCreate: onEditorBeforeCreate,
|
|
@@ -110649,7 +111358,8 @@ ${style2}
|
|
|
110649
111358
|
return options;
|
|
110650
111359
|
};
|
|
110651
111360
|
const onEditorCommentLocationsUpdate = ({ allCommentIds: activeThreadId, allCommentPositions }) => {
|
|
110652
|
-
|
|
111361
|
+
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
111362
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
110653
111363
|
handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
|
|
110654
111364
|
};
|
|
110655
111365
|
const onEditorCommentsUpdate = (params2 = {}) => {
|
|
@@ -110671,7 +111381,7 @@ ${style2}
|
|
|
110671
111381
|
proxy.$superdoc.config.onTransaction({ editor, transaction, duration: duration2 });
|
|
110672
111382
|
}
|
|
110673
111383
|
};
|
|
110674
|
-
const isCommentsEnabled = computed(() =>
|
|
111384
|
+
const isCommentsEnabled = computed(() => Boolean(commentsModuleConfig.value));
|
|
110675
111385
|
const showCommentsSidebar = computed(() => {
|
|
110676
111386
|
return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
|
|
110677
111387
|
});
|
|
@@ -110681,13 +111391,14 @@ ${style2}
|
|
|
110681
111391
|
});
|
|
110682
111392
|
computed(() => {
|
|
110683
111393
|
if (!isCommentsEnabled.value) return false;
|
|
110684
|
-
!getConfig?.readOnly && selectionPosition.value;
|
|
111394
|
+
return !getConfig.value?.readOnly && selectionPosition.value;
|
|
110685
111395
|
});
|
|
110686
111396
|
watch(showCommentsSidebar, (value) => {
|
|
110687
111397
|
proxy.$superdoc.broadcastSidebarToggle(value);
|
|
110688
111398
|
});
|
|
110689
111399
|
const scrollToComment = (commentId) => {
|
|
110690
|
-
|
|
111400
|
+
const commentsConfig = proxy.$superdoc.config?.modules?.comments;
|
|
111401
|
+
if (!commentsConfig || commentsConfig === false) return;
|
|
110691
111402
|
const element = document.querySelector(`[data-thread-id=${commentId}]`);
|
|
110692
111403
|
if (element) {
|
|
110693
111404
|
element.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
@@ -110695,7 +111406,8 @@ ${style2}
|
|
|
110695
111406
|
}
|
|
110696
111407
|
};
|
|
110697
111408
|
onMounted(() => {
|
|
110698
|
-
|
|
111409
|
+
const config2 = commentsModuleConfig.value;
|
|
111410
|
+
if (config2 && !config2.readOnly) {
|
|
110699
111411
|
document.addEventListener("mousedown", handleDocumentMouseDown);
|
|
110700
111412
|
}
|
|
110701
111413
|
});
|
|
@@ -110817,6 +111529,7 @@ ${style2}
|
|
|
110817
111529
|
};
|
|
110818
111530
|
const shouldShowSelection = computed(() => {
|
|
110819
111531
|
const config2 = proxy.$superdoc.config.modules?.comments;
|
|
111532
|
+
if (!config2 || config2 === false) return false;
|
|
110820
111533
|
return !config2.readOnly;
|
|
110821
111534
|
});
|
|
110822
111535
|
const handleSuperEditorPageMarginsChange = (doc2, params2) => {
|
|
@@ -110983,7 +111696,7 @@ ${style2}
|
|
|
110983
111696
|
};
|
|
110984
111697
|
}
|
|
110985
111698
|
};
|
|
110986
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
111699
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-45f44b6e"]]);
|
|
110987
111700
|
const createSuperdocVueApp = () => {
|
|
110988
111701
|
const app = createApp(App);
|
|
110989
111702
|
const pinia = createPinia();
|
|
@@ -111082,6 +111795,10 @@ ${style2}
|
|
|
111082
111795
|
...this.config,
|
|
111083
111796
|
...config2
|
|
111084
111797
|
};
|
|
111798
|
+
this.config.modules = this.config.modules || {};
|
|
111799
|
+
if (!Object.prototype.hasOwnProperty.call(this.config.modules, "comments")) {
|
|
111800
|
+
this.config.modules.comments = {};
|
|
111801
|
+
}
|
|
111085
111802
|
this.config.colors = shuffleArray(this.config.colors);
|
|
111086
111803
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
111087
111804
|
this.colorIndex = 0;
|
|
@@ -111216,7 +111933,8 @@ ${style2}
|
|
|
111216
111933
|
this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
|
|
111217
111934
|
}
|
|
111218
111935
|
this.superdocStore.init(this.config);
|
|
111219
|
-
this.
|
|
111936
|
+
const commentsModuleConfig = this.config.modules.comments;
|
|
111937
|
+
this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
|
|
111220
111938
|
}
|
|
111221
111939
|
#initListeners() {
|
|
111222
111940
|
this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
|
|
@@ -111566,15 +112284,8 @@ ${style2}
|
|
|
111566
112284
|
}
|
|
111567
112285
|
/**
|
|
111568
112286
|
* Export the superdoc to a file
|
|
111569
|
-
* @param {
|
|
111570
|
-
* @
|
|
111571
|
-
* @param {string} [params.commentsType]
|
|
111572
|
-
* @param {string} [params.exportedName]
|
|
111573
|
-
* @param {Array} [params.additionalFiles]
|
|
111574
|
-
* @param {Array} [params.additionalFileNames]
|
|
111575
|
-
* @param {boolean} [params.isFinalDoc]
|
|
111576
|
-
* @param {boolean} [params.triggerDownload] Whether to trigger the download of the exported file
|
|
111577
|
-
* @returns {Promise<void | Blob>} Returns void if triggerDownload is false, otherwise returns the exported file
|
|
112287
|
+
* @param {ExportParams} params - Export configuration
|
|
112288
|
+
* @returns {Promise<void | Blob>}
|
|
111578
112289
|
*/
|
|
111579
112290
|
async export({
|
|
111580
112291
|
exportType = ["docx"],
|