@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
|
@@ -14798,22 +14798,25 @@ async function readFromClipboard(state2) {
|
|
|
14798
14798
|
function inchesToTwips(inches) {
|
|
14799
14799
|
if (inches == null) return;
|
|
14800
14800
|
if (typeof inches === "string") inches = parseFloat(inches);
|
|
14801
|
-
return Math.round(inches * 1440);
|
|
14801
|
+
return Math.round(Number(inches) * 1440);
|
|
14802
14802
|
}
|
|
14803
14803
|
function twipsToInches(twips) {
|
|
14804
14804
|
if (twips == null) return;
|
|
14805
|
-
|
|
14806
|
-
|
|
14805
|
+
const value = Number(twips);
|
|
14806
|
+
if (Number.isNaN(value)) return;
|
|
14807
|
+
return value / 1440;
|
|
14807
14808
|
}
|
|
14808
14809
|
function twipsToPixels(twips) {
|
|
14809
14810
|
if (twips == null) return;
|
|
14810
|
-
|
|
14811
|
-
|
|
14811
|
+
const inches = twipsToInches(twips);
|
|
14812
|
+
if (inches == null) return;
|
|
14813
|
+
const pixels = inches * 96;
|
|
14814
|
+
return Math.round(pixels * 1e3) / 1e3;
|
|
14812
14815
|
}
|
|
14813
14816
|
function pixelsToTwips(pixels) {
|
|
14814
14817
|
if (pixels == null) return;
|
|
14815
|
-
|
|
14816
|
-
return inchesToTwips(
|
|
14818
|
+
const inches = Number(pixels) / 96;
|
|
14819
|
+
return inchesToTwips(inches);
|
|
14817
14820
|
}
|
|
14818
14821
|
function twipsToLines(twips) {
|
|
14819
14822
|
if (twips == null) return;
|
|
@@ -14856,6 +14859,14 @@ function ptToTwips(pt) {
|
|
|
14856
14859
|
if (pt == null) return;
|
|
14857
14860
|
return pt * 20;
|
|
14858
14861
|
}
|
|
14862
|
+
function rotToDegrees(rot) {
|
|
14863
|
+
if (rot == null) return;
|
|
14864
|
+
return rot / 6e4;
|
|
14865
|
+
}
|
|
14866
|
+
function degreesToRot(degrees) {
|
|
14867
|
+
if (degrees == null) return;
|
|
14868
|
+
return degrees * 6e4;
|
|
14869
|
+
}
|
|
14859
14870
|
const getTextIndentExportValue = (indent) => {
|
|
14860
14871
|
const [value, unit] = parseSizeUnit(indent);
|
|
14861
14872
|
const functionsMap = {
|
|
@@ -24701,13 +24712,15 @@ const getParagraphIndent = (node, docx, styleId = "") => {
|
|
|
24701
24712
|
}
|
|
24702
24713
|
return indent;
|
|
24703
24714
|
};
|
|
24704
|
-
const getParagraphSpacing = (node, docx, styleId = "", marks = []) => {
|
|
24715
|
+
const getParagraphSpacing = (node, docx, styleId = "", marks = [], options = {}) => {
|
|
24716
|
+
const { insideTable = false } = options;
|
|
24705
24717
|
const spacing = {};
|
|
24706
|
-
const { spacing: pDefaultSpacing = {} } = getDefaultParagraphStyle(docx, styleId);
|
|
24718
|
+
const { spacing: pDefaultSpacing = {}, spacingSource } = getDefaultParagraphStyle(docx, styleId);
|
|
24707
24719
|
let lineSpaceAfter, lineSpaceBefore, line, lineRuleStyle;
|
|
24708
24720
|
const pPr = node.elements?.find((el) => el.name === "w:pPr");
|
|
24709
24721
|
const inLineSpacingTag = pPr?.elements?.find((el) => el.name === "w:spacing");
|
|
24710
24722
|
const inLineSpacing = inLineSpacingTag?.attributes || {};
|
|
24723
|
+
const hasInlineSpacing = !!Object.keys(inLineSpacing).length;
|
|
24711
24724
|
const textStyleMark = marks.find((el) => el.type === "textStyle");
|
|
24712
24725
|
const fontSize2 = textStyleMark?.attrs?.fontSize;
|
|
24713
24726
|
const lineSpacing = inLineSpacing?.["w:line"] || line || pDefaultSpacing?.["w:line"];
|
|
@@ -24729,6 +24742,12 @@ const getParagraphSpacing = (node, docx, styleId = "", marks = []) => {
|
|
|
24729
24742
|
if (afterAutospacing === "1" && fontSize2) {
|
|
24730
24743
|
spacing.lineSpaceAfter += Math.round(parseInt(fontSize2) * 0.5 * 96 / 72);
|
|
24731
24744
|
}
|
|
24745
|
+
if (insideTable && !hasInlineSpacing && spacingSource === "docDefault") {
|
|
24746
|
+
const hasExplicitSpacing = Object.keys(inLineSpacing).length > 0;
|
|
24747
|
+
if (!hasExplicitSpacing) {
|
|
24748
|
+
return void 0;
|
|
24749
|
+
}
|
|
24750
|
+
}
|
|
24732
24751
|
return spacing;
|
|
24733
24752
|
};
|
|
24734
24753
|
const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
@@ -24769,9 +24788,20 @@ const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
|
24769
24788
|
const { attributes: pPrByIdIndentAttr } = pPrStyleIdIndentTag;
|
|
24770
24789
|
const spacingRest = isNormalAsDefault ? pPrNormalSpacingAttr || pPrDefaultSpacingAttr : pPrDefaultSpacingAttr || pPrNormalSpacingAttr;
|
|
24771
24790
|
const indentRest = isNormalAsDefault ? pPrNormalIndentAttr || pPrDefaultIndentAttr : pPrDefaultIndentAttr || pPrNormalIndentAttr;
|
|
24791
|
+
let spacingToUse = pPrByIdSpacingAttr || spacingRest;
|
|
24792
|
+
let spacingSource = "docDefault";
|
|
24793
|
+
if (pPrByIdSpacingAttr) {
|
|
24794
|
+
spacingSource = "style";
|
|
24795
|
+
} else if (spacingRest === pPrNormalSpacingAttr && pPrNormalSpacingAttr) {
|
|
24796
|
+
spacingSource = isNormalAsDefault ? "docDefault" : "normal";
|
|
24797
|
+
} else if (spacingRest === pPrDefaultSpacingAttr && pPrDefaultSpacingAttr) {
|
|
24798
|
+
spacingSource = "docDefault";
|
|
24799
|
+
}
|
|
24800
|
+
let indentToUse = pPrByIdIndentAttr || indentRest;
|
|
24772
24801
|
return {
|
|
24773
|
-
spacing:
|
|
24774
|
-
|
|
24802
|
+
spacing: spacingToUse,
|
|
24803
|
+
spacingSource,
|
|
24804
|
+
indent: indentToUse,
|
|
24775
24805
|
justify: pPrByIdJcAttr
|
|
24776
24806
|
};
|
|
24777
24807
|
};
|
|
@@ -24946,7 +24976,13 @@ const handleParagraphNode$1 = (params2) => {
|
|
|
24946
24976
|
}
|
|
24947
24977
|
if (docx) {
|
|
24948
24978
|
const defaultStyleId = node.attributes?.["w:rsidRDefault"];
|
|
24949
|
-
|
|
24979
|
+
const insideTable = (params2.path || []).some((ancestor) => ancestor.name === "w:tc");
|
|
24980
|
+
const spacing = getParagraphSpacing(node, docx, styleId, schemaNode.attrs.marksAttrs, {
|
|
24981
|
+
insideTable
|
|
24982
|
+
});
|
|
24983
|
+
if (spacing) {
|
|
24984
|
+
schemaNode.attrs["spacing"] = spacing;
|
|
24985
|
+
}
|
|
24950
24986
|
schemaNode.attrs["rsidRDefault"] = defaultStyleId;
|
|
24951
24987
|
}
|
|
24952
24988
|
if (docx) {
|
|
@@ -25192,10 +25228,10 @@ function createBorderPropertyHandler(xmlName, sdName = null) {
|
|
|
25192
25228
|
createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
|
|
25193
25229
|
createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
|
|
25194
25230
|
],
|
|
25195
|
-
encode: (
|
|
25231
|
+
encode: (params2, encodedAttrs) => {
|
|
25196
25232
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25197
25233
|
},
|
|
25198
|
-
decode: function({ node },
|
|
25234
|
+
decode: function({ node }, context) {
|
|
25199
25235
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
25200
25236
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25201
25237
|
}
|
|
@@ -25554,10 +25590,10 @@ const translator$B = NodeTranslator.from({
|
|
|
25554
25590
|
"w:themeTint",
|
|
25555
25591
|
"w:val"
|
|
25556
25592
|
].map((attr) => createAttributeHandler(attr)),
|
|
25557
|
-
encode: (
|
|
25593
|
+
encode: (params2, encodedAttrs) => {
|
|
25558
25594
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25559
25595
|
},
|
|
25560
|
-
decode: function({ node },
|
|
25596
|
+
decode: function({ node }, context) {
|
|
25561
25597
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.shading || {} } });
|
|
25562
25598
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25563
25599
|
}
|
|
@@ -25570,10 +25606,10 @@ const translator$w = NodeTranslator.from({
|
|
|
25570
25606
|
xmlName: "w:tblLook",
|
|
25571
25607
|
sdNodeOrKeyName: "tblLook",
|
|
25572
25608
|
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
25573
|
-
encode: (
|
|
25609
|
+
encode: (params2, encodedAttrs) => {
|
|
25574
25610
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25575
25611
|
},
|
|
25576
|
-
decode: function({ node },
|
|
25612
|
+
decode: function({ node }, context) {
|
|
25577
25613
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.tblLook || {} } });
|
|
25578
25614
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25579
25615
|
}
|
|
@@ -25591,10 +25627,10 @@ const translator$q = NodeTranslator.from({
|
|
|
25591
25627
|
xmlName: "w:tblpPr",
|
|
25592
25628
|
sdNodeOrKeyName: "floatingTableProperties",
|
|
25593
25629
|
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))),
|
|
25594
|
-
encode: (
|
|
25630
|
+
encode: (params2, encodedAttrs) => {
|
|
25595
25631
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25596
25632
|
},
|
|
25597
|
-
decode: function({ node },
|
|
25633
|
+
decode: function({ node }, context) {
|
|
25598
25634
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.floatingTableProperties || {} } });
|
|
25599
25635
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25600
25636
|
}
|
|
@@ -25615,13 +25651,13 @@ const translator$d = NodeTranslator.from(createBorderPropertyHandler("w:top"));
|
|
|
25615
25651
|
const translator$c = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
|
|
25616
25652
|
const XML_NODE_NAME$a = "w:tblBorders";
|
|
25617
25653
|
const SD_ATTR_KEY$3 = "borders";
|
|
25618
|
-
const encode$a = (params2
|
|
25654
|
+
const encode$a = (params2) => {
|
|
25619
25655
|
const { nodes } = params2;
|
|
25620
25656
|
const node = nodes[0];
|
|
25621
25657
|
const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
|
|
25622
25658
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
25623
25659
|
};
|
|
25624
|
-
const decode$a = (params2
|
|
25660
|
+
const decode$a = (params2) => {
|
|
25625
25661
|
const { borders = {} } = params2.node.attrs || {};
|
|
25626
25662
|
const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
|
|
25627
25663
|
const newNode = {
|
|
@@ -25658,13 +25694,13 @@ const translator$b = NodeTranslator.from({
|
|
|
25658
25694
|
});
|
|
25659
25695
|
const XML_NODE_NAME$9 = "w:tblCellMar";
|
|
25660
25696
|
const SD_ATTR_KEY$2 = "cellMargins";
|
|
25661
|
-
const encode$9 = (params2
|
|
25697
|
+
const encode$9 = (params2) => {
|
|
25662
25698
|
const { nodes } = params2;
|
|
25663
25699
|
const node = nodes[0];
|
|
25664
25700
|
const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
|
|
25665
25701
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
25666
25702
|
};
|
|
25667
|
-
const decode$9 = (params2
|
|
25703
|
+
const decode$9 = (params2) => {
|
|
25668
25704
|
const { cellMargins = {} } = params2.node.attrs || {};
|
|
25669
25705
|
const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
|
|
25670
25706
|
const newNode = {
|
|
@@ -25755,6 +25791,53 @@ const translator$9 = NodeTranslator.from(config$8);
|
|
|
25755
25791
|
const translator$8 = NodeTranslator.from(
|
|
25756
25792
|
createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
|
|
25757
25793
|
);
|
|
25794
|
+
const DEFAULT_COLUMN_WIDTH_PX = 100;
|
|
25795
|
+
const normalizeTwipWidth = (value) => {
|
|
25796
|
+
if (value == null) return null;
|
|
25797
|
+
const numericValue = typeof value === "string" ? parseInt(value, 10) : value;
|
|
25798
|
+
if (!Number.isFinite(numericValue) || Number.isNaN(numericValue) || numericValue <= 0) {
|
|
25799
|
+
return null;
|
|
25800
|
+
}
|
|
25801
|
+
return numericValue;
|
|
25802
|
+
};
|
|
25803
|
+
const getSchemaDefaultColumnWidthPx = (params2) => {
|
|
25804
|
+
const defaultValue = params2?.editor?.schema?.nodes?.tableCell?.spec?.attrs?.colwidth?.default;
|
|
25805
|
+
if (Array.isArray(defaultValue)) {
|
|
25806
|
+
const numericWidth = defaultValue.find((width) => typeof width === "number" && Number.isFinite(width) && width > 0);
|
|
25807
|
+
if (numericWidth != null) return numericWidth;
|
|
25808
|
+
} else if (typeof defaultValue === "number" && Number.isFinite(defaultValue) && defaultValue > 0) {
|
|
25809
|
+
return defaultValue;
|
|
25810
|
+
}
|
|
25811
|
+
return DEFAULT_COLUMN_WIDTH_PX;
|
|
25812
|
+
};
|
|
25813
|
+
const getTableWidthPx = (params2) => {
|
|
25814
|
+
const explicitWidth = params2?.node?.attrs?.tableWidth?.width;
|
|
25815
|
+
if (typeof explicitWidth === "number" && explicitWidth > 0) return explicitWidth;
|
|
25816
|
+
const tableWidth = params2?.node?.attrs?.tableProperties?.tableWidth;
|
|
25817
|
+
if (tableWidth?.value != null && typeof tableWidth.value === "number" && tableWidth.value > 0) {
|
|
25818
|
+
const { value, type: type2 } = tableWidth;
|
|
25819
|
+
if (!type2 || type2 === "auto" || type2 === "dxa") {
|
|
25820
|
+
return twipsToPixels(value);
|
|
25821
|
+
}
|
|
25822
|
+
}
|
|
25823
|
+
return null;
|
|
25824
|
+
};
|
|
25825
|
+
const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwips) => {
|
|
25826
|
+
const columnCount = Math.max(totalColumns, 1);
|
|
25827
|
+
const defaultColumnWidthPx = getSchemaDefaultColumnWidthPx(params2);
|
|
25828
|
+
const tableWidthPx = getTableWidthPx(params2);
|
|
25829
|
+
const safeDefaultPx = Number.isFinite(defaultColumnWidthPx) && defaultColumnWidthPx > 0 ? defaultColumnWidthPx : DEFAULT_COLUMN_WIDTH_PX;
|
|
25830
|
+
let fallbackWidthPx = safeDefaultPx;
|
|
25831
|
+
if (typeof tableWidthPx === "number" && tableWidthPx > 0) {
|
|
25832
|
+
fallbackWidthPx = tableWidthPx / columnCount;
|
|
25833
|
+
}
|
|
25834
|
+
const fallbackWidthTwips = pixelsToTwips(fallbackWidthPx);
|
|
25835
|
+
if (!Number.isFinite(fallbackWidthTwips) || Number.isNaN(fallbackWidthTwips) || fallbackWidthTwips <= 0) {
|
|
25836
|
+
const safeDefault = Math.max(pixelsToTwips(safeDefaultPx), cellMinWidthTwips);
|
|
25837
|
+
return safeDefault;
|
|
25838
|
+
}
|
|
25839
|
+
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
25840
|
+
};
|
|
25758
25841
|
const XML_NODE_NAME$7 = "w:tblGrid";
|
|
25759
25842
|
const SD_ATTR_KEY = "grid";
|
|
25760
25843
|
const cellMinWidth = pixelsToTwips(10);
|
|
@@ -25769,35 +25852,60 @@ const encode$7 = (params2) => {
|
|
|
25769
25852
|
};
|
|
25770
25853
|
};
|
|
25771
25854
|
const decode$7 = (params2) => {
|
|
25772
|
-
const { grid
|
|
25855
|
+
const { grid: rawGrid } = params2.node.attrs || {};
|
|
25856
|
+
const grid = Array.isArray(rawGrid) ? rawGrid : [];
|
|
25773
25857
|
const { firstRow = {} } = params2.extraParams || {};
|
|
25774
25858
|
const cellNodes = firstRow.content?.filter((n) => n.type === "tableCell") ?? [];
|
|
25775
|
-
const
|
|
25859
|
+
const columnCountFromCells = cellNodes.reduce((count, cell) => {
|
|
25860
|
+
const spanCount = Math.max(1, cell?.attrs?.colspan ?? 1);
|
|
25861
|
+
return count + spanCount;
|
|
25862
|
+
}, 0);
|
|
25863
|
+
const totalColumns = Math.max(columnCountFromCells, grid.length);
|
|
25864
|
+
const fallbackColumnWidthTwips = resolveFallbackColumnWidthTwips(params2, totalColumns, cellMinWidth);
|
|
25776
25865
|
const elements = [];
|
|
25777
|
-
|
|
25778
|
-
|
|
25866
|
+
let columnIndex = 0;
|
|
25867
|
+
const pushColumn = (widthTwips) => {
|
|
25868
|
+
let numericWidth = typeof widthTwips === "string" ? parseInt(widthTwips, 10) : widthTwips;
|
|
25869
|
+
if (numericWidth == null || Number.isNaN(numericWidth) || numericWidth <= 0) {
|
|
25870
|
+
numericWidth = fallbackColumnWidthTwips;
|
|
25871
|
+
}
|
|
25872
|
+
numericWidth = Math.max(numericWidth, cellMinWidth);
|
|
25873
|
+
const decoded = translator$8.decode({
|
|
25874
|
+
node: { type: (
|
|
25875
|
+
/** @type {string} */
|
|
25876
|
+
translator$8.sdNodeOrKeyName
|
|
25877
|
+
), attrs: { col: numericWidth } }
|
|
25878
|
+
});
|
|
25879
|
+
if (decoded) elements.push(decoded);
|
|
25880
|
+
};
|
|
25881
|
+
cellNodes.forEach((cell) => {
|
|
25779
25882
|
const { colspan = 1, colwidth } = cell?.attrs || {};
|
|
25780
|
-
|
|
25781
|
-
|
|
25782
|
-
const
|
|
25783
|
-
const
|
|
25784
|
-
const
|
|
25883
|
+
const spanCount = Math.max(1, colspan);
|
|
25884
|
+
for (let span = 0; span < spanCount; span++) {
|
|
25885
|
+
const cellWidthPixels = Array.isArray(colwidth) ? colwidth[span] : void 0;
|
|
25886
|
+
const colGridAttrs = grid?.[columnIndex] || {};
|
|
25887
|
+
const gridWidthTwips = normalizeTwipWidth(colGridAttrs.col);
|
|
25888
|
+
const gridWidthPixels = gridWidthTwips != null ? twipsToPixels(gridWidthTwips) : null;
|
|
25785
25889
|
let cellWidthTwips;
|
|
25786
|
-
if (
|
|
25890
|
+
if (cellWidthPixels != null) {
|
|
25891
|
+
if (gridWidthTwips != null && gridWidthPixels === cellWidthPixels) {
|
|
25892
|
+
cellWidthTwips = gridWidthTwips;
|
|
25893
|
+
} else {
|
|
25894
|
+
cellWidthTwips = pixelsToTwips(cellWidthPixels);
|
|
25895
|
+
}
|
|
25896
|
+
} else if (gridWidthTwips != null) {
|
|
25787
25897
|
cellWidthTwips = gridWidthTwips;
|
|
25788
|
-
} else
|
|
25789
|
-
cellWidthTwips =
|
|
25790
|
-
}
|
|
25791
|
-
|
|
25792
|
-
|
|
25793
|
-
translator$8.decode({
|
|
25794
|
-
node: { type: (
|
|
25795
|
-
/** @type {string} */
|
|
25796
|
-
translator$8.sdNodeOrKeyName
|
|
25797
|
-
), attrs: { col: widthTwips } }
|
|
25798
|
-
})
|
|
25799
|
-
);
|
|
25898
|
+
} else {
|
|
25899
|
+
cellWidthTwips = fallbackColumnWidthTwips;
|
|
25900
|
+
}
|
|
25901
|
+
pushColumn(cellWidthTwips);
|
|
25902
|
+
columnIndex++;
|
|
25800
25903
|
}
|
|
25904
|
+
});
|
|
25905
|
+
while (columnIndex < grid.length) {
|
|
25906
|
+
const gridWidthTwips = normalizeTwipWidth(grid[columnIndex]?.col);
|
|
25907
|
+
pushColumn(gridWidthTwips);
|
|
25908
|
+
columnIndex++;
|
|
25801
25909
|
}
|
|
25802
25910
|
const newNode = {
|
|
25803
25911
|
name: XML_NODE_NAME$7,
|
|
@@ -25820,7 +25928,8 @@ const encode$6 = (params2, encodedAttrs) => {
|
|
|
25820
25928
|
const node = nodes[0];
|
|
25821
25929
|
const tblPr = node.elements.find((el) => el.name === "w:tblPr");
|
|
25822
25930
|
if (tblPr) {
|
|
25823
|
-
|
|
25931
|
+
const encodedProperties = translator$9.encode({ ...params2, nodes: [tblPr] });
|
|
25932
|
+
encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
|
|
25824
25933
|
}
|
|
25825
25934
|
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
25826
25935
|
if (tblGrid) {
|
|
@@ -25842,7 +25951,7 @@ const encode$6 = (params2, encodedAttrs) => {
|
|
|
25842
25951
|
key2 = prop;
|
|
25843
25952
|
transform = (v2) => v2;
|
|
25844
25953
|
}
|
|
25845
|
-
if (encodedAttrs.tableProperties
|
|
25954
|
+
if (encodedAttrs.tableProperties && encodedAttrs.tableProperties[key2]) {
|
|
25846
25955
|
encodedAttrs[key2] = transform(encodedAttrs.tableProperties[key2]);
|
|
25847
25956
|
}
|
|
25848
25957
|
});
|
|
@@ -25851,11 +25960,17 @@ const encode$6 = (params2, encodedAttrs) => {
|
|
|
25851
25960
|
}
|
|
25852
25961
|
const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
|
|
25853
25962
|
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2);
|
|
25963
|
+
if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
|
|
25964
|
+
encodedAttrs.tableProperties = {
|
|
25965
|
+
...encodedAttrs.tableProperties || {},
|
|
25966
|
+
cellMargins: referencedStyles.cellMargins
|
|
25967
|
+
};
|
|
25968
|
+
}
|
|
25854
25969
|
const rows = node.elements.filter((el) => el.name === "w:tr");
|
|
25855
25970
|
const borderData = Object.assign({}, referencedStyles?.borders || {}, borders || {});
|
|
25856
25971
|
const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
|
|
25857
25972
|
encodedAttrs["borders"] = borderData;
|
|
25858
|
-
const tblStyleTag = tblPr
|
|
25973
|
+
const tblStyleTag = tblPr?.elements?.find((el) => el.name === "w:tblStyle");
|
|
25859
25974
|
const columnWidths = (encodedAttrs["grid"] ?? []).map((item) => twipsToPixels(item.col));
|
|
25860
25975
|
const content = [];
|
|
25861
25976
|
rows.forEach((row) => {
|
|
@@ -25864,6 +25979,7 @@ const encode$6 = (params2, encodedAttrs) => {
|
|
|
25864
25979
|
nodes: [row],
|
|
25865
25980
|
extraParams: {
|
|
25866
25981
|
row,
|
|
25982
|
+
table: node,
|
|
25867
25983
|
rowBorders: borderRowData,
|
|
25868
25984
|
styleTag: tblStyleTag,
|
|
25869
25985
|
columnWidths
|
|
@@ -25965,7 +26081,12 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
|
|
|
25965
26081
|
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
25966
26082
|
const cellMargins = {};
|
|
25967
26083
|
Object.entries(tableProperties.cellMargins || {}).forEach(([key2, attrs]) => {
|
|
25968
|
-
if (attrs?.value
|
|
26084
|
+
if (attrs?.value != null) {
|
|
26085
|
+
cellMargins[key2] = {
|
|
26086
|
+
value: attrs.value,
|
|
26087
|
+
type: attrs.type || "dxa"
|
|
26088
|
+
};
|
|
26089
|
+
}
|
|
25969
26090
|
});
|
|
25970
26091
|
if (Object.keys(cellMargins).length) stylesToReturn.cellMargins = cellMargins;
|
|
25971
26092
|
}
|
|
@@ -26218,11 +26339,17 @@ const getTableCellMargins = (marginTag, referencedStyles) => {
|
|
|
26218
26339
|
marginTop: marginTopStyle,
|
|
26219
26340
|
marginBottom: marginBottomStyle
|
|
26220
26341
|
} = cellMargins;
|
|
26342
|
+
const resolveMargin = (inlineValue, styleValue) => {
|
|
26343
|
+
if (inlineValue != null) return inlineValue;
|
|
26344
|
+
if (styleValue == null) return void 0;
|
|
26345
|
+
if (typeof styleValue === "object") return styleValue.value;
|
|
26346
|
+
return styleValue;
|
|
26347
|
+
};
|
|
26221
26348
|
const margins = {
|
|
26222
|
-
left: twipsToPixels(inlineMarginLeftValue
|
|
26223
|
-
right: twipsToPixels(inlineMarginRightValue
|
|
26224
|
-
top: twipsToPixels(inlineMarginTopValue
|
|
26225
|
-
bottom: twipsToPixels(inlineMarginBottomValue
|
|
26349
|
+
left: twipsToPixels(resolveMargin(inlineMarginLeftValue, marginLeftStyle)),
|
|
26350
|
+
right: twipsToPixels(resolveMargin(inlineMarginRightValue, marginRightStyle)),
|
|
26351
|
+
top: twipsToPixels(resolveMargin(inlineMarginTopValue, marginTopStyle)),
|
|
26352
|
+
bottom: twipsToPixels(resolveMargin(inlineMarginBottomValue, marginBottomStyle))
|
|
26226
26353
|
};
|
|
26227
26354
|
return margins;
|
|
26228
26355
|
};
|
|
@@ -26497,7 +26624,7 @@ function parseTagValueJSON(json) {
|
|
|
26497
26624
|
}
|
|
26498
26625
|
try {
|
|
26499
26626
|
return JSON.parse(trimmed);
|
|
26500
|
-
} catch
|
|
26627
|
+
} catch {
|
|
26501
26628
|
return {};
|
|
26502
26629
|
}
|
|
26503
26630
|
}
|
|
@@ -26753,6 +26880,32 @@ function handleImageNode(node, params2, isAnchor) {
|
|
|
26753
26880
|
if (!picture || !picture.elements) return null;
|
|
26754
26881
|
const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
|
|
26755
26882
|
const blip = blipFill.elements.find((el) => el.name === "a:blip");
|
|
26883
|
+
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
26884
|
+
let transformData = {};
|
|
26885
|
+
if (spPr) {
|
|
26886
|
+
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
26887
|
+
if (xfrm?.attributes) {
|
|
26888
|
+
transformData = {
|
|
26889
|
+
rotation: rotToDegrees(xfrm.attributes["rot"]),
|
|
26890
|
+
verticalFlip: xfrm.attributes["flipV"] === "1",
|
|
26891
|
+
horizontalFlip: xfrm.attributes["flipH"] === "1"
|
|
26892
|
+
};
|
|
26893
|
+
}
|
|
26894
|
+
}
|
|
26895
|
+
const effectExtent = node.elements.find((el) => el.name === "wp:effectExtent");
|
|
26896
|
+
if (effectExtent) {
|
|
26897
|
+
const sanitizeEmuValue = (value) => {
|
|
26898
|
+
if (value === null || value === void 0) return 0;
|
|
26899
|
+
const numeric = Number(value);
|
|
26900
|
+
return Number.isFinite(numeric) ? numeric : 0;
|
|
26901
|
+
};
|
|
26902
|
+
transformData.sizeExtension = {
|
|
26903
|
+
left: emuToPixels(sanitizeEmuValue(effectExtent.attributes["l"])),
|
|
26904
|
+
top: emuToPixels(sanitizeEmuValue(effectExtent.attributes["t"])),
|
|
26905
|
+
right: emuToPixels(sanitizeEmuValue(effectExtent.attributes["r"])),
|
|
26906
|
+
bottom: emuToPixels(sanitizeEmuValue(effectExtent.attributes["b"]))
|
|
26907
|
+
};
|
|
26908
|
+
}
|
|
26756
26909
|
const positionHTag = node.elements.find((el) => el.name === "wp:positionH");
|
|
26757
26910
|
const positionH = positionHTag?.elements.find((el) => el.name === "wp:posOffset");
|
|
26758
26911
|
const positionHValue = emuToPixels(positionH?.elements[0]?.text);
|
|
@@ -26809,6 +26962,7 @@ function handleImageNode(node, params2, isAnchor) {
|
|
|
26809
26962
|
size: size2,
|
|
26810
26963
|
anchorData,
|
|
26811
26964
|
isAnchor,
|
|
26965
|
+
transformData,
|
|
26812
26966
|
...simplePos && {
|
|
26813
26967
|
simplePos: {
|
|
26814
26968
|
x: simplePos.attributes.x,
|
|
@@ -26960,6 +27114,31 @@ const translateImageNode = (params2) => {
|
|
|
26960
27114
|
distL: 0,
|
|
26961
27115
|
distR: 0
|
|
26962
27116
|
};
|
|
27117
|
+
const xfrmAttrs = {};
|
|
27118
|
+
const effectExtentAttrs = {
|
|
27119
|
+
l: 0,
|
|
27120
|
+
t: 0,
|
|
27121
|
+
r: 0,
|
|
27122
|
+
b: 0
|
|
27123
|
+
};
|
|
27124
|
+
const transformData = attrs.transformData;
|
|
27125
|
+
if (transformData) {
|
|
27126
|
+
if (transformData.rotation) {
|
|
27127
|
+
xfrmAttrs.rot = degreesToRot(transformData.rotation);
|
|
27128
|
+
}
|
|
27129
|
+
if (transformData.verticalFlip) {
|
|
27130
|
+
xfrmAttrs.flipV = "1";
|
|
27131
|
+
}
|
|
27132
|
+
if (transformData.horizontalFlip) {
|
|
27133
|
+
xfrmAttrs.flipH = "1";
|
|
27134
|
+
}
|
|
27135
|
+
if (transformData.sizeExtension) {
|
|
27136
|
+
effectExtentAttrs.l = pixelsToEmu(transformData.sizeExtension.left);
|
|
27137
|
+
effectExtentAttrs.t = pixelsToEmu(transformData.sizeExtension.top);
|
|
27138
|
+
effectExtentAttrs.r = pixelsToEmu(transformData.sizeExtension.right);
|
|
27139
|
+
effectExtentAttrs.b = pixelsToEmu(transformData.sizeExtension.bottom);
|
|
27140
|
+
}
|
|
27141
|
+
}
|
|
26963
27142
|
const drawingXmlns = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
26964
27143
|
const pictureXmlns = "http://schemas.openxmlformats.org/drawingml/2006/picture";
|
|
26965
27144
|
return {
|
|
@@ -26974,12 +27153,7 @@ const translateImageNode = (params2) => {
|
|
|
26974
27153
|
},
|
|
26975
27154
|
{
|
|
26976
27155
|
name: "wp:effectExtent",
|
|
26977
|
-
attributes:
|
|
26978
|
-
l: 0,
|
|
26979
|
-
t: 0,
|
|
26980
|
-
r: 0,
|
|
26981
|
-
b: 0
|
|
26982
|
-
}
|
|
27156
|
+
attributes: effectExtentAttrs
|
|
26983
27157
|
},
|
|
26984
27158
|
{
|
|
26985
27159
|
name: "wp:docPr",
|
|
@@ -27059,6 +27233,7 @@ const translateImageNode = (params2) => {
|
|
|
27059
27233
|
elements: [
|
|
27060
27234
|
{
|
|
27061
27235
|
name: "a:xfrm",
|
|
27236
|
+
attributes: xfrmAttrs,
|
|
27062
27237
|
elements: [
|
|
27063
27238
|
{
|
|
27064
27239
|
name: "a:ext",
|
|
@@ -27236,14 +27411,14 @@ function translateAnchorNode(params2) {
|
|
|
27236
27411
|
const XML_NODE_NAME$3 = "wp:anchor";
|
|
27237
27412
|
const SD_NODE_NAME$3 = ["image"];
|
|
27238
27413
|
const validXmlAttributes$3 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
27239
|
-
function encode$3(params2
|
|
27414
|
+
function encode$3(params2) {
|
|
27240
27415
|
const { node } = params2.extraParams;
|
|
27241
27416
|
if (!node || !node.type) {
|
|
27242
27417
|
return null;
|
|
27243
27418
|
}
|
|
27244
27419
|
return handleAnchorNode(params2);
|
|
27245
27420
|
}
|
|
27246
|
-
function decode$3(params2
|
|
27421
|
+
function decode$3(params2) {
|
|
27247
27422
|
const { node } = params2;
|
|
27248
27423
|
if (!node || !node.type) {
|
|
27249
27424
|
return null;
|
|
@@ -27277,14 +27452,14 @@ function translateInlineNode(params2) {
|
|
|
27277
27452
|
const XML_NODE_NAME$2 = "wp:inline";
|
|
27278
27453
|
const SD_NODE_NAME$2 = ["image"];
|
|
27279
27454
|
const validXmlAttributes$2 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
27280
|
-
function encode$2(params2
|
|
27455
|
+
function encode$2(params2) {
|
|
27281
27456
|
const { node } = params2.extraParams;
|
|
27282
27457
|
if (!node || !node.type) {
|
|
27283
27458
|
return null;
|
|
27284
27459
|
}
|
|
27285
27460
|
return handleInlineNode(params2);
|
|
27286
27461
|
}
|
|
27287
|
-
function decode$2(params2
|
|
27462
|
+
function decode$2(params2) {
|
|
27288
27463
|
const { node } = params2;
|
|
27289
27464
|
if (!node || !node.type) {
|
|
27290
27465
|
return null;
|
|
@@ -27310,7 +27485,7 @@ const registeredHandlers = Object.freeze({
|
|
|
27310
27485
|
const XML_NODE_NAME$1 = "w:drawing";
|
|
27311
27486
|
const SD_NODE_NAME$1 = [];
|
|
27312
27487
|
const validXmlAttributes$1 = [];
|
|
27313
|
-
function encode$1(params2
|
|
27488
|
+
function encode$1(params2) {
|
|
27314
27489
|
const nodes = params2.nodes;
|
|
27315
27490
|
const node = nodes[0];
|
|
27316
27491
|
const validChildTranslators = ["wp:anchor", "wp:inline"];
|
|
@@ -27321,7 +27496,7 @@ function encode$1(params2, encodedAttrs) {
|
|
|
27321
27496
|
return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
|
|
27322
27497
|
}, null);
|
|
27323
27498
|
}
|
|
27324
|
-
function decode$1(params2
|
|
27499
|
+
function decode$1(params2) {
|
|
27325
27500
|
const { node } = params2;
|
|
27326
27501
|
if (!node || !node.type) {
|
|
27327
27502
|
return null;
|
|
@@ -28922,7 +29097,7 @@ function translateStructuredContent(params2) {
|
|
|
28922
29097
|
const XML_NODE_NAME = "w:sdt";
|
|
28923
29098
|
const SD_NODE_NAME = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
28924
29099
|
const validXmlAttributes = [];
|
|
28925
|
-
function encode$s(params2
|
|
29100
|
+
function encode$s(params2) {
|
|
28926
29101
|
const nodes = params2.nodes;
|
|
28927
29102
|
const node = nodes[0];
|
|
28928
29103
|
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
@@ -28932,7 +29107,7 @@ function encode$s(params2, encodedAttrs) {
|
|
|
28932
29107
|
const result = handler2(params2);
|
|
28933
29108
|
return result;
|
|
28934
29109
|
}
|
|
28935
|
-
function decode(params2
|
|
29110
|
+
function decode(params2) {
|
|
28936
29111
|
const { node } = params2;
|
|
28937
29112
|
if (!node || !node.type) {
|
|
28938
29113
|
return null;
|
|
@@ -31261,8 +31436,8 @@ function addDefaultStylesIfMissing(styles) {
|
|
|
31261
31436
|
}
|
|
31262
31437
|
const importHeadersFooters = (docx, converter, mainEditor) => {
|
|
31263
31438
|
const rels = docx["word/_rels/document.xml.rels"];
|
|
31264
|
-
const relationships = rels
|
|
31265
|
-
const { elements } = relationships;
|
|
31439
|
+
const relationships = rels?.elements.find((el) => el.name === "Relationships");
|
|
31440
|
+
const { elements } = relationships || { elements: [] };
|
|
31266
31441
|
const headerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
|
|
31267
31442
|
const footerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
|
|
31268
31443
|
const headers = elements.filter((el) => el.attributes["Type"] === headerType);
|
|
@@ -42220,12 +42395,6 @@ const History = Extension.create({
|
|
|
42220
42395
|
name: "history",
|
|
42221
42396
|
addOptions() {
|
|
42222
42397
|
return {
|
|
42223
|
-
/**
|
|
42224
|
-
* @typedef {Object} HistoryOptions
|
|
42225
|
-
* @category Options
|
|
42226
|
-
* @property {number} [depth=100] - Maximum undo/redo steps to remember
|
|
42227
|
-
* @property {number} [newGroupDelay=500] - Milliseconds to wait before starting a new history group
|
|
42228
|
-
*/
|
|
42229
42398
|
depth: 100,
|
|
42230
42399
|
newGroupDelay: 500
|
|
42231
42400
|
};
|
|
@@ -42244,9 +42413,8 @@ const History = Extension.create({
|
|
|
42244
42413
|
/**
|
|
42245
42414
|
* Undo the last action
|
|
42246
42415
|
* @category Command
|
|
42247
|
-
* @returns {Function} Command function
|
|
42248
42416
|
* @example
|
|
42249
|
-
* undo()
|
|
42417
|
+
* editor.commands.undo()
|
|
42250
42418
|
* @note Groups changes within the newGroupDelay window
|
|
42251
42419
|
*/
|
|
42252
42420
|
undo: () => ({ state: state2, dispatch, tr }) => {
|
|
@@ -42260,9 +42428,8 @@ const History = Extension.create({
|
|
|
42260
42428
|
/**
|
|
42261
42429
|
* Redo the last undone action
|
|
42262
42430
|
* @category Command
|
|
42263
|
-
* @returns {Function} Command function
|
|
42264
42431
|
* @example
|
|
42265
|
-
* redo()
|
|
42432
|
+
* editor.commands.redo()
|
|
42266
42433
|
* @note Only available after an undo action
|
|
42267
42434
|
*/
|
|
42268
42435
|
redo: () => ({ state: state2, dispatch, tr }) => {
|
|
@@ -49181,6 +49348,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
49181
49348
|
return result;
|
|
49182
49349
|
} catch (error) {
|
|
49183
49350
|
this.emit("exception", { error, editor: this });
|
|
49351
|
+
console.error(error);
|
|
49184
49352
|
}
|
|
49185
49353
|
}
|
|
49186
49354
|
/**
|
|
@@ -49204,6 +49372,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
49204
49372
|
this.converter.footerEditors.length = 0;
|
|
49205
49373
|
} catch (error) {
|
|
49206
49374
|
this.emit("exception", { error, editor: this });
|
|
49375
|
+
console.error(error);
|
|
49207
49376
|
}
|
|
49208
49377
|
}
|
|
49209
49378
|
/**
|
|
@@ -49792,6 +49961,7 @@ endCollaboration_fn = function() {
|
|
|
49792
49961
|
if (this.options.ydoc) this.options.ydoc.destroy();
|
|
49793
49962
|
} catch (error) {
|
|
49794
49963
|
this.emit("exception", { error, editor: this });
|
|
49964
|
+
console.error(error);
|
|
49795
49965
|
}
|
|
49796
49966
|
};
|
|
49797
49967
|
validateDocumentInit_fn = function() {
|
|
@@ -49818,11 +49988,6 @@ const Color = Extension.create({
|
|
|
49818
49988
|
name: "color",
|
|
49819
49989
|
addOptions() {
|
|
49820
49990
|
return {
|
|
49821
|
-
/**
|
|
49822
|
-
* @typedef {Object} ColorOptions
|
|
49823
|
-
* @category Options
|
|
49824
|
-
* @property {string[]} [types=['textStyle']] - Mark types to add color support to
|
|
49825
|
-
*/
|
|
49826
49991
|
types: ["textStyle"]
|
|
49827
49992
|
};
|
|
49828
49993
|
},
|
|
@@ -49831,10 +49996,6 @@ const Color = Extension.create({
|
|
|
49831
49996
|
{
|
|
49832
49997
|
types: this.options.types,
|
|
49833
49998
|
attributes: {
|
|
49834
|
-
/**
|
|
49835
|
-
* @category Attribute
|
|
49836
|
-
* @param {ColorValue} [color] - Text color value
|
|
49837
|
-
*/
|
|
49838
49999
|
color: {
|
|
49839
50000
|
default: null,
|
|
49840
50001
|
parseDOM: (el) => el.style.color?.replace(/['"]+/g, ""),
|
|
@@ -49853,16 +50014,17 @@ const Color = Extension.create({
|
|
|
49853
50014
|
* Set text color
|
|
49854
50015
|
* @category Command
|
|
49855
50016
|
* @param {ColorValue} color - Color value to apply
|
|
49856
|
-
* @returns {Function} Command function
|
|
49857
50017
|
* @example
|
|
49858
50018
|
* // Set to red using hex
|
|
49859
|
-
* setColor('#ff0000')
|
|
50019
|
+
* editor.commands.setColor('#ff0000')
|
|
49860
50020
|
*
|
|
50021
|
+
* @example
|
|
49861
50022
|
* // Set using rgb
|
|
49862
|
-
* setColor('rgb(255, 0, 0)')
|
|
50023
|
+
* editor.commands.setColor('rgb(255, 0, 0)')
|
|
49863
50024
|
*
|
|
50025
|
+
* @example
|
|
49864
50026
|
* // Set using named color
|
|
49865
|
-
* setColor('blue')
|
|
50027
|
+
* editor.commands.setColor('blue')
|
|
49866
50028
|
* @note Preserves other text styling attributes
|
|
49867
50029
|
*/
|
|
49868
50030
|
setColor: (color) => ({ chain }) => {
|
|
@@ -49871,9 +50033,8 @@ const Color = Extension.create({
|
|
|
49871
50033
|
/**
|
|
49872
50034
|
* Remove text color
|
|
49873
50035
|
* @category Command
|
|
49874
|
-
* @returns {Function} Command function
|
|
49875
50036
|
* @example
|
|
49876
|
-
* unsetColor()
|
|
50037
|
+
* editor.commands.unsetColor()
|
|
49877
50038
|
* @note Removes color while preserving other text styles
|
|
49878
50039
|
*/
|
|
49879
50040
|
unsetColor: () => ({ chain }) => {
|
|
@@ -49886,11 +50047,6 @@ const FontFamily = Extension.create({
|
|
|
49886
50047
|
name: "fontFamily",
|
|
49887
50048
|
addOptions() {
|
|
49888
50049
|
return {
|
|
49889
|
-
/**
|
|
49890
|
-
* @typedef {Object} FontFamilyOptions
|
|
49891
|
-
* @category Options
|
|
49892
|
-
* @property {string[]} [types=['textStyle']] - Mark types to add font family support to
|
|
49893
|
-
*/
|
|
49894
50050
|
types: ["textStyle"]
|
|
49895
50051
|
};
|
|
49896
50052
|
},
|
|
@@ -49899,10 +50055,6 @@ const FontFamily = Extension.create({
|
|
|
49899
50055
|
{
|
|
49900
50056
|
types: this.options.types,
|
|
49901
50057
|
attributes: {
|
|
49902
|
-
/**
|
|
49903
|
-
* @category Attribute
|
|
49904
|
-
* @param {FontFamilyValue} [fontFamily] - Font family for text
|
|
49905
|
-
*/
|
|
49906
50058
|
fontFamily: {
|
|
49907
50059
|
default: null,
|
|
49908
50060
|
parseDOM: (el) => el.style.fontFamily?.replace(/['"]+/g, ""),
|
|
@@ -49921,13 +50073,13 @@ const FontFamily = Extension.create({
|
|
|
49921
50073
|
* Set font family
|
|
49922
50074
|
* @category Command
|
|
49923
50075
|
* @param {FontFamilyValue} fontFamily - Font family to apply
|
|
49924
|
-
* @returns {Function} Command function
|
|
49925
50076
|
* @example
|
|
49926
50077
|
* // Set to Arial
|
|
49927
|
-
* setFontFamily('Arial')
|
|
50078
|
+
* editor.commands.setFontFamily('Arial')
|
|
49928
50079
|
*
|
|
50080
|
+
* @example
|
|
49929
50081
|
* // Set to serif font
|
|
49930
|
-
* setFontFamily('Georgia, serif')
|
|
50082
|
+
* editor.commands.setFontFamily('Georgia, serif')
|
|
49931
50083
|
* @note Preserves other text styling attributes
|
|
49932
50084
|
*/
|
|
49933
50085
|
setFontFamily: (fontFamily2) => ({ chain }) => {
|
|
@@ -49936,9 +50088,8 @@ const FontFamily = Extension.create({
|
|
|
49936
50088
|
/**
|
|
49937
50089
|
* Remove font family
|
|
49938
50090
|
* @category Command
|
|
49939
|
-
* @returns {Function} Command function
|
|
49940
50091
|
* @example
|
|
49941
|
-
* unsetFontFamily()
|
|
50092
|
+
* editor.commands.unsetFontFamily()
|
|
49942
50093
|
* @note Reverts to default document font
|
|
49943
50094
|
*/
|
|
49944
50095
|
unsetFontFamily: () => ({ chain }) => {
|
|
@@ -49951,12 +50102,6 @@ const FontSize = Extension.create({
|
|
|
49951
50102
|
name: "fontSize",
|
|
49952
50103
|
addOptions() {
|
|
49953
50104
|
return {
|
|
49954
|
-
/**
|
|
49955
|
-
* @typedef {Object} FontSizeOptions
|
|
49956
|
-
* @category Options
|
|
49957
|
-
* @property {string[]} [types=['textStyle', 'tableCell']] - Node/mark types to add font size support to
|
|
49958
|
-
* @property {FontSizeDefaults} [defaults] - Default size configuration
|
|
49959
|
-
*/
|
|
49960
50105
|
types: ["textStyle", "tableCell"],
|
|
49961
50106
|
defaults: {
|
|
49962
50107
|
value: 12,
|
|
@@ -49971,10 +50116,6 @@ const FontSize = Extension.create({
|
|
|
49971
50116
|
{
|
|
49972
50117
|
types: this.options.types,
|
|
49973
50118
|
attributes: {
|
|
49974
|
-
/**
|
|
49975
|
-
* @category Attribute
|
|
49976
|
-
* @param {FontSizeValue} [fontSize] - Font size with unit
|
|
49977
|
-
*/
|
|
49978
50119
|
fontSize: {
|
|
49979
50120
|
default: null,
|
|
49980
50121
|
parseDOM: (el) => el.style.fontSize,
|
|
@@ -49996,16 +50137,10 @@ const FontSize = Extension.create({
|
|
|
49996
50137
|
* Set font size
|
|
49997
50138
|
* @category Command
|
|
49998
50139
|
* @param {FontSizeValue} fontSize - Size to apply (with optional unit)
|
|
49999
|
-
* @returns {Function} Command function
|
|
50000
50140
|
* @example
|
|
50001
|
-
*
|
|
50002
|
-
* setFontSize('
|
|
50003
|
-
*
|
|
50004
|
-
* // Set to 18px
|
|
50005
|
-
* setFontSize('18px')
|
|
50006
|
-
*
|
|
50007
|
-
* // Set without unit (uses default)
|
|
50008
|
-
* setFontSize(16)
|
|
50141
|
+
* editor.commands.setFontSize('14pt')
|
|
50142
|
+
* editor.commands.setFontSize('18px')
|
|
50143
|
+
* editor.commands.setFontSize(16)
|
|
50009
50144
|
* @note Automatically clamps to min/max values
|
|
50010
50145
|
*/
|
|
50011
50146
|
setFontSize: (fontSize2) => ({ chain }) => {
|
|
@@ -50027,9 +50162,8 @@ const FontSize = Extension.create({
|
|
|
50027
50162
|
/**
|
|
50028
50163
|
* Remove font size
|
|
50029
50164
|
* @category Command
|
|
50030
|
-
* @returns {Function} Command function
|
|
50031
50165
|
* @example
|
|
50032
|
-
* unsetFontSize()
|
|
50166
|
+
* editor.commands.unsetFontSize()
|
|
50033
50167
|
* @note Reverts to default document size
|
|
50034
50168
|
*/
|
|
50035
50169
|
unsetFontSize: () => ({ chain }) => {
|
|
@@ -50079,13 +50213,9 @@ const TextAlign = Extension.create({
|
|
|
50079
50213
|
* Set text alignment
|
|
50080
50214
|
* @category Command
|
|
50081
50215
|
* @param {string} alignment - Alignment value (left, center, right, justify)
|
|
50082
|
-
* @returns {Function} Command function
|
|
50083
50216
|
* @example
|
|
50084
|
-
*
|
|
50085
|
-
* setTextAlign('
|
|
50086
|
-
*
|
|
50087
|
-
* // Set to justify
|
|
50088
|
-
* setTextAlign('justify')
|
|
50217
|
+
* editor.commands.setTextAlign('center')
|
|
50218
|
+
* editor.commands.setTextAlign('justify')
|
|
50089
50219
|
* @note Applies to all configured node types (heading, paragraph by default)
|
|
50090
50220
|
*/
|
|
50091
50221
|
setTextAlign: (alignment2) => ({ commands: commands2 }) => {
|
|
@@ -50096,9 +50226,8 @@ const TextAlign = Extension.create({
|
|
|
50096
50226
|
/**
|
|
50097
50227
|
* Remove text alignment (reset to default)
|
|
50098
50228
|
* @category Command
|
|
50099
|
-
* @returns {Function} Command function
|
|
50100
50229
|
* @example
|
|
50101
|
-
* unsetTextAlign()
|
|
50230
|
+
* editor.commands.unsetTextAlign()
|
|
50102
50231
|
* @note Resets alignment to the default value
|
|
50103
50232
|
*/
|
|
50104
50233
|
unsetTextAlign: () => ({ commands: commands2 }) => {
|
|
@@ -50239,13 +50368,6 @@ const LineHeight = Extension.create({
|
|
|
50239
50368
|
name: "lineHeight",
|
|
50240
50369
|
addOptions() {
|
|
50241
50370
|
return {
|
|
50242
|
-
/**
|
|
50243
|
-
* @typedef {Object} LineHeightOptions
|
|
50244
|
-
* @category Options
|
|
50245
|
-
* @property {string[]} [types=['heading', 'paragraph']] - Block types to add line height support to
|
|
50246
|
-
* @property {Object} [defaults] - Default configuration
|
|
50247
|
-
* @property {string} [defaults.unit=''] - Default unit for line height values
|
|
50248
|
-
*/
|
|
50249
50371
|
types: ["heading", "paragraph"],
|
|
50250
50372
|
defaults: {
|
|
50251
50373
|
unit: ""
|
|
@@ -50257,10 +50379,6 @@ const LineHeight = Extension.create({
|
|
|
50257
50379
|
{
|
|
50258
50380
|
types: this.options.types,
|
|
50259
50381
|
attributes: {
|
|
50260
|
-
/**
|
|
50261
|
-
* @category Attribute
|
|
50262
|
-
* @param {LineHeightValue} [lineHeight] - Line height value
|
|
50263
|
-
*/
|
|
50264
50382
|
lineHeight: {
|
|
50265
50383
|
default: null,
|
|
50266
50384
|
parseDOM: (el) => el.style.lineHeight,
|
|
@@ -50286,16 +50404,10 @@ const LineHeight = Extension.create({
|
|
|
50286
50404
|
* Set line height for blocks
|
|
50287
50405
|
* @category Command
|
|
50288
50406
|
* @param {LineHeightValue} lineHeight - Line height to apply
|
|
50289
|
-
* @returns {Function} Command function
|
|
50290
50407
|
* @example
|
|
50291
|
-
*
|
|
50292
|
-
* setLineHeight(
|
|
50293
|
-
*
|
|
50294
|
-
* // Set to 24px spacing
|
|
50295
|
-
* setLineHeight('24px')
|
|
50296
|
-
*
|
|
50297
|
-
* // Set to double spacing
|
|
50298
|
-
* setLineHeight(2)
|
|
50408
|
+
* editor.commands.setLineHeight(1.5)
|
|
50409
|
+
* editor.commands.setLineHeight('24px')
|
|
50410
|
+
* editor.commands.setLineHeight(2)
|
|
50299
50411
|
* @note Applies to paragraphs and headings
|
|
50300
50412
|
*/
|
|
50301
50413
|
setLineHeight: (lineHeight2) => ({ commands: commands2 }) => {
|
|
@@ -50305,9 +50417,8 @@ const LineHeight = Extension.create({
|
|
|
50305
50417
|
/**
|
|
50306
50418
|
* Remove line height
|
|
50307
50419
|
* @category Command
|
|
50308
|
-
* @returns {Function} Command function
|
|
50309
50420
|
* @example
|
|
50310
|
-
* unsetLineHeight()
|
|
50421
|
+
* editor.commands.unsetLineHeight()
|
|
50311
50422
|
* @note Reverts to default line spacing
|
|
50312
50423
|
*/
|
|
50313
50424
|
unsetLineHeight: () => ({ commands: commands2 }) => {
|
|
@@ -50335,9 +50446,8 @@ const FormatCommands = Extension.create({
|
|
|
50335
50446
|
/**
|
|
50336
50447
|
* Clear all formatting (nodes and marks)
|
|
50337
50448
|
* @category Command
|
|
50338
|
-
* @returns {Function} Command function
|
|
50339
50449
|
* @example
|
|
50340
|
-
* clearFormat()
|
|
50450
|
+
* editor.commands.clearFormat()
|
|
50341
50451
|
* @note Removes all marks and resets nodes to default paragraph
|
|
50342
50452
|
*/
|
|
50343
50453
|
clearFormat: () => ({ chain }) => {
|
|
@@ -50346,9 +50456,8 @@ const FormatCommands = Extension.create({
|
|
|
50346
50456
|
/**
|
|
50347
50457
|
* Clear only mark formatting
|
|
50348
50458
|
* @category Command
|
|
50349
|
-
* @returns {Function} Command function
|
|
50350
50459
|
* @example
|
|
50351
|
-
* clearMarksFormat()
|
|
50460
|
+
* editor.commands.clearMarksFormat()
|
|
50352
50461
|
* @note Removes bold, italic, underline, colors, etc. but preserves block structure
|
|
50353
50462
|
*/
|
|
50354
50463
|
clearMarksFormat: () => ({ chain }) => {
|
|
@@ -50357,9 +50466,8 @@ const FormatCommands = Extension.create({
|
|
|
50357
50466
|
/**
|
|
50358
50467
|
* Clear only node formatting
|
|
50359
50468
|
* @category Command
|
|
50360
|
-
* @returns {Function} Command function
|
|
50361
50469
|
* @example
|
|
50362
|
-
* clearNodesFormat()
|
|
50470
|
+
* editor.commands.clearNodesFormat()
|
|
50363
50471
|
* @note Converts headings, lists, etc. to paragraphs but preserves text marks
|
|
50364
50472
|
*/
|
|
50365
50473
|
clearNodesFormat: () => ({ chain }) => {
|
|
@@ -50368,13 +50476,8 @@ const FormatCommands = Extension.create({
|
|
|
50368
50476
|
/**
|
|
50369
50477
|
* Copy format from selection or apply copied format
|
|
50370
50478
|
* @category Command
|
|
50371
|
-
* @returns {Function} Command function
|
|
50372
50479
|
* @example
|
|
50373
|
-
*
|
|
50374
|
-
* copyFormat()
|
|
50375
|
-
*
|
|
50376
|
-
* // Second call: apply copied format to new selection
|
|
50377
|
-
* copyFormat()
|
|
50480
|
+
* editor.commands.copyFormat()
|
|
50378
50481
|
* @note Works like format painter - first click copies, second click applies
|
|
50379
50482
|
*/
|
|
50380
50483
|
copyFormat: () => ({ chain }) => {
|
|
@@ -50787,6 +50890,9 @@ function drawGapCursor(state2) {
|
|
|
50787
50890
|
}
|
|
50788
50891
|
const Gapcursor = Extension.create({
|
|
50789
50892
|
name: "gapCursor",
|
|
50893
|
+
addOptions() {
|
|
50894
|
+
return {};
|
|
50895
|
+
},
|
|
50790
50896
|
addPmPlugins() {
|
|
50791
50897
|
return [gapCursor()];
|
|
50792
50898
|
},
|
|
@@ -51127,6 +51233,9 @@ function getCursorPositionRelativeToContainer(view, eventLocation) {
|
|
|
51127
51233
|
const SlashMenuPluginKey = new PluginKey("slashMenu");
|
|
51128
51234
|
const SlashMenu = Extension.create({
|
|
51129
51235
|
name: "slashMenu",
|
|
51236
|
+
addOptions() {
|
|
51237
|
+
return {};
|
|
51238
|
+
},
|
|
51130
51239
|
addPmPlugins() {
|
|
51131
51240
|
if (this.editor.options?.disableContextMenu) {
|
|
51132
51241
|
return [];
|
|
@@ -51264,11 +51373,6 @@ const Document = Node$1.create({
|
|
|
51264
51373
|
},
|
|
51265
51374
|
addAttributes() {
|
|
51266
51375
|
return {
|
|
51267
|
-
/**
|
|
51268
|
-
* @private
|
|
51269
|
-
* @category Attribute
|
|
51270
|
-
* @param {Object} [attributes] - Internal document attributes
|
|
51271
|
-
*/
|
|
51272
51376
|
attributes: {
|
|
51273
51377
|
rendered: false,
|
|
51274
51378
|
"aria-label": "Document node"
|
|
@@ -51280,10 +51384,10 @@ const Document = Node$1.create({
|
|
|
51280
51384
|
/**
|
|
51281
51385
|
* Get document statistics
|
|
51282
51386
|
* @category Command
|
|
51283
|
-
* @returns {Function} Command function
|
|
51284
51387
|
* @example
|
|
51285
51388
|
* // Get word and character count
|
|
51286
|
-
* getDocumentStats()
|
|
51389
|
+
* const stats = editor.commands.getDocumentStats()
|
|
51390
|
+
* console.log(`${stats.words} words, ${stats.characters} characters`)
|
|
51287
51391
|
* @note Returns word count, character count, and paragraph count
|
|
51288
51392
|
*/
|
|
51289
51393
|
getDocumentStats: () => ({ editor }) => {
|
|
@@ -51300,9 +51404,8 @@ const Document = Node$1.create({
|
|
|
51300
51404
|
/**
|
|
51301
51405
|
* Clear entire document
|
|
51302
51406
|
* @category Command
|
|
51303
|
-
* @returns {Function} Command function
|
|
51304
51407
|
* @example
|
|
51305
|
-
* clearDocument()
|
|
51408
|
+
* editor.commands.clearDocument()
|
|
51306
51409
|
* @note Replaces all content with an empty paragraph
|
|
51307
51410
|
*/
|
|
51308
51411
|
clearDocument: () => ({ commands: commands2 }) => {
|
|
@@ -51314,13 +51417,19 @@ const Document = Node$1.create({
|
|
|
51314
51417
|
const Text = Node$1.create({
|
|
51315
51418
|
name: "text",
|
|
51316
51419
|
group: "inline",
|
|
51317
|
-
inline: true
|
|
51420
|
+
inline: true,
|
|
51421
|
+
addOptions() {
|
|
51422
|
+
return {};
|
|
51423
|
+
}
|
|
51318
51424
|
});
|
|
51319
51425
|
const RunItem = Node$1.create({
|
|
51320
51426
|
name: "run",
|
|
51321
51427
|
group: "inline",
|
|
51322
51428
|
content: "text*",
|
|
51323
51429
|
inline: true,
|
|
51430
|
+
addOptions() {
|
|
51431
|
+
return {};
|
|
51432
|
+
},
|
|
51324
51433
|
parseDOM() {
|
|
51325
51434
|
return [{ tag: "run" }];
|
|
51326
51435
|
},
|
|
@@ -51346,14 +51455,6 @@ const BulletList = Node$1.create({
|
|
|
51346
51455
|
},
|
|
51347
51456
|
addOptions() {
|
|
51348
51457
|
return {
|
|
51349
|
-
/**
|
|
51350
|
-
* @typedef {Object} BulletListOptions
|
|
51351
|
-
* @category Options
|
|
51352
|
-
* @property {string} [itemTypeName='listItem'] - Name of the list item node type
|
|
51353
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the ul element
|
|
51354
|
-
* @property {boolean} [keepMarks=true] - Whether to preserve marks when splitting
|
|
51355
|
-
* @property {boolean} [keepAttributes=false] - Whether to preserve attributes when splitting
|
|
51356
|
-
*/
|
|
51357
51458
|
itemTypeName: "listItem",
|
|
51358
51459
|
htmlAttributes: {
|
|
51359
51460
|
"aria-label": "Bullet list node"
|
|
@@ -51371,27 +51472,13 @@ const BulletList = Node$1.create({
|
|
|
51371
51472
|
},
|
|
51372
51473
|
addAttributes() {
|
|
51373
51474
|
return {
|
|
51374
|
-
/**
|
|
51375
|
-
* @category Attribute
|
|
51376
|
-
* @param {string} [list-style-type='bullet'] - List style type for this list
|
|
51377
|
-
*/
|
|
51378
51475
|
"list-style-type": {
|
|
51379
51476
|
default: "bullet",
|
|
51380
51477
|
rendered: false
|
|
51381
51478
|
},
|
|
51382
|
-
/**
|
|
51383
|
-
* @private
|
|
51384
|
-
* @category Attribute
|
|
51385
|
-
* @param {string} [listId] - Internal list identifier for numbering
|
|
51386
|
-
*/
|
|
51387
51479
|
listId: {
|
|
51388
51480
|
rendered: false
|
|
51389
51481
|
},
|
|
51390
|
-
/**
|
|
51391
|
-
* @private
|
|
51392
|
-
* @category Attribute
|
|
51393
|
-
* @param {string} [sdBlockId] - Internal block tracking ID
|
|
51394
|
-
*/
|
|
51395
51482
|
sdBlockId: {
|
|
51396
51483
|
default: null,
|
|
51397
51484
|
keepOnSplit: false,
|
|
@@ -51400,11 +51487,6 @@ const BulletList = Node$1.create({
|
|
|
51400
51487
|
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
51401
51488
|
}
|
|
51402
51489
|
},
|
|
51403
|
-
/**
|
|
51404
|
-
* @private
|
|
51405
|
-
* @category Attribute
|
|
51406
|
-
* @param {Object} [attributes] - Additional attributes for the list
|
|
51407
|
-
*/
|
|
51408
51490
|
attributes: {
|
|
51409
51491
|
rendered: false,
|
|
51410
51492
|
keepOnSplit: true
|
|
@@ -51416,10 +51498,9 @@ const BulletList = Node$1.create({
|
|
|
51416
51498
|
/**
|
|
51417
51499
|
* Toggle a bullet list at the current selection
|
|
51418
51500
|
* @category Command
|
|
51419
|
-
* @returns {Function} Command function
|
|
51420
51501
|
* @example
|
|
51421
51502
|
* // Toggle bullet list on selected text
|
|
51422
|
-
* toggleBulletList()
|
|
51503
|
+
* editor.commands.toggleBulletList()
|
|
51423
51504
|
* @note Converts selected paragraphs to list items or removes list formatting
|
|
51424
51505
|
*/
|
|
51425
51506
|
toggleBulletList: () => (params2) => {
|
|
@@ -51538,9 +51619,25 @@ const OrderedList = Node$1.create({
|
|
|
51538
51619
|
},
|
|
51539
51620
|
addCommands() {
|
|
51540
51621
|
return {
|
|
51622
|
+
/**
|
|
51623
|
+
* Toggle ordered list formatting
|
|
51624
|
+
* @category Command
|
|
51625
|
+
* @example
|
|
51626
|
+
* editor.commands.toggleOrderedList()
|
|
51627
|
+
* @note Converts selection to ordered list or back to paragraphs
|
|
51628
|
+
*/
|
|
51541
51629
|
toggleOrderedList: () => (params2) => {
|
|
51542
51630
|
return toggleList(this.type)(params2);
|
|
51543
51631
|
},
|
|
51632
|
+
/**
|
|
51633
|
+
* Restart list node numbering
|
|
51634
|
+
* @category Command
|
|
51635
|
+
* @param {Array} followingNodes - Nodes to restart
|
|
51636
|
+
* @param {number} pos - Starting position
|
|
51637
|
+
* @example
|
|
51638
|
+
* editor.commands.restartListNodes(nodes, position)
|
|
51639
|
+
* @note Resets list numbering for specified nodes
|
|
51640
|
+
*/
|
|
51544
51641
|
restartListNodes: (followingNodes, pos) => ({ tr }) => {
|
|
51545
51642
|
let currentNodePos = pos;
|
|
51546
51643
|
const nodes = followingNodes.map((node) => {
|
|
@@ -51559,8 +51656,11 @@ const OrderedList = Node$1.create({
|
|
|
51559
51656
|
return true;
|
|
51560
51657
|
},
|
|
51561
51658
|
/**
|
|
51562
|
-
*
|
|
51563
|
-
* @
|
|
51659
|
+
* Update ordered list style type based on nesting level
|
|
51660
|
+
* @category Command
|
|
51661
|
+
* @example
|
|
51662
|
+
* editor.commands.updateOrderedListStyleType()
|
|
51663
|
+
* @note Cycles through decimal -> lowerAlpha -> lowerRoman based on depth
|
|
51564
51664
|
*/
|
|
51565
51665
|
updateOrderedListStyleType: () => ({ dispatch, tr }) => {
|
|
51566
51666
|
let list = findParentNode((node) => node.type.name === this.name)(tr.selection);
|
|
@@ -51837,7 +51937,7 @@ const CustomSelection = Extension.create({
|
|
|
51837
51937
|
* @returns {Function} Command function
|
|
51838
51938
|
* @example
|
|
51839
51939
|
* // Restore selection after toolbar interaction
|
|
51840
|
-
* restorePreservedSelection()
|
|
51940
|
+
* editor.commands.restorePreservedSelection()
|
|
51841
51941
|
* @note Used internally to maintain selection when interacting with toolbar
|
|
51842
51942
|
*/
|
|
51843
51943
|
restorePreservedSelection: () => ({ tr, state: state2 }) => {
|
|
@@ -52126,6 +52226,9 @@ const LinkedStyles = Extension.create({
|
|
|
52126
52226
|
name: "linkedStyles",
|
|
52127
52227
|
priority: 1,
|
|
52128
52228
|
// We need this plugin to run before the list plugins
|
|
52229
|
+
addOptions() {
|
|
52230
|
+
return {};
|
|
52231
|
+
},
|
|
52129
52232
|
addPmPlugins() {
|
|
52130
52233
|
return [createLinkedStylesPlugin(this.editor)];
|
|
52131
52234
|
},
|
|
@@ -52134,11 +52237,10 @@ const LinkedStyles = Extension.create({
|
|
|
52134
52237
|
/**
|
|
52135
52238
|
* Apply a linked style to the selected paragraphs
|
|
52136
52239
|
* @category Command
|
|
52137
|
-
* @param {
|
|
52138
|
-
* @returns {Function} Command function
|
|
52240
|
+
* @param {LinkedStyle} style - The style object to apply
|
|
52139
52241
|
* @example
|
|
52140
52242
|
* const style = editor.helpers.linkedStyles.getStyleById('Heading1');
|
|
52141
|
-
* setLinkedStyle(style);
|
|
52243
|
+
* editor.commands.setLinkedStyle(style);
|
|
52142
52244
|
* @note Clears existing formatting when applying a style
|
|
52143
52245
|
* @note Works with custom selection preservation
|
|
52144
52246
|
*/
|
|
@@ -52149,16 +52251,12 @@ const LinkedStyles = Extension.create({
|
|
|
52149
52251
|
/**
|
|
52150
52252
|
* Toggle a linked style on the current selection
|
|
52151
52253
|
* @category Command
|
|
52152
|
-
* @param {
|
|
52254
|
+
* @param {LinkedStyle} style - The linked style to apply (with id property)
|
|
52153
52255
|
* @param {string|null} [nodeType=null] - Node type to restrict toggle to (e.g., 'paragraph')
|
|
52154
|
-
* @returns {Function} Command function
|
|
52155
52256
|
* @example
|
|
52156
|
-
* // Toggle a heading style
|
|
52157
52257
|
* const style = editor.helpers.linkedStyles.getStyleById('Heading1');
|
|
52158
|
-
* toggleLinkedStyle(style)
|
|
52159
|
-
*
|
|
52160
|
-
* // Toggle only on paragraph nodes
|
|
52161
|
-
* toggleLinkedStyle(style, 'paragraph')
|
|
52258
|
+
* editor.commands.toggleLinkedStyle(style)
|
|
52259
|
+
* editor.commands.toggleLinkedStyle(style, 'paragraph')
|
|
52162
52260
|
* @note If selection is empty, returns false
|
|
52163
52261
|
* @note Removes style if already applied, applies it if not
|
|
52164
52262
|
*/
|
|
@@ -52186,13 +52284,9 @@ const LinkedStyles = Extension.create({
|
|
|
52186
52284
|
* Apply a linked style by its ID
|
|
52187
52285
|
* @category Command
|
|
52188
52286
|
* @param {string} styleId - The style ID to apply (e.g., 'Heading1')
|
|
52189
|
-
* @returns {Function} Command function
|
|
52190
52287
|
* @example
|
|
52191
|
-
*
|
|
52192
|
-
* setStyleById('
|
|
52193
|
-
*
|
|
52194
|
-
* // Apply a normal style
|
|
52195
|
-
* setStyleById('Normal')
|
|
52288
|
+
* editor.commands.setStyleById('Heading1')
|
|
52289
|
+
* editor.commands.setStyleById('Normal')
|
|
52196
52290
|
* @note Looks up the style from loaded Word styles
|
|
52197
52291
|
*/
|
|
52198
52292
|
setStyleById: (styleId) => (params2) => {
|
|
@@ -52900,12 +52994,6 @@ const Paragraph = OxmlNode.create({
|
|
|
52900
52994
|
inline: false,
|
|
52901
52995
|
addOptions() {
|
|
52902
52996
|
return {
|
|
52903
|
-
/**
|
|
52904
|
-
* @typedef {Object} HeadingOptions
|
|
52905
|
-
* @category Options
|
|
52906
|
-
* @property {number[]} [headingLevels=[1,2,3,4,5,6]] - Supported heading levels
|
|
52907
|
-
* @property {Object} [htmlAttributes] - HTML attributes for paragraph elements
|
|
52908
|
-
*/
|
|
52909
52997
|
headingLevels: [1, 2, 3, 4, 5, 6],
|
|
52910
52998
|
htmlAttributes: {}
|
|
52911
52999
|
};
|
|
@@ -53137,11 +53225,6 @@ const Heading = Extension.create({
|
|
|
53137
53225
|
name: "heading",
|
|
53138
53226
|
addOptions() {
|
|
53139
53227
|
return {
|
|
53140
|
-
/**
|
|
53141
|
-
* @typedef {Object} HeadingOptions
|
|
53142
|
-
* @category Options
|
|
53143
|
-
* @property {number[]} [levels=[1,2,3,4,5,6]] - Supported heading levels
|
|
53144
|
-
*/
|
|
53145
53228
|
levels: [1, 2, 3, 4, 5, 6]
|
|
53146
53229
|
};
|
|
53147
53230
|
},
|
|
@@ -53151,10 +53234,8 @@ const Heading = Extension.create({
|
|
|
53151
53234
|
* Set a heading with specified level
|
|
53152
53235
|
* @category Command
|
|
53153
53236
|
* @param {HeadingAttributes} attributes - Heading attributes including level
|
|
53154
|
-
* @returns {Function} Command function
|
|
53155
53237
|
* @example
|
|
53156
|
-
*
|
|
53157
|
-
* setHeading({ level: 2 })
|
|
53238
|
+
* editor.commands.setHeading({ level: 2 })
|
|
53158
53239
|
* @note Converts current block to heading
|
|
53159
53240
|
*/
|
|
53160
53241
|
setHeading: (attributes) => ({ commands: commands2 }) => {
|
|
@@ -53166,13 +53247,9 @@ const Heading = Extension.create({
|
|
|
53166
53247
|
* Toggle between heading and paragraph
|
|
53167
53248
|
* @category Command
|
|
53168
53249
|
* @param {HeadingAttributes} attributes - Heading attributes including level
|
|
53169
|
-
* @returns {Function} Command function
|
|
53170
53250
|
* @example
|
|
53171
|
-
*
|
|
53172
|
-
* toggleHeading({ level:
|
|
53173
|
-
*
|
|
53174
|
-
* // Toggle heading level 3
|
|
53175
|
-
* toggleHeading({ level: 3 })
|
|
53251
|
+
* editor.commands.toggleHeading({ level: 1 })
|
|
53252
|
+
* editor.commands.toggleHeading({ level: 3 })
|
|
53176
53253
|
* @note Switches between heading and paragraph for the same level
|
|
53177
53254
|
*/
|
|
53178
53255
|
toggleHeading: (attributes) => ({ commands: commands2 }) => {
|
|
@@ -53577,6 +53654,9 @@ const LineBreak = Node$1.create({
|
|
|
53577
53654
|
selectable: false,
|
|
53578
53655
|
content: "",
|
|
53579
53656
|
atom: true,
|
|
53657
|
+
addOptions() {
|
|
53658
|
+
return {};
|
|
53659
|
+
},
|
|
53580
53660
|
parseDOM() {
|
|
53581
53661
|
return [{ tag: "br" }];
|
|
53582
53662
|
},
|
|
@@ -53585,17 +53665,7 @@ const LineBreak = Node$1.create({
|
|
|
53585
53665
|
},
|
|
53586
53666
|
addAttributes() {
|
|
53587
53667
|
return {
|
|
53588
|
-
/**
|
|
53589
|
-
* @private
|
|
53590
|
-
* @category Attribute
|
|
53591
|
-
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
53592
|
-
*/
|
|
53593
53668
|
lineBreakType: { rendered: false },
|
|
53594
|
-
/**
|
|
53595
|
-
* @private
|
|
53596
|
-
* @category Attribute
|
|
53597
|
-
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
53598
|
-
*/
|
|
53599
53669
|
clear: { rendered: false }
|
|
53600
53670
|
};
|
|
53601
53671
|
},
|
|
@@ -53604,9 +53674,8 @@ const LineBreak = Node$1.create({
|
|
|
53604
53674
|
/**
|
|
53605
53675
|
* Insert a line break
|
|
53606
53676
|
* @category Command
|
|
53607
|
-
* @returns {Function} Command function
|
|
53608
53677
|
* @example
|
|
53609
|
-
* insertLineBreak()
|
|
53678
|
+
* editor.commands.insertLineBreak()
|
|
53610
53679
|
* @note Creates a soft break within the same paragraph
|
|
53611
53680
|
*/
|
|
53612
53681
|
insertLineBreak: () => ({ commands: commands2 }) => {
|
|
@@ -53623,11 +53692,6 @@ const HardBreak = Node$1.create({
|
|
|
53623
53692
|
atom: true,
|
|
53624
53693
|
addOptions() {
|
|
53625
53694
|
return {
|
|
53626
|
-
/**
|
|
53627
|
-
* @typedef {Object} HardBreakOptions
|
|
53628
|
-
* @category Options
|
|
53629
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the break element
|
|
53630
|
-
*/
|
|
53631
53695
|
htmlAttributes: {
|
|
53632
53696
|
contentEditable: "false",
|
|
53633
53697
|
lineBreakType: "page",
|
|
@@ -53638,35 +53702,15 @@ const HardBreak = Node$1.create({
|
|
|
53638
53702
|
},
|
|
53639
53703
|
addAttributes() {
|
|
53640
53704
|
return {
|
|
53641
|
-
/**
|
|
53642
|
-
* @private
|
|
53643
|
-
* @category Attribute
|
|
53644
|
-
* @param {string} [pageBreakSource] - Source of the page break
|
|
53645
|
-
*/
|
|
53646
53705
|
pageBreakSource: {
|
|
53647
53706
|
rendered: false,
|
|
53648
53707
|
default: null
|
|
53649
53708
|
},
|
|
53650
|
-
/**
|
|
53651
|
-
* @private
|
|
53652
|
-
* @category Attribute
|
|
53653
|
-
* @param {string} [pageBreakType] - Type of page break
|
|
53654
|
-
*/
|
|
53655
53709
|
pageBreakType: {
|
|
53656
53710
|
default: null,
|
|
53657
53711
|
rendered: false
|
|
53658
53712
|
},
|
|
53659
|
-
/**
|
|
53660
|
-
* @private
|
|
53661
|
-
* @category Attribute
|
|
53662
|
-
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
53663
|
-
*/
|
|
53664
53713
|
lineBreakType: { rendered: false },
|
|
53665
|
-
/**
|
|
53666
|
-
* @private
|
|
53667
|
-
* @category Attribute
|
|
53668
|
-
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
53669
|
-
*/
|
|
53670
53714
|
clear: { rendered: false }
|
|
53671
53715
|
};
|
|
53672
53716
|
},
|
|
@@ -53692,9 +53736,8 @@ const HardBreak = Node$1.create({
|
|
|
53692
53736
|
/**
|
|
53693
53737
|
* Insert a page break
|
|
53694
53738
|
* @category Command
|
|
53695
|
-
* @returns {Function} Command function
|
|
53696
53739
|
* @example
|
|
53697
|
-
* insertPageBreak()
|
|
53740
|
+
* editor.commands.insertPageBreak()
|
|
53698
53741
|
* @note Forces content to start on a new page when printed
|
|
53699
53742
|
*/
|
|
53700
53743
|
insertPageBreak: () => ({ commands: commands2 }) => {
|
|
@@ -56084,17 +56127,6 @@ const Table = Node$1.create({
|
|
|
56084
56127
|
group: "block",
|
|
56085
56128
|
isolating: true,
|
|
56086
56129
|
tableRole: "table",
|
|
56087
|
-
/**
|
|
56088
|
-
* Table extension options
|
|
56089
|
-
* @category Options
|
|
56090
|
-
* @typedef {Object} TableOptions
|
|
56091
|
-
* @property {Object} [htmlAttributes={'aria-label': 'Table node'}] - Default HTML attributes for all tables
|
|
56092
|
-
* @property {boolean} [resizable=true] - Enable column resizing functionality
|
|
56093
|
-
* @property {number} [handleWidth=5] - Width of resize handles in pixels
|
|
56094
|
-
* @property {number} [cellMinWidth=10] - Minimum cell width constraint in pixels
|
|
56095
|
-
* @property {boolean} [lastColumnResizable=true] - Allow resizing of the last column
|
|
56096
|
-
* @property {boolean} [allowTableNodeSelection=false] - Enable selecting the entire table node
|
|
56097
|
-
*/
|
|
56098
56130
|
addOptions() {
|
|
56099
56131
|
return {
|
|
56100
56132
|
htmlAttributes: {
|
|
@@ -56252,14 +56284,9 @@ const Table = Node$1.create({
|
|
|
56252
56284
|
* Insert a new table into the document
|
|
56253
56285
|
* @category Command
|
|
56254
56286
|
* @param {TableConfig} [config] - Table configuration options
|
|
56255
|
-
* @returns {Function} Command
|
|
56256
56287
|
* @example
|
|
56257
|
-
*
|
|
56258
|
-
* insertTable(
|
|
56259
|
-
*
|
|
56260
|
-
* // Using custom values
|
|
56261
|
-
* insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
56262
|
-
*
|
|
56288
|
+
* editor.commands.insertTable()
|
|
56289
|
+
* editor.commands.insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
56263
56290
|
*/
|
|
56264
56291
|
insertTable: ({ rows = 3, cols = 3, withHeaderRow = false } = {}) => ({ tr, dispatch, editor }) => {
|
|
56265
56292
|
const node = createTable(editor.schema, rows, cols, withHeaderRow);
|
|
@@ -56272,9 +56299,8 @@ const Table = Node$1.create({
|
|
|
56272
56299
|
/**
|
|
56273
56300
|
* Delete the entire table containing the cursor
|
|
56274
56301
|
* @category Command
|
|
56275
|
-
* @returns {Function} Command
|
|
56276
56302
|
* @example
|
|
56277
|
-
* deleteTable()
|
|
56303
|
+
* editor.commands.deleteTable()
|
|
56278
56304
|
*/
|
|
56279
56305
|
deleteTable: () => ({ state: state2, dispatch }) => {
|
|
56280
56306
|
return deleteTable(state2, dispatch);
|
|
@@ -56282,9 +56308,8 @@ const Table = Node$1.create({
|
|
|
56282
56308
|
/**
|
|
56283
56309
|
* Add a column before the current column
|
|
56284
56310
|
* @category Command
|
|
56285
|
-
* @returns {Function} Command
|
|
56286
56311
|
* @example
|
|
56287
|
-
* addColumnBefore()
|
|
56312
|
+
* editor.commands.addColumnBefore()
|
|
56288
56313
|
* @note Preserves cell attributes from current column
|
|
56289
56314
|
*/
|
|
56290
56315
|
addColumnBefore: () => ({ state: state2, dispatch, chain }) => {
|
|
@@ -56661,10 +56686,9 @@ const Table = Node$1.create({
|
|
|
56661
56686
|
* Set background color for selected cells
|
|
56662
56687
|
* @category Command
|
|
56663
56688
|
* @param {string} value - Color value (hex with or without #)
|
|
56664
|
-
* @returns {Function} Command
|
|
56665
56689
|
* @example
|
|
56666
|
-
* setCellBackground('#ff0000')
|
|
56667
|
-
* setCellBackground('ff0000')
|
|
56690
|
+
* editor.commands.setCellBackground('#ff0000')
|
|
56691
|
+
* editor.commands.setCellBackground('ff0000')
|
|
56668
56692
|
*/
|
|
56669
56693
|
setCellBackground: (value) => ({ editor, commands: commands2, dispatch }) => {
|
|
56670
56694
|
const { selection } = editor.state;
|
|
@@ -56790,24 +56814,12 @@ const TableHeader = Node$1.create({
|
|
|
56790
56814
|
},
|
|
56791
56815
|
addAttributes() {
|
|
56792
56816
|
return {
|
|
56793
|
-
/**
|
|
56794
|
-
* @category Attribute
|
|
56795
|
-
* @param {number} [colspan=1] - Number of columns this header spans
|
|
56796
|
-
*/
|
|
56797
56817
|
colspan: {
|
|
56798
56818
|
default: 1
|
|
56799
56819
|
},
|
|
56800
|
-
/**
|
|
56801
|
-
* @category Attribute
|
|
56802
|
-
* @param {number} [rowspan=1] - Number of rows this header spans
|
|
56803
|
-
*/
|
|
56804
56820
|
rowspan: {
|
|
56805
56821
|
default: 1
|
|
56806
56822
|
},
|
|
56807
|
-
/**
|
|
56808
|
-
* @category Attribute
|
|
56809
|
-
* @param {number[]} [colwidth] - Column widths array in pixels
|
|
56810
|
-
*/
|
|
56811
56823
|
colwidth: {
|
|
56812
56824
|
default: null,
|
|
56813
56825
|
parseDOM: (element) => {
|
|
@@ -56844,10 +56856,6 @@ const TableRow = Node$1.create({
|
|
|
56844
56856
|
},
|
|
56845
56857
|
addAttributes() {
|
|
56846
56858
|
return {
|
|
56847
|
-
/**
|
|
56848
|
-
* @category Attribute
|
|
56849
|
-
* @param {number} [rowHeight] - Fixed row height in pixels
|
|
56850
|
-
*/
|
|
56851
56859
|
rowHeight: {
|
|
56852
56860
|
renderDOM({ rowHeight }) {
|
|
56853
56861
|
if (!rowHeight) return {};
|
|
@@ -56855,11 +56863,6 @@ const TableRow = Node$1.create({
|
|
|
56855
56863
|
return { style: style2 };
|
|
56856
56864
|
}
|
|
56857
56865
|
},
|
|
56858
|
-
/**
|
|
56859
|
-
* Indicates that this row should not be split across pages when paginating/exporting.
|
|
56860
|
-
* @category Attribute
|
|
56861
|
-
* @param {boolean} [cantSplit]
|
|
56862
|
-
*/
|
|
56863
56866
|
cantSplit: {
|
|
56864
56867
|
default: false,
|
|
56865
56868
|
parseDOM() {
|
|
@@ -56871,44 +56874,30 @@ const TableRow = Node$1.create({
|
|
|
56871
56874
|
}
|
|
56872
56875
|
},
|
|
56873
56876
|
/**
|
|
56874
|
-
* @category Attribute
|
|
56875
|
-
* @param {TableRowProperties} [tableRowProperties] - Properties for the table row.
|
|
56876
56877
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 377-482
|
|
56877
56878
|
*/
|
|
56878
56879
|
tableRowProperties: { rendered: false },
|
|
56879
56880
|
/**
|
|
56880
|
-
* @category Attribute
|
|
56881
|
-
* @param {string} [rsidDel] - Unique identifier used to track the editing session when the row was deleted from the main document.
|
|
56882
56881
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
56883
56882
|
*/
|
|
56884
56883
|
rsidDel: { rendered: false },
|
|
56885
56884
|
/**
|
|
56886
|
-
* @category Attribute
|
|
56887
|
-
* @param {string} [rsidR] - Unique identifier used to track the editing session when the table row was added to the main document.
|
|
56888
56885
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
56889
56886
|
*/
|
|
56890
56887
|
rsidR: { rendered: false },
|
|
56891
56888
|
/**
|
|
56892
|
-
* @category Attribute
|
|
56893
|
-
* @param {string} [rsidRPr] - Unique identifier used to track the editing session when the glyph character representing the table row mark was last modified in the main document.
|
|
56894
56889
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
56895
56890
|
*/
|
|
56896
56891
|
rsidRPr: { rendered: false },
|
|
56897
56892
|
/**
|
|
56898
|
-
* @category Attribute
|
|
56899
|
-
* @param {string} [rsidTr] - Unique identifier used to track the editing session when the table row's properties were last modified in this document.
|
|
56900
56893
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
56901
56894
|
*/
|
|
56902
56895
|
rsidTr: { rendered: false },
|
|
56903
56896
|
/**
|
|
56904
|
-
* @category Attribute
|
|
56905
|
-
* @param {string} [paraId] - A randomly generated unique identifier for the table row.
|
|
56906
56897
|
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/a0e7d2e2-2246-44c6-96e8-1cf009823615}
|
|
56907
56898
|
*/
|
|
56908
56899
|
paraId: { rendered: false },
|
|
56909
56900
|
/**
|
|
56910
|
-
* @category Attribute
|
|
56911
|
-
* @param {string} [textId] - A randomly generated unique identifier for the text of the table row.
|
|
56912
56901
|
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/b7eeddec-7c50-47fb-88b6-1feec3ed832c}
|
|
56913
56902
|
*/
|
|
56914
56903
|
textId: { rendered: false }
|
|
@@ -56935,24 +56924,12 @@ const TableCell = Node$1.create({
|
|
|
56935
56924
|
},
|
|
56936
56925
|
addAttributes() {
|
|
56937
56926
|
return {
|
|
56938
|
-
/**
|
|
56939
|
-
* @category Attribute
|
|
56940
|
-
* @param {number} [colspan=1] - Number of columns this cell spans
|
|
56941
|
-
*/
|
|
56942
56927
|
colspan: {
|
|
56943
56928
|
default: 1
|
|
56944
56929
|
},
|
|
56945
|
-
/**
|
|
56946
|
-
* @category Attribute
|
|
56947
|
-
* @param {number} [rowspan=1] - Number of rows this cell spans
|
|
56948
|
-
*/
|
|
56949
56930
|
rowspan: {
|
|
56950
56931
|
default: 1
|
|
56951
56932
|
},
|
|
56952
|
-
/**
|
|
56953
|
-
* @category Attribute
|
|
56954
|
-
* @param {number[]} [colwidth=[100]] - Column widths array in pixels
|
|
56955
|
-
*/
|
|
56956
56933
|
colwidth: {
|
|
56957
56934
|
default: [100],
|
|
56958
56935
|
parseDOM: (elem) => {
|
|
@@ -56967,10 +56944,6 @@ const TableCell = Node$1.create({
|
|
|
56967
56944
|
};
|
|
56968
56945
|
}
|
|
56969
56946
|
},
|
|
56970
|
-
/**
|
|
56971
|
-
* @category Attribute
|
|
56972
|
-
* @param {CellBackground} [background] - Cell background color configuration
|
|
56973
|
-
*/
|
|
56974
56947
|
background: {
|
|
56975
56948
|
renderDOM({ background }) {
|
|
56976
56949
|
if (!background) return {};
|
|
@@ -56979,10 +56952,6 @@ const TableCell = Node$1.create({
|
|
|
56979
56952
|
return { style: style2 };
|
|
56980
56953
|
}
|
|
56981
56954
|
},
|
|
56982
|
-
/**
|
|
56983
|
-
* @category Attribute
|
|
56984
|
-
* @param {string} [verticalAlign] - Vertical content alignment (top, middle, bottom)
|
|
56985
|
-
*/
|
|
56986
56955
|
verticalAlign: {
|
|
56987
56956
|
renderDOM({ verticalAlign }) {
|
|
56988
56957
|
if (!verticalAlign) return {};
|
|
@@ -56990,10 +56959,6 @@ const TableCell = Node$1.create({
|
|
|
56990
56959
|
return { style: style2 };
|
|
56991
56960
|
}
|
|
56992
56961
|
},
|
|
56993
|
-
/**
|
|
56994
|
-
* @category Attribute
|
|
56995
|
-
* @param {CellMargins} [cellMargins] - Internal cell padding
|
|
56996
|
-
*/
|
|
56997
56962
|
cellMargins: {
|
|
56998
56963
|
renderDOM({ cellMargins }) {
|
|
56999
56964
|
if (!cellMargins) return {};
|
|
@@ -57006,10 +56971,6 @@ const TableCell = Node$1.create({
|
|
|
57006
56971
|
return { style: style2 };
|
|
57007
56972
|
}
|
|
57008
56973
|
},
|
|
57009
|
-
/**
|
|
57010
|
-
* @category Attribute
|
|
57011
|
-
* @param {CellBorders} [borders] - Cell border configuration
|
|
57012
|
-
*/
|
|
57013
56974
|
borders: {
|
|
57014
56975
|
default: () => createCellBorders(),
|
|
57015
56976
|
renderDOM({ borders }) {
|
|
@@ -57024,20 +56985,10 @@ const TableCell = Node$1.create({
|
|
|
57024
56985
|
return { style: style2 };
|
|
57025
56986
|
}
|
|
57026
56987
|
},
|
|
57027
|
-
/**
|
|
57028
|
-
* @private
|
|
57029
|
-
* @category Attribute
|
|
57030
|
-
* @param {string} [widthType='auto'] - Internal width type
|
|
57031
|
-
*/
|
|
57032
56988
|
widthType: {
|
|
57033
56989
|
default: "auto",
|
|
57034
56990
|
rendered: false
|
|
57035
56991
|
},
|
|
57036
|
-
/**
|
|
57037
|
-
* @private
|
|
57038
|
-
* @category Attribute
|
|
57039
|
-
* @param {string} [widthUnit='px'] - Internal width unit
|
|
57040
|
-
*/
|
|
57041
56992
|
widthUnit: {
|
|
57042
56993
|
default: "px",
|
|
57043
56994
|
rendered: false
|
|
@@ -58667,7 +58618,7 @@ const validateUrlAccessibility = async (url) => {
|
|
|
58667
58618
|
credentials: "omit"
|
|
58668
58619
|
});
|
|
58669
58620
|
return response.ok;
|
|
58670
|
-
} catch
|
|
58621
|
+
} catch {
|
|
58671
58622
|
return false;
|
|
58672
58623
|
}
|
|
58673
58624
|
};
|
|
@@ -59240,6 +59191,19 @@ const findPreviousDomNodeWithClass = (view, pos, className) => {
|
|
|
59240
59191
|
}
|
|
59241
59192
|
return null;
|
|
59242
59193
|
};
|
|
59194
|
+
const getRotationMargins = (w2, h2, angleDegrees) => {
|
|
59195
|
+
const rad = angleDegrees * (Math.PI / 180);
|
|
59196
|
+
const cos = Math.abs(Math.cos(rad));
|
|
59197
|
+
const sin = Math.abs(Math.sin(rad));
|
|
59198
|
+
const boundingWidth = w2 * cos + h2 * sin;
|
|
59199
|
+
const boundingHeight = w2 * sin + h2 * cos;
|
|
59200
|
+
const marginLeftRight = Math.round(Math.max(0, (boundingWidth - w2) / 2));
|
|
59201
|
+
const marginTopBottom = Math.round(Math.max(0, (boundingHeight - h2) / 2));
|
|
59202
|
+
return {
|
|
59203
|
+
horizontal: marginLeftRight,
|
|
59204
|
+
vertical: marginTopBottom
|
|
59205
|
+
};
|
|
59206
|
+
};
|
|
59243
59207
|
const Image = Node$1.create({
|
|
59244
59208
|
name: "image",
|
|
59245
59209
|
group: "inline",
|
|
@@ -59261,10 +59225,6 @@ const Image = Node$1.create({
|
|
|
59261
59225
|
},
|
|
59262
59226
|
addAttributes() {
|
|
59263
59227
|
return {
|
|
59264
|
-
/**
|
|
59265
|
-
* @category Attribute
|
|
59266
|
-
* @param {string} [src] - Image source URL or path
|
|
59267
|
-
*/
|
|
59268
59228
|
src: {
|
|
59269
59229
|
default: null,
|
|
59270
59230
|
renderDOM: ({ src }) => {
|
|
@@ -59273,95 +59233,75 @@ const Image = Node$1.create({
|
|
|
59273
59233
|
};
|
|
59274
59234
|
}
|
|
59275
59235
|
},
|
|
59276
|
-
/**
|
|
59277
|
-
* @category Attribute
|
|
59278
|
-
* @param {string} [alt='Uploaded picture'] - Alternative text for accessibility
|
|
59279
|
-
*/
|
|
59280
59236
|
alt: {
|
|
59281
59237
|
default: "Uploaded picture"
|
|
59282
59238
|
},
|
|
59283
|
-
/**
|
|
59284
|
-
* @category Attribute
|
|
59285
|
-
* @param {string} [id] - Image element ID
|
|
59286
|
-
* @private
|
|
59287
|
-
*/
|
|
59288
59239
|
id: { rendered: false },
|
|
59289
|
-
/**
|
|
59290
|
-
* @category Attribute
|
|
59291
|
-
* @param {string} [title] - Image title/tooltip text
|
|
59292
|
-
*/
|
|
59293
59240
|
title: {
|
|
59294
59241
|
default: null
|
|
59295
59242
|
},
|
|
59296
|
-
/**
|
|
59297
|
-
* @category Attribute
|
|
59298
|
-
* @param {string} [rId] - Relationship ID for Word export
|
|
59299
|
-
* @private
|
|
59300
|
-
*/
|
|
59301
59243
|
rId: {
|
|
59302
59244
|
default: null,
|
|
59303
59245
|
rendered: false
|
|
59304
59246
|
},
|
|
59305
|
-
/**
|
|
59306
|
-
* @category Attribute
|
|
59307
|
-
* @param {Object} [originalPadding] - Original padding values from Word import
|
|
59308
|
-
* @private
|
|
59309
|
-
*/
|
|
59310
59247
|
originalPadding: {
|
|
59311
59248
|
default: null,
|
|
59312
59249
|
rendered: false
|
|
59313
59250
|
},
|
|
59314
|
-
/**
|
|
59315
|
-
* @category Attribute
|
|
59316
|
-
* @param {Object} [originalAttributes] - Original attributes from Word import
|
|
59317
|
-
* @private
|
|
59318
|
-
*/
|
|
59319
59251
|
originalAttributes: { rendered: false },
|
|
59320
|
-
/**
|
|
59321
|
-
* @category Attribute
|
|
59322
|
-
* @param {boolean} [wrapTopAndBottom] - Wrap text above and below image
|
|
59323
|
-
* @private
|
|
59324
|
-
*/
|
|
59325
59252
|
wrapTopAndBottom: { rendered: false },
|
|
59326
|
-
/**
|
|
59327
|
-
* @category Attribute
|
|
59328
|
-
* @param {Object} [anchorData] - Anchor positioning data for Word
|
|
59329
|
-
* @private
|
|
59330
|
-
*/
|
|
59331
59253
|
anchorData: {
|
|
59332
59254
|
default: null,
|
|
59333
59255
|
rendered: false
|
|
59334
59256
|
},
|
|
59257
|
+
isAnchor: { rendered: false },
|
|
59335
59258
|
/**
|
|
59336
59259
|
* @category Attribute
|
|
59337
|
-
* @param {
|
|
59260
|
+
* @param {Object} [transformData] - Transform data for image (turn and flip)
|
|
59261
|
+
* @param {number} [transformData.rotation] - Turn angle in degrees
|
|
59262
|
+
* @param {boolean} [transformData.verticalFlip] - Whether to flip vertically
|
|
59263
|
+
* @param {boolean} [transformData.horizontalFlip] - Whether to flip horizontally
|
|
59264
|
+
* @param {Object} [transformData.sizeExtension] - Size extension for image due to transformation
|
|
59265
|
+
* @param {number} [transformData.sizeExtension.left] - Left size extension for image
|
|
59266
|
+
* @param {number} [transformData.sizeExtension.top] - Top size extension for image
|
|
59267
|
+
* @param {number} [transformData.sizeExtension.right] - Right size extension for image
|
|
59268
|
+
* @param {number} [transformData.sizeExtension.bottom] - Bottom size extension for image
|
|
59269
|
+
*
|
|
59338
59270
|
* @private
|
|
59339
59271
|
*/
|
|
59340
|
-
|
|
59272
|
+
transformData: {
|
|
59273
|
+
default: {},
|
|
59274
|
+
renderDOM: ({ transformData }) => {
|
|
59275
|
+
let style2 = "";
|
|
59276
|
+
if (transformData?.rotation) {
|
|
59277
|
+
style2 += `rotate(${Math.round(transformData.rotation)}deg) `;
|
|
59278
|
+
}
|
|
59279
|
+
if (transformData?.verticalFlip) {
|
|
59280
|
+
style2 += "scaleY(-1) ";
|
|
59281
|
+
}
|
|
59282
|
+
if (transformData?.horizontalFlip) {
|
|
59283
|
+
style2 += "scaleX(-1) ";
|
|
59284
|
+
}
|
|
59285
|
+
style2 = style2.trim();
|
|
59286
|
+
if (style2.length > 0) {
|
|
59287
|
+
return { style: `transform: ${style2};` };
|
|
59288
|
+
}
|
|
59289
|
+
return;
|
|
59290
|
+
}
|
|
59291
|
+
},
|
|
59341
59292
|
/**
|
|
59342
59293
|
* @category Attribute
|
|
59343
59294
|
* @param {boolean} [simplePos] - Simple positioning flag
|
|
59344
59295
|
* @private
|
|
59345
59296
|
*/
|
|
59346
59297
|
simplePos: { rendered: false },
|
|
59347
|
-
/**
|
|
59348
|
-
* @category Attribute
|
|
59349
|
-
* @param {string} [wrapText] - Text wrapping style
|
|
59350
|
-
* @private
|
|
59351
|
-
*/
|
|
59352
59298
|
wrapText: { rendered: false },
|
|
59353
59299
|
extension: { rendered: false },
|
|
59354
|
-
/**
|
|
59355
|
-
* @category Attribute
|
|
59356
|
-
* @param {Object} [size] - Image dimensions
|
|
59357
|
-
* @param {number} [size.width] - Width in pixels
|
|
59358
|
-
* @param {number} [size.height] - Height in pixels
|
|
59359
|
-
*/
|
|
59360
59300
|
size: {
|
|
59361
59301
|
default: {},
|
|
59362
59302
|
renderDOM: ({ size: size2, extension }) => {
|
|
59363
59303
|
let style2 = "";
|
|
59364
|
-
|
|
59304
|
+
let { width, height } = size2 ?? {};
|
|
59365
59305
|
if (width) style2 += `width: ${width}px;`;
|
|
59366
59306
|
if (height && ["emf", "wmf"].includes(extension))
|
|
59367
59307
|
style2 += `height: ${height}px; border: 1px solid black; position: absolute;`;
|
|
@@ -59369,51 +59309,58 @@ const Image = Node$1.create({
|
|
|
59369
59309
|
return { style: style2 };
|
|
59370
59310
|
}
|
|
59371
59311
|
},
|
|
59372
|
-
/**
|
|
59373
|
-
* @category Attribute
|
|
59374
|
-
* @param {Object} [padding] - Image padding/margins
|
|
59375
|
-
* @param {number} [padding.left] - Left padding in pixels
|
|
59376
|
-
* @param {number} [padding.top] - Top padding in pixels
|
|
59377
|
-
* @param {number} [padding.bottom] - Bottom padding in pixels
|
|
59378
|
-
* @param {number} [padding.right] - Right padding in pixels
|
|
59379
|
-
*/
|
|
59380
59312
|
padding: {
|
|
59381
59313
|
default: {},
|
|
59382
|
-
renderDOM: ({ padding, marginOffset }) => {
|
|
59383
|
-
|
|
59314
|
+
renderDOM: ({ size: size2 = {}, padding, marginOffset, transformData }) => {
|
|
59315
|
+
let { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
|
|
59316
|
+
const { rotation } = transformData ?? {};
|
|
59317
|
+
const { height, width } = size2 ?? {};
|
|
59318
|
+
if (rotation && height && width) {
|
|
59319
|
+
const { horizontal, vertical } = getRotationMargins(width, height, rotation);
|
|
59320
|
+
left2 += horizontal;
|
|
59321
|
+
right2 += horizontal;
|
|
59322
|
+
top2 += vertical;
|
|
59323
|
+
bottom2 += vertical;
|
|
59324
|
+
}
|
|
59384
59325
|
let style2 = "";
|
|
59385
|
-
if (left2 &&
|
|
59386
|
-
if (top2 &&
|
|
59326
|
+
if (left2 && marginOffset?.left == null) style2 += `margin-left: ${left2}px;`;
|
|
59327
|
+
if (top2 && marginOffset?.top == null) style2 += `margin-top: ${top2}px;`;
|
|
59387
59328
|
if (bottom2) style2 += `margin-bottom: ${bottom2}px;`;
|
|
59388
59329
|
if (right2) style2 += `margin-right: ${right2}px;`;
|
|
59389
59330
|
return { style: style2 };
|
|
59390
59331
|
}
|
|
59391
59332
|
},
|
|
59392
|
-
/**
|
|
59393
|
-
* @category Attribute
|
|
59394
|
-
* @param {Object} [marginOffset] - Margin offset for anchored images
|
|
59395
|
-
* @param {number} [marginOffset.left] - Left margin offset
|
|
59396
|
-
* @param {number} [marginOffset.top] - Top margin offset
|
|
59397
|
-
*/
|
|
59398
59333
|
marginOffset: {
|
|
59399
59334
|
default: {},
|
|
59400
|
-
renderDOM: ({ marginOffset, anchorData }) => {
|
|
59335
|
+
renderDOM: ({ marginOffset, anchorData, transformData, size: size2 }) => {
|
|
59336
|
+
const hasAnchorData = Boolean(anchorData);
|
|
59337
|
+
const hasMarginOffsets = marginOffset?.left != null || marginOffset?.top != null;
|
|
59338
|
+
if (!hasAnchorData && !hasMarginOffsets) return {};
|
|
59401
59339
|
const relativeFromPageV = anchorData?.vRelativeFrom === "page";
|
|
59402
59340
|
const maxMarginV = 500;
|
|
59403
|
-
const
|
|
59341
|
+
const baseLeft = marginOffset?.left ?? 0;
|
|
59342
|
+
const baseTop = marginOffset?.top ?? 0;
|
|
59343
|
+
let rotationLeft = 0;
|
|
59344
|
+
let rotationTop = 0;
|
|
59345
|
+
const { rotation } = transformData ?? {};
|
|
59346
|
+
const { height, width } = size2 ?? {};
|
|
59347
|
+
if (rotation && height && width) {
|
|
59348
|
+
const { horizontal, vertical } = getRotationMargins(width, height, rotation);
|
|
59349
|
+
rotationLeft = horizontal;
|
|
59350
|
+
rotationTop = vertical;
|
|
59351
|
+
}
|
|
59352
|
+
const left2 = baseLeft + rotationLeft;
|
|
59353
|
+
const top2 = baseTop + rotationTop;
|
|
59404
59354
|
let style2 = "";
|
|
59405
59355
|
if (left2) style2 += `margin-left: ${left2}px;`;
|
|
59406
59356
|
if (top2) {
|
|
59407
59357
|
if (relativeFromPageV && top2 >= maxMarginV) style2 += `margin-top: ${maxMarginV}px;`;
|
|
59408
59358
|
else style2 += `margin-top: ${top2}px;`;
|
|
59409
59359
|
}
|
|
59360
|
+
if (!style2) return {};
|
|
59410
59361
|
return { style: style2 };
|
|
59411
59362
|
}
|
|
59412
59363
|
},
|
|
59413
|
-
/**
|
|
59414
|
-
* @category Attribute
|
|
59415
|
-
* @param {string} [style] - Custom inline CSS styles
|
|
59416
|
-
*/
|
|
59417
59364
|
style: {
|
|
59418
59365
|
default: null,
|
|
59419
59366
|
rendered: true,
|
|
@@ -59439,18 +59386,10 @@ const Image = Node$1.create({
|
|
|
59439
59386
|
/**
|
|
59440
59387
|
* Insert an image at the current position
|
|
59441
59388
|
* @category Command
|
|
59442
|
-
* @param {
|
|
59443
|
-
* @param {string} options.src - Image source URL or data URI
|
|
59444
|
-
* @param {string} [options.alt] - Alternative text
|
|
59445
|
-
* @param {string} [options.title] - Image title
|
|
59446
|
-
* @param {Object} [options.size] - Image dimensions
|
|
59447
|
-
* @returns {Function} Command function
|
|
59389
|
+
* @param {ImageInsertOptions} options - Image insertion options
|
|
59448
59390
|
* @example
|
|
59449
|
-
*
|
|
59450
|
-
* setImage({
|
|
59451
|
-
*
|
|
59452
|
-
* // Insert a base64 encoded image
|
|
59453
|
-
* setImage({
|
|
59391
|
+
* editor.commands.setImage({ src: 'https://example.com/image.jpg' })
|
|
59392
|
+
* editor.commands.setImage({
|
|
59454
59393
|
* src: 'data:image/png;base64,...',
|
|
59455
59394
|
* alt: 'Company logo',
|
|
59456
59395
|
* size: { width: 200 }
|
|
@@ -59667,6 +59606,14 @@ const PageNumber = Node$1.create({
|
|
|
59667
59606
|
},
|
|
59668
59607
|
addCommands() {
|
|
59669
59608
|
return {
|
|
59609
|
+
/**
|
|
59610
|
+
* Insert an automatic page number
|
|
59611
|
+
* @category Command
|
|
59612
|
+
* @returns {Function} Command function
|
|
59613
|
+
* @example
|
|
59614
|
+
* editor.commands.addAutoPageNumber()
|
|
59615
|
+
* @note Only works in header/footer contexts
|
|
59616
|
+
*/
|
|
59670
59617
|
addAutoPageNumber: () => ({ tr, dispatch, state: state2, editor }) => {
|
|
59671
59618
|
const { options } = editor;
|
|
59672
59619
|
if (!options.isHeaderOrFooter) return false;
|
|
@@ -59729,6 +59676,14 @@ const TotalPageCount = Node$1.create({
|
|
|
59729
59676
|
},
|
|
59730
59677
|
addCommands() {
|
|
59731
59678
|
return {
|
|
59679
|
+
/**
|
|
59680
|
+
* Insert total page count
|
|
59681
|
+
* @category Command
|
|
59682
|
+
* @returns {Function} Command function
|
|
59683
|
+
* @example
|
|
59684
|
+
* editor.commands.addTotalPageCount()
|
|
59685
|
+
* @note Only works in header/footer contexts
|
|
59686
|
+
*/
|
|
59732
59687
|
addTotalPageCount: () => ({ tr, dispatch, state: state2, editor }) => {
|
|
59733
59688
|
const { options } = editor;
|
|
59734
59689
|
if (!options.isHeaderOrFooter) return false;
|
|
@@ -59995,11 +59950,6 @@ const ContentBlock = Node$1.create({
|
|
|
59995
59950
|
inline: true,
|
|
59996
59951
|
addOptions() {
|
|
59997
59952
|
return {
|
|
59998
|
-
/**
|
|
59999
|
-
* @typedef {Object} ContentBlockOptions
|
|
60000
|
-
* @category Options
|
|
60001
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the block element
|
|
60002
|
-
*/
|
|
60003
59953
|
htmlAttributes: {
|
|
60004
59954
|
contenteditable: false
|
|
60005
59955
|
}
|
|
@@ -60007,10 +59957,6 @@ const ContentBlock = Node$1.create({
|
|
|
60007
59957
|
},
|
|
60008
59958
|
addAttributes() {
|
|
60009
59959
|
return {
|
|
60010
|
-
/**
|
|
60011
|
-
* @category Attribute
|
|
60012
|
-
* @param {boolean} [horizontalRule=false] - Whether this block is a horizontal rule
|
|
60013
|
-
*/
|
|
60014
59960
|
horizontalRule: {
|
|
60015
59961
|
default: false,
|
|
60016
59962
|
renderDOM: ({ horizontalRule }) => {
|
|
@@ -60018,10 +59964,6 @@ const ContentBlock = Node$1.create({
|
|
|
60018
59964
|
return { "data-horizontal-rule": "true" };
|
|
60019
59965
|
}
|
|
60020
59966
|
},
|
|
60021
|
-
/**
|
|
60022
|
-
* @category Attribute
|
|
60023
|
-
* @param {ContentBlockSize} [size] - Size and position of the content block
|
|
60024
|
-
*/
|
|
60025
59967
|
size: {
|
|
60026
59968
|
default: null,
|
|
60027
59969
|
renderDOM: ({ size: size2 }) => {
|
|
@@ -60035,10 +59977,6 @@ const ContentBlock = Node$1.create({
|
|
|
60035
59977
|
return { style: style2 };
|
|
60036
59978
|
}
|
|
60037
59979
|
},
|
|
60038
|
-
/**
|
|
60039
|
-
* @category Attribute
|
|
60040
|
-
* @param {string} [background] - Background color for the block
|
|
60041
|
-
*/
|
|
60042
59980
|
background: {
|
|
60043
59981
|
default: null,
|
|
60044
59982
|
renderDOM: (attrs) => {
|
|
@@ -60048,19 +59986,9 @@ const ContentBlock = Node$1.create({
|
|
|
60048
59986
|
};
|
|
60049
59987
|
}
|
|
60050
59988
|
},
|
|
60051
|
-
/**
|
|
60052
|
-
* @private
|
|
60053
|
-
* @category Attribute
|
|
60054
|
-
* @param {Object} [drawingContent] - Internal drawing data
|
|
60055
|
-
*/
|
|
60056
59989
|
drawingContent: {
|
|
60057
59990
|
rendered: false
|
|
60058
59991
|
},
|
|
60059
|
-
/**
|
|
60060
|
-
* @private
|
|
60061
|
-
* @category Attribute
|
|
60062
|
-
* @param {Object} [attributes] - Additional internal attributes
|
|
60063
|
-
*/
|
|
60064
59992
|
attributes: {
|
|
60065
59993
|
rendered: false
|
|
60066
59994
|
}
|
|
@@ -60081,9 +60009,8 @@ const ContentBlock = Node$1.create({
|
|
|
60081
60009
|
/**
|
|
60082
60010
|
* Insert a horizontal rule
|
|
60083
60011
|
* @category Command
|
|
60084
|
-
* @returns {Function} Command function
|
|
60085
60012
|
* @example
|
|
60086
|
-
* insertHorizontalRule()
|
|
60013
|
+
* editor.commands.insertHorizontalRule()
|
|
60087
60014
|
* @note Creates a visual separator between content sections
|
|
60088
60015
|
*/
|
|
60089
60016
|
insertHorizontalRule: () => ({ commands: commands2 }) => {
|
|
@@ -60100,13 +60027,13 @@ const ContentBlock = Node$1.create({
|
|
|
60100
60027
|
* Insert a content block
|
|
60101
60028
|
* @category Command
|
|
60102
60029
|
* @param {ContentBlockConfig} config - Block configuration
|
|
60103
|
-
* @returns {Function} Command function
|
|
60104
60030
|
* @example
|
|
60105
60031
|
* // Insert a spacer block
|
|
60106
|
-
* insertContentBlock({ size: { height: 20 } })
|
|
60032
|
+
* editor.commands.insertContentBlock({ size: { height: 20 } })
|
|
60107
60033
|
*
|
|
60034
|
+
* @example
|
|
60108
60035
|
* // Insert a colored divider
|
|
60109
|
-
* insertContentBlock({
|
|
60036
|
+
* editor.commands.insertContentBlock({
|
|
60110
60037
|
* size: { width: '50%', height: 3 },
|
|
60111
60038
|
* background: '#3b82f6'
|
|
60112
60039
|
* })
|
|
@@ -60143,7 +60070,7 @@ class StructuredContentViewBase {
|
|
|
60143
60070
|
this.htmlAttributes = props.htmlAttributes;
|
|
60144
60071
|
this.mount(props);
|
|
60145
60072
|
}
|
|
60146
|
-
mount(
|
|
60073
|
+
mount() {
|
|
60147
60074
|
return;
|
|
60148
60075
|
}
|
|
60149
60076
|
get dom() {
|
|
@@ -60634,16 +60561,7 @@ const DocumentSection = Node$1.create({
|
|
|
60634
60561
|
},
|
|
60635
60562
|
addAttributes() {
|
|
60636
60563
|
return {
|
|
60637
|
-
/**
|
|
60638
|
-
* @category Attribute
|
|
60639
|
-
* @param {number} [id] - Unique section identifier
|
|
60640
|
-
*/
|
|
60641
60564
|
id: {},
|
|
60642
|
-
/**
|
|
60643
|
-
* @private
|
|
60644
|
-
* @category Attribute
|
|
60645
|
-
* @param {string} [sdBlockId] - Internal block tracking
|
|
60646
|
-
*/
|
|
60647
60565
|
sdBlockId: {
|
|
60648
60566
|
default: null,
|
|
60649
60567
|
keepOnSplit: false,
|
|
@@ -60652,25 +60570,9 @@ const DocumentSection = Node$1.create({
|
|
|
60652
60570
|
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
60653
60571
|
}
|
|
60654
60572
|
},
|
|
60655
|
-
/**
|
|
60656
|
-
* @category Attribute
|
|
60657
|
-
* @param {string} [title] - Section display label
|
|
60658
|
-
*/
|
|
60659
60573
|
title: {},
|
|
60660
|
-
/**
|
|
60661
|
-
* @category Attribute
|
|
60662
|
-
* @param {string} [description] - Section metadata
|
|
60663
|
-
*/
|
|
60664
60574
|
description: {},
|
|
60665
|
-
/**
|
|
60666
|
-
* @category Attribute
|
|
60667
|
-
* @param {string} [sectionType] - Business classification (e.g., 'legal', 'pricing')
|
|
60668
|
-
*/
|
|
60669
60575
|
sectionType: {},
|
|
60670
|
-
/**
|
|
60671
|
-
* @category Attribute
|
|
60672
|
-
* @param {boolean} [isLocked=false] - Lock state preventing edits
|
|
60673
|
-
*/
|
|
60674
60576
|
isLocked: { default: false }
|
|
60675
60577
|
};
|
|
60676
60578
|
},
|
|
@@ -60685,10 +60587,9 @@ const DocumentSection = Node$1.create({
|
|
|
60685
60587
|
* Create a lockable content section
|
|
60686
60588
|
* @category Command
|
|
60687
60589
|
* @param {SectionCreate} [options={}] - Section configuration
|
|
60688
|
-
* @returns {Function} Command - true if created, false if position invalid
|
|
60689
60590
|
* @example
|
|
60690
|
-
* createDocumentSection({
|
|
60691
|
-
* id:
|
|
60591
|
+
* editor.commands.createDocumentSection({
|
|
60592
|
+
* id: 1,
|
|
60692
60593
|
* title: 'Terms & Conditions',
|
|
60693
60594
|
* isLocked: true,
|
|
60694
60595
|
* html: '<p>Legal content...</p>'
|
|
@@ -60769,9 +60670,8 @@ const DocumentSection = Node$1.create({
|
|
|
60769
60670
|
/**
|
|
60770
60671
|
* Remove section wrapper at cursor, preserving its content
|
|
60771
60672
|
* @category Command
|
|
60772
|
-
* @returns {Function} Command - true if removed, false if no section at position
|
|
60773
60673
|
* @example
|
|
60774
|
-
* removeSectionAtSelection()
|
|
60674
|
+
* editor.commands.removeSectionAtSelection()
|
|
60775
60675
|
* @note Content stays in document, only section wrapper is removed
|
|
60776
60676
|
*/
|
|
60777
60677
|
removeSectionAtSelection: () => ({ tr, dispatch }) => {
|
|
@@ -60797,9 +60697,8 @@ const DocumentSection = Node$1.create({
|
|
|
60797
60697
|
* Delete section and all its content
|
|
60798
60698
|
* @category Command
|
|
60799
60699
|
* @param {number} id - Section to delete
|
|
60800
|
-
* @returns {Function} Command - true if deleted, false if ID doesn't exist
|
|
60801
60700
|
* @example
|
|
60802
|
-
* removeSectionById(123)
|
|
60701
|
+
* editor.commands.removeSectionById(123)
|
|
60803
60702
|
*/
|
|
60804
60703
|
removeSectionById: (id) => ({ tr, dispatch }) => {
|
|
60805
60704
|
const sections = SectionHelpers.getAllSections(this.editor);
|
|
@@ -60819,9 +60718,8 @@ const DocumentSection = Node$1.create({
|
|
|
60819
60718
|
* Lock section against edits
|
|
60820
60719
|
* @category Command
|
|
60821
60720
|
* @param {number} id - Section to lock
|
|
60822
|
-
* @returns {Function} Command - true if locked, false if ID doesn't exist
|
|
60823
60721
|
* @example
|
|
60824
|
-
* lockSectionById(123)
|
|
60722
|
+
* editor.commands.lockSectionById(123)
|
|
60825
60723
|
*/
|
|
60826
60724
|
lockSectionById: (id) => ({ tr, dispatch }) => {
|
|
60827
60725
|
const sections = SectionHelpers.getAllSections(this.editor);
|
|
@@ -60838,16 +60736,10 @@ const DocumentSection = Node$1.create({
|
|
|
60838
60736
|
* Modify section attributes or content
|
|
60839
60737
|
* @category Command
|
|
60840
60738
|
* @param {SectionUpdate} options - Changes to apply
|
|
60841
|
-
* @returns {Function} Command - true if updated, false if ID doesn't exist
|
|
60842
60739
|
* @example
|
|
60843
|
-
*
|
|
60844
|
-
* updateSectionById({ id: 123,
|
|
60845
|
-
*
|
|
60846
|
-
* // Replace content
|
|
60847
|
-
* updateSectionById({ id: 123, html: '<p>New content</p>' })
|
|
60848
|
-
*
|
|
60849
|
-
* // Both
|
|
60850
|
-
* updateSectionById({
|
|
60740
|
+
* editor.commands.updateSectionById({ id: 123, attrs: { isLocked: false } })
|
|
60741
|
+
* editor.commands.updateSectionById({ id: 123, html: '<p>New content</p>' })
|
|
60742
|
+
* editor.commands.updateSectionById({
|
|
60851
60743
|
* id: 123,
|
|
60852
60744
|
* html: '<p>Updated</p>',
|
|
60853
60745
|
* attrs: { title: 'New Title' }
|
|
@@ -60897,11 +60789,10 @@ const BlockNode = Extension.create({
|
|
|
60897
60789
|
* Replace a block node by its ID with new content
|
|
60898
60790
|
* @category Command
|
|
60899
60791
|
* @param {string} id - The sdBlockId of the node to replace
|
|
60900
|
-
* @param {
|
|
60901
|
-
* @returns {Function} Command function
|
|
60792
|
+
* @param {ProseMirrorNode} contentNode - The replacement ProseMirror node
|
|
60902
60793
|
* @example
|
|
60903
60794
|
* const newParagraph = editor.schema.nodes.paragraph.create({}, editor.schema.text('New content'))
|
|
60904
|
-
* replaceBlockNodeById('block-123', newParagraph)
|
|
60795
|
+
* editor.commands.replaceBlockNodeById('block-123', newParagraph)
|
|
60905
60796
|
* @note The replacement node should have the same type as the original
|
|
60906
60797
|
*/
|
|
60907
60798
|
replaceBlockNodeById: (id, contentNode) => ({ dispatch, tr }) => {
|
|
@@ -60924,9 +60815,8 @@ const BlockNode = Extension.create({
|
|
|
60924
60815
|
* Delete a block node by its ID
|
|
60925
60816
|
* @category Command
|
|
60926
60817
|
* @param {string} id - The sdBlockId of the node to delete
|
|
60927
|
-
* @returns {Function} Command function
|
|
60928
60818
|
* @example
|
|
60929
|
-
* deleteBlockNodeById('block-123')
|
|
60819
|
+
* editor.commands.deleteBlockNodeById('block-123')
|
|
60930
60820
|
* @note Completely removes the node from the document
|
|
60931
60821
|
*/
|
|
60932
60822
|
deleteBlockNodeById: (id) => ({ dispatch, tr }) => {
|
|
@@ -60950,11 +60840,10 @@ const BlockNode = Extension.create({
|
|
|
60950
60840
|
* @category Command
|
|
60951
60841
|
* @param {string} id - The sdBlockId of the node to update
|
|
60952
60842
|
* @param {Object} attrs - Attributes to update
|
|
60953
|
-
* @returns {Function} Command function
|
|
60954
60843
|
* @example
|
|
60955
|
-
* updateBlockNodeAttributes('block-123', { textAlign: 'center' })
|
|
60844
|
+
* editor.commands.updateBlockNodeAttributes('block-123', { textAlign: 'center' })
|
|
60956
60845
|
* @example
|
|
60957
|
-
* updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
|
|
60846
|
+
* editor.commands.updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
|
|
60958
60847
|
* @note Merges new attributes with existing ones
|
|
60959
60848
|
*/
|
|
60960
60849
|
updateBlockNodeAttributes: (id, attrs = {}) => ({ dispatch, tr }) => {
|
|
@@ -61048,7 +60937,7 @@ const BlockNode = Extension.create({
|
|
|
61048
60937
|
key: BlockNodePluginKey,
|
|
61049
60938
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
61050
60939
|
if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
|
|
61051
|
-
if (hasInitialized && !checkForNewBlockNodesInTrs(transactions)) return null;
|
|
60940
|
+
if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) return null;
|
|
61052
60941
|
const { tr } = newState;
|
|
61053
60942
|
let changed = false;
|
|
61054
60943
|
newState.doc.descendants((node, pos) => {
|
|
@@ -61127,9 +61016,8 @@ const TextStyle = Mark2.create({
|
|
|
61127
61016
|
/**
|
|
61128
61017
|
* Remove empty text style marks
|
|
61129
61018
|
* @category Command
|
|
61130
|
-
* @returns {Function} Command function - Removes mark if no attributes present
|
|
61131
61019
|
* @example
|
|
61132
|
-
* removeEmptyTextStyle()
|
|
61020
|
+
* editor.commands.removeEmptyTextStyle()
|
|
61133
61021
|
* @note Cleanup utility to prevent empty span elements
|
|
61134
61022
|
* @note Automatically checks if any style attributes exist before removal
|
|
61135
61023
|
*/
|
|
@@ -61151,10 +61039,6 @@ const Bold = Mark2.create({
|
|
|
61151
61039
|
},
|
|
61152
61040
|
addAttributes() {
|
|
61153
61041
|
return {
|
|
61154
|
-
/**
|
|
61155
|
-
* @category Attribute
|
|
61156
|
-
* @param {string} [value] - Bold weight value ('0' renders as normal)
|
|
61157
|
-
*/
|
|
61158
61042
|
value: {
|
|
61159
61043
|
default: null,
|
|
61160
61044
|
renderDOM: (attrs) => {
|
|
@@ -61183,26 +61067,23 @@ const Bold = Mark2.create({
|
|
|
61183
61067
|
/**
|
|
61184
61068
|
* Apply bold formatting
|
|
61185
61069
|
* @category Command
|
|
61186
|
-
* @returns {Function} Command
|
|
61187
61070
|
* @example
|
|
61188
|
-
* setBold()
|
|
61071
|
+
* editor.commands.setBold()
|
|
61189
61072
|
* @note '0' renders as normal weight
|
|
61190
61073
|
*/
|
|
61191
61074
|
setBold: () => ({ commands: commands2 }) => commands2.setMark(this.name),
|
|
61192
61075
|
/**
|
|
61193
61076
|
* Remove bold formatting
|
|
61194
61077
|
* @category Command
|
|
61195
|
-
* @returns {Function} Command
|
|
61196
61078
|
* @example
|
|
61197
|
-
* unsetBold()
|
|
61079
|
+
* editor.commands.unsetBold()
|
|
61198
61080
|
*/
|
|
61199
61081
|
unsetBold: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
61200
61082
|
/**
|
|
61201
61083
|
* Toggle bold formatting
|
|
61202
61084
|
* @category Command
|
|
61203
|
-
* @returns {Function} Command
|
|
61204
61085
|
* @example
|
|
61205
|
-
* toggleBold()
|
|
61086
|
+
* editor.commands.toggleBold()
|
|
61206
61087
|
*/
|
|
61207
61088
|
toggleBold: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
61208
61089
|
};
|
|
@@ -61237,25 +61118,22 @@ const Italic = Mark2.create({
|
|
|
61237
61118
|
/**
|
|
61238
61119
|
* Apply italic formatting
|
|
61239
61120
|
* @category Command
|
|
61240
|
-
* @returns {Function} Command
|
|
61241
61121
|
* @example
|
|
61242
|
-
* setItalic()
|
|
61122
|
+
* editor.commands.setItalic()
|
|
61243
61123
|
*/
|
|
61244
61124
|
setItalic: () => ({ commands: commands2 }) => commands2.setMark(this.name),
|
|
61245
61125
|
/**
|
|
61246
61126
|
* Remove italic formatting
|
|
61247
61127
|
* @category Command
|
|
61248
|
-
* @returns {Function} Command
|
|
61249
61128
|
* @example
|
|
61250
|
-
* unsetItalic()
|
|
61129
|
+
* editor.commands.unsetItalic()
|
|
61251
61130
|
*/
|
|
61252
61131
|
unsetItalic: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
61253
61132
|
/**
|
|
61254
61133
|
* Toggle italic formatting
|
|
61255
61134
|
* @category Command
|
|
61256
|
-
* @returns {Function} Command
|
|
61257
61135
|
* @example
|
|
61258
|
-
* toggleItalic()
|
|
61136
|
+
* editor.commands.toggleItalic()
|
|
61259
61137
|
*/
|
|
61260
61138
|
toggleItalic: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
61261
61139
|
};
|
|
@@ -61339,10 +61217,6 @@ const Highlight = Mark2.create({
|
|
|
61339
61217
|
},
|
|
61340
61218
|
addAttributes() {
|
|
61341
61219
|
return {
|
|
61342
|
-
/**
|
|
61343
|
-
* @category Attribute
|
|
61344
|
-
* @param {string} [color] - Background color (CSS color value)
|
|
61345
|
-
*/
|
|
61346
61220
|
color: {
|
|
61347
61221
|
default: null,
|
|
61348
61222
|
parseDOM: (element) => element.getAttribute("data-color") || element.style.backgroundColor,
|
|
@@ -61370,26 +61244,23 @@ const Highlight = Mark2.create({
|
|
|
61370
61244
|
* Apply highlight with specified color
|
|
61371
61245
|
* @category Command
|
|
61372
61246
|
* @param {string} color - CSS color value
|
|
61373
|
-
* @returns {Function} Command
|
|
61374
61247
|
* @example
|
|
61375
|
-
* setHighlight('#FFEB3B')
|
|
61376
|
-
* setHighlight('rgba(255, 235, 59, 0.5)')
|
|
61248
|
+
* editor.commands.setHighlight('#FFEB3B')
|
|
61249
|
+
* editor.commands.setHighlight('rgba(255, 235, 59, 0.5)')
|
|
61377
61250
|
*/
|
|
61378
61251
|
setHighlight: (color) => ({ commands: commands2 }) => commands2.setMark(this.name, { color }),
|
|
61379
61252
|
/**
|
|
61380
61253
|
* Remove highlight formatting
|
|
61381
61254
|
* @category Command
|
|
61382
|
-
* @returns {Function} Command
|
|
61383
61255
|
* @example
|
|
61384
|
-
* unsetHighlight()
|
|
61256
|
+
* editor.commands.unsetHighlight()
|
|
61385
61257
|
*/
|
|
61386
61258
|
unsetHighlight: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
61387
61259
|
/**
|
|
61388
61260
|
* Toggle highlight formatting
|
|
61389
61261
|
* @category Command
|
|
61390
|
-
* @returns {Function} Command
|
|
61391
61262
|
* @example
|
|
61392
|
-
* toggleHighlight()
|
|
61263
|
+
* editor.commands.toggleHighlight()
|
|
61393
61264
|
*/
|
|
61394
61265
|
toggleHighlight: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
61395
61266
|
};
|
|
@@ -61422,9 +61293,8 @@ const Strike = Mark2.create({
|
|
|
61422
61293
|
/**
|
|
61423
61294
|
* Apply strikethrough formatting
|
|
61424
61295
|
* @category Command
|
|
61425
|
-
* @returns {Function} Command
|
|
61426
61296
|
* @example
|
|
61427
|
-
* setStrike()
|
|
61297
|
+
* editor.commands.setStrike()
|
|
61428
61298
|
*/
|
|
61429
61299
|
setStrike: () => ({ commands: commands2 }) => {
|
|
61430
61300
|
return commands2.setMark(this.name);
|
|
@@ -61432,9 +61302,8 @@ const Strike = Mark2.create({
|
|
|
61432
61302
|
/**
|
|
61433
61303
|
* Remove strikethrough formatting
|
|
61434
61304
|
* @category Command
|
|
61435
|
-
* @returns {Function} Command
|
|
61436
61305
|
* @example
|
|
61437
|
-
* unsetStrike()
|
|
61306
|
+
* editor.commands.unsetStrike()
|
|
61438
61307
|
*/
|
|
61439
61308
|
unsetStrike: () => ({ commands: commands2 }) => {
|
|
61440
61309
|
return commands2.unsetMark(this.name);
|
|
@@ -61442,9 +61311,8 @@ const Strike = Mark2.create({
|
|
|
61442
61311
|
/**
|
|
61443
61312
|
* Toggle strikethrough formatting
|
|
61444
61313
|
* @category Command
|
|
61445
|
-
* @returns {Function} Command
|
|
61446
61314
|
* @example
|
|
61447
|
-
* toggleStrike()
|
|
61315
|
+
* editor.commands.toggleStrike()
|
|
61448
61316
|
*/
|
|
61449
61317
|
toggleStrike: () => ({ commands: commands2 }) => {
|
|
61450
61318
|
return commands2.toggleMark(this.name);
|
|
@@ -61464,11 +61332,6 @@ const Link = Mark2.create({
|
|
|
61464
61332
|
inclusive: false,
|
|
61465
61333
|
addOptions() {
|
|
61466
61334
|
return {
|
|
61467
|
-
/**
|
|
61468
|
-
* Allowed URL protocols
|
|
61469
|
-
* @type {string[]}
|
|
61470
|
-
* @default ['http', 'https']
|
|
61471
|
-
*/
|
|
61472
61335
|
protocols: ["http", "https"],
|
|
61473
61336
|
htmlAttributes: {
|
|
61474
61337
|
target: null,
|
|
@@ -61567,16 +61430,10 @@ const Link = Mark2.create({
|
|
|
61567
61430
|
/**
|
|
61568
61431
|
* Create or update a link
|
|
61569
61432
|
* @category Command
|
|
61570
|
-
* @param {
|
|
61571
|
-
* @param {string} [options.href] - URL for the link
|
|
61572
|
-
* @param {string} [options.text] - Display text (uses selection if omitted)
|
|
61573
|
-
* @returns {Function} Command - Creates link with underline
|
|
61433
|
+
* @param {SetLinkOptions} [options] - Link configuration
|
|
61574
61434
|
* @example
|
|
61575
|
-
*
|
|
61576
|
-
* setLink({
|
|
61577
|
-
*
|
|
61578
|
-
* // Link with custom text
|
|
61579
|
-
* setLink({
|
|
61435
|
+
* editor.commands.setLink({ href: 'https://example.com' })
|
|
61436
|
+
* editor.commands.setLink({
|
|
61580
61437
|
* href: 'https://example.com',
|
|
61581
61438
|
* text: 'Visit Example'
|
|
61582
61439
|
* })
|
|
@@ -61628,9 +61485,8 @@ const Link = Mark2.create({
|
|
|
61628
61485
|
/**
|
|
61629
61486
|
* Remove link and associated formatting
|
|
61630
61487
|
* @category Command
|
|
61631
|
-
* @returns {Function} Command - Removes link, underline, and color
|
|
61632
61488
|
* @example
|
|
61633
|
-
* unsetLink()
|
|
61489
|
+
* editor.commands.unsetLink()
|
|
61634
61490
|
* @note Also removes underline and text color
|
|
61635
61491
|
*/
|
|
61636
61492
|
unsetLink: () => ({ chain }) => {
|
|
@@ -61639,16 +61495,10 @@ const Link = Mark2.create({
|
|
|
61639
61495
|
/**
|
|
61640
61496
|
* Toggle link on selection
|
|
61641
61497
|
* @category Command
|
|
61642
|
-
* @param {
|
|
61643
|
-
* @param {string} [options.href] - URL for the link
|
|
61644
|
-
* @param {string} [options.text] - Display text
|
|
61645
|
-
* @returns {Function} Command - Creates link if href provided, removes otherwise
|
|
61498
|
+
* @param {SetLinkOptions} [options] - Link configuration
|
|
61646
61499
|
* @example
|
|
61647
|
-
*
|
|
61648
|
-
* toggleLink(
|
|
61649
|
-
*
|
|
61650
|
-
* // Remove link
|
|
61651
|
-
* toggleLink()
|
|
61500
|
+
* editor.commands.toggleLink({ href: 'https://example.com' })
|
|
61501
|
+
* editor.commands.toggleLink()
|
|
61652
61502
|
*/
|
|
61653
61503
|
toggleLink: ({ href, text } = {}) => ({ commands: commands2 }) => {
|
|
61654
61504
|
if (!href) return commands2.unsetLink();
|
|
@@ -64965,6 +64815,9 @@ const Mentions = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v
|
|
|
64965
64815
|
const popoverPluginKey = new PluginKey("popoverPlugin");
|
|
64966
64816
|
const PopoverPlugin = Extension.create({
|
|
64967
64817
|
name: "popoverPlugin",
|
|
64818
|
+
addOptions() {
|
|
64819
|
+
return {};
|
|
64820
|
+
},
|
|
64968
64821
|
addPmPlugins() {
|
|
64969
64822
|
const popover = new Plugin({
|
|
64970
64823
|
key: popoverPluginKey,
|
|
@@ -67192,12 +67045,11 @@ const Search = Extension.create({
|
|
|
67192
67045
|
addCommands() {
|
|
67193
67046
|
return {
|
|
67194
67047
|
/**
|
|
67195
|
-
*
|
|
67048
|
+
* Navigate to the first search match
|
|
67196
67049
|
* @category Command
|
|
67197
|
-
* @returns {Function} - Command function
|
|
67198
67050
|
* @example
|
|
67199
|
-
* goToFirstMatch()
|
|
67200
|
-
* @note Scrolls
|
|
67051
|
+
* editor.commands.goToFirstMatch()
|
|
67052
|
+
* @note Scrolls editor to the first match from previous search
|
|
67201
67053
|
*/
|
|
67202
67054
|
goToFirstMatch: () => (
|
|
67203
67055
|
/** @returns {boolean} */
|
|
@@ -67213,13 +67065,13 @@ const Search = Extension.create({
|
|
|
67213
67065
|
})
|
|
67214
67066
|
),
|
|
67215
67067
|
/**
|
|
67216
|
-
*
|
|
67068
|
+
* Search for string matches in editor content
|
|
67217
67069
|
* @category Command
|
|
67218
67070
|
* @param {String|RegExp} patternInput - Search string or pattern
|
|
67219
|
-
* @returns {Function} - Command function that returns matches
|
|
67220
67071
|
* @example
|
|
67221
|
-
* search('test string')
|
|
67222
|
-
*
|
|
67072
|
+
* const matches = editor.commands.search('test string')
|
|
67073
|
+
* const regexMatches = editor.commands.search(/test/i)
|
|
67074
|
+
* @note Returns array of SearchMatch objects with positions and IDs
|
|
67223
67075
|
*/
|
|
67224
67076
|
search: (patternInput) => (
|
|
67225
67077
|
/** @returns {SearchMatch[]} */
|
|
@@ -67262,14 +67114,13 @@ const Search = Extension.create({
|
|
|
67262
67114
|
})
|
|
67263
67115
|
),
|
|
67264
67116
|
/**
|
|
67265
|
-
*
|
|
67117
|
+
* Navigate to a specific search match
|
|
67266
67118
|
* @category Command
|
|
67267
|
-
* @param {SearchMatch} match Match
|
|
67268
|
-
* @returns {Function} - Command function
|
|
67119
|
+
* @param {SearchMatch} match - Match object to navigate to
|
|
67269
67120
|
* @example
|
|
67270
|
-
* const
|
|
67271
|
-
* goToSearchResult(
|
|
67272
|
-
* @note Scrolls
|
|
67121
|
+
* const searchResults = editor.commands.search('test string')
|
|
67122
|
+
* editor.commands.goToSearchResult(searchResults[3])
|
|
67123
|
+
* @note Scrolls to match and selects it
|
|
67273
67124
|
*/
|
|
67274
67125
|
goToSearchResult: (match) => (
|
|
67275
67126
|
/** @returns {boolean} */
|
|
@@ -67531,6 +67382,9 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
|
|
|
67531
67382
|
};
|
|
67532
67383
|
const NodeResizer = Extension.create({
|
|
67533
67384
|
name: "nodeResizer",
|
|
67385
|
+
addOptions() {
|
|
67386
|
+
return {};
|
|
67387
|
+
},
|
|
67534
67388
|
addPmPlugins() {
|
|
67535
67389
|
const isHeadless = this.editor.options.isHeadless;
|
|
67536
67390
|
const hasDocument = typeof document !== "undefined";
|