@harbour-enterprises/superdoc 0.20.0-next.7 → 0.20.0-next.9
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-BYyZViQt.es.js → PdfViewer-BZlsmhsJ.es.js} +1 -1
- package/dist/chunks/{PdfViewer-DXtnxGoU.cjs → PdfViewer-BqGjx7hC.cjs} +1 -1
- package/dist/chunks/{index-CqLcgYHG.es.js → index-4GToG3C3.es.js} +2 -2
- package/dist/chunks/{index-CMBPzhIR.cjs → index-DPzgGSfg.cjs} +2 -2
- package/dist/chunks/{super-editor.es-5O71lyiI.cjs → super-editor.es-BkxUKZfn.cjs} +493 -639
- package/dist/chunks/{super-editor.es-BTalhwn-.es.js → super-editor.es-DqX3Ipsk.es.js} +493 -639
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-kutpjDQU.js → converter-C6YOTAXG.js} +246 -71
- package/dist/super-editor/chunks/{docx-zipper-BjcI24VU.js → docx-zipper-CSiwWpmr.js} +1 -1
- package/dist/super-editor/chunks/{editor-CQMKOaY4.js → editor-chVid4VD.js} +249 -570
- package/dist/super-editor/chunks/{toolbar-Cp6gL4i5.js → toolbar-ancqgN0p.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/src/core/super-converter/helpers.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/imageImporter.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblGrid/tblGrid-helpers.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +9 -1
- package/dist/super-editor/src/extensions/block-node/block-node.d.ts +30 -5
- package/dist/super-editor/src/extensions/bold/bold.d.ts +20 -0
- package/dist/super-editor/src/extensions/bullet-list/bullet-list.d.ts +12 -0
- package/dist/super-editor/src/extensions/color/color.d.ts +26 -0
- package/dist/super-editor/src/extensions/content-block/content-block.d.ts +30 -0
- package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +16 -0
- package/dist/super-editor/src/extensions/document/document.d.ts +26 -0
- package/dist/super-editor/src/extensions/dropcursor/dropcursor.d.ts +26 -0
- package/dist/super-editor/src/extensions/font-family/font-family.d.ts +29 -0
- package/dist/super-editor/src/extensions/font-size/font-size.d.ts +21 -0
- package/dist/super-editor/src/extensions/format-commands/format-commands.d.ts +9 -0
- package/dist/super-editor/src/extensions/gapcursor/gapcursor.d.ts +9 -0
- package/dist/super-editor/src/extensions/heading/heading.d.ts +12 -6
- package/dist/super-editor/src/extensions/highlight/highlight.d.ts +20 -0
- package/dist/super-editor/src/extensions/history/history.d.ts +7 -15
- package/dist/super-editor/src/extensions/image/image.d.ts +78 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/rotation.d.ts +4 -0
- package/dist/super-editor/src/extensions/italic/italic.d.ts +10 -0
- package/dist/super-editor/src/extensions/line-break/line-break.d.ts +43 -0
- package/dist/super-editor/src/extensions/line-height/line-height.d.ts +22 -0
- package/dist/super-editor/src/extensions/link/link.d.ts +53 -25
- package/dist/super-editor/src/extensions/linked-styles/linked-styles.d.ts +9 -0
- package/dist/super-editor/src/extensions/list-item/list-item.d.ts +48 -0
- package/dist/super-editor/src/extensions/mention/mention.d.ts +26 -0
- package/dist/super-editor/src/extensions/noderesizer/noderesizer.d.ts +14 -0
- package/dist/super-editor/src/extensions/ordered-list/ordered-list.d.ts +35 -0
- package/dist/super-editor/src/extensions/page-number/page-number.d.ts +52 -0
- package/dist/super-editor/src/extensions/paragraph/paragraph.d.ts +49 -0
- package/dist/super-editor/src/extensions/placeholder/placeholder.d.ts +15 -0
- package/dist/super-editor/src/extensions/popover-plugin/popover-plugin.d.ts +9 -0
- package/dist/super-editor/src/extensions/run-item/run-item.d.ts +24 -0
- package/dist/super-editor/src/extensions/search/search.d.ts +11 -2
- package/dist/super-editor/src/extensions/shape-container/shape-container.d.ts +29 -0
- package/dist/super-editor/src/extensions/shape-textbox/shape-textbox.d.ts +26 -0
- package/dist/super-editor/src/extensions/slash-menu/slash-menu.d.ts +9 -0
- package/dist/super-editor/src/extensions/strike/strike.d.ts +10 -0
- package/dist/super-editor/src/extensions/structured-content/StructuredContentBlockView.d.ts +0 -1
- package/dist/super-editor/src/extensions/structured-content/StructuredContentInlineView.d.ts +0 -1
- package/dist/super-editor/src/extensions/structured-content/StructuredContentViewBase.d.ts +1 -1
- package/dist/super-editor/src/extensions/structured-content/document-section.d.ts +46 -27
- package/dist/super-editor/src/extensions/structured-content/structured-content-block.d.ts +26 -0
- package/dist/super-editor/src/extensions/structured-content/structured-content.d.ts +26 -0
- package/dist/super-editor/src/extensions/tab/tab.d.ts +25 -0
- package/dist/super-editor/src/extensions/table/table.d.ts +112 -121
- package/dist/super-editor/src/extensions/table-cell/table-cell.d.ts +41 -0
- package/dist/super-editor/src/extensions/table-header/table-header.d.ts +22 -0
- package/dist/super-editor/src/extensions/table-row/table-row.d.ts +28 -0
- package/dist/super-editor/src/extensions/text/text.d.ts +14 -0
- package/dist/super-editor/src/extensions/text-align/text-align.d.ts +22 -0
- package/dist/super-editor/src/extensions/text-indent/text-indent.d.ts +19 -10
- package/dist/super-editor/src/extensions/text-style/text-style.d.ts +20 -0
- package/dist/super-editor/src/extensions/text-transform/text-transform.d.ts +20 -0
- package/dist/super-editor/src/extensions/underline/underline.d.ts +25 -0
- package/dist/super-editor/src/tests/helpers/editor-test-utils.d.ts +14 -0
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +493 -639
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperDoc.d.ts","sourceRoot":"","sources":["../../src/core/SuperDoc.js"],"names":[],"mappings":"AAgBA;;;;;GAKG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH,2EAA2E;AAE3E;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH;;;;;;GAMG;AACH;IACE,4BAA4B;IAC5B,qBADW,KAAK,CAAC,MAAM,CAAC,CACgB;IAwExC;;OAEG;IACH,oBAFW,MAAM,EAKhB;IA5ED,qBAAqB;IACrB,SADW,MAAM,CACT;IAER,qBAAqB;IACrB,OADW,IAAI,EAAE,CACX;IAEN,4CAA4C;IAC5C,MADW,OAAO,KAAK,EAAE,GAAG,GAAG,SAAS,CACnC;IAEL,4EAA4E;IAC5E,UADW,OAAO,sBAAsB,EAAE,kBAAkB,GAAG,SAAS,CAC/D;IAET,qBAAqB;IACrB,QADW,MAAM,CAwDf;IAiBA,4BAA6B;IAC7B,mBAAmB;IAMnB,gBAA+C;IAC/C,iBAAgC;IAehC,WAA4B;IAE5B,YAAkB;IAElB,eAAuC;IAEvC;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"SuperDoc.d.ts","sourceRoot":"","sources":["../../src/core/SuperDoc.js"],"names":[],"mappings":"AAgBA;;;;;GAKG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH,2EAA2E;AAE3E;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH;;;;;;GAMG;AACH;IACE,4BAA4B;IAC5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IAAI,KAAG,OAAO,CAAC,MAAM,CAAC;;;;eAC/B,IAAI;;;;aACJ,OAAO;;;;gCACP,OAAO;;;;;;;;yBAEP,OAAO;;;;WACP,MAAM;;;;eACN,MAAM;;;;cACN,OAAO;;6BA7GQ,eAAe;0BASlB,0CAA0C;6BAJ5B,mCAAmC;8BAC7C,iEAAiE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
|
|
2
|
-
import { T as TextSelection } from "./chunks/converter-
|
|
3
|
-
import { _ as _export_sfc } from "./chunks/editor-
|
|
2
|
+
import { T as TextSelection } from "./chunks/converter-C6YOTAXG.js";
|
|
3
|
+
import { _ as _export_sfc } from "./chunks/editor-chVid4VD.js";
|
|
4
4
|
const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
|
|
5
5
|
const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
|
|
6
6
|
async function baseInsightsFetch(payload, options = {}) {
|
|
@@ -14779,22 +14779,25 @@ async function readFromClipboard(state2) {
|
|
|
14779
14779
|
function inchesToTwips(inches) {
|
|
14780
14780
|
if (inches == null) return;
|
|
14781
14781
|
if (typeof inches === "string") inches = parseFloat(inches);
|
|
14782
|
-
return Math.round(inches * 1440);
|
|
14782
|
+
return Math.round(Number(inches) * 1440);
|
|
14783
14783
|
}
|
|
14784
14784
|
function twipsToInches(twips) {
|
|
14785
14785
|
if (twips == null) return;
|
|
14786
|
-
|
|
14787
|
-
|
|
14786
|
+
const value = Number(twips);
|
|
14787
|
+
if (Number.isNaN(value)) return;
|
|
14788
|
+
return value / 1440;
|
|
14788
14789
|
}
|
|
14789
14790
|
function twipsToPixels(twips) {
|
|
14790
14791
|
if (twips == null) return;
|
|
14791
|
-
|
|
14792
|
-
|
|
14792
|
+
const inches = twipsToInches(twips);
|
|
14793
|
+
if (inches == null) return;
|
|
14794
|
+
const pixels = inches * 96;
|
|
14795
|
+
return Math.round(pixels * 1e3) / 1e3;
|
|
14793
14796
|
}
|
|
14794
14797
|
function pixelsToTwips(pixels) {
|
|
14795
14798
|
if (pixels == null) return;
|
|
14796
|
-
|
|
14797
|
-
return inchesToTwips(
|
|
14799
|
+
const inches = Number(pixels) / 96;
|
|
14800
|
+
return inchesToTwips(inches);
|
|
14798
14801
|
}
|
|
14799
14802
|
function twipsToLines(twips) {
|
|
14800
14803
|
if (twips == null) return;
|
|
@@ -14837,6 +14840,14 @@ function ptToTwips(pt) {
|
|
|
14837
14840
|
if (pt == null) return;
|
|
14838
14841
|
return pt * 20;
|
|
14839
14842
|
}
|
|
14843
|
+
function rotToDegrees(rot) {
|
|
14844
|
+
if (rot == null) return;
|
|
14845
|
+
return rot / 6e4;
|
|
14846
|
+
}
|
|
14847
|
+
function degreesToRot(degrees) {
|
|
14848
|
+
if (degrees == null) return;
|
|
14849
|
+
return degrees * 6e4;
|
|
14850
|
+
}
|
|
14840
14851
|
const getTextIndentExportValue = (indent) => {
|
|
14841
14852
|
const [value, unit] = parseSizeUnit(indent);
|
|
14842
14853
|
const functionsMap = {
|
|
@@ -24691,13 +24702,15 @@ const getParagraphIndent = (node, docx, styleId = "") => {
|
|
|
24691
24702
|
}
|
|
24692
24703
|
return indent;
|
|
24693
24704
|
};
|
|
24694
|
-
const getParagraphSpacing = (node, docx, styleId = "", marks = []) => {
|
|
24705
|
+
const getParagraphSpacing = (node, docx, styleId = "", marks = [], options = {}) => {
|
|
24706
|
+
const { insideTable = false } = options;
|
|
24695
24707
|
const spacing = {};
|
|
24696
|
-
const { spacing: pDefaultSpacing = {} } = getDefaultParagraphStyle(docx, styleId);
|
|
24708
|
+
const { spacing: pDefaultSpacing = {}, spacingSource } = getDefaultParagraphStyle(docx, styleId);
|
|
24697
24709
|
let lineSpaceAfter, lineSpaceBefore, line, lineRuleStyle;
|
|
24698
24710
|
const pPr = node.elements?.find((el) => el.name === "w:pPr");
|
|
24699
24711
|
const inLineSpacingTag = pPr?.elements?.find((el) => el.name === "w:spacing");
|
|
24700
24712
|
const inLineSpacing = inLineSpacingTag?.attributes || {};
|
|
24713
|
+
const hasInlineSpacing = !!Object.keys(inLineSpacing).length;
|
|
24701
24714
|
const textStyleMark = marks.find((el) => el.type === "textStyle");
|
|
24702
24715
|
const fontSize = textStyleMark?.attrs?.fontSize;
|
|
24703
24716
|
const lineSpacing = inLineSpacing?.["w:line"] || line || pDefaultSpacing?.["w:line"];
|
|
@@ -24719,6 +24732,12 @@ const getParagraphSpacing = (node, docx, styleId = "", marks = []) => {
|
|
|
24719
24732
|
if (afterAutospacing === "1" && fontSize) {
|
|
24720
24733
|
spacing.lineSpaceAfter += Math.round(parseInt(fontSize) * 0.5 * 96 / 72);
|
|
24721
24734
|
}
|
|
24735
|
+
if (insideTable && !hasInlineSpacing && spacingSource === "docDefault") {
|
|
24736
|
+
const hasExplicitSpacing = Object.keys(inLineSpacing).length > 0;
|
|
24737
|
+
if (!hasExplicitSpacing) {
|
|
24738
|
+
return void 0;
|
|
24739
|
+
}
|
|
24740
|
+
}
|
|
24722
24741
|
return spacing;
|
|
24723
24742
|
};
|
|
24724
24743
|
const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
@@ -24759,9 +24778,20 @@ const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
|
24759
24778
|
const { attributes: pPrByIdIndentAttr } = pPrStyleIdIndentTag;
|
|
24760
24779
|
const spacingRest = isNormalAsDefault ? pPrNormalSpacingAttr || pPrDefaultSpacingAttr : pPrDefaultSpacingAttr || pPrNormalSpacingAttr;
|
|
24761
24780
|
const indentRest = isNormalAsDefault ? pPrNormalIndentAttr || pPrDefaultIndentAttr : pPrDefaultIndentAttr || pPrNormalIndentAttr;
|
|
24781
|
+
let spacingToUse = pPrByIdSpacingAttr || spacingRest;
|
|
24782
|
+
let spacingSource = "docDefault";
|
|
24783
|
+
if (pPrByIdSpacingAttr) {
|
|
24784
|
+
spacingSource = "style";
|
|
24785
|
+
} else if (spacingRest === pPrNormalSpacingAttr && pPrNormalSpacingAttr) {
|
|
24786
|
+
spacingSource = isNormalAsDefault ? "docDefault" : "normal";
|
|
24787
|
+
} else if (spacingRest === pPrDefaultSpacingAttr && pPrDefaultSpacingAttr) {
|
|
24788
|
+
spacingSource = "docDefault";
|
|
24789
|
+
}
|
|
24790
|
+
let indentToUse = pPrByIdIndentAttr || indentRest;
|
|
24762
24791
|
return {
|
|
24763
|
-
spacing:
|
|
24764
|
-
|
|
24792
|
+
spacing: spacingToUse,
|
|
24793
|
+
spacingSource,
|
|
24794
|
+
indent: indentToUse,
|
|
24765
24795
|
justify: pPrByIdJcAttr
|
|
24766
24796
|
};
|
|
24767
24797
|
};
|
|
@@ -24936,7 +24966,13 @@ const handleParagraphNode$1 = (params) => {
|
|
|
24936
24966
|
}
|
|
24937
24967
|
if (docx) {
|
|
24938
24968
|
const defaultStyleId = node.attributes?.["w:rsidRDefault"];
|
|
24939
|
-
|
|
24969
|
+
const insideTable = (params.path || []).some((ancestor) => ancestor.name === "w:tc");
|
|
24970
|
+
const spacing = getParagraphSpacing(node, docx, styleId, schemaNode.attrs.marksAttrs, {
|
|
24971
|
+
insideTable
|
|
24972
|
+
});
|
|
24973
|
+
if (spacing) {
|
|
24974
|
+
schemaNode.attrs["spacing"] = spacing;
|
|
24975
|
+
}
|
|
24940
24976
|
schemaNode.attrs["rsidRDefault"] = defaultStyleId;
|
|
24941
24977
|
}
|
|
24942
24978
|
if (docx) {
|
|
@@ -25182,10 +25218,10 @@ function createBorderPropertyHandler(xmlName, sdName = null) {
|
|
|
25182
25218
|
createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
|
|
25183
25219
|
createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
|
|
25184
25220
|
],
|
|
25185
|
-
encode: (
|
|
25221
|
+
encode: (params, encodedAttrs) => {
|
|
25186
25222
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25187
25223
|
},
|
|
25188
|
-
decode: function({ node },
|
|
25224
|
+
decode: function({ node }, context) {
|
|
25189
25225
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
25190
25226
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25191
25227
|
}
|
|
@@ -25544,10 +25580,10 @@ const translator$B = NodeTranslator.from({
|
|
|
25544
25580
|
"w:themeTint",
|
|
25545
25581
|
"w:val"
|
|
25546
25582
|
].map((attr) => createAttributeHandler(attr)),
|
|
25547
|
-
encode: (
|
|
25583
|
+
encode: (params, encodedAttrs) => {
|
|
25548
25584
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25549
25585
|
},
|
|
25550
|
-
decode: function({ node },
|
|
25586
|
+
decode: function({ node }, context) {
|
|
25551
25587
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.shading || {} } });
|
|
25552
25588
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25553
25589
|
}
|
|
@@ -25560,10 +25596,10 @@ const translator$w = NodeTranslator.from({
|
|
|
25560
25596
|
xmlName: "w:tblLook",
|
|
25561
25597
|
sdNodeOrKeyName: "tblLook",
|
|
25562
25598
|
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
25563
|
-
encode: (
|
|
25599
|
+
encode: (params, encodedAttrs) => {
|
|
25564
25600
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25565
25601
|
},
|
|
25566
|
-
decode: function({ node },
|
|
25602
|
+
decode: function({ node }, context) {
|
|
25567
25603
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.tblLook || {} } });
|
|
25568
25604
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25569
25605
|
}
|
|
@@ -25581,10 +25617,10 @@ const translator$q = NodeTranslator.from({
|
|
|
25581
25617
|
xmlName: "w:tblpPr",
|
|
25582
25618
|
sdNodeOrKeyName: "floatingTableProperties",
|
|
25583
25619
|
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))),
|
|
25584
|
-
encode: (
|
|
25620
|
+
encode: (params, encodedAttrs) => {
|
|
25585
25621
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25586
25622
|
},
|
|
25587
|
-
decode: function({ node },
|
|
25623
|
+
decode: function({ node }, context) {
|
|
25588
25624
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.floatingTableProperties || {} } });
|
|
25589
25625
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25590
25626
|
}
|
|
@@ -25605,13 +25641,13 @@ const translator$d = NodeTranslator.from(createBorderPropertyHandler("w:top"));
|
|
|
25605
25641
|
const translator$c = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
|
|
25606
25642
|
const XML_NODE_NAME$a = "w:tblBorders";
|
|
25607
25643
|
const SD_ATTR_KEY$3 = "borders";
|
|
25608
|
-
const encode$a = (params
|
|
25644
|
+
const encode$a = (params) => {
|
|
25609
25645
|
const { nodes } = params;
|
|
25610
25646
|
const node = nodes[0];
|
|
25611
25647
|
const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
|
|
25612
25648
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
25613
25649
|
};
|
|
25614
|
-
const decode$a = (params
|
|
25650
|
+
const decode$a = (params) => {
|
|
25615
25651
|
const { borders = {} } = params.node.attrs || {};
|
|
25616
25652
|
const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
|
|
25617
25653
|
const newNode = {
|
|
@@ -25648,13 +25684,13 @@ const translator$b = NodeTranslator.from({
|
|
|
25648
25684
|
});
|
|
25649
25685
|
const XML_NODE_NAME$9 = "w:tblCellMar";
|
|
25650
25686
|
const SD_ATTR_KEY$2 = "cellMargins";
|
|
25651
|
-
const encode$9 = (params
|
|
25687
|
+
const encode$9 = (params) => {
|
|
25652
25688
|
const { nodes } = params;
|
|
25653
25689
|
const node = nodes[0];
|
|
25654
25690
|
const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
|
|
25655
25691
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
25656
25692
|
};
|
|
25657
|
-
const decode$9 = (params
|
|
25693
|
+
const decode$9 = (params) => {
|
|
25658
25694
|
const { cellMargins = {} } = params.node.attrs || {};
|
|
25659
25695
|
const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
|
|
25660
25696
|
const newNode = {
|
|
@@ -25745,6 +25781,53 @@ const translator$9 = NodeTranslator.from(config$8);
|
|
|
25745
25781
|
const translator$8 = NodeTranslator.from(
|
|
25746
25782
|
createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
|
|
25747
25783
|
);
|
|
25784
|
+
const DEFAULT_COLUMN_WIDTH_PX = 100;
|
|
25785
|
+
const normalizeTwipWidth = (value) => {
|
|
25786
|
+
if (value == null) return null;
|
|
25787
|
+
const numericValue = typeof value === "string" ? parseInt(value, 10) : value;
|
|
25788
|
+
if (!Number.isFinite(numericValue) || Number.isNaN(numericValue) || numericValue <= 0) {
|
|
25789
|
+
return null;
|
|
25790
|
+
}
|
|
25791
|
+
return numericValue;
|
|
25792
|
+
};
|
|
25793
|
+
const getSchemaDefaultColumnWidthPx = (params) => {
|
|
25794
|
+
const defaultValue = params?.editor?.schema?.nodes?.tableCell?.spec?.attrs?.colwidth?.default;
|
|
25795
|
+
if (Array.isArray(defaultValue)) {
|
|
25796
|
+
const numericWidth = defaultValue.find((width) => typeof width === "number" && Number.isFinite(width) && width > 0);
|
|
25797
|
+
if (numericWidth != null) return numericWidth;
|
|
25798
|
+
} else if (typeof defaultValue === "number" && Number.isFinite(defaultValue) && defaultValue > 0) {
|
|
25799
|
+
return defaultValue;
|
|
25800
|
+
}
|
|
25801
|
+
return DEFAULT_COLUMN_WIDTH_PX;
|
|
25802
|
+
};
|
|
25803
|
+
const getTableWidthPx = (params) => {
|
|
25804
|
+
const explicitWidth = params?.node?.attrs?.tableWidth?.width;
|
|
25805
|
+
if (typeof explicitWidth === "number" && explicitWidth > 0) return explicitWidth;
|
|
25806
|
+
const tableWidth = params?.node?.attrs?.tableProperties?.tableWidth;
|
|
25807
|
+
if (tableWidth?.value != null && typeof tableWidth.value === "number" && tableWidth.value > 0) {
|
|
25808
|
+
const { value, type: type2 } = tableWidth;
|
|
25809
|
+
if (!type2 || type2 === "auto" || type2 === "dxa") {
|
|
25810
|
+
return twipsToPixels(value);
|
|
25811
|
+
}
|
|
25812
|
+
}
|
|
25813
|
+
return null;
|
|
25814
|
+
};
|
|
25815
|
+
const resolveFallbackColumnWidthTwips = (params, totalColumns, cellMinWidthTwips) => {
|
|
25816
|
+
const columnCount = Math.max(totalColumns, 1);
|
|
25817
|
+
const defaultColumnWidthPx = getSchemaDefaultColumnWidthPx(params);
|
|
25818
|
+
const tableWidthPx = getTableWidthPx(params);
|
|
25819
|
+
const safeDefaultPx = Number.isFinite(defaultColumnWidthPx) && defaultColumnWidthPx > 0 ? defaultColumnWidthPx : DEFAULT_COLUMN_WIDTH_PX;
|
|
25820
|
+
let fallbackWidthPx = safeDefaultPx;
|
|
25821
|
+
if (typeof tableWidthPx === "number" && tableWidthPx > 0) {
|
|
25822
|
+
fallbackWidthPx = tableWidthPx / columnCount;
|
|
25823
|
+
}
|
|
25824
|
+
const fallbackWidthTwips = pixelsToTwips(fallbackWidthPx);
|
|
25825
|
+
if (!Number.isFinite(fallbackWidthTwips) || Number.isNaN(fallbackWidthTwips) || fallbackWidthTwips <= 0) {
|
|
25826
|
+
const safeDefault = Math.max(pixelsToTwips(safeDefaultPx), cellMinWidthTwips);
|
|
25827
|
+
return safeDefault;
|
|
25828
|
+
}
|
|
25829
|
+
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
25830
|
+
};
|
|
25748
25831
|
const XML_NODE_NAME$7 = "w:tblGrid";
|
|
25749
25832
|
const SD_ATTR_KEY = "grid";
|
|
25750
25833
|
const cellMinWidth = pixelsToTwips(10);
|
|
@@ -25759,35 +25842,60 @@ const encode$7 = (params) => {
|
|
|
25759
25842
|
};
|
|
25760
25843
|
};
|
|
25761
25844
|
const decode$7 = (params) => {
|
|
25762
|
-
const { grid
|
|
25845
|
+
const { grid: rawGrid } = params.node.attrs || {};
|
|
25846
|
+
const grid = Array.isArray(rawGrid) ? rawGrid : [];
|
|
25763
25847
|
const { firstRow = {} } = params.extraParams || {};
|
|
25764
25848
|
const cellNodes = firstRow.content?.filter((n) => n.type === "tableCell") ?? [];
|
|
25765
|
-
const
|
|
25849
|
+
const columnCountFromCells = cellNodes.reduce((count, cell) => {
|
|
25850
|
+
const spanCount = Math.max(1, cell?.attrs?.colspan ?? 1);
|
|
25851
|
+
return count + spanCount;
|
|
25852
|
+
}, 0);
|
|
25853
|
+
const totalColumns = Math.max(columnCountFromCells, grid.length);
|
|
25854
|
+
const fallbackColumnWidthTwips = resolveFallbackColumnWidthTwips(params, totalColumns, cellMinWidth);
|
|
25766
25855
|
const elements = [];
|
|
25767
|
-
|
|
25768
|
-
|
|
25856
|
+
let columnIndex = 0;
|
|
25857
|
+
const pushColumn = (widthTwips) => {
|
|
25858
|
+
let numericWidth = typeof widthTwips === "string" ? parseInt(widthTwips, 10) : widthTwips;
|
|
25859
|
+
if (numericWidth == null || Number.isNaN(numericWidth) || numericWidth <= 0) {
|
|
25860
|
+
numericWidth = fallbackColumnWidthTwips;
|
|
25861
|
+
}
|
|
25862
|
+
numericWidth = Math.max(numericWidth, cellMinWidth);
|
|
25863
|
+
const decoded = translator$8.decode({
|
|
25864
|
+
node: { type: (
|
|
25865
|
+
/** @type {string} */
|
|
25866
|
+
translator$8.sdNodeOrKeyName
|
|
25867
|
+
), attrs: { col: numericWidth } }
|
|
25868
|
+
});
|
|
25869
|
+
if (decoded) elements.push(decoded);
|
|
25870
|
+
};
|
|
25871
|
+
cellNodes.forEach((cell) => {
|
|
25769
25872
|
const { colspan = 1, colwidth } = cell?.attrs || {};
|
|
25770
|
-
|
|
25771
|
-
|
|
25772
|
-
const
|
|
25773
|
-
const
|
|
25774
|
-
const
|
|
25873
|
+
const spanCount = Math.max(1, colspan);
|
|
25874
|
+
for (let span = 0; span < spanCount; span++) {
|
|
25875
|
+
const cellWidthPixels = Array.isArray(colwidth) ? colwidth[span] : void 0;
|
|
25876
|
+
const colGridAttrs = grid?.[columnIndex] || {};
|
|
25877
|
+
const gridWidthTwips = normalizeTwipWidth(colGridAttrs.col);
|
|
25878
|
+
const gridWidthPixels = gridWidthTwips != null ? twipsToPixels(gridWidthTwips) : null;
|
|
25775
25879
|
let cellWidthTwips;
|
|
25776
|
-
if (
|
|
25880
|
+
if (cellWidthPixels != null) {
|
|
25881
|
+
if (gridWidthTwips != null && gridWidthPixels === cellWidthPixels) {
|
|
25882
|
+
cellWidthTwips = gridWidthTwips;
|
|
25883
|
+
} else {
|
|
25884
|
+
cellWidthTwips = pixelsToTwips(cellWidthPixels);
|
|
25885
|
+
}
|
|
25886
|
+
} else if (gridWidthTwips != null) {
|
|
25777
25887
|
cellWidthTwips = gridWidthTwips;
|
|
25778
|
-
} else
|
|
25779
|
-
cellWidthTwips =
|
|
25780
|
-
}
|
|
25781
|
-
|
|
25782
|
-
|
|
25783
|
-
translator$8.decode({
|
|
25784
|
-
node: { type: (
|
|
25785
|
-
/** @type {string} */
|
|
25786
|
-
translator$8.sdNodeOrKeyName
|
|
25787
|
-
), attrs: { col: widthTwips } }
|
|
25788
|
-
})
|
|
25789
|
-
);
|
|
25888
|
+
} else {
|
|
25889
|
+
cellWidthTwips = fallbackColumnWidthTwips;
|
|
25890
|
+
}
|
|
25891
|
+
pushColumn(cellWidthTwips);
|
|
25892
|
+
columnIndex++;
|
|
25790
25893
|
}
|
|
25894
|
+
});
|
|
25895
|
+
while (columnIndex < grid.length) {
|
|
25896
|
+
const gridWidthTwips = normalizeTwipWidth(grid[columnIndex]?.col);
|
|
25897
|
+
pushColumn(gridWidthTwips);
|
|
25898
|
+
columnIndex++;
|
|
25791
25899
|
}
|
|
25792
25900
|
const newNode = {
|
|
25793
25901
|
name: XML_NODE_NAME$7,
|
|
@@ -25810,7 +25918,8 @@ const encode$6 = (params, encodedAttrs) => {
|
|
|
25810
25918
|
const node = nodes[0];
|
|
25811
25919
|
const tblPr = node.elements.find((el) => el.name === "w:tblPr");
|
|
25812
25920
|
if (tblPr) {
|
|
25813
|
-
|
|
25921
|
+
const encodedProperties = translator$9.encode({ ...params, nodes: [tblPr] });
|
|
25922
|
+
encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
|
|
25814
25923
|
}
|
|
25815
25924
|
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
25816
25925
|
if (tblGrid) {
|
|
@@ -25832,7 +25941,7 @@ const encode$6 = (params, encodedAttrs) => {
|
|
|
25832
25941
|
key = prop;
|
|
25833
25942
|
transform = (v2) => v2;
|
|
25834
25943
|
}
|
|
25835
|
-
if (encodedAttrs.tableProperties
|
|
25944
|
+
if (encodedAttrs.tableProperties && encodedAttrs.tableProperties[key]) {
|
|
25836
25945
|
encodedAttrs[key] = transform(encodedAttrs.tableProperties[key]);
|
|
25837
25946
|
}
|
|
25838
25947
|
});
|
|
@@ -25841,11 +25950,17 @@ const encode$6 = (params, encodedAttrs) => {
|
|
|
25841
25950
|
}
|
|
25842
25951
|
const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
|
|
25843
25952
|
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params);
|
|
25953
|
+
if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
|
|
25954
|
+
encodedAttrs.tableProperties = {
|
|
25955
|
+
...encodedAttrs.tableProperties || {},
|
|
25956
|
+
cellMargins: referencedStyles.cellMargins
|
|
25957
|
+
};
|
|
25958
|
+
}
|
|
25844
25959
|
const rows = node.elements.filter((el) => el.name === "w:tr");
|
|
25845
25960
|
const borderData = Object.assign({}, referencedStyles?.borders || {}, borders || {});
|
|
25846
25961
|
const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
|
|
25847
25962
|
encodedAttrs["borders"] = borderData;
|
|
25848
|
-
const tblStyleTag = tblPr
|
|
25963
|
+
const tblStyleTag = tblPr?.elements?.find((el) => el.name === "w:tblStyle");
|
|
25849
25964
|
const columnWidths = (encodedAttrs["grid"] ?? []).map((item) => twipsToPixels(item.col));
|
|
25850
25965
|
const content = [];
|
|
25851
25966
|
rows.forEach((row) => {
|
|
@@ -25854,6 +25969,7 @@ const encode$6 = (params, encodedAttrs) => {
|
|
|
25854
25969
|
nodes: [row],
|
|
25855
25970
|
extraParams: {
|
|
25856
25971
|
row,
|
|
25972
|
+
table: node,
|
|
25857
25973
|
rowBorders: borderRowData,
|
|
25858
25974
|
styleTag: tblStyleTag,
|
|
25859
25975
|
columnWidths
|
|
@@ -25955,7 +26071,12 @@ function _getReferencedTableStyles(tableStyleReference, params) {
|
|
|
25955
26071
|
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
25956
26072
|
const cellMargins = {};
|
|
25957
26073
|
Object.entries(tableProperties.cellMargins || {}).forEach(([key, attrs]) => {
|
|
25958
|
-
if (attrs?.value
|
|
26074
|
+
if (attrs?.value != null) {
|
|
26075
|
+
cellMargins[key] = {
|
|
26076
|
+
value: attrs.value,
|
|
26077
|
+
type: attrs.type || "dxa"
|
|
26078
|
+
};
|
|
26079
|
+
}
|
|
25959
26080
|
});
|
|
25960
26081
|
if (Object.keys(cellMargins).length) stylesToReturn.cellMargins = cellMargins;
|
|
25961
26082
|
}
|
|
@@ -26208,11 +26329,17 @@ const getTableCellMargins = (marginTag, referencedStyles) => {
|
|
|
26208
26329
|
marginTop: marginTopStyle,
|
|
26209
26330
|
marginBottom: marginBottomStyle
|
|
26210
26331
|
} = cellMargins;
|
|
26332
|
+
const resolveMargin = (inlineValue, styleValue) => {
|
|
26333
|
+
if (inlineValue != null) return inlineValue;
|
|
26334
|
+
if (styleValue == null) return void 0;
|
|
26335
|
+
if (typeof styleValue === "object") return styleValue.value;
|
|
26336
|
+
return styleValue;
|
|
26337
|
+
};
|
|
26211
26338
|
const margins = {
|
|
26212
|
-
left: twipsToPixels(inlineMarginLeftValue
|
|
26213
|
-
right: twipsToPixels(inlineMarginRightValue
|
|
26214
|
-
top: twipsToPixels(inlineMarginTopValue
|
|
26215
|
-
bottom: twipsToPixels(inlineMarginBottomValue
|
|
26339
|
+
left: twipsToPixels(resolveMargin(inlineMarginLeftValue, marginLeftStyle)),
|
|
26340
|
+
right: twipsToPixels(resolveMargin(inlineMarginRightValue, marginRightStyle)),
|
|
26341
|
+
top: twipsToPixels(resolveMargin(inlineMarginTopValue, marginTopStyle)),
|
|
26342
|
+
bottom: twipsToPixels(resolveMargin(inlineMarginBottomValue, marginBottomStyle))
|
|
26216
26343
|
};
|
|
26217
26344
|
return margins;
|
|
26218
26345
|
};
|
|
@@ -26487,7 +26614,7 @@ function parseTagValueJSON(json) {
|
|
|
26487
26614
|
}
|
|
26488
26615
|
try {
|
|
26489
26616
|
return JSON.parse(trimmed);
|
|
26490
|
-
} catch
|
|
26617
|
+
} catch {
|
|
26491
26618
|
return {};
|
|
26492
26619
|
}
|
|
26493
26620
|
}
|
|
@@ -26743,6 +26870,32 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
26743
26870
|
if (!picture || !picture.elements) return null;
|
|
26744
26871
|
const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
|
|
26745
26872
|
const blip = blipFill.elements.find((el) => el.name === "a:blip");
|
|
26873
|
+
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
26874
|
+
let transformData = {};
|
|
26875
|
+
if (spPr) {
|
|
26876
|
+
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
26877
|
+
if (xfrm?.attributes) {
|
|
26878
|
+
transformData = {
|
|
26879
|
+
rotation: rotToDegrees(xfrm.attributes["rot"]),
|
|
26880
|
+
verticalFlip: xfrm.attributes["flipV"] === "1",
|
|
26881
|
+
horizontalFlip: xfrm.attributes["flipH"] === "1"
|
|
26882
|
+
};
|
|
26883
|
+
}
|
|
26884
|
+
}
|
|
26885
|
+
const effectExtent = node.elements.find((el) => el.name === "wp:effectExtent");
|
|
26886
|
+
if (effectExtent) {
|
|
26887
|
+
const sanitizeEmuValue = (value) => {
|
|
26888
|
+
if (value === null || value === void 0) return 0;
|
|
26889
|
+
const numeric = Number(value);
|
|
26890
|
+
return Number.isFinite(numeric) ? numeric : 0;
|
|
26891
|
+
};
|
|
26892
|
+
transformData.sizeExtension = {
|
|
26893
|
+
left: emuToPixels(sanitizeEmuValue(effectExtent.attributes["l"])),
|
|
26894
|
+
top: emuToPixels(sanitizeEmuValue(effectExtent.attributes["t"])),
|
|
26895
|
+
right: emuToPixels(sanitizeEmuValue(effectExtent.attributes["r"])),
|
|
26896
|
+
bottom: emuToPixels(sanitizeEmuValue(effectExtent.attributes["b"]))
|
|
26897
|
+
};
|
|
26898
|
+
}
|
|
26746
26899
|
const positionHTag = node.elements.find((el) => el.name === "wp:positionH");
|
|
26747
26900
|
const positionH = positionHTag?.elements.find((el) => el.name === "wp:posOffset");
|
|
26748
26901
|
const positionHValue = emuToPixels(positionH?.elements[0]?.text);
|
|
@@ -26799,6 +26952,7 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
26799
26952
|
size,
|
|
26800
26953
|
anchorData,
|
|
26801
26954
|
isAnchor,
|
|
26955
|
+
transformData,
|
|
26802
26956
|
...simplePos && {
|
|
26803
26957
|
simplePos: {
|
|
26804
26958
|
x: simplePos.attributes.x,
|
|
@@ -26950,6 +27104,31 @@ const translateImageNode = (params) => {
|
|
|
26950
27104
|
distL: 0,
|
|
26951
27105
|
distR: 0
|
|
26952
27106
|
};
|
|
27107
|
+
const xfrmAttrs = {};
|
|
27108
|
+
const effectExtentAttrs = {
|
|
27109
|
+
l: 0,
|
|
27110
|
+
t: 0,
|
|
27111
|
+
r: 0,
|
|
27112
|
+
b: 0
|
|
27113
|
+
};
|
|
27114
|
+
const transformData = attrs.transformData;
|
|
27115
|
+
if (transformData) {
|
|
27116
|
+
if (transformData.rotation) {
|
|
27117
|
+
xfrmAttrs.rot = degreesToRot(transformData.rotation);
|
|
27118
|
+
}
|
|
27119
|
+
if (transformData.verticalFlip) {
|
|
27120
|
+
xfrmAttrs.flipV = "1";
|
|
27121
|
+
}
|
|
27122
|
+
if (transformData.horizontalFlip) {
|
|
27123
|
+
xfrmAttrs.flipH = "1";
|
|
27124
|
+
}
|
|
27125
|
+
if (transformData.sizeExtension) {
|
|
27126
|
+
effectExtentAttrs.l = pixelsToEmu(transformData.sizeExtension.left);
|
|
27127
|
+
effectExtentAttrs.t = pixelsToEmu(transformData.sizeExtension.top);
|
|
27128
|
+
effectExtentAttrs.r = pixelsToEmu(transformData.sizeExtension.right);
|
|
27129
|
+
effectExtentAttrs.b = pixelsToEmu(transformData.sizeExtension.bottom);
|
|
27130
|
+
}
|
|
27131
|
+
}
|
|
26953
27132
|
const drawingXmlns = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
26954
27133
|
const pictureXmlns = "http://schemas.openxmlformats.org/drawingml/2006/picture";
|
|
26955
27134
|
return {
|
|
@@ -26964,12 +27143,7 @@ const translateImageNode = (params) => {
|
|
|
26964
27143
|
},
|
|
26965
27144
|
{
|
|
26966
27145
|
name: "wp:effectExtent",
|
|
26967
|
-
attributes:
|
|
26968
|
-
l: 0,
|
|
26969
|
-
t: 0,
|
|
26970
|
-
r: 0,
|
|
26971
|
-
b: 0
|
|
26972
|
-
}
|
|
27146
|
+
attributes: effectExtentAttrs
|
|
26973
27147
|
},
|
|
26974
27148
|
{
|
|
26975
27149
|
name: "wp:docPr",
|
|
@@ -27049,6 +27223,7 @@ const translateImageNode = (params) => {
|
|
|
27049
27223
|
elements: [
|
|
27050
27224
|
{
|
|
27051
27225
|
name: "a:xfrm",
|
|
27226
|
+
attributes: xfrmAttrs,
|
|
27052
27227
|
elements: [
|
|
27053
27228
|
{
|
|
27054
27229
|
name: "a:ext",
|
|
@@ -27226,14 +27401,14 @@ function translateAnchorNode(params) {
|
|
|
27226
27401
|
const XML_NODE_NAME$3 = "wp:anchor";
|
|
27227
27402
|
const SD_NODE_NAME$3 = ["image"];
|
|
27228
27403
|
const validXmlAttributes$3 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
27229
|
-
function encode$3(params
|
|
27404
|
+
function encode$3(params) {
|
|
27230
27405
|
const { node } = params.extraParams;
|
|
27231
27406
|
if (!node || !node.type) {
|
|
27232
27407
|
return null;
|
|
27233
27408
|
}
|
|
27234
27409
|
return handleAnchorNode(params);
|
|
27235
27410
|
}
|
|
27236
|
-
function decode$3(params
|
|
27411
|
+
function decode$3(params) {
|
|
27237
27412
|
const { node } = params;
|
|
27238
27413
|
if (!node || !node.type) {
|
|
27239
27414
|
return null;
|
|
@@ -27267,14 +27442,14 @@ function translateInlineNode(params) {
|
|
|
27267
27442
|
const XML_NODE_NAME$2 = "wp:inline";
|
|
27268
27443
|
const SD_NODE_NAME$2 = ["image"];
|
|
27269
27444
|
const validXmlAttributes$2 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
27270
|
-
function encode$2(params
|
|
27445
|
+
function encode$2(params) {
|
|
27271
27446
|
const { node } = params.extraParams;
|
|
27272
27447
|
if (!node || !node.type) {
|
|
27273
27448
|
return null;
|
|
27274
27449
|
}
|
|
27275
27450
|
return handleInlineNode(params);
|
|
27276
27451
|
}
|
|
27277
|
-
function decode$2(params
|
|
27452
|
+
function decode$2(params) {
|
|
27278
27453
|
const { node } = params;
|
|
27279
27454
|
if (!node || !node.type) {
|
|
27280
27455
|
return null;
|
|
@@ -27300,7 +27475,7 @@ const registeredHandlers = Object.freeze({
|
|
|
27300
27475
|
const XML_NODE_NAME$1 = "w:drawing";
|
|
27301
27476
|
const SD_NODE_NAME$1 = [];
|
|
27302
27477
|
const validXmlAttributes$1 = [];
|
|
27303
|
-
function encode$1(params
|
|
27478
|
+
function encode$1(params) {
|
|
27304
27479
|
const nodes = params.nodes;
|
|
27305
27480
|
const node = nodes[0];
|
|
27306
27481
|
const validChildTranslators = ["wp:anchor", "wp:inline"];
|
|
@@ -27311,7 +27486,7 @@ function encode$1(params, encodedAttrs) {
|
|
|
27311
27486
|
return translator2.encode({ ...params, extraParams: { node: child } }) || acc;
|
|
27312
27487
|
}, null);
|
|
27313
27488
|
}
|
|
27314
|
-
function decode$1(params
|
|
27489
|
+
function decode$1(params) {
|
|
27315
27490
|
const { node } = params;
|
|
27316
27491
|
if (!node || !node.type) {
|
|
27317
27492
|
return null;
|
|
@@ -28912,7 +29087,7 @@ function translateStructuredContent(params) {
|
|
|
28912
29087
|
const XML_NODE_NAME = "w:sdt";
|
|
28913
29088
|
const SD_NODE_NAME = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
28914
29089
|
const validXmlAttributes = [];
|
|
28915
|
-
function encode(params
|
|
29090
|
+
function encode(params) {
|
|
28916
29091
|
const nodes = params.nodes;
|
|
28917
29092
|
const node = nodes[0];
|
|
28918
29093
|
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
@@ -28922,7 +29097,7 @@ function encode(params, encodedAttrs) {
|
|
|
28922
29097
|
const result = handler2(params);
|
|
28923
29098
|
return result;
|
|
28924
29099
|
}
|
|
28925
|
-
function decode(params
|
|
29100
|
+
function decode(params) {
|
|
28926
29101
|
const { node } = params;
|
|
28927
29102
|
if (!node || !node.type) {
|
|
28928
29103
|
return null;
|
|
@@ -31251,8 +31426,8 @@ function addDefaultStylesIfMissing(styles) {
|
|
|
31251
31426
|
}
|
|
31252
31427
|
const importHeadersFooters = (docx, converter, mainEditor) => {
|
|
31253
31428
|
const rels = docx["word/_rels/document.xml.rels"];
|
|
31254
|
-
const relationships = rels
|
|
31255
|
-
const { elements } = relationships;
|
|
31429
|
+
const relationships = rels?.elements.find((el) => el.name === "Relationships");
|
|
31430
|
+
const { elements } = relationships || { elements: [] };
|
|
31256
31431
|
const headerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
|
|
31257
31432
|
const footerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
|
|
31258
31433
|
const headers = elements.filter((el) => el.attributes["Type"] === headerType);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as process$1, av as commonjsGlobal, B as Buffer, aw as getDefaultExportFromCjs, ax as getContentTypesFromXml, ay as xmljs } from "./converter-
|
|
1
|
+
import { p as process$1, av as commonjsGlobal, B as Buffer, aw as getDefaultExportFromCjs, ax as getContentTypesFromXml, ay as xmljs } from "./converter-C6YOTAXG.js";
|
|
2
2
|
function commonjsRequire(path) {
|
|
3
3
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
4
4
|
}
|