@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
|
@@ -14781,22 +14781,25 @@ async function readFromClipboard(state2) {
|
|
|
14781
14781
|
function inchesToTwips(inches) {
|
|
14782
14782
|
if (inches == null) return;
|
|
14783
14783
|
if (typeof inches === "string") inches = parseFloat(inches);
|
|
14784
|
-
return Math.round(inches * 1440);
|
|
14784
|
+
return Math.round(Number(inches) * 1440);
|
|
14785
14785
|
}
|
|
14786
14786
|
function twipsToInches(twips) {
|
|
14787
14787
|
if (twips == null) return;
|
|
14788
|
-
|
|
14789
|
-
|
|
14788
|
+
const value = Number(twips);
|
|
14789
|
+
if (Number.isNaN(value)) return;
|
|
14790
|
+
return value / 1440;
|
|
14790
14791
|
}
|
|
14791
14792
|
function twipsToPixels(twips) {
|
|
14792
14793
|
if (twips == null) return;
|
|
14793
|
-
|
|
14794
|
-
|
|
14794
|
+
const inches = twipsToInches(twips);
|
|
14795
|
+
if (inches == null) return;
|
|
14796
|
+
const pixels = inches * 96;
|
|
14797
|
+
return Math.round(pixels * 1e3) / 1e3;
|
|
14795
14798
|
}
|
|
14796
14799
|
function pixelsToTwips(pixels) {
|
|
14797
14800
|
if (pixels == null) return;
|
|
14798
|
-
|
|
14799
|
-
return inchesToTwips(
|
|
14801
|
+
const inches = Number(pixels) / 96;
|
|
14802
|
+
return inchesToTwips(inches);
|
|
14800
14803
|
}
|
|
14801
14804
|
function twipsToLines(twips) {
|
|
14802
14805
|
if (twips == null) return;
|
|
@@ -14839,6 +14842,14 @@ function ptToTwips(pt) {
|
|
|
14839
14842
|
if (pt == null) return;
|
|
14840
14843
|
return pt * 20;
|
|
14841
14844
|
}
|
|
14845
|
+
function rotToDegrees(rot) {
|
|
14846
|
+
if (rot == null) return;
|
|
14847
|
+
return rot / 6e4;
|
|
14848
|
+
}
|
|
14849
|
+
function degreesToRot(degrees) {
|
|
14850
|
+
if (degrees == null) return;
|
|
14851
|
+
return degrees * 6e4;
|
|
14852
|
+
}
|
|
14842
14853
|
const getTextIndentExportValue = (indent) => {
|
|
14843
14854
|
const [value, unit] = parseSizeUnit(indent);
|
|
14844
14855
|
const functionsMap = {
|
|
@@ -24684,13 +24695,15 @@ const getParagraphIndent = (node, docx, styleId = "") => {
|
|
|
24684
24695
|
}
|
|
24685
24696
|
return indent;
|
|
24686
24697
|
};
|
|
24687
|
-
const getParagraphSpacing = (node, docx, styleId = "", marks = []) => {
|
|
24698
|
+
const getParagraphSpacing = (node, docx, styleId = "", marks = [], options = {}) => {
|
|
24699
|
+
const { insideTable = false } = options;
|
|
24688
24700
|
const spacing = {};
|
|
24689
|
-
const { spacing: pDefaultSpacing = {} } = getDefaultParagraphStyle(docx, styleId);
|
|
24701
|
+
const { spacing: pDefaultSpacing = {}, spacingSource } = getDefaultParagraphStyle(docx, styleId);
|
|
24690
24702
|
let lineSpaceAfter, lineSpaceBefore, line, lineRuleStyle;
|
|
24691
24703
|
const pPr = node.elements?.find((el) => el.name === "w:pPr");
|
|
24692
24704
|
const inLineSpacingTag = pPr?.elements?.find((el) => el.name === "w:spacing");
|
|
24693
24705
|
const inLineSpacing = inLineSpacingTag?.attributes || {};
|
|
24706
|
+
const hasInlineSpacing = !!Object.keys(inLineSpacing).length;
|
|
24694
24707
|
const textStyleMark = marks.find((el) => el.type === "textStyle");
|
|
24695
24708
|
const fontSize2 = textStyleMark?.attrs?.fontSize;
|
|
24696
24709
|
const lineSpacing = inLineSpacing?.["w:line"] || line || pDefaultSpacing?.["w:line"];
|
|
@@ -24712,6 +24725,12 @@ const getParagraphSpacing = (node, docx, styleId = "", marks = []) => {
|
|
|
24712
24725
|
if (afterAutospacing === "1" && fontSize2) {
|
|
24713
24726
|
spacing.lineSpaceAfter += Math.round(parseInt(fontSize2) * 0.5 * 96 / 72);
|
|
24714
24727
|
}
|
|
24728
|
+
if (insideTable && !hasInlineSpacing && spacingSource === "docDefault") {
|
|
24729
|
+
const hasExplicitSpacing = Object.keys(inLineSpacing).length > 0;
|
|
24730
|
+
if (!hasExplicitSpacing) {
|
|
24731
|
+
return void 0;
|
|
24732
|
+
}
|
|
24733
|
+
}
|
|
24715
24734
|
return spacing;
|
|
24716
24735
|
};
|
|
24717
24736
|
const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
@@ -24752,9 +24771,20 @@ const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
|
24752
24771
|
const { attributes: pPrByIdIndentAttr } = pPrStyleIdIndentTag;
|
|
24753
24772
|
const spacingRest = isNormalAsDefault ? pPrNormalSpacingAttr || pPrDefaultSpacingAttr : pPrDefaultSpacingAttr || pPrNormalSpacingAttr;
|
|
24754
24773
|
const indentRest = isNormalAsDefault ? pPrNormalIndentAttr || pPrDefaultIndentAttr : pPrDefaultIndentAttr || pPrNormalIndentAttr;
|
|
24774
|
+
let spacingToUse = pPrByIdSpacingAttr || spacingRest;
|
|
24775
|
+
let spacingSource = "docDefault";
|
|
24776
|
+
if (pPrByIdSpacingAttr) {
|
|
24777
|
+
spacingSource = "style";
|
|
24778
|
+
} else if (spacingRest === pPrNormalSpacingAttr && pPrNormalSpacingAttr) {
|
|
24779
|
+
spacingSource = isNormalAsDefault ? "docDefault" : "normal";
|
|
24780
|
+
} else if (spacingRest === pPrDefaultSpacingAttr && pPrDefaultSpacingAttr) {
|
|
24781
|
+
spacingSource = "docDefault";
|
|
24782
|
+
}
|
|
24783
|
+
let indentToUse = pPrByIdIndentAttr || indentRest;
|
|
24755
24784
|
return {
|
|
24756
|
-
spacing:
|
|
24757
|
-
|
|
24785
|
+
spacing: spacingToUse,
|
|
24786
|
+
spacingSource,
|
|
24787
|
+
indent: indentToUse,
|
|
24758
24788
|
justify: pPrByIdJcAttr
|
|
24759
24789
|
};
|
|
24760
24790
|
};
|
|
@@ -24929,7 +24959,13 @@ const handleParagraphNode$1 = (params2) => {
|
|
|
24929
24959
|
}
|
|
24930
24960
|
if (docx) {
|
|
24931
24961
|
const defaultStyleId = node.attributes?.["w:rsidRDefault"];
|
|
24932
|
-
|
|
24962
|
+
const insideTable = (params2.path || []).some((ancestor) => ancestor.name === "w:tc");
|
|
24963
|
+
const spacing = getParagraphSpacing(node, docx, styleId, schemaNode.attrs.marksAttrs, {
|
|
24964
|
+
insideTable
|
|
24965
|
+
});
|
|
24966
|
+
if (spacing) {
|
|
24967
|
+
schemaNode.attrs["spacing"] = spacing;
|
|
24968
|
+
}
|
|
24933
24969
|
schemaNode.attrs["rsidRDefault"] = defaultStyleId;
|
|
24934
24970
|
}
|
|
24935
24971
|
if (docx) {
|
|
@@ -25175,10 +25211,10 @@ function createBorderPropertyHandler(xmlName, sdName = null) {
|
|
|
25175
25211
|
createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
|
|
25176
25212
|
createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
|
|
25177
25213
|
],
|
|
25178
|
-
encode: (
|
|
25214
|
+
encode: (params2, encodedAttrs) => {
|
|
25179
25215
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25180
25216
|
},
|
|
25181
|
-
decode: function({ node },
|
|
25217
|
+
decode: function({ node }, context) {
|
|
25182
25218
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
25183
25219
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25184
25220
|
}
|
|
@@ -25537,10 +25573,10 @@ const translator$B = NodeTranslator.from({
|
|
|
25537
25573
|
"w:themeTint",
|
|
25538
25574
|
"w:val"
|
|
25539
25575
|
].map((attr) => createAttributeHandler(attr)),
|
|
25540
|
-
encode: (
|
|
25576
|
+
encode: (params2, encodedAttrs) => {
|
|
25541
25577
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25542
25578
|
},
|
|
25543
|
-
decode: function({ node },
|
|
25579
|
+
decode: function({ node }, context) {
|
|
25544
25580
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.shading || {} } });
|
|
25545
25581
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25546
25582
|
}
|
|
@@ -25553,10 +25589,10 @@ const translator$w = NodeTranslator.from({
|
|
|
25553
25589
|
xmlName: "w:tblLook",
|
|
25554
25590
|
sdNodeOrKeyName: "tblLook",
|
|
25555
25591
|
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
25556
|
-
encode: (
|
|
25592
|
+
encode: (params2, encodedAttrs) => {
|
|
25557
25593
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25558
25594
|
},
|
|
25559
|
-
decode: function({ node },
|
|
25595
|
+
decode: function({ node }, context) {
|
|
25560
25596
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.tblLook || {} } });
|
|
25561
25597
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25562
25598
|
}
|
|
@@ -25574,10 +25610,10 @@ const translator$q = NodeTranslator.from({
|
|
|
25574
25610
|
xmlName: "w:tblpPr",
|
|
25575
25611
|
sdNodeOrKeyName: "floatingTableProperties",
|
|
25576
25612
|
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))),
|
|
25577
|
-
encode: (
|
|
25613
|
+
encode: (params2, encodedAttrs) => {
|
|
25578
25614
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25579
25615
|
},
|
|
25580
|
-
decode: function({ node },
|
|
25616
|
+
decode: function({ node }, context) {
|
|
25581
25617
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.floatingTableProperties || {} } });
|
|
25582
25618
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25583
25619
|
}
|
|
@@ -25598,13 +25634,13 @@ const translator$d = NodeTranslator.from(createBorderPropertyHandler("w:top"));
|
|
|
25598
25634
|
const translator$c = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
|
|
25599
25635
|
const XML_NODE_NAME$a = "w:tblBorders";
|
|
25600
25636
|
const SD_ATTR_KEY$3 = "borders";
|
|
25601
|
-
const encode$a = (params2
|
|
25637
|
+
const encode$a = (params2) => {
|
|
25602
25638
|
const { nodes } = params2;
|
|
25603
25639
|
const node = nodes[0];
|
|
25604
25640
|
const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
|
|
25605
25641
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
25606
25642
|
};
|
|
25607
|
-
const decode$a = (params2
|
|
25643
|
+
const decode$a = (params2) => {
|
|
25608
25644
|
const { borders = {} } = params2.node.attrs || {};
|
|
25609
25645
|
const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
|
|
25610
25646
|
const newNode = {
|
|
@@ -25641,13 +25677,13 @@ const translator$b = NodeTranslator.from({
|
|
|
25641
25677
|
});
|
|
25642
25678
|
const XML_NODE_NAME$9 = "w:tblCellMar";
|
|
25643
25679
|
const SD_ATTR_KEY$2 = "cellMargins";
|
|
25644
|
-
const encode$9 = (params2
|
|
25680
|
+
const encode$9 = (params2) => {
|
|
25645
25681
|
const { nodes } = params2;
|
|
25646
25682
|
const node = nodes[0];
|
|
25647
25683
|
const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
|
|
25648
25684
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
25649
25685
|
};
|
|
25650
|
-
const decode$9 = (params2
|
|
25686
|
+
const decode$9 = (params2) => {
|
|
25651
25687
|
const { cellMargins = {} } = params2.node.attrs || {};
|
|
25652
25688
|
const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
|
|
25653
25689
|
const newNode = {
|
|
@@ -25738,6 +25774,53 @@ const translator$9 = NodeTranslator.from(config$8);
|
|
|
25738
25774
|
const translator$8 = NodeTranslator.from(
|
|
25739
25775
|
createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
|
|
25740
25776
|
);
|
|
25777
|
+
const DEFAULT_COLUMN_WIDTH_PX = 100;
|
|
25778
|
+
const normalizeTwipWidth = (value) => {
|
|
25779
|
+
if (value == null) return null;
|
|
25780
|
+
const numericValue = typeof value === "string" ? parseInt(value, 10) : value;
|
|
25781
|
+
if (!Number.isFinite(numericValue) || Number.isNaN(numericValue) || numericValue <= 0) {
|
|
25782
|
+
return null;
|
|
25783
|
+
}
|
|
25784
|
+
return numericValue;
|
|
25785
|
+
};
|
|
25786
|
+
const getSchemaDefaultColumnWidthPx = (params2) => {
|
|
25787
|
+
const defaultValue = params2?.editor?.schema?.nodes?.tableCell?.spec?.attrs?.colwidth?.default;
|
|
25788
|
+
if (Array.isArray(defaultValue)) {
|
|
25789
|
+
const numericWidth = defaultValue.find((width) => typeof width === "number" && Number.isFinite(width) && width > 0);
|
|
25790
|
+
if (numericWidth != null) return numericWidth;
|
|
25791
|
+
} else if (typeof defaultValue === "number" && Number.isFinite(defaultValue) && defaultValue > 0) {
|
|
25792
|
+
return defaultValue;
|
|
25793
|
+
}
|
|
25794
|
+
return DEFAULT_COLUMN_WIDTH_PX;
|
|
25795
|
+
};
|
|
25796
|
+
const getTableWidthPx = (params2) => {
|
|
25797
|
+
const explicitWidth = params2?.node?.attrs?.tableWidth?.width;
|
|
25798
|
+
if (typeof explicitWidth === "number" && explicitWidth > 0) return explicitWidth;
|
|
25799
|
+
const tableWidth = params2?.node?.attrs?.tableProperties?.tableWidth;
|
|
25800
|
+
if (tableWidth?.value != null && typeof tableWidth.value === "number" && tableWidth.value > 0) {
|
|
25801
|
+
const { value, type: type2 } = tableWidth;
|
|
25802
|
+
if (!type2 || type2 === "auto" || type2 === "dxa") {
|
|
25803
|
+
return twipsToPixels(value);
|
|
25804
|
+
}
|
|
25805
|
+
}
|
|
25806
|
+
return null;
|
|
25807
|
+
};
|
|
25808
|
+
const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwips) => {
|
|
25809
|
+
const columnCount = Math.max(totalColumns, 1);
|
|
25810
|
+
const defaultColumnWidthPx = getSchemaDefaultColumnWidthPx(params2);
|
|
25811
|
+
const tableWidthPx = getTableWidthPx(params2);
|
|
25812
|
+
const safeDefaultPx = Number.isFinite(defaultColumnWidthPx) && defaultColumnWidthPx > 0 ? defaultColumnWidthPx : DEFAULT_COLUMN_WIDTH_PX;
|
|
25813
|
+
let fallbackWidthPx = safeDefaultPx;
|
|
25814
|
+
if (typeof tableWidthPx === "number" && tableWidthPx > 0) {
|
|
25815
|
+
fallbackWidthPx = tableWidthPx / columnCount;
|
|
25816
|
+
}
|
|
25817
|
+
const fallbackWidthTwips = pixelsToTwips(fallbackWidthPx);
|
|
25818
|
+
if (!Number.isFinite(fallbackWidthTwips) || Number.isNaN(fallbackWidthTwips) || fallbackWidthTwips <= 0) {
|
|
25819
|
+
const safeDefault = Math.max(pixelsToTwips(safeDefaultPx), cellMinWidthTwips);
|
|
25820
|
+
return safeDefault;
|
|
25821
|
+
}
|
|
25822
|
+
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
25823
|
+
};
|
|
25741
25824
|
const XML_NODE_NAME$7 = "w:tblGrid";
|
|
25742
25825
|
const SD_ATTR_KEY = "grid";
|
|
25743
25826
|
const cellMinWidth = pixelsToTwips(10);
|
|
@@ -25752,35 +25835,60 @@ const encode$7 = (params2) => {
|
|
|
25752
25835
|
};
|
|
25753
25836
|
};
|
|
25754
25837
|
const decode$7 = (params2) => {
|
|
25755
|
-
const { grid
|
|
25838
|
+
const { grid: rawGrid } = params2.node.attrs || {};
|
|
25839
|
+
const grid = Array.isArray(rawGrid) ? rawGrid : [];
|
|
25756
25840
|
const { firstRow = {} } = params2.extraParams || {};
|
|
25757
25841
|
const cellNodes = firstRow.content?.filter((n) => n.type === "tableCell") ?? [];
|
|
25758
|
-
const
|
|
25842
|
+
const columnCountFromCells = cellNodes.reduce((count, cell) => {
|
|
25843
|
+
const spanCount = Math.max(1, cell?.attrs?.colspan ?? 1);
|
|
25844
|
+
return count + spanCount;
|
|
25845
|
+
}, 0);
|
|
25846
|
+
const totalColumns = Math.max(columnCountFromCells, grid.length);
|
|
25847
|
+
const fallbackColumnWidthTwips = resolveFallbackColumnWidthTwips(params2, totalColumns, cellMinWidth);
|
|
25759
25848
|
const elements = [];
|
|
25760
|
-
|
|
25761
|
-
|
|
25849
|
+
let columnIndex = 0;
|
|
25850
|
+
const pushColumn = (widthTwips) => {
|
|
25851
|
+
let numericWidth = typeof widthTwips === "string" ? parseInt(widthTwips, 10) : widthTwips;
|
|
25852
|
+
if (numericWidth == null || Number.isNaN(numericWidth) || numericWidth <= 0) {
|
|
25853
|
+
numericWidth = fallbackColumnWidthTwips;
|
|
25854
|
+
}
|
|
25855
|
+
numericWidth = Math.max(numericWidth, cellMinWidth);
|
|
25856
|
+
const decoded = translator$8.decode({
|
|
25857
|
+
node: { type: (
|
|
25858
|
+
/** @type {string} */
|
|
25859
|
+
translator$8.sdNodeOrKeyName
|
|
25860
|
+
), attrs: { col: numericWidth } }
|
|
25861
|
+
});
|
|
25862
|
+
if (decoded) elements.push(decoded);
|
|
25863
|
+
};
|
|
25864
|
+
cellNodes.forEach((cell) => {
|
|
25762
25865
|
const { colspan = 1, colwidth } = cell?.attrs || {};
|
|
25763
|
-
|
|
25764
|
-
|
|
25765
|
-
const
|
|
25766
|
-
const
|
|
25767
|
-
const
|
|
25866
|
+
const spanCount = Math.max(1, colspan);
|
|
25867
|
+
for (let span = 0; span < spanCount; span++) {
|
|
25868
|
+
const cellWidthPixels = Array.isArray(colwidth) ? colwidth[span] : void 0;
|
|
25869
|
+
const colGridAttrs = grid?.[columnIndex] || {};
|
|
25870
|
+
const gridWidthTwips = normalizeTwipWidth(colGridAttrs.col);
|
|
25871
|
+
const gridWidthPixels = gridWidthTwips != null ? twipsToPixels(gridWidthTwips) : null;
|
|
25768
25872
|
let cellWidthTwips;
|
|
25769
|
-
if (
|
|
25873
|
+
if (cellWidthPixels != null) {
|
|
25874
|
+
if (gridWidthTwips != null && gridWidthPixels === cellWidthPixels) {
|
|
25875
|
+
cellWidthTwips = gridWidthTwips;
|
|
25876
|
+
} else {
|
|
25877
|
+
cellWidthTwips = pixelsToTwips(cellWidthPixels);
|
|
25878
|
+
}
|
|
25879
|
+
} else if (gridWidthTwips != null) {
|
|
25770
25880
|
cellWidthTwips = gridWidthTwips;
|
|
25771
|
-
} else
|
|
25772
|
-
cellWidthTwips =
|
|
25773
|
-
}
|
|
25774
|
-
|
|
25775
|
-
|
|
25776
|
-
translator$8.decode({
|
|
25777
|
-
node: { type: (
|
|
25778
|
-
/** @type {string} */
|
|
25779
|
-
translator$8.sdNodeOrKeyName
|
|
25780
|
-
), attrs: { col: widthTwips } }
|
|
25781
|
-
})
|
|
25782
|
-
);
|
|
25881
|
+
} else {
|
|
25882
|
+
cellWidthTwips = fallbackColumnWidthTwips;
|
|
25883
|
+
}
|
|
25884
|
+
pushColumn(cellWidthTwips);
|
|
25885
|
+
columnIndex++;
|
|
25783
25886
|
}
|
|
25887
|
+
});
|
|
25888
|
+
while (columnIndex < grid.length) {
|
|
25889
|
+
const gridWidthTwips = normalizeTwipWidth(grid[columnIndex]?.col);
|
|
25890
|
+
pushColumn(gridWidthTwips);
|
|
25891
|
+
columnIndex++;
|
|
25784
25892
|
}
|
|
25785
25893
|
const newNode = {
|
|
25786
25894
|
name: XML_NODE_NAME$7,
|
|
@@ -25803,7 +25911,8 @@ const encode$6 = (params2, encodedAttrs) => {
|
|
|
25803
25911
|
const node = nodes[0];
|
|
25804
25912
|
const tblPr = node.elements.find((el) => el.name === "w:tblPr");
|
|
25805
25913
|
if (tblPr) {
|
|
25806
|
-
|
|
25914
|
+
const encodedProperties = translator$9.encode({ ...params2, nodes: [tblPr] });
|
|
25915
|
+
encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
|
|
25807
25916
|
}
|
|
25808
25917
|
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
25809
25918
|
if (tblGrid) {
|
|
@@ -25825,7 +25934,7 @@ const encode$6 = (params2, encodedAttrs) => {
|
|
|
25825
25934
|
key2 = prop;
|
|
25826
25935
|
transform = (v2) => v2;
|
|
25827
25936
|
}
|
|
25828
|
-
if (encodedAttrs.tableProperties
|
|
25937
|
+
if (encodedAttrs.tableProperties && encodedAttrs.tableProperties[key2]) {
|
|
25829
25938
|
encodedAttrs[key2] = transform(encodedAttrs.tableProperties[key2]);
|
|
25830
25939
|
}
|
|
25831
25940
|
});
|
|
@@ -25834,11 +25943,17 @@ const encode$6 = (params2, encodedAttrs) => {
|
|
|
25834
25943
|
}
|
|
25835
25944
|
const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
|
|
25836
25945
|
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2);
|
|
25946
|
+
if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
|
|
25947
|
+
encodedAttrs.tableProperties = {
|
|
25948
|
+
...encodedAttrs.tableProperties || {},
|
|
25949
|
+
cellMargins: referencedStyles.cellMargins
|
|
25950
|
+
};
|
|
25951
|
+
}
|
|
25837
25952
|
const rows = node.elements.filter((el) => el.name === "w:tr");
|
|
25838
25953
|
const borderData = Object.assign({}, referencedStyles?.borders || {}, borders || {});
|
|
25839
25954
|
const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
|
|
25840
25955
|
encodedAttrs["borders"] = borderData;
|
|
25841
|
-
const tblStyleTag = tblPr
|
|
25956
|
+
const tblStyleTag = tblPr?.elements?.find((el) => el.name === "w:tblStyle");
|
|
25842
25957
|
const columnWidths = (encodedAttrs["grid"] ?? []).map((item) => twipsToPixels(item.col));
|
|
25843
25958
|
const content = [];
|
|
25844
25959
|
rows.forEach((row) => {
|
|
@@ -25847,6 +25962,7 @@ const encode$6 = (params2, encodedAttrs) => {
|
|
|
25847
25962
|
nodes: [row],
|
|
25848
25963
|
extraParams: {
|
|
25849
25964
|
row,
|
|
25965
|
+
table: node,
|
|
25850
25966
|
rowBorders: borderRowData,
|
|
25851
25967
|
styleTag: tblStyleTag,
|
|
25852
25968
|
columnWidths
|
|
@@ -25948,7 +26064,12 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
|
|
|
25948
26064
|
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
25949
26065
|
const cellMargins = {};
|
|
25950
26066
|
Object.entries(tableProperties.cellMargins || {}).forEach(([key2, attrs]) => {
|
|
25951
|
-
if (attrs?.value
|
|
26067
|
+
if (attrs?.value != null) {
|
|
26068
|
+
cellMargins[key2] = {
|
|
26069
|
+
value: attrs.value,
|
|
26070
|
+
type: attrs.type || "dxa"
|
|
26071
|
+
};
|
|
26072
|
+
}
|
|
25952
26073
|
});
|
|
25953
26074
|
if (Object.keys(cellMargins).length) stylesToReturn.cellMargins = cellMargins;
|
|
25954
26075
|
}
|
|
@@ -26201,11 +26322,17 @@ const getTableCellMargins = (marginTag, referencedStyles) => {
|
|
|
26201
26322
|
marginTop: marginTopStyle,
|
|
26202
26323
|
marginBottom: marginBottomStyle
|
|
26203
26324
|
} = cellMargins;
|
|
26325
|
+
const resolveMargin = (inlineValue, styleValue) => {
|
|
26326
|
+
if (inlineValue != null) return inlineValue;
|
|
26327
|
+
if (styleValue == null) return void 0;
|
|
26328
|
+
if (typeof styleValue === "object") return styleValue.value;
|
|
26329
|
+
return styleValue;
|
|
26330
|
+
};
|
|
26204
26331
|
const margins = {
|
|
26205
|
-
left: twipsToPixels(inlineMarginLeftValue
|
|
26206
|
-
right: twipsToPixels(inlineMarginRightValue
|
|
26207
|
-
top: twipsToPixels(inlineMarginTopValue
|
|
26208
|
-
bottom: twipsToPixels(inlineMarginBottomValue
|
|
26332
|
+
left: twipsToPixels(resolveMargin(inlineMarginLeftValue, marginLeftStyle)),
|
|
26333
|
+
right: twipsToPixels(resolveMargin(inlineMarginRightValue, marginRightStyle)),
|
|
26334
|
+
top: twipsToPixels(resolveMargin(inlineMarginTopValue, marginTopStyle)),
|
|
26335
|
+
bottom: twipsToPixels(resolveMargin(inlineMarginBottomValue, marginBottomStyle))
|
|
26209
26336
|
};
|
|
26210
26337
|
return margins;
|
|
26211
26338
|
};
|
|
@@ -26480,7 +26607,7 @@ function parseTagValueJSON(json) {
|
|
|
26480
26607
|
}
|
|
26481
26608
|
try {
|
|
26482
26609
|
return JSON.parse(trimmed);
|
|
26483
|
-
} catch
|
|
26610
|
+
} catch {
|
|
26484
26611
|
return {};
|
|
26485
26612
|
}
|
|
26486
26613
|
}
|
|
@@ -26736,6 +26863,32 @@ function handleImageNode(node, params2, isAnchor) {
|
|
|
26736
26863
|
if (!picture || !picture.elements) return null;
|
|
26737
26864
|
const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
|
|
26738
26865
|
const blip = blipFill.elements.find((el) => el.name === "a:blip");
|
|
26866
|
+
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
26867
|
+
let transformData = {};
|
|
26868
|
+
if (spPr) {
|
|
26869
|
+
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
26870
|
+
if (xfrm?.attributes) {
|
|
26871
|
+
transformData = {
|
|
26872
|
+
rotation: rotToDegrees(xfrm.attributes["rot"]),
|
|
26873
|
+
verticalFlip: xfrm.attributes["flipV"] === "1",
|
|
26874
|
+
horizontalFlip: xfrm.attributes["flipH"] === "1"
|
|
26875
|
+
};
|
|
26876
|
+
}
|
|
26877
|
+
}
|
|
26878
|
+
const effectExtent = node.elements.find((el) => el.name === "wp:effectExtent");
|
|
26879
|
+
if (effectExtent) {
|
|
26880
|
+
const sanitizeEmuValue = (value) => {
|
|
26881
|
+
if (value === null || value === void 0) return 0;
|
|
26882
|
+
const numeric = Number(value);
|
|
26883
|
+
return Number.isFinite(numeric) ? numeric : 0;
|
|
26884
|
+
};
|
|
26885
|
+
transformData.sizeExtension = {
|
|
26886
|
+
left: emuToPixels(sanitizeEmuValue(effectExtent.attributes["l"])),
|
|
26887
|
+
top: emuToPixels(sanitizeEmuValue(effectExtent.attributes["t"])),
|
|
26888
|
+
right: emuToPixels(sanitizeEmuValue(effectExtent.attributes["r"])),
|
|
26889
|
+
bottom: emuToPixels(sanitizeEmuValue(effectExtent.attributes["b"]))
|
|
26890
|
+
};
|
|
26891
|
+
}
|
|
26739
26892
|
const positionHTag = node.elements.find((el) => el.name === "wp:positionH");
|
|
26740
26893
|
const positionH = positionHTag?.elements.find((el) => el.name === "wp:posOffset");
|
|
26741
26894
|
const positionHValue = emuToPixels(positionH?.elements[0]?.text);
|
|
@@ -26792,6 +26945,7 @@ function handleImageNode(node, params2, isAnchor) {
|
|
|
26792
26945
|
size: size2,
|
|
26793
26946
|
anchorData,
|
|
26794
26947
|
isAnchor,
|
|
26948
|
+
transformData,
|
|
26795
26949
|
...simplePos && {
|
|
26796
26950
|
simplePos: {
|
|
26797
26951
|
x: simplePos.attributes.x,
|
|
@@ -26943,6 +27097,31 @@ const translateImageNode = (params2) => {
|
|
|
26943
27097
|
distL: 0,
|
|
26944
27098
|
distR: 0
|
|
26945
27099
|
};
|
|
27100
|
+
const xfrmAttrs = {};
|
|
27101
|
+
const effectExtentAttrs = {
|
|
27102
|
+
l: 0,
|
|
27103
|
+
t: 0,
|
|
27104
|
+
r: 0,
|
|
27105
|
+
b: 0
|
|
27106
|
+
};
|
|
27107
|
+
const transformData = attrs.transformData;
|
|
27108
|
+
if (transformData) {
|
|
27109
|
+
if (transformData.rotation) {
|
|
27110
|
+
xfrmAttrs.rot = degreesToRot(transformData.rotation);
|
|
27111
|
+
}
|
|
27112
|
+
if (transformData.verticalFlip) {
|
|
27113
|
+
xfrmAttrs.flipV = "1";
|
|
27114
|
+
}
|
|
27115
|
+
if (transformData.horizontalFlip) {
|
|
27116
|
+
xfrmAttrs.flipH = "1";
|
|
27117
|
+
}
|
|
27118
|
+
if (transformData.sizeExtension) {
|
|
27119
|
+
effectExtentAttrs.l = pixelsToEmu(transformData.sizeExtension.left);
|
|
27120
|
+
effectExtentAttrs.t = pixelsToEmu(transformData.sizeExtension.top);
|
|
27121
|
+
effectExtentAttrs.r = pixelsToEmu(transformData.sizeExtension.right);
|
|
27122
|
+
effectExtentAttrs.b = pixelsToEmu(transformData.sizeExtension.bottom);
|
|
27123
|
+
}
|
|
27124
|
+
}
|
|
26946
27125
|
const drawingXmlns = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
26947
27126
|
const pictureXmlns = "http://schemas.openxmlformats.org/drawingml/2006/picture";
|
|
26948
27127
|
return {
|
|
@@ -26957,12 +27136,7 @@ const translateImageNode = (params2) => {
|
|
|
26957
27136
|
},
|
|
26958
27137
|
{
|
|
26959
27138
|
name: "wp:effectExtent",
|
|
26960
|
-
attributes:
|
|
26961
|
-
l: 0,
|
|
26962
|
-
t: 0,
|
|
26963
|
-
r: 0,
|
|
26964
|
-
b: 0
|
|
26965
|
-
}
|
|
27139
|
+
attributes: effectExtentAttrs
|
|
26966
27140
|
},
|
|
26967
27141
|
{
|
|
26968
27142
|
name: "wp:docPr",
|
|
@@ -27042,6 +27216,7 @@ const translateImageNode = (params2) => {
|
|
|
27042
27216
|
elements: [
|
|
27043
27217
|
{
|
|
27044
27218
|
name: "a:xfrm",
|
|
27219
|
+
attributes: xfrmAttrs,
|
|
27045
27220
|
elements: [
|
|
27046
27221
|
{
|
|
27047
27222
|
name: "a:ext",
|
|
@@ -27219,14 +27394,14 @@ function translateAnchorNode(params2) {
|
|
|
27219
27394
|
const XML_NODE_NAME$3 = "wp:anchor";
|
|
27220
27395
|
const SD_NODE_NAME$3 = ["image"];
|
|
27221
27396
|
const validXmlAttributes$3 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
27222
|
-
function encode$3(params2
|
|
27397
|
+
function encode$3(params2) {
|
|
27223
27398
|
const { node } = params2.extraParams;
|
|
27224
27399
|
if (!node || !node.type) {
|
|
27225
27400
|
return null;
|
|
27226
27401
|
}
|
|
27227
27402
|
return handleAnchorNode(params2);
|
|
27228
27403
|
}
|
|
27229
|
-
function decode$3(params2
|
|
27404
|
+
function decode$3(params2) {
|
|
27230
27405
|
const { node } = params2;
|
|
27231
27406
|
if (!node || !node.type) {
|
|
27232
27407
|
return null;
|
|
@@ -27260,14 +27435,14 @@ function translateInlineNode(params2) {
|
|
|
27260
27435
|
const XML_NODE_NAME$2 = "wp:inline";
|
|
27261
27436
|
const SD_NODE_NAME$2 = ["image"];
|
|
27262
27437
|
const validXmlAttributes$2 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
27263
|
-
function encode$2(params2
|
|
27438
|
+
function encode$2(params2) {
|
|
27264
27439
|
const { node } = params2.extraParams;
|
|
27265
27440
|
if (!node || !node.type) {
|
|
27266
27441
|
return null;
|
|
27267
27442
|
}
|
|
27268
27443
|
return handleInlineNode(params2);
|
|
27269
27444
|
}
|
|
27270
|
-
function decode$2(params2
|
|
27445
|
+
function decode$2(params2) {
|
|
27271
27446
|
const { node } = params2;
|
|
27272
27447
|
if (!node || !node.type) {
|
|
27273
27448
|
return null;
|
|
@@ -27293,7 +27468,7 @@ const registeredHandlers = Object.freeze({
|
|
|
27293
27468
|
const XML_NODE_NAME$1 = "w:drawing";
|
|
27294
27469
|
const SD_NODE_NAME$1 = [];
|
|
27295
27470
|
const validXmlAttributes$1 = [];
|
|
27296
|
-
function encode$1(params2
|
|
27471
|
+
function encode$1(params2) {
|
|
27297
27472
|
const nodes = params2.nodes;
|
|
27298
27473
|
const node = nodes[0];
|
|
27299
27474
|
const validChildTranslators = ["wp:anchor", "wp:inline"];
|
|
@@ -27304,7 +27479,7 @@ function encode$1(params2, encodedAttrs) {
|
|
|
27304
27479
|
return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
|
|
27305
27480
|
}, null);
|
|
27306
27481
|
}
|
|
27307
|
-
function decode$1(params2
|
|
27482
|
+
function decode$1(params2) {
|
|
27308
27483
|
const { node } = params2;
|
|
27309
27484
|
if (!node || !node.type) {
|
|
27310
27485
|
return null;
|
|
@@ -28905,7 +29080,7 @@ function translateStructuredContent(params2) {
|
|
|
28905
29080
|
const XML_NODE_NAME = "w:sdt";
|
|
28906
29081
|
const SD_NODE_NAME = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
28907
29082
|
const validXmlAttributes = [];
|
|
28908
|
-
function encode$s(params2
|
|
29083
|
+
function encode$s(params2) {
|
|
28909
29084
|
const nodes = params2.nodes;
|
|
28910
29085
|
const node = nodes[0];
|
|
28911
29086
|
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
@@ -28915,7 +29090,7 @@ function encode$s(params2, encodedAttrs) {
|
|
|
28915
29090
|
const result = handler2(params2);
|
|
28916
29091
|
return result;
|
|
28917
29092
|
}
|
|
28918
|
-
function decode(params2
|
|
29093
|
+
function decode(params2) {
|
|
28919
29094
|
const { node } = params2;
|
|
28920
29095
|
if (!node || !node.type) {
|
|
28921
29096
|
return null;
|
|
@@ -31244,8 +31419,8 @@ function addDefaultStylesIfMissing(styles) {
|
|
|
31244
31419
|
}
|
|
31245
31420
|
const importHeadersFooters = (docx, converter, mainEditor) => {
|
|
31246
31421
|
const rels = docx["word/_rels/document.xml.rels"];
|
|
31247
|
-
const relationships = rels
|
|
31248
|
-
const { elements } = relationships;
|
|
31422
|
+
const relationships = rels?.elements.find((el) => el.name === "Relationships");
|
|
31423
|
+
const { elements } = relationships || { elements: [] };
|
|
31249
31424
|
const headerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
|
|
31250
31425
|
const footerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
|
|
31251
31426
|
const headers = elements.filter((el) => el.attributes["Type"] === headerType);
|
|
@@ -42203,12 +42378,6 @@ const History = Extension.create({
|
|
|
42203
42378
|
name: "history",
|
|
42204
42379
|
addOptions() {
|
|
42205
42380
|
return {
|
|
42206
|
-
/**
|
|
42207
|
-
* @typedef {Object} HistoryOptions
|
|
42208
|
-
* @category Options
|
|
42209
|
-
* @property {number} [depth=100] - Maximum undo/redo steps to remember
|
|
42210
|
-
* @property {number} [newGroupDelay=500] - Milliseconds to wait before starting a new history group
|
|
42211
|
-
*/
|
|
42212
42381
|
depth: 100,
|
|
42213
42382
|
newGroupDelay: 500
|
|
42214
42383
|
};
|
|
@@ -42227,9 +42396,8 @@ const History = Extension.create({
|
|
|
42227
42396
|
/**
|
|
42228
42397
|
* Undo the last action
|
|
42229
42398
|
* @category Command
|
|
42230
|
-
* @returns {Function} Command function
|
|
42231
42399
|
* @example
|
|
42232
|
-
* undo()
|
|
42400
|
+
* editor.commands.undo()
|
|
42233
42401
|
* @note Groups changes within the newGroupDelay window
|
|
42234
42402
|
*/
|
|
42235
42403
|
undo: () => ({ state: state2, dispatch, tr }) => {
|
|
@@ -42243,9 +42411,8 @@ const History = Extension.create({
|
|
|
42243
42411
|
/**
|
|
42244
42412
|
* Redo the last undone action
|
|
42245
42413
|
* @category Command
|
|
42246
|
-
* @returns {Function} Command function
|
|
42247
42414
|
* @example
|
|
42248
|
-
* redo()
|
|
42415
|
+
* editor.commands.redo()
|
|
42249
42416
|
* @note Only available after an undo action
|
|
42250
42417
|
*/
|
|
42251
42418
|
redo: () => ({ state: state2, dispatch, tr }) => {
|
|
@@ -49164,6 +49331,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
49164
49331
|
return result;
|
|
49165
49332
|
} catch (error) {
|
|
49166
49333
|
this.emit("exception", { error, editor: this });
|
|
49334
|
+
console.error(error);
|
|
49167
49335
|
}
|
|
49168
49336
|
}
|
|
49169
49337
|
/**
|
|
@@ -49187,6 +49355,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
49187
49355
|
this.converter.footerEditors.length = 0;
|
|
49188
49356
|
} catch (error) {
|
|
49189
49357
|
this.emit("exception", { error, editor: this });
|
|
49358
|
+
console.error(error);
|
|
49190
49359
|
}
|
|
49191
49360
|
}
|
|
49192
49361
|
/**
|
|
@@ -49775,6 +49944,7 @@ endCollaboration_fn = function() {
|
|
|
49775
49944
|
if (this.options.ydoc) this.options.ydoc.destroy();
|
|
49776
49945
|
} catch (error) {
|
|
49777
49946
|
this.emit("exception", { error, editor: this });
|
|
49947
|
+
console.error(error);
|
|
49778
49948
|
}
|
|
49779
49949
|
};
|
|
49780
49950
|
validateDocumentInit_fn = function() {
|
|
@@ -49801,11 +49971,6 @@ const Color = Extension.create({
|
|
|
49801
49971
|
name: "color",
|
|
49802
49972
|
addOptions() {
|
|
49803
49973
|
return {
|
|
49804
|
-
/**
|
|
49805
|
-
* @typedef {Object} ColorOptions
|
|
49806
|
-
* @category Options
|
|
49807
|
-
* @property {string[]} [types=['textStyle']] - Mark types to add color support to
|
|
49808
|
-
*/
|
|
49809
49974
|
types: ["textStyle"]
|
|
49810
49975
|
};
|
|
49811
49976
|
},
|
|
@@ -49814,10 +49979,6 @@ const Color = Extension.create({
|
|
|
49814
49979
|
{
|
|
49815
49980
|
types: this.options.types,
|
|
49816
49981
|
attributes: {
|
|
49817
|
-
/**
|
|
49818
|
-
* @category Attribute
|
|
49819
|
-
* @param {ColorValue} [color] - Text color value
|
|
49820
|
-
*/
|
|
49821
49982
|
color: {
|
|
49822
49983
|
default: null,
|
|
49823
49984
|
parseDOM: (el) => el.style.color?.replace(/['"]+/g, ""),
|
|
@@ -49836,16 +49997,17 @@ const Color = Extension.create({
|
|
|
49836
49997
|
* Set text color
|
|
49837
49998
|
* @category Command
|
|
49838
49999
|
* @param {ColorValue} color - Color value to apply
|
|
49839
|
-
* @returns {Function} Command function
|
|
49840
50000
|
* @example
|
|
49841
50001
|
* // Set to red using hex
|
|
49842
|
-
* setColor('#ff0000')
|
|
50002
|
+
* editor.commands.setColor('#ff0000')
|
|
49843
50003
|
*
|
|
50004
|
+
* @example
|
|
49844
50005
|
* // Set using rgb
|
|
49845
|
-
* setColor('rgb(255, 0, 0)')
|
|
50006
|
+
* editor.commands.setColor('rgb(255, 0, 0)')
|
|
49846
50007
|
*
|
|
50008
|
+
* @example
|
|
49847
50009
|
* // Set using named color
|
|
49848
|
-
* setColor('blue')
|
|
50010
|
+
* editor.commands.setColor('blue')
|
|
49849
50011
|
* @note Preserves other text styling attributes
|
|
49850
50012
|
*/
|
|
49851
50013
|
setColor: (color) => ({ chain }) => {
|
|
@@ -49854,9 +50016,8 @@ const Color = Extension.create({
|
|
|
49854
50016
|
/**
|
|
49855
50017
|
* Remove text color
|
|
49856
50018
|
* @category Command
|
|
49857
|
-
* @returns {Function} Command function
|
|
49858
50019
|
* @example
|
|
49859
|
-
* unsetColor()
|
|
50020
|
+
* editor.commands.unsetColor()
|
|
49860
50021
|
* @note Removes color while preserving other text styles
|
|
49861
50022
|
*/
|
|
49862
50023
|
unsetColor: () => ({ chain }) => {
|
|
@@ -49869,11 +50030,6 @@ const FontFamily = Extension.create({
|
|
|
49869
50030
|
name: "fontFamily",
|
|
49870
50031
|
addOptions() {
|
|
49871
50032
|
return {
|
|
49872
|
-
/**
|
|
49873
|
-
* @typedef {Object} FontFamilyOptions
|
|
49874
|
-
* @category Options
|
|
49875
|
-
* @property {string[]} [types=['textStyle']] - Mark types to add font family support to
|
|
49876
|
-
*/
|
|
49877
50033
|
types: ["textStyle"]
|
|
49878
50034
|
};
|
|
49879
50035
|
},
|
|
@@ -49882,10 +50038,6 @@ const FontFamily = Extension.create({
|
|
|
49882
50038
|
{
|
|
49883
50039
|
types: this.options.types,
|
|
49884
50040
|
attributes: {
|
|
49885
|
-
/**
|
|
49886
|
-
* @category Attribute
|
|
49887
|
-
* @param {FontFamilyValue} [fontFamily] - Font family for text
|
|
49888
|
-
*/
|
|
49889
50041
|
fontFamily: {
|
|
49890
50042
|
default: null,
|
|
49891
50043
|
parseDOM: (el) => el.style.fontFamily?.replace(/['"]+/g, ""),
|
|
@@ -49904,13 +50056,13 @@ const FontFamily = Extension.create({
|
|
|
49904
50056
|
* Set font family
|
|
49905
50057
|
* @category Command
|
|
49906
50058
|
* @param {FontFamilyValue} fontFamily - Font family to apply
|
|
49907
|
-
* @returns {Function} Command function
|
|
49908
50059
|
* @example
|
|
49909
50060
|
* // Set to Arial
|
|
49910
|
-
* setFontFamily('Arial')
|
|
50061
|
+
* editor.commands.setFontFamily('Arial')
|
|
49911
50062
|
*
|
|
50063
|
+
* @example
|
|
49912
50064
|
* // Set to serif font
|
|
49913
|
-
* setFontFamily('Georgia, serif')
|
|
50065
|
+
* editor.commands.setFontFamily('Georgia, serif')
|
|
49914
50066
|
* @note Preserves other text styling attributes
|
|
49915
50067
|
*/
|
|
49916
50068
|
setFontFamily: (fontFamily2) => ({ chain }) => {
|
|
@@ -49919,9 +50071,8 @@ const FontFamily = Extension.create({
|
|
|
49919
50071
|
/**
|
|
49920
50072
|
* Remove font family
|
|
49921
50073
|
* @category Command
|
|
49922
|
-
* @returns {Function} Command function
|
|
49923
50074
|
* @example
|
|
49924
|
-
* unsetFontFamily()
|
|
50075
|
+
* editor.commands.unsetFontFamily()
|
|
49925
50076
|
* @note Reverts to default document font
|
|
49926
50077
|
*/
|
|
49927
50078
|
unsetFontFamily: () => ({ chain }) => {
|
|
@@ -49934,12 +50085,6 @@ const FontSize = Extension.create({
|
|
|
49934
50085
|
name: "fontSize",
|
|
49935
50086
|
addOptions() {
|
|
49936
50087
|
return {
|
|
49937
|
-
/**
|
|
49938
|
-
* @typedef {Object} FontSizeOptions
|
|
49939
|
-
* @category Options
|
|
49940
|
-
* @property {string[]} [types=['textStyle', 'tableCell']] - Node/mark types to add font size support to
|
|
49941
|
-
* @property {FontSizeDefaults} [defaults] - Default size configuration
|
|
49942
|
-
*/
|
|
49943
50088
|
types: ["textStyle", "tableCell"],
|
|
49944
50089
|
defaults: {
|
|
49945
50090
|
value: 12,
|
|
@@ -49954,10 +50099,6 @@ const FontSize = Extension.create({
|
|
|
49954
50099
|
{
|
|
49955
50100
|
types: this.options.types,
|
|
49956
50101
|
attributes: {
|
|
49957
|
-
/**
|
|
49958
|
-
* @category Attribute
|
|
49959
|
-
* @param {FontSizeValue} [fontSize] - Font size with unit
|
|
49960
|
-
*/
|
|
49961
50102
|
fontSize: {
|
|
49962
50103
|
default: null,
|
|
49963
50104
|
parseDOM: (el) => el.style.fontSize,
|
|
@@ -49979,16 +50120,10 @@ const FontSize = Extension.create({
|
|
|
49979
50120
|
* Set font size
|
|
49980
50121
|
* @category Command
|
|
49981
50122
|
* @param {FontSizeValue} fontSize - Size to apply (with optional unit)
|
|
49982
|
-
* @returns {Function} Command function
|
|
49983
50123
|
* @example
|
|
49984
|
-
*
|
|
49985
|
-
* setFontSize('
|
|
49986
|
-
*
|
|
49987
|
-
* // Set to 18px
|
|
49988
|
-
* setFontSize('18px')
|
|
49989
|
-
*
|
|
49990
|
-
* // Set without unit (uses default)
|
|
49991
|
-
* setFontSize(16)
|
|
50124
|
+
* editor.commands.setFontSize('14pt')
|
|
50125
|
+
* editor.commands.setFontSize('18px')
|
|
50126
|
+
* editor.commands.setFontSize(16)
|
|
49992
50127
|
* @note Automatically clamps to min/max values
|
|
49993
50128
|
*/
|
|
49994
50129
|
setFontSize: (fontSize2) => ({ chain }) => {
|
|
@@ -50010,9 +50145,8 @@ const FontSize = Extension.create({
|
|
|
50010
50145
|
/**
|
|
50011
50146
|
* Remove font size
|
|
50012
50147
|
* @category Command
|
|
50013
|
-
* @returns {Function} Command function
|
|
50014
50148
|
* @example
|
|
50015
|
-
* unsetFontSize()
|
|
50149
|
+
* editor.commands.unsetFontSize()
|
|
50016
50150
|
* @note Reverts to default document size
|
|
50017
50151
|
*/
|
|
50018
50152
|
unsetFontSize: () => ({ chain }) => {
|
|
@@ -50062,13 +50196,9 @@ const TextAlign = Extension.create({
|
|
|
50062
50196
|
* Set text alignment
|
|
50063
50197
|
* @category Command
|
|
50064
50198
|
* @param {string} alignment - Alignment value (left, center, right, justify)
|
|
50065
|
-
* @returns {Function} Command function
|
|
50066
50199
|
* @example
|
|
50067
|
-
*
|
|
50068
|
-
* setTextAlign('
|
|
50069
|
-
*
|
|
50070
|
-
* // Set to justify
|
|
50071
|
-
* setTextAlign('justify')
|
|
50200
|
+
* editor.commands.setTextAlign('center')
|
|
50201
|
+
* editor.commands.setTextAlign('justify')
|
|
50072
50202
|
* @note Applies to all configured node types (heading, paragraph by default)
|
|
50073
50203
|
*/
|
|
50074
50204
|
setTextAlign: (alignment2) => ({ commands: commands2 }) => {
|
|
@@ -50079,9 +50209,8 @@ const TextAlign = Extension.create({
|
|
|
50079
50209
|
/**
|
|
50080
50210
|
* Remove text alignment (reset to default)
|
|
50081
50211
|
* @category Command
|
|
50082
|
-
* @returns {Function} Command function
|
|
50083
50212
|
* @example
|
|
50084
|
-
* unsetTextAlign()
|
|
50213
|
+
* editor.commands.unsetTextAlign()
|
|
50085
50214
|
* @note Resets alignment to the default value
|
|
50086
50215
|
*/
|
|
50087
50216
|
unsetTextAlign: () => ({ commands: commands2 }) => {
|
|
@@ -50222,13 +50351,6 @@ const LineHeight = Extension.create({
|
|
|
50222
50351
|
name: "lineHeight",
|
|
50223
50352
|
addOptions() {
|
|
50224
50353
|
return {
|
|
50225
|
-
/**
|
|
50226
|
-
* @typedef {Object} LineHeightOptions
|
|
50227
|
-
* @category Options
|
|
50228
|
-
* @property {string[]} [types=['heading', 'paragraph']] - Block types to add line height support to
|
|
50229
|
-
* @property {Object} [defaults] - Default configuration
|
|
50230
|
-
* @property {string} [defaults.unit=''] - Default unit for line height values
|
|
50231
|
-
*/
|
|
50232
50354
|
types: ["heading", "paragraph"],
|
|
50233
50355
|
defaults: {
|
|
50234
50356
|
unit: ""
|
|
@@ -50240,10 +50362,6 @@ const LineHeight = Extension.create({
|
|
|
50240
50362
|
{
|
|
50241
50363
|
types: this.options.types,
|
|
50242
50364
|
attributes: {
|
|
50243
|
-
/**
|
|
50244
|
-
* @category Attribute
|
|
50245
|
-
* @param {LineHeightValue} [lineHeight] - Line height value
|
|
50246
|
-
*/
|
|
50247
50365
|
lineHeight: {
|
|
50248
50366
|
default: null,
|
|
50249
50367
|
parseDOM: (el) => el.style.lineHeight,
|
|
@@ -50269,16 +50387,10 @@ const LineHeight = Extension.create({
|
|
|
50269
50387
|
* Set line height for blocks
|
|
50270
50388
|
* @category Command
|
|
50271
50389
|
* @param {LineHeightValue} lineHeight - Line height to apply
|
|
50272
|
-
* @returns {Function} Command function
|
|
50273
50390
|
* @example
|
|
50274
|
-
*
|
|
50275
|
-
* setLineHeight(
|
|
50276
|
-
*
|
|
50277
|
-
* // Set to 24px spacing
|
|
50278
|
-
* setLineHeight('24px')
|
|
50279
|
-
*
|
|
50280
|
-
* // Set to double spacing
|
|
50281
|
-
* setLineHeight(2)
|
|
50391
|
+
* editor.commands.setLineHeight(1.5)
|
|
50392
|
+
* editor.commands.setLineHeight('24px')
|
|
50393
|
+
* editor.commands.setLineHeight(2)
|
|
50282
50394
|
* @note Applies to paragraphs and headings
|
|
50283
50395
|
*/
|
|
50284
50396
|
setLineHeight: (lineHeight2) => ({ commands: commands2 }) => {
|
|
@@ -50288,9 +50400,8 @@ const LineHeight = Extension.create({
|
|
|
50288
50400
|
/**
|
|
50289
50401
|
* Remove line height
|
|
50290
50402
|
* @category Command
|
|
50291
|
-
* @returns {Function} Command function
|
|
50292
50403
|
* @example
|
|
50293
|
-
* unsetLineHeight()
|
|
50404
|
+
* editor.commands.unsetLineHeight()
|
|
50294
50405
|
* @note Reverts to default line spacing
|
|
50295
50406
|
*/
|
|
50296
50407
|
unsetLineHeight: () => ({ commands: commands2 }) => {
|
|
@@ -50318,9 +50429,8 @@ const FormatCommands = Extension.create({
|
|
|
50318
50429
|
/**
|
|
50319
50430
|
* Clear all formatting (nodes and marks)
|
|
50320
50431
|
* @category Command
|
|
50321
|
-
* @returns {Function} Command function
|
|
50322
50432
|
* @example
|
|
50323
|
-
* clearFormat()
|
|
50433
|
+
* editor.commands.clearFormat()
|
|
50324
50434
|
* @note Removes all marks and resets nodes to default paragraph
|
|
50325
50435
|
*/
|
|
50326
50436
|
clearFormat: () => ({ chain }) => {
|
|
@@ -50329,9 +50439,8 @@ const FormatCommands = Extension.create({
|
|
|
50329
50439
|
/**
|
|
50330
50440
|
* Clear only mark formatting
|
|
50331
50441
|
* @category Command
|
|
50332
|
-
* @returns {Function} Command function
|
|
50333
50442
|
* @example
|
|
50334
|
-
* clearMarksFormat()
|
|
50443
|
+
* editor.commands.clearMarksFormat()
|
|
50335
50444
|
* @note Removes bold, italic, underline, colors, etc. but preserves block structure
|
|
50336
50445
|
*/
|
|
50337
50446
|
clearMarksFormat: () => ({ chain }) => {
|
|
@@ -50340,9 +50449,8 @@ const FormatCommands = Extension.create({
|
|
|
50340
50449
|
/**
|
|
50341
50450
|
* Clear only node formatting
|
|
50342
50451
|
* @category Command
|
|
50343
|
-
* @returns {Function} Command function
|
|
50344
50452
|
* @example
|
|
50345
|
-
* clearNodesFormat()
|
|
50453
|
+
* editor.commands.clearNodesFormat()
|
|
50346
50454
|
* @note Converts headings, lists, etc. to paragraphs but preserves text marks
|
|
50347
50455
|
*/
|
|
50348
50456
|
clearNodesFormat: () => ({ chain }) => {
|
|
@@ -50351,13 +50459,8 @@ const FormatCommands = Extension.create({
|
|
|
50351
50459
|
/**
|
|
50352
50460
|
* Copy format from selection or apply copied format
|
|
50353
50461
|
* @category Command
|
|
50354
|
-
* @returns {Function} Command function
|
|
50355
50462
|
* @example
|
|
50356
|
-
*
|
|
50357
|
-
* copyFormat()
|
|
50358
|
-
*
|
|
50359
|
-
* // Second call: apply copied format to new selection
|
|
50360
|
-
* copyFormat()
|
|
50463
|
+
* editor.commands.copyFormat()
|
|
50361
50464
|
* @note Works like format painter - first click copies, second click applies
|
|
50362
50465
|
*/
|
|
50363
50466
|
copyFormat: () => ({ chain }) => {
|
|
@@ -50770,6 +50873,9 @@ function drawGapCursor(state2) {
|
|
|
50770
50873
|
}
|
|
50771
50874
|
const Gapcursor = Extension.create({
|
|
50772
50875
|
name: "gapCursor",
|
|
50876
|
+
addOptions() {
|
|
50877
|
+
return {};
|
|
50878
|
+
},
|
|
50773
50879
|
addPmPlugins() {
|
|
50774
50880
|
return [gapCursor()];
|
|
50775
50881
|
},
|
|
@@ -51110,6 +51216,9 @@ function getCursorPositionRelativeToContainer(view, eventLocation) {
|
|
|
51110
51216
|
const SlashMenuPluginKey = new PluginKey("slashMenu");
|
|
51111
51217
|
const SlashMenu = Extension.create({
|
|
51112
51218
|
name: "slashMenu",
|
|
51219
|
+
addOptions() {
|
|
51220
|
+
return {};
|
|
51221
|
+
},
|
|
51113
51222
|
addPmPlugins() {
|
|
51114
51223
|
if (this.editor.options?.disableContextMenu) {
|
|
51115
51224
|
return [];
|
|
@@ -51247,11 +51356,6 @@ const Document = Node$1.create({
|
|
|
51247
51356
|
},
|
|
51248
51357
|
addAttributes() {
|
|
51249
51358
|
return {
|
|
51250
|
-
/**
|
|
51251
|
-
* @private
|
|
51252
|
-
* @category Attribute
|
|
51253
|
-
* @param {Object} [attributes] - Internal document attributes
|
|
51254
|
-
*/
|
|
51255
51359
|
attributes: {
|
|
51256
51360
|
rendered: false,
|
|
51257
51361
|
"aria-label": "Document node"
|
|
@@ -51263,10 +51367,10 @@ const Document = Node$1.create({
|
|
|
51263
51367
|
/**
|
|
51264
51368
|
* Get document statistics
|
|
51265
51369
|
* @category Command
|
|
51266
|
-
* @returns {Function} Command function
|
|
51267
51370
|
* @example
|
|
51268
51371
|
* // Get word and character count
|
|
51269
|
-
* getDocumentStats()
|
|
51372
|
+
* const stats = editor.commands.getDocumentStats()
|
|
51373
|
+
* console.log(`${stats.words} words, ${stats.characters} characters`)
|
|
51270
51374
|
* @note Returns word count, character count, and paragraph count
|
|
51271
51375
|
*/
|
|
51272
51376
|
getDocumentStats: () => ({ editor }) => {
|
|
@@ -51283,9 +51387,8 @@ const Document = Node$1.create({
|
|
|
51283
51387
|
/**
|
|
51284
51388
|
* Clear entire document
|
|
51285
51389
|
* @category Command
|
|
51286
|
-
* @returns {Function} Command function
|
|
51287
51390
|
* @example
|
|
51288
|
-
* clearDocument()
|
|
51391
|
+
* editor.commands.clearDocument()
|
|
51289
51392
|
* @note Replaces all content with an empty paragraph
|
|
51290
51393
|
*/
|
|
51291
51394
|
clearDocument: () => ({ commands: commands2 }) => {
|
|
@@ -51297,13 +51400,19 @@ const Document = Node$1.create({
|
|
|
51297
51400
|
const Text = Node$1.create({
|
|
51298
51401
|
name: "text",
|
|
51299
51402
|
group: "inline",
|
|
51300
|
-
inline: true
|
|
51403
|
+
inline: true,
|
|
51404
|
+
addOptions() {
|
|
51405
|
+
return {};
|
|
51406
|
+
}
|
|
51301
51407
|
});
|
|
51302
51408
|
const RunItem = Node$1.create({
|
|
51303
51409
|
name: "run",
|
|
51304
51410
|
group: "inline",
|
|
51305
51411
|
content: "text*",
|
|
51306
51412
|
inline: true,
|
|
51413
|
+
addOptions() {
|
|
51414
|
+
return {};
|
|
51415
|
+
},
|
|
51307
51416
|
parseDOM() {
|
|
51308
51417
|
return [{ tag: "run" }];
|
|
51309
51418
|
},
|
|
@@ -51329,14 +51438,6 @@ const BulletList = Node$1.create({
|
|
|
51329
51438
|
},
|
|
51330
51439
|
addOptions() {
|
|
51331
51440
|
return {
|
|
51332
|
-
/**
|
|
51333
|
-
* @typedef {Object} BulletListOptions
|
|
51334
|
-
* @category Options
|
|
51335
|
-
* @property {string} [itemTypeName='listItem'] - Name of the list item node type
|
|
51336
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the ul element
|
|
51337
|
-
* @property {boolean} [keepMarks=true] - Whether to preserve marks when splitting
|
|
51338
|
-
* @property {boolean} [keepAttributes=false] - Whether to preserve attributes when splitting
|
|
51339
|
-
*/
|
|
51340
51441
|
itemTypeName: "listItem",
|
|
51341
51442
|
htmlAttributes: {
|
|
51342
51443
|
"aria-label": "Bullet list node"
|
|
@@ -51354,27 +51455,13 @@ const BulletList = Node$1.create({
|
|
|
51354
51455
|
},
|
|
51355
51456
|
addAttributes() {
|
|
51356
51457
|
return {
|
|
51357
|
-
/**
|
|
51358
|
-
* @category Attribute
|
|
51359
|
-
* @param {string} [list-style-type='bullet'] - List style type for this list
|
|
51360
|
-
*/
|
|
51361
51458
|
"list-style-type": {
|
|
51362
51459
|
default: "bullet",
|
|
51363
51460
|
rendered: false
|
|
51364
51461
|
},
|
|
51365
|
-
/**
|
|
51366
|
-
* @private
|
|
51367
|
-
* @category Attribute
|
|
51368
|
-
* @param {string} [listId] - Internal list identifier for numbering
|
|
51369
|
-
*/
|
|
51370
51462
|
listId: {
|
|
51371
51463
|
rendered: false
|
|
51372
51464
|
},
|
|
51373
|
-
/**
|
|
51374
|
-
* @private
|
|
51375
|
-
* @category Attribute
|
|
51376
|
-
* @param {string} [sdBlockId] - Internal block tracking ID
|
|
51377
|
-
*/
|
|
51378
51465
|
sdBlockId: {
|
|
51379
51466
|
default: null,
|
|
51380
51467
|
keepOnSplit: false,
|
|
@@ -51383,11 +51470,6 @@ const BulletList = Node$1.create({
|
|
|
51383
51470
|
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
51384
51471
|
}
|
|
51385
51472
|
},
|
|
51386
|
-
/**
|
|
51387
|
-
* @private
|
|
51388
|
-
* @category Attribute
|
|
51389
|
-
* @param {Object} [attributes] - Additional attributes for the list
|
|
51390
|
-
*/
|
|
51391
51473
|
attributes: {
|
|
51392
51474
|
rendered: false,
|
|
51393
51475
|
keepOnSplit: true
|
|
@@ -51399,10 +51481,9 @@ const BulletList = Node$1.create({
|
|
|
51399
51481
|
/**
|
|
51400
51482
|
* Toggle a bullet list at the current selection
|
|
51401
51483
|
* @category Command
|
|
51402
|
-
* @returns {Function} Command function
|
|
51403
51484
|
* @example
|
|
51404
51485
|
* // Toggle bullet list on selected text
|
|
51405
|
-
* toggleBulletList()
|
|
51486
|
+
* editor.commands.toggleBulletList()
|
|
51406
51487
|
* @note Converts selected paragraphs to list items or removes list formatting
|
|
51407
51488
|
*/
|
|
51408
51489
|
toggleBulletList: () => (params2) => {
|
|
@@ -51521,9 +51602,25 @@ const OrderedList = Node$1.create({
|
|
|
51521
51602
|
},
|
|
51522
51603
|
addCommands() {
|
|
51523
51604
|
return {
|
|
51605
|
+
/**
|
|
51606
|
+
* Toggle ordered list formatting
|
|
51607
|
+
* @category Command
|
|
51608
|
+
* @example
|
|
51609
|
+
* editor.commands.toggleOrderedList()
|
|
51610
|
+
* @note Converts selection to ordered list or back to paragraphs
|
|
51611
|
+
*/
|
|
51524
51612
|
toggleOrderedList: () => (params2) => {
|
|
51525
51613
|
return toggleList(this.type)(params2);
|
|
51526
51614
|
},
|
|
51615
|
+
/**
|
|
51616
|
+
* Restart list node numbering
|
|
51617
|
+
* @category Command
|
|
51618
|
+
* @param {Array} followingNodes - Nodes to restart
|
|
51619
|
+
* @param {number} pos - Starting position
|
|
51620
|
+
* @example
|
|
51621
|
+
* editor.commands.restartListNodes(nodes, position)
|
|
51622
|
+
* @note Resets list numbering for specified nodes
|
|
51623
|
+
*/
|
|
51527
51624
|
restartListNodes: (followingNodes, pos) => ({ tr }) => {
|
|
51528
51625
|
let currentNodePos = pos;
|
|
51529
51626
|
const nodes = followingNodes.map((node) => {
|
|
@@ -51542,8 +51639,11 @@ const OrderedList = Node$1.create({
|
|
|
51542
51639
|
return true;
|
|
51543
51640
|
},
|
|
51544
51641
|
/**
|
|
51545
|
-
*
|
|
51546
|
-
* @
|
|
51642
|
+
* Update ordered list style type based on nesting level
|
|
51643
|
+
* @category Command
|
|
51644
|
+
* @example
|
|
51645
|
+
* editor.commands.updateOrderedListStyleType()
|
|
51646
|
+
* @note Cycles through decimal -> lowerAlpha -> lowerRoman based on depth
|
|
51547
51647
|
*/
|
|
51548
51648
|
updateOrderedListStyleType: () => ({ dispatch, tr }) => {
|
|
51549
51649
|
let list = findParentNode((node) => node.type.name === this.name)(tr.selection);
|
|
@@ -51820,7 +51920,7 @@ const CustomSelection = Extension.create({
|
|
|
51820
51920
|
* @returns {Function} Command function
|
|
51821
51921
|
* @example
|
|
51822
51922
|
* // Restore selection after toolbar interaction
|
|
51823
|
-
* restorePreservedSelection()
|
|
51923
|
+
* editor.commands.restorePreservedSelection()
|
|
51824
51924
|
* @note Used internally to maintain selection when interacting with toolbar
|
|
51825
51925
|
*/
|
|
51826
51926
|
restorePreservedSelection: () => ({ tr, state: state2 }) => {
|
|
@@ -52109,6 +52209,9 @@ const LinkedStyles = Extension.create({
|
|
|
52109
52209
|
name: "linkedStyles",
|
|
52110
52210
|
priority: 1,
|
|
52111
52211
|
// We need this plugin to run before the list plugins
|
|
52212
|
+
addOptions() {
|
|
52213
|
+
return {};
|
|
52214
|
+
},
|
|
52112
52215
|
addPmPlugins() {
|
|
52113
52216
|
return [createLinkedStylesPlugin(this.editor)];
|
|
52114
52217
|
},
|
|
@@ -52117,11 +52220,10 @@ const LinkedStyles = Extension.create({
|
|
|
52117
52220
|
/**
|
|
52118
52221
|
* Apply a linked style to the selected paragraphs
|
|
52119
52222
|
* @category Command
|
|
52120
|
-
* @param {
|
|
52121
|
-
* @returns {Function} Command function
|
|
52223
|
+
* @param {LinkedStyle} style - The style object to apply
|
|
52122
52224
|
* @example
|
|
52123
52225
|
* const style = editor.helpers.linkedStyles.getStyleById('Heading1');
|
|
52124
|
-
* setLinkedStyle(style);
|
|
52226
|
+
* editor.commands.setLinkedStyle(style);
|
|
52125
52227
|
* @note Clears existing formatting when applying a style
|
|
52126
52228
|
* @note Works with custom selection preservation
|
|
52127
52229
|
*/
|
|
@@ -52132,16 +52234,12 @@ const LinkedStyles = Extension.create({
|
|
|
52132
52234
|
/**
|
|
52133
52235
|
* Toggle a linked style on the current selection
|
|
52134
52236
|
* @category Command
|
|
52135
|
-
* @param {
|
|
52237
|
+
* @param {LinkedStyle} style - The linked style to apply (with id property)
|
|
52136
52238
|
* @param {string|null} [nodeType=null] - Node type to restrict toggle to (e.g., 'paragraph')
|
|
52137
|
-
* @returns {Function} Command function
|
|
52138
52239
|
* @example
|
|
52139
|
-
* // Toggle a heading style
|
|
52140
52240
|
* const style = editor.helpers.linkedStyles.getStyleById('Heading1');
|
|
52141
|
-
* toggleLinkedStyle(style)
|
|
52142
|
-
*
|
|
52143
|
-
* // Toggle only on paragraph nodes
|
|
52144
|
-
* toggleLinkedStyle(style, 'paragraph')
|
|
52241
|
+
* editor.commands.toggleLinkedStyle(style)
|
|
52242
|
+
* editor.commands.toggleLinkedStyle(style, 'paragraph')
|
|
52145
52243
|
* @note If selection is empty, returns false
|
|
52146
52244
|
* @note Removes style if already applied, applies it if not
|
|
52147
52245
|
*/
|
|
@@ -52169,13 +52267,9 @@ const LinkedStyles = Extension.create({
|
|
|
52169
52267
|
* Apply a linked style by its ID
|
|
52170
52268
|
* @category Command
|
|
52171
52269
|
* @param {string} styleId - The style ID to apply (e.g., 'Heading1')
|
|
52172
|
-
* @returns {Function} Command function
|
|
52173
52270
|
* @example
|
|
52174
|
-
*
|
|
52175
|
-
* setStyleById('
|
|
52176
|
-
*
|
|
52177
|
-
* // Apply a normal style
|
|
52178
|
-
* setStyleById('Normal')
|
|
52271
|
+
* editor.commands.setStyleById('Heading1')
|
|
52272
|
+
* editor.commands.setStyleById('Normal')
|
|
52179
52273
|
* @note Looks up the style from loaded Word styles
|
|
52180
52274
|
*/
|
|
52181
52275
|
setStyleById: (styleId) => (params2) => {
|
|
@@ -52883,12 +52977,6 @@ const Paragraph = OxmlNode.create({
|
|
|
52883
52977
|
inline: false,
|
|
52884
52978
|
addOptions() {
|
|
52885
52979
|
return {
|
|
52886
|
-
/**
|
|
52887
|
-
* @typedef {Object} HeadingOptions
|
|
52888
|
-
* @category Options
|
|
52889
|
-
* @property {number[]} [headingLevels=[1,2,3,4,5,6]] - Supported heading levels
|
|
52890
|
-
* @property {Object} [htmlAttributes] - HTML attributes for paragraph elements
|
|
52891
|
-
*/
|
|
52892
52980
|
headingLevels: [1, 2, 3, 4, 5, 6],
|
|
52893
52981
|
htmlAttributes: {}
|
|
52894
52982
|
};
|
|
@@ -53120,11 +53208,6 @@ const Heading = Extension.create({
|
|
|
53120
53208
|
name: "heading",
|
|
53121
53209
|
addOptions() {
|
|
53122
53210
|
return {
|
|
53123
|
-
/**
|
|
53124
|
-
* @typedef {Object} HeadingOptions
|
|
53125
|
-
* @category Options
|
|
53126
|
-
* @property {number[]} [levels=[1,2,3,4,5,6]] - Supported heading levels
|
|
53127
|
-
*/
|
|
53128
53211
|
levels: [1, 2, 3, 4, 5, 6]
|
|
53129
53212
|
};
|
|
53130
53213
|
},
|
|
@@ -53134,10 +53217,8 @@ const Heading = Extension.create({
|
|
|
53134
53217
|
* Set a heading with specified level
|
|
53135
53218
|
* @category Command
|
|
53136
53219
|
* @param {HeadingAttributes} attributes - Heading attributes including level
|
|
53137
|
-
* @returns {Function} Command function
|
|
53138
53220
|
* @example
|
|
53139
|
-
*
|
|
53140
|
-
* setHeading({ level: 2 })
|
|
53221
|
+
* editor.commands.setHeading({ level: 2 })
|
|
53141
53222
|
* @note Converts current block to heading
|
|
53142
53223
|
*/
|
|
53143
53224
|
setHeading: (attributes) => ({ commands: commands2 }) => {
|
|
@@ -53149,13 +53230,9 @@ const Heading = Extension.create({
|
|
|
53149
53230
|
* Toggle between heading and paragraph
|
|
53150
53231
|
* @category Command
|
|
53151
53232
|
* @param {HeadingAttributes} attributes - Heading attributes including level
|
|
53152
|
-
* @returns {Function} Command function
|
|
53153
53233
|
* @example
|
|
53154
|
-
*
|
|
53155
|
-
* toggleHeading({ level:
|
|
53156
|
-
*
|
|
53157
|
-
* // Toggle heading level 3
|
|
53158
|
-
* toggleHeading({ level: 3 })
|
|
53234
|
+
* editor.commands.toggleHeading({ level: 1 })
|
|
53235
|
+
* editor.commands.toggleHeading({ level: 3 })
|
|
53159
53236
|
* @note Switches between heading and paragraph for the same level
|
|
53160
53237
|
*/
|
|
53161
53238
|
toggleHeading: (attributes) => ({ commands: commands2 }) => {
|
|
@@ -53560,6 +53637,9 @@ const LineBreak = Node$1.create({
|
|
|
53560
53637
|
selectable: false,
|
|
53561
53638
|
content: "",
|
|
53562
53639
|
atom: true,
|
|
53640
|
+
addOptions() {
|
|
53641
|
+
return {};
|
|
53642
|
+
},
|
|
53563
53643
|
parseDOM() {
|
|
53564
53644
|
return [{ tag: "br" }];
|
|
53565
53645
|
},
|
|
@@ -53568,17 +53648,7 @@ const LineBreak = Node$1.create({
|
|
|
53568
53648
|
},
|
|
53569
53649
|
addAttributes() {
|
|
53570
53650
|
return {
|
|
53571
|
-
/**
|
|
53572
|
-
* @private
|
|
53573
|
-
* @category Attribute
|
|
53574
|
-
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
53575
|
-
*/
|
|
53576
53651
|
lineBreakType: { rendered: false },
|
|
53577
|
-
/**
|
|
53578
|
-
* @private
|
|
53579
|
-
* @category Attribute
|
|
53580
|
-
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
53581
|
-
*/
|
|
53582
53652
|
clear: { rendered: false }
|
|
53583
53653
|
};
|
|
53584
53654
|
},
|
|
@@ -53587,9 +53657,8 @@ const LineBreak = Node$1.create({
|
|
|
53587
53657
|
/**
|
|
53588
53658
|
* Insert a line break
|
|
53589
53659
|
* @category Command
|
|
53590
|
-
* @returns {Function} Command function
|
|
53591
53660
|
* @example
|
|
53592
|
-
* insertLineBreak()
|
|
53661
|
+
* editor.commands.insertLineBreak()
|
|
53593
53662
|
* @note Creates a soft break within the same paragraph
|
|
53594
53663
|
*/
|
|
53595
53664
|
insertLineBreak: () => ({ commands: commands2 }) => {
|
|
@@ -53606,11 +53675,6 @@ const HardBreak = Node$1.create({
|
|
|
53606
53675
|
atom: true,
|
|
53607
53676
|
addOptions() {
|
|
53608
53677
|
return {
|
|
53609
|
-
/**
|
|
53610
|
-
* @typedef {Object} HardBreakOptions
|
|
53611
|
-
* @category Options
|
|
53612
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the break element
|
|
53613
|
-
*/
|
|
53614
53678
|
htmlAttributes: {
|
|
53615
53679
|
contentEditable: "false",
|
|
53616
53680
|
lineBreakType: "page",
|
|
@@ -53621,35 +53685,15 @@ const HardBreak = Node$1.create({
|
|
|
53621
53685
|
},
|
|
53622
53686
|
addAttributes() {
|
|
53623
53687
|
return {
|
|
53624
|
-
/**
|
|
53625
|
-
* @private
|
|
53626
|
-
* @category Attribute
|
|
53627
|
-
* @param {string} [pageBreakSource] - Source of the page break
|
|
53628
|
-
*/
|
|
53629
53688
|
pageBreakSource: {
|
|
53630
53689
|
rendered: false,
|
|
53631
53690
|
default: null
|
|
53632
53691
|
},
|
|
53633
|
-
/**
|
|
53634
|
-
* @private
|
|
53635
|
-
* @category Attribute
|
|
53636
|
-
* @param {string} [pageBreakType] - Type of page break
|
|
53637
|
-
*/
|
|
53638
53692
|
pageBreakType: {
|
|
53639
53693
|
default: null,
|
|
53640
53694
|
rendered: false
|
|
53641
53695
|
},
|
|
53642
|
-
/**
|
|
53643
|
-
* @private
|
|
53644
|
-
* @category Attribute
|
|
53645
|
-
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
53646
|
-
*/
|
|
53647
53696
|
lineBreakType: { rendered: false },
|
|
53648
|
-
/**
|
|
53649
|
-
* @private
|
|
53650
|
-
* @category Attribute
|
|
53651
|
-
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
53652
|
-
*/
|
|
53653
53697
|
clear: { rendered: false }
|
|
53654
53698
|
};
|
|
53655
53699
|
},
|
|
@@ -53675,9 +53719,8 @@ const HardBreak = Node$1.create({
|
|
|
53675
53719
|
/**
|
|
53676
53720
|
* Insert a page break
|
|
53677
53721
|
* @category Command
|
|
53678
|
-
* @returns {Function} Command function
|
|
53679
53722
|
* @example
|
|
53680
|
-
* insertPageBreak()
|
|
53723
|
+
* editor.commands.insertPageBreak()
|
|
53681
53724
|
* @note Forces content to start on a new page when printed
|
|
53682
53725
|
*/
|
|
53683
53726
|
insertPageBreak: () => ({ commands: commands2 }) => {
|
|
@@ -56067,17 +56110,6 @@ const Table = Node$1.create({
|
|
|
56067
56110
|
group: "block",
|
|
56068
56111
|
isolating: true,
|
|
56069
56112
|
tableRole: "table",
|
|
56070
|
-
/**
|
|
56071
|
-
* Table extension options
|
|
56072
|
-
* @category Options
|
|
56073
|
-
* @typedef {Object} TableOptions
|
|
56074
|
-
* @property {Object} [htmlAttributes={'aria-label': 'Table node'}] - Default HTML attributes for all tables
|
|
56075
|
-
* @property {boolean} [resizable=true] - Enable column resizing functionality
|
|
56076
|
-
* @property {number} [handleWidth=5] - Width of resize handles in pixels
|
|
56077
|
-
* @property {number} [cellMinWidth=10] - Minimum cell width constraint in pixels
|
|
56078
|
-
* @property {boolean} [lastColumnResizable=true] - Allow resizing of the last column
|
|
56079
|
-
* @property {boolean} [allowTableNodeSelection=false] - Enable selecting the entire table node
|
|
56080
|
-
*/
|
|
56081
56113
|
addOptions() {
|
|
56082
56114
|
return {
|
|
56083
56115
|
htmlAttributes: {
|
|
@@ -56235,14 +56267,9 @@ const Table = Node$1.create({
|
|
|
56235
56267
|
* Insert a new table into the document
|
|
56236
56268
|
* @category Command
|
|
56237
56269
|
* @param {TableConfig} [config] - Table configuration options
|
|
56238
|
-
* @returns {Function} Command
|
|
56239
56270
|
* @example
|
|
56240
|
-
*
|
|
56241
|
-
* insertTable(
|
|
56242
|
-
*
|
|
56243
|
-
* // Using custom values
|
|
56244
|
-
* insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
56245
|
-
*
|
|
56271
|
+
* editor.commands.insertTable()
|
|
56272
|
+
* editor.commands.insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
56246
56273
|
*/
|
|
56247
56274
|
insertTable: ({ rows = 3, cols = 3, withHeaderRow = false } = {}) => ({ tr, dispatch, editor }) => {
|
|
56248
56275
|
const node = createTable(editor.schema, rows, cols, withHeaderRow);
|
|
@@ -56255,9 +56282,8 @@ const Table = Node$1.create({
|
|
|
56255
56282
|
/**
|
|
56256
56283
|
* Delete the entire table containing the cursor
|
|
56257
56284
|
* @category Command
|
|
56258
|
-
* @returns {Function} Command
|
|
56259
56285
|
* @example
|
|
56260
|
-
* deleteTable()
|
|
56286
|
+
* editor.commands.deleteTable()
|
|
56261
56287
|
*/
|
|
56262
56288
|
deleteTable: () => ({ state: state2, dispatch }) => {
|
|
56263
56289
|
return deleteTable(state2, dispatch);
|
|
@@ -56265,9 +56291,8 @@ const Table = Node$1.create({
|
|
|
56265
56291
|
/**
|
|
56266
56292
|
* Add a column before the current column
|
|
56267
56293
|
* @category Command
|
|
56268
|
-
* @returns {Function} Command
|
|
56269
56294
|
* @example
|
|
56270
|
-
* addColumnBefore()
|
|
56295
|
+
* editor.commands.addColumnBefore()
|
|
56271
56296
|
* @note Preserves cell attributes from current column
|
|
56272
56297
|
*/
|
|
56273
56298
|
addColumnBefore: () => ({ state: state2, dispatch, chain }) => {
|
|
@@ -56644,10 +56669,9 @@ const Table = Node$1.create({
|
|
|
56644
56669
|
* Set background color for selected cells
|
|
56645
56670
|
* @category Command
|
|
56646
56671
|
* @param {string} value - Color value (hex with or without #)
|
|
56647
|
-
* @returns {Function} Command
|
|
56648
56672
|
* @example
|
|
56649
|
-
* setCellBackground('#ff0000')
|
|
56650
|
-
* setCellBackground('ff0000')
|
|
56673
|
+
* editor.commands.setCellBackground('#ff0000')
|
|
56674
|
+
* editor.commands.setCellBackground('ff0000')
|
|
56651
56675
|
*/
|
|
56652
56676
|
setCellBackground: (value) => ({ editor, commands: commands2, dispatch }) => {
|
|
56653
56677
|
const { selection } = editor.state;
|
|
@@ -56773,24 +56797,12 @@ const TableHeader = Node$1.create({
|
|
|
56773
56797
|
},
|
|
56774
56798
|
addAttributes() {
|
|
56775
56799
|
return {
|
|
56776
|
-
/**
|
|
56777
|
-
* @category Attribute
|
|
56778
|
-
* @param {number} [colspan=1] - Number of columns this header spans
|
|
56779
|
-
*/
|
|
56780
56800
|
colspan: {
|
|
56781
56801
|
default: 1
|
|
56782
56802
|
},
|
|
56783
|
-
/**
|
|
56784
|
-
* @category Attribute
|
|
56785
|
-
* @param {number} [rowspan=1] - Number of rows this header spans
|
|
56786
|
-
*/
|
|
56787
56803
|
rowspan: {
|
|
56788
56804
|
default: 1
|
|
56789
56805
|
},
|
|
56790
|
-
/**
|
|
56791
|
-
* @category Attribute
|
|
56792
|
-
* @param {number[]} [colwidth] - Column widths array in pixels
|
|
56793
|
-
*/
|
|
56794
56806
|
colwidth: {
|
|
56795
56807
|
default: null,
|
|
56796
56808
|
parseDOM: (element) => {
|
|
@@ -56827,10 +56839,6 @@ const TableRow = Node$1.create({
|
|
|
56827
56839
|
},
|
|
56828
56840
|
addAttributes() {
|
|
56829
56841
|
return {
|
|
56830
|
-
/**
|
|
56831
|
-
* @category Attribute
|
|
56832
|
-
* @param {number} [rowHeight] - Fixed row height in pixels
|
|
56833
|
-
*/
|
|
56834
56842
|
rowHeight: {
|
|
56835
56843
|
renderDOM({ rowHeight }) {
|
|
56836
56844
|
if (!rowHeight) return {};
|
|
@@ -56838,11 +56846,6 @@ const TableRow = Node$1.create({
|
|
|
56838
56846
|
return { style: style2 };
|
|
56839
56847
|
}
|
|
56840
56848
|
},
|
|
56841
|
-
/**
|
|
56842
|
-
* Indicates that this row should not be split across pages when paginating/exporting.
|
|
56843
|
-
* @category Attribute
|
|
56844
|
-
* @param {boolean} [cantSplit]
|
|
56845
|
-
*/
|
|
56846
56849
|
cantSplit: {
|
|
56847
56850
|
default: false,
|
|
56848
56851
|
parseDOM() {
|
|
@@ -56854,44 +56857,30 @@ const TableRow = Node$1.create({
|
|
|
56854
56857
|
}
|
|
56855
56858
|
},
|
|
56856
56859
|
/**
|
|
56857
|
-
* @category Attribute
|
|
56858
|
-
* @param {TableRowProperties} [tableRowProperties] - Properties for the table row.
|
|
56859
56860
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 377-482
|
|
56860
56861
|
*/
|
|
56861
56862
|
tableRowProperties: { rendered: false },
|
|
56862
56863
|
/**
|
|
56863
|
-
* @category Attribute
|
|
56864
|
-
* @param {string} [rsidDel] - Unique identifier used to track the editing session when the row was deleted from the main document.
|
|
56865
56864
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
56866
56865
|
*/
|
|
56867
56866
|
rsidDel: { rendered: false },
|
|
56868
56867
|
/**
|
|
56869
|
-
* @category Attribute
|
|
56870
|
-
* @param {string} [rsidR] - Unique identifier used to track the editing session when the table row was added to the main document.
|
|
56871
56868
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
56872
56869
|
*/
|
|
56873
56870
|
rsidR: { rendered: false },
|
|
56874
56871
|
/**
|
|
56875
|
-
* @category Attribute
|
|
56876
|
-
* @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.
|
|
56877
56872
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
56878
56873
|
*/
|
|
56879
56874
|
rsidRPr: { rendered: false },
|
|
56880
56875
|
/**
|
|
56881
|
-
* @category Attribute
|
|
56882
|
-
* @param {string} [rsidTr] - Unique identifier used to track the editing session when the table row's properties were last modified in this document.
|
|
56883
56876
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
56884
56877
|
*/
|
|
56885
56878
|
rsidTr: { rendered: false },
|
|
56886
56879
|
/**
|
|
56887
|
-
* @category Attribute
|
|
56888
|
-
* @param {string} [paraId] - A randomly generated unique identifier for the table row.
|
|
56889
56880
|
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/a0e7d2e2-2246-44c6-96e8-1cf009823615}
|
|
56890
56881
|
*/
|
|
56891
56882
|
paraId: { rendered: false },
|
|
56892
56883
|
/**
|
|
56893
|
-
* @category Attribute
|
|
56894
|
-
* @param {string} [textId] - A randomly generated unique identifier for the text of the table row.
|
|
56895
56884
|
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/b7eeddec-7c50-47fb-88b6-1feec3ed832c}
|
|
56896
56885
|
*/
|
|
56897
56886
|
textId: { rendered: false }
|
|
@@ -56918,24 +56907,12 @@ const TableCell = Node$1.create({
|
|
|
56918
56907
|
},
|
|
56919
56908
|
addAttributes() {
|
|
56920
56909
|
return {
|
|
56921
|
-
/**
|
|
56922
|
-
* @category Attribute
|
|
56923
|
-
* @param {number} [colspan=1] - Number of columns this cell spans
|
|
56924
|
-
*/
|
|
56925
56910
|
colspan: {
|
|
56926
56911
|
default: 1
|
|
56927
56912
|
},
|
|
56928
|
-
/**
|
|
56929
|
-
* @category Attribute
|
|
56930
|
-
* @param {number} [rowspan=1] - Number of rows this cell spans
|
|
56931
|
-
*/
|
|
56932
56913
|
rowspan: {
|
|
56933
56914
|
default: 1
|
|
56934
56915
|
},
|
|
56935
|
-
/**
|
|
56936
|
-
* @category Attribute
|
|
56937
|
-
* @param {number[]} [colwidth=[100]] - Column widths array in pixels
|
|
56938
|
-
*/
|
|
56939
56916
|
colwidth: {
|
|
56940
56917
|
default: [100],
|
|
56941
56918
|
parseDOM: (elem) => {
|
|
@@ -56950,10 +56927,6 @@ const TableCell = Node$1.create({
|
|
|
56950
56927
|
};
|
|
56951
56928
|
}
|
|
56952
56929
|
},
|
|
56953
|
-
/**
|
|
56954
|
-
* @category Attribute
|
|
56955
|
-
* @param {CellBackground} [background] - Cell background color configuration
|
|
56956
|
-
*/
|
|
56957
56930
|
background: {
|
|
56958
56931
|
renderDOM({ background }) {
|
|
56959
56932
|
if (!background) return {};
|
|
@@ -56962,10 +56935,6 @@ const TableCell = Node$1.create({
|
|
|
56962
56935
|
return { style: style2 };
|
|
56963
56936
|
}
|
|
56964
56937
|
},
|
|
56965
|
-
/**
|
|
56966
|
-
* @category Attribute
|
|
56967
|
-
* @param {string} [verticalAlign] - Vertical content alignment (top, middle, bottom)
|
|
56968
|
-
*/
|
|
56969
56938
|
verticalAlign: {
|
|
56970
56939
|
renderDOM({ verticalAlign }) {
|
|
56971
56940
|
if (!verticalAlign) return {};
|
|
@@ -56973,10 +56942,6 @@ const TableCell = Node$1.create({
|
|
|
56973
56942
|
return { style: style2 };
|
|
56974
56943
|
}
|
|
56975
56944
|
},
|
|
56976
|
-
/**
|
|
56977
|
-
* @category Attribute
|
|
56978
|
-
* @param {CellMargins} [cellMargins] - Internal cell padding
|
|
56979
|
-
*/
|
|
56980
56945
|
cellMargins: {
|
|
56981
56946
|
renderDOM({ cellMargins }) {
|
|
56982
56947
|
if (!cellMargins) return {};
|
|
@@ -56989,10 +56954,6 @@ const TableCell = Node$1.create({
|
|
|
56989
56954
|
return { style: style2 };
|
|
56990
56955
|
}
|
|
56991
56956
|
},
|
|
56992
|
-
/**
|
|
56993
|
-
* @category Attribute
|
|
56994
|
-
* @param {CellBorders} [borders] - Cell border configuration
|
|
56995
|
-
*/
|
|
56996
56957
|
borders: {
|
|
56997
56958
|
default: () => createCellBorders(),
|
|
56998
56959
|
renderDOM({ borders }) {
|
|
@@ -57007,20 +56968,10 @@ const TableCell = Node$1.create({
|
|
|
57007
56968
|
return { style: style2 };
|
|
57008
56969
|
}
|
|
57009
56970
|
},
|
|
57010
|
-
/**
|
|
57011
|
-
* @private
|
|
57012
|
-
* @category Attribute
|
|
57013
|
-
* @param {string} [widthType='auto'] - Internal width type
|
|
57014
|
-
*/
|
|
57015
56971
|
widthType: {
|
|
57016
56972
|
default: "auto",
|
|
57017
56973
|
rendered: false
|
|
57018
56974
|
},
|
|
57019
|
-
/**
|
|
57020
|
-
* @private
|
|
57021
|
-
* @category Attribute
|
|
57022
|
-
* @param {string} [widthUnit='px'] - Internal width unit
|
|
57023
|
-
*/
|
|
57024
56975
|
widthUnit: {
|
|
57025
56976
|
default: "px",
|
|
57026
56977
|
rendered: false
|
|
@@ -58650,7 +58601,7 @@ const validateUrlAccessibility = async (url) => {
|
|
|
58650
58601
|
credentials: "omit"
|
|
58651
58602
|
});
|
|
58652
58603
|
return response.ok;
|
|
58653
|
-
} catch
|
|
58604
|
+
} catch {
|
|
58654
58605
|
return false;
|
|
58655
58606
|
}
|
|
58656
58607
|
};
|
|
@@ -59223,6 +59174,19 @@ const findPreviousDomNodeWithClass = (view, pos, className) => {
|
|
|
59223
59174
|
}
|
|
59224
59175
|
return null;
|
|
59225
59176
|
};
|
|
59177
|
+
const getRotationMargins = (w2, h2, angleDegrees) => {
|
|
59178
|
+
const rad = angleDegrees * (Math.PI / 180);
|
|
59179
|
+
const cos = Math.abs(Math.cos(rad));
|
|
59180
|
+
const sin = Math.abs(Math.sin(rad));
|
|
59181
|
+
const boundingWidth = w2 * cos + h2 * sin;
|
|
59182
|
+
const boundingHeight = w2 * sin + h2 * cos;
|
|
59183
|
+
const marginLeftRight = Math.round(Math.max(0, (boundingWidth - w2) / 2));
|
|
59184
|
+
const marginTopBottom = Math.round(Math.max(0, (boundingHeight - h2) / 2));
|
|
59185
|
+
return {
|
|
59186
|
+
horizontal: marginLeftRight,
|
|
59187
|
+
vertical: marginTopBottom
|
|
59188
|
+
};
|
|
59189
|
+
};
|
|
59226
59190
|
const Image = Node$1.create({
|
|
59227
59191
|
name: "image",
|
|
59228
59192
|
group: "inline",
|
|
@@ -59244,10 +59208,6 @@ const Image = Node$1.create({
|
|
|
59244
59208
|
},
|
|
59245
59209
|
addAttributes() {
|
|
59246
59210
|
return {
|
|
59247
|
-
/**
|
|
59248
|
-
* @category Attribute
|
|
59249
|
-
* @param {string} [src] - Image source URL or path
|
|
59250
|
-
*/
|
|
59251
59211
|
src: {
|
|
59252
59212
|
default: null,
|
|
59253
59213
|
renderDOM: ({ src }) => {
|
|
@@ -59256,95 +59216,75 @@ const Image = Node$1.create({
|
|
|
59256
59216
|
};
|
|
59257
59217
|
}
|
|
59258
59218
|
},
|
|
59259
|
-
/**
|
|
59260
|
-
* @category Attribute
|
|
59261
|
-
* @param {string} [alt='Uploaded picture'] - Alternative text for accessibility
|
|
59262
|
-
*/
|
|
59263
59219
|
alt: {
|
|
59264
59220
|
default: "Uploaded picture"
|
|
59265
59221
|
},
|
|
59266
|
-
/**
|
|
59267
|
-
* @category Attribute
|
|
59268
|
-
* @param {string} [id] - Image element ID
|
|
59269
|
-
* @private
|
|
59270
|
-
*/
|
|
59271
59222
|
id: { rendered: false },
|
|
59272
|
-
/**
|
|
59273
|
-
* @category Attribute
|
|
59274
|
-
* @param {string} [title] - Image title/tooltip text
|
|
59275
|
-
*/
|
|
59276
59223
|
title: {
|
|
59277
59224
|
default: null
|
|
59278
59225
|
},
|
|
59279
|
-
/**
|
|
59280
|
-
* @category Attribute
|
|
59281
|
-
* @param {string} [rId] - Relationship ID for Word export
|
|
59282
|
-
* @private
|
|
59283
|
-
*/
|
|
59284
59226
|
rId: {
|
|
59285
59227
|
default: null,
|
|
59286
59228
|
rendered: false
|
|
59287
59229
|
},
|
|
59288
|
-
/**
|
|
59289
|
-
* @category Attribute
|
|
59290
|
-
* @param {Object} [originalPadding] - Original padding values from Word import
|
|
59291
|
-
* @private
|
|
59292
|
-
*/
|
|
59293
59230
|
originalPadding: {
|
|
59294
59231
|
default: null,
|
|
59295
59232
|
rendered: false
|
|
59296
59233
|
},
|
|
59297
|
-
/**
|
|
59298
|
-
* @category Attribute
|
|
59299
|
-
* @param {Object} [originalAttributes] - Original attributes from Word import
|
|
59300
|
-
* @private
|
|
59301
|
-
*/
|
|
59302
59234
|
originalAttributes: { rendered: false },
|
|
59303
|
-
/**
|
|
59304
|
-
* @category Attribute
|
|
59305
|
-
* @param {boolean} [wrapTopAndBottom] - Wrap text above and below image
|
|
59306
|
-
* @private
|
|
59307
|
-
*/
|
|
59308
59235
|
wrapTopAndBottom: { rendered: false },
|
|
59309
|
-
/**
|
|
59310
|
-
* @category Attribute
|
|
59311
|
-
* @param {Object} [anchorData] - Anchor positioning data for Word
|
|
59312
|
-
* @private
|
|
59313
|
-
*/
|
|
59314
59236
|
anchorData: {
|
|
59315
59237
|
default: null,
|
|
59316
59238
|
rendered: false
|
|
59317
59239
|
},
|
|
59240
|
+
isAnchor: { rendered: false },
|
|
59318
59241
|
/**
|
|
59319
59242
|
* @category Attribute
|
|
59320
|
-
* @param {
|
|
59243
|
+
* @param {Object} [transformData] - Transform data for image (turn and flip)
|
|
59244
|
+
* @param {number} [transformData.rotation] - Turn angle in degrees
|
|
59245
|
+
* @param {boolean} [transformData.verticalFlip] - Whether to flip vertically
|
|
59246
|
+
* @param {boolean} [transformData.horizontalFlip] - Whether to flip horizontally
|
|
59247
|
+
* @param {Object} [transformData.sizeExtension] - Size extension for image due to transformation
|
|
59248
|
+
* @param {number} [transformData.sizeExtension.left] - Left size extension for image
|
|
59249
|
+
* @param {number} [transformData.sizeExtension.top] - Top size extension for image
|
|
59250
|
+
* @param {number} [transformData.sizeExtension.right] - Right size extension for image
|
|
59251
|
+
* @param {number} [transformData.sizeExtension.bottom] - Bottom size extension for image
|
|
59252
|
+
*
|
|
59321
59253
|
* @private
|
|
59322
59254
|
*/
|
|
59323
|
-
|
|
59255
|
+
transformData: {
|
|
59256
|
+
default: {},
|
|
59257
|
+
renderDOM: ({ transformData }) => {
|
|
59258
|
+
let style2 = "";
|
|
59259
|
+
if (transformData?.rotation) {
|
|
59260
|
+
style2 += `rotate(${Math.round(transformData.rotation)}deg) `;
|
|
59261
|
+
}
|
|
59262
|
+
if (transformData?.verticalFlip) {
|
|
59263
|
+
style2 += "scaleY(-1) ";
|
|
59264
|
+
}
|
|
59265
|
+
if (transformData?.horizontalFlip) {
|
|
59266
|
+
style2 += "scaleX(-1) ";
|
|
59267
|
+
}
|
|
59268
|
+
style2 = style2.trim();
|
|
59269
|
+
if (style2.length > 0) {
|
|
59270
|
+
return { style: `transform: ${style2};` };
|
|
59271
|
+
}
|
|
59272
|
+
return;
|
|
59273
|
+
}
|
|
59274
|
+
},
|
|
59324
59275
|
/**
|
|
59325
59276
|
* @category Attribute
|
|
59326
59277
|
* @param {boolean} [simplePos] - Simple positioning flag
|
|
59327
59278
|
* @private
|
|
59328
59279
|
*/
|
|
59329
59280
|
simplePos: { rendered: false },
|
|
59330
|
-
/**
|
|
59331
|
-
* @category Attribute
|
|
59332
|
-
* @param {string} [wrapText] - Text wrapping style
|
|
59333
|
-
* @private
|
|
59334
|
-
*/
|
|
59335
59281
|
wrapText: { rendered: false },
|
|
59336
59282
|
extension: { rendered: false },
|
|
59337
|
-
/**
|
|
59338
|
-
* @category Attribute
|
|
59339
|
-
* @param {Object} [size] - Image dimensions
|
|
59340
|
-
* @param {number} [size.width] - Width in pixels
|
|
59341
|
-
* @param {number} [size.height] - Height in pixels
|
|
59342
|
-
*/
|
|
59343
59283
|
size: {
|
|
59344
59284
|
default: {},
|
|
59345
59285
|
renderDOM: ({ size: size2, extension }) => {
|
|
59346
59286
|
let style2 = "";
|
|
59347
|
-
|
|
59287
|
+
let { width, height } = size2 ?? {};
|
|
59348
59288
|
if (width) style2 += `width: ${width}px;`;
|
|
59349
59289
|
if (height && ["emf", "wmf"].includes(extension))
|
|
59350
59290
|
style2 += `height: ${height}px; border: 1px solid black; position: absolute;`;
|
|
@@ -59352,51 +59292,58 @@ const Image = Node$1.create({
|
|
|
59352
59292
|
return { style: style2 };
|
|
59353
59293
|
}
|
|
59354
59294
|
},
|
|
59355
|
-
/**
|
|
59356
|
-
* @category Attribute
|
|
59357
|
-
* @param {Object} [padding] - Image padding/margins
|
|
59358
|
-
* @param {number} [padding.left] - Left padding in pixels
|
|
59359
|
-
* @param {number} [padding.top] - Top padding in pixels
|
|
59360
|
-
* @param {number} [padding.bottom] - Bottom padding in pixels
|
|
59361
|
-
* @param {number} [padding.right] - Right padding in pixels
|
|
59362
|
-
*/
|
|
59363
59295
|
padding: {
|
|
59364
59296
|
default: {},
|
|
59365
|
-
renderDOM: ({ padding, marginOffset }) => {
|
|
59366
|
-
|
|
59297
|
+
renderDOM: ({ size: size2 = {}, padding, marginOffset, transformData }) => {
|
|
59298
|
+
let { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
|
|
59299
|
+
const { rotation } = transformData ?? {};
|
|
59300
|
+
const { height, width } = size2 ?? {};
|
|
59301
|
+
if (rotation && height && width) {
|
|
59302
|
+
const { horizontal, vertical } = getRotationMargins(width, height, rotation);
|
|
59303
|
+
left2 += horizontal;
|
|
59304
|
+
right2 += horizontal;
|
|
59305
|
+
top2 += vertical;
|
|
59306
|
+
bottom2 += vertical;
|
|
59307
|
+
}
|
|
59367
59308
|
let style2 = "";
|
|
59368
|
-
if (left2 &&
|
|
59369
|
-
if (top2 &&
|
|
59309
|
+
if (left2 && marginOffset?.left == null) style2 += `margin-left: ${left2}px;`;
|
|
59310
|
+
if (top2 && marginOffset?.top == null) style2 += `margin-top: ${top2}px;`;
|
|
59370
59311
|
if (bottom2) style2 += `margin-bottom: ${bottom2}px;`;
|
|
59371
59312
|
if (right2) style2 += `margin-right: ${right2}px;`;
|
|
59372
59313
|
return { style: style2 };
|
|
59373
59314
|
}
|
|
59374
59315
|
},
|
|
59375
|
-
/**
|
|
59376
|
-
* @category Attribute
|
|
59377
|
-
* @param {Object} [marginOffset] - Margin offset for anchored images
|
|
59378
|
-
* @param {number} [marginOffset.left] - Left margin offset
|
|
59379
|
-
* @param {number} [marginOffset.top] - Top margin offset
|
|
59380
|
-
*/
|
|
59381
59316
|
marginOffset: {
|
|
59382
59317
|
default: {},
|
|
59383
|
-
renderDOM: ({ marginOffset, anchorData }) => {
|
|
59318
|
+
renderDOM: ({ marginOffset, anchorData, transformData, size: size2 }) => {
|
|
59319
|
+
const hasAnchorData = Boolean(anchorData);
|
|
59320
|
+
const hasMarginOffsets = marginOffset?.left != null || marginOffset?.top != null;
|
|
59321
|
+
if (!hasAnchorData && !hasMarginOffsets) return {};
|
|
59384
59322
|
const relativeFromPageV = anchorData?.vRelativeFrom === "page";
|
|
59385
59323
|
const maxMarginV = 500;
|
|
59386
|
-
const
|
|
59324
|
+
const baseLeft = marginOffset?.left ?? 0;
|
|
59325
|
+
const baseTop = marginOffset?.top ?? 0;
|
|
59326
|
+
let rotationLeft = 0;
|
|
59327
|
+
let rotationTop = 0;
|
|
59328
|
+
const { rotation } = transformData ?? {};
|
|
59329
|
+
const { height, width } = size2 ?? {};
|
|
59330
|
+
if (rotation && height && width) {
|
|
59331
|
+
const { horizontal, vertical } = getRotationMargins(width, height, rotation);
|
|
59332
|
+
rotationLeft = horizontal;
|
|
59333
|
+
rotationTop = vertical;
|
|
59334
|
+
}
|
|
59335
|
+
const left2 = baseLeft + rotationLeft;
|
|
59336
|
+
const top2 = baseTop + rotationTop;
|
|
59387
59337
|
let style2 = "";
|
|
59388
59338
|
if (left2) style2 += `margin-left: ${left2}px;`;
|
|
59389
59339
|
if (top2) {
|
|
59390
59340
|
if (relativeFromPageV && top2 >= maxMarginV) style2 += `margin-top: ${maxMarginV}px;`;
|
|
59391
59341
|
else style2 += `margin-top: ${top2}px;`;
|
|
59392
59342
|
}
|
|
59343
|
+
if (!style2) return {};
|
|
59393
59344
|
return { style: style2 };
|
|
59394
59345
|
}
|
|
59395
59346
|
},
|
|
59396
|
-
/**
|
|
59397
|
-
* @category Attribute
|
|
59398
|
-
* @param {string} [style] - Custom inline CSS styles
|
|
59399
|
-
*/
|
|
59400
59347
|
style: {
|
|
59401
59348
|
default: null,
|
|
59402
59349
|
rendered: true,
|
|
@@ -59422,18 +59369,10 @@ const Image = Node$1.create({
|
|
|
59422
59369
|
/**
|
|
59423
59370
|
* Insert an image at the current position
|
|
59424
59371
|
* @category Command
|
|
59425
|
-
* @param {
|
|
59426
|
-
* @param {string} options.src - Image source URL or data URI
|
|
59427
|
-
* @param {string} [options.alt] - Alternative text
|
|
59428
|
-
* @param {string} [options.title] - Image title
|
|
59429
|
-
* @param {Object} [options.size] - Image dimensions
|
|
59430
|
-
* @returns {Function} Command function
|
|
59372
|
+
* @param {ImageInsertOptions} options - Image insertion options
|
|
59431
59373
|
* @example
|
|
59432
|
-
*
|
|
59433
|
-
* setImage({
|
|
59434
|
-
*
|
|
59435
|
-
* // Insert a base64 encoded image
|
|
59436
|
-
* setImage({
|
|
59374
|
+
* editor.commands.setImage({ src: 'https://example.com/image.jpg' })
|
|
59375
|
+
* editor.commands.setImage({
|
|
59437
59376
|
* src: 'data:image/png;base64,...',
|
|
59438
59377
|
* alt: 'Company logo',
|
|
59439
59378
|
* size: { width: 200 }
|
|
@@ -59650,6 +59589,14 @@ const PageNumber = Node$1.create({
|
|
|
59650
59589
|
},
|
|
59651
59590
|
addCommands() {
|
|
59652
59591
|
return {
|
|
59592
|
+
/**
|
|
59593
|
+
* Insert an automatic page number
|
|
59594
|
+
* @category Command
|
|
59595
|
+
* @returns {Function} Command function
|
|
59596
|
+
* @example
|
|
59597
|
+
* editor.commands.addAutoPageNumber()
|
|
59598
|
+
* @note Only works in header/footer contexts
|
|
59599
|
+
*/
|
|
59653
59600
|
addAutoPageNumber: () => ({ tr, dispatch, state: state2, editor }) => {
|
|
59654
59601
|
const { options } = editor;
|
|
59655
59602
|
if (!options.isHeaderOrFooter) return false;
|
|
@@ -59712,6 +59659,14 @@ const TotalPageCount = Node$1.create({
|
|
|
59712
59659
|
},
|
|
59713
59660
|
addCommands() {
|
|
59714
59661
|
return {
|
|
59662
|
+
/**
|
|
59663
|
+
* Insert total page count
|
|
59664
|
+
* @category Command
|
|
59665
|
+
* @returns {Function} Command function
|
|
59666
|
+
* @example
|
|
59667
|
+
* editor.commands.addTotalPageCount()
|
|
59668
|
+
* @note Only works in header/footer contexts
|
|
59669
|
+
*/
|
|
59715
59670
|
addTotalPageCount: () => ({ tr, dispatch, state: state2, editor }) => {
|
|
59716
59671
|
const { options } = editor;
|
|
59717
59672
|
if (!options.isHeaderOrFooter) return false;
|
|
@@ -59978,11 +59933,6 @@ const ContentBlock = Node$1.create({
|
|
|
59978
59933
|
inline: true,
|
|
59979
59934
|
addOptions() {
|
|
59980
59935
|
return {
|
|
59981
|
-
/**
|
|
59982
|
-
* @typedef {Object} ContentBlockOptions
|
|
59983
|
-
* @category Options
|
|
59984
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the block element
|
|
59985
|
-
*/
|
|
59986
59936
|
htmlAttributes: {
|
|
59987
59937
|
contenteditable: false
|
|
59988
59938
|
}
|
|
@@ -59990,10 +59940,6 @@ const ContentBlock = Node$1.create({
|
|
|
59990
59940
|
},
|
|
59991
59941
|
addAttributes() {
|
|
59992
59942
|
return {
|
|
59993
|
-
/**
|
|
59994
|
-
* @category Attribute
|
|
59995
|
-
* @param {boolean} [horizontalRule=false] - Whether this block is a horizontal rule
|
|
59996
|
-
*/
|
|
59997
59943
|
horizontalRule: {
|
|
59998
59944
|
default: false,
|
|
59999
59945
|
renderDOM: ({ horizontalRule }) => {
|
|
@@ -60001,10 +59947,6 @@ const ContentBlock = Node$1.create({
|
|
|
60001
59947
|
return { "data-horizontal-rule": "true" };
|
|
60002
59948
|
}
|
|
60003
59949
|
},
|
|
60004
|
-
/**
|
|
60005
|
-
* @category Attribute
|
|
60006
|
-
* @param {ContentBlockSize} [size] - Size and position of the content block
|
|
60007
|
-
*/
|
|
60008
59950
|
size: {
|
|
60009
59951
|
default: null,
|
|
60010
59952
|
renderDOM: ({ size: size2 }) => {
|
|
@@ -60018,10 +59960,6 @@ const ContentBlock = Node$1.create({
|
|
|
60018
59960
|
return { style: style2 };
|
|
60019
59961
|
}
|
|
60020
59962
|
},
|
|
60021
|
-
/**
|
|
60022
|
-
* @category Attribute
|
|
60023
|
-
* @param {string} [background] - Background color for the block
|
|
60024
|
-
*/
|
|
60025
59963
|
background: {
|
|
60026
59964
|
default: null,
|
|
60027
59965
|
renderDOM: (attrs) => {
|
|
@@ -60031,19 +59969,9 @@ const ContentBlock = Node$1.create({
|
|
|
60031
59969
|
};
|
|
60032
59970
|
}
|
|
60033
59971
|
},
|
|
60034
|
-
/**
|
|
60035
|
-
* @private
|
|
60036
|
-
* @category Attribute
|
|
60037
|
-
* @param {Object} [drawingContent] - Internal drawing data
|
|
60038
|
-
*/
|
|
60039
59972
|
drawingContent: {
|
|
60040
59973
|
rendered: false
|
|
60041
59974
|
},
|
|
60042
|
-
/**
|
|
60043
|
-
* @private
|
|
60044
|
-
* @category Attribute
|
|
60045
|
-
* @param {Object} [attributes] - Additional internal attributes
|
|
60046
|
-
*/
|
|
60047
59975
|
attributes: {
|
|
60048
59976
|
rendered: false
|
|
60049
59977
|
}
|
|
@@ -60064,9 +59992,8 @@ const ContentBlock = Node$1.create({
|
|
|
60064
59992
|
/**
|
|
60065
59993
|
* Insert a horizontal rule
|
|
60066
59994
|
* @category Command
|
|
60067
|
-
* @returns {Function} Command function
|
|
60068
59995
|
* @example
|
|
60069
|
-
* insertHorizontalRule()
|
|
59996
|
+
* editor.commands.insertHorizontalRule()
|
|
60070
59997
|
* @note Creates a visual separator between content sections
|
|
60071
59998
|
*/
|
|
60072
59999
|
insertHorizontalRule: () => ({ commands: commands2 }) => {
|
|
@@ -60083,13 +60010,13 @@ const ContentBlock = Node$1.create({
|
|
|
60083
60010
|
* Insert a content block
|
|
60084
60011
|
* @category Command
|
|
60085
60012
|
* @param {ContentBlockConfig} config - Block configuration
|
|
60086
|
-
* @returns {Function} Command function
|
|
60087
60013
|
* @example
|
|
60088
60014
|
* // Insert a spacer block
|
|
60089
|
-
* insertContentBlock({ size: { height: 20 } })
|
|
60015
|
+
* editor.commands.insertContentBlock({ size: { height: 20 } })
|
|
60090
60016
|
*
|
|
60017
|
+
* @example
|
|
60091
60018
|
* // Insert a colored divider
|
|
60092
|
-
* insertContentBlock({
|
|
60019
|
+
* editor.commands.insertContentBlock({
|
|
60093
60020
|
* size: { width: '50%', height: 3 },
|
|
60094
60021
|
* background: '#3b82f6'
|
|
60095
60022
|
* })
|
|
@@ -60126,7 +60053,7 @@ class StructuredContentViewBase {
|
|
|
60126
60053
|
this.htmlAttributes = props.htmlAttributes;
|
|
60127
60054
|
this.mount(props);
|
|
60128
60055
|
}
|
|
60129
|
-
mount(
|
|
60056
|
+
mount() {
|
|
60130
60057
|
return;
|
|
60131
60058
|
}
|
|
60132
60059
|
get dom() {
|
|
@@ -60617,16 +60544,7 @@ const DocumentSection = Node$1.create({
|
|
|
60617
60544
|
},
|
|
60618
60545
|
addAttributes() {
|
|
60619
60546
|
return {
|
|
60620
|
-
/**
|
|
60621
|
-
* @category Attribute
|
|
60622
|
-
* @param {number} [id] - Unique section identifier
|
|
60623
|
-
*/
|
|
60624
60547
|
id: {},
|
|
60625
|
-
/**
|
|
60626
|
-
* @private
|
|
60627
|
-
* @category Attribute
|
|
60628
|
-
* @param {string} [sdBlockId] - Internal block tracking
|
|
60629
|
-
*/
|
|
60630
60548
|
sdBlockId: {
|
|
60631
60549
|
default: null,
|
|
60632
60550
|
keepOnSplit: false,
|
|
@@ -60635,25 +60553,9 @@ const DocumentSection = Node$1.create({
|
|
|
60635
60553
|
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
60636
60554
|
}
|
|
60637
60555
|
},
|
|
60638
|
-
/**
|
|
60639
|
-
* @category Attribute
|
|
60640
|
-
* @param {string} [title] - Section display label
|
|
60641
|
-
*/
|
|
60642
60556
|
title: {},
|
|
60643
|
-
/**
|
|
60644
|
-
* @category Attribute
|
|
60645
|
-
* @param {string} [description] - Section metadata
|
|
60646
|
-
*/
|
|
60647
60557
|
description: {},
|
|
60648
|
-
/**
|
|
60649
|
-
* @category Attribute
|
|
60650
|
-
* @param {string} [sectionType] - Business classification (e.g., 'legal', 'pricing')
|
|
60651
|
-
*/
|
|
60652
60558
|
sectionType: {},
|
|
60653
|
-
/**
|
|
60654
|
-
* @category Attribute
|
|
60655
|
-
* @param {boolean} [isLocked=false] - Lock state preventing edits
|
|
60656
|
-
*/
|
|
60657
60559
|
isLocked: { default: false }
|
|
60658
60560
|
};
|
|
60659
60561
|
},
|
|
@@ -60668,10 +60570,9 @@ const DocumentSection = Node$1.create({
|
|
|
60668
60570
|
* Create a lockable content section
|
|
60669
60571
|
* @category Command
|
|
60670
60572
|
* @param {SectionCreate} [options={}] - Section configuration
|
|
60671
|
-
* @returns {Function} Command - true if created, false if position invalid
|
|
60672
60573
|
* @example
|
|
60673
|
-
* createDocumentSection({
|
|
60674
|
-
* id:
|
|
60574
|
+
* editor.commands.createDocumentSection({
|
|
60575
|
+
* id: 1,
|
|
60675
60576
|
* title: 'Terms & Conditions',
|
|
60676
60577
|
* isLocked: true,
|
|
60677
60578
|
* html: '<p>Legal content...</p>'
|
|
@@ -60752,9 +60653,8 @@ const DocumentSection = Node$1.create({
|
|
|
60752
60653
|
/**
|
|
60753
60654
|
* Remove section wrapper at cursor, preserving its content
|
|
60754
60655
|
* @category Command
|
|
60755
|
-
* @returns {Function} Command - true if removed, false if no section at position
|
|
60756
60656
|
* @example
|
|
60757
|
-
* removeSectionAtSelection()
|
|
60657
|
+
* editor.commands.removeSectionAtSelection()
|
|
60758
60658
|
* @note Content stays in document, only section wrapper is removed
|
|
60759
60659
|
*/
|
|
60760
60660
|
removeSectionAtSelection: () => ({ tr, dispatch }) => {
|
|
@@ -60780,9 +60680,8 @@ const DocumentSection = Node$1.create({
|
|
|
60780
60680
|
* Delete section and all its content
|
|
60781
60681
|
* @category Command
|
|
60782
60682
|
* @param {number} id - Section to delete
|
|
60783
|
-
* @returns {Function} Command - true if deleted, false if ID doesn't exist
|
|
60784
60683
|
* @example
|
|
60785
|
-
* removeSectionById(123)
|
|
60684
|
+
* editor.commands.removeSectionById(123)
|
|
60786
60685
|
*/
|
|
60787
60686
|
removeSectionById: (id) => ({ tr, dispatch }) => {
|
|
60788
60687
|
const sections = SectionHelpers.getAllSections(this.editor);
|
|
@@ -60802,9 +60701,8 @@ const DocumentSection = Node$1.create({
|
|
|
60802
60701
|
* Lock section against edits
|
|
60803
60702
|
* @category Command
|
|
60804
60703
|
* @param {number} id - Section to lock
|
|
60805
|
-
* @returns {Function} Command - true if locked, false if ID doesn't exist
|
|
60806
60704
|
* @example
|
|
60807
|
-
* lockSectionById(123)
|
|
60705
|
+
* editor.commands.lockSectionById(123)
|
|
60808
60706
|
*/
|
|
60809
60707
|
lockSectionById: (id) => ({ tr, dispatch }) => {
|
|
60810
60708
|
const sections = SectionHelpers.getAllSections(this.editor);
|
|
@@ -60821,16 +60719,10 @@ const DocumentSection = Node$1.create({
|
|
|
60821
60719
|
* Modify section attributes or content
|
|
60822
60720
|
* @category Command
|
|
60823
60721
|
* @param {SectionUpdate} options - Changes to apply
|
|
60824
|
-
* @returns {Function} Command - true if updated, false if ID doesn't exist
|
|
60825
60722
|
* @example
|
|
60826
|
-
*
|
|
60827
|
-
* updateSectionById({ id: 123,
|
|
60828
|
-
*
|
|
60829
|
-
* // Replace content
|
|
60830
|
-
* updateSectionById({ id: 123, html: '<p>New content</p>' })
|
|
60831
|
-
*
|
|
60832
|
-
* // Both
|
|
60833
|
-
* updateSectionById({
|
|
60723
|
+
* editor.commands.updateSectionById({ id: 123, attrs: { isLocked: false } })
|
|
60724
|
+
* editor.commands.updateSectionById({ id: 123, html: '<p>New content</p>' })
|
|
60725
|
+
* editor.commands.updateSectionById({
|
|
60834
60726
|
* id: 123,
|
|
60835
60727
|
* html: '<p>Updated</p>',
|
|
60836
60728
|
* attrs: { title: 'New Title' }
|
|
@@ -60880,11 +60772,10 @@ const BlockNode = Extension.create({
|
|
|
60880
60772
|
* Replace a block node by its ID with new content
|
|
60881
60773
|
* @category Command
|
|
60882
60774
|
* @param {string} id - The sdBlockId of the node to replace
|
|
60883
|
-
* @param {
|
|
60884
|
-
* @returns {Function} Command function
|
|
60775
|
+
* @param {ProseMirrorNode} contentNode - The replacement ProseMirror node
|
|
60885
60776
|
* @example
|
|
60886
60777
|
* const newParagraph = editor.schema.nodes.paragraph.create({}, editor.schema.text('New content'))
|
|
60887
|
-
* replaceBlockNodeById('block-123', newParagraph)
|
|
60778
|
+
* editor.commands.replaceBlockNodeById('block-123', newParagraph)
|
|
60888
60779
|
* @note The replacement node should have the same type as the original
|
|
60889
60780
|
*/
|
|
60890
60781
|
replaceBlockNodeById: (id, contentNode) => ({ dispatch, tr }) => {
|
|
@@ -60907,9 +60798,8 @@ const BlockNode = Extension.create({
|
|
|
60907
60798
|
* Delete a block node by its ID
|
|
60908
60799
|
* @category Command
|
|
60909
60800
|
* @param {string} id - The sdBlockId of the node to delete
|
|
60910
|
-
* @returns {Function} Command function
|
|
60911
60801
|
* @example
|
|
60912
|
-
* deleteBlockNodeById('block-123')
|
|
60802
|
+
* editor.commands.deleteBlockNodeById('block-123')
|
|
60913
60803
|
* @note Completely removes the node from the document
|
|
60914
60804
|
*/
|
|
60915
60805
|
deleteBlockNodeById: (id) => ({ dispatch, tr }) => {
|
|
@@ -60933,11 +60823,10 @@ const BlockNode = Extension.create({
|
|
|
60933
60823
|
* @category Command
|
|
60934
60824
|
* @param {string} id - The sdBlockId of the node to update
|
|
60935
60825
|
* @param {Object} attrs - Attributes to update
|
|
60936
|
-
* @returns {Function} Command function
|
|
60937
60826
|
* @example
|
|
60938
|
-
* updateBlockNodeAttributes('block-123', { textAlign: 'center' })
|
|
60827
|
+
* editor.commands.updateBlockNodeAttributes('block-123', { textAlign: 'center' })
|
|
60939
60828
|
* @example
|
|
60940
|
-
* updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
|
|
60829
|
+
* editor.commands.updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
|
|
60941
60830
|
* @note Merges new attributes with existing ones
|
|
60942
60831
|
*/
|
|
60943
60832
|
updateBlockNodeAttributes: (id, attrs = {}) => ({ dispatch, tr }) => {
|
|
@@ -61031,7 +60920,7 @@ const BlockNode = Extension.create({
|
|
|
61031
60920
|
key: BlockNodePluginKey,
|
|
61032
60921
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
61033
60922
|
if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
|
|
61034
|
-
if (hasInitialized && !checkForNewBlockNodesInTrs(transactions)) return null;
|
|
60923
|
+
if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) return null;
|
|
61035
60924
|
const { tr } = newState;
|
|
61036
60925
|
let changed = false;
|
|
61037
60926
|
newState.doc.descendants((node, pos) => {
|
|
@@ -61110,9 +60999,8 @@ const TextStyle = Mark2.create({
|
|
|
61110
60999
|
/**
|
|
61111
61000
|
* Remove empty text style marks
|
|
61112
61001
|
* @category Command
|
|
61113
|
-
* @returns {Function} Command function - Removes mark if no attributes present
|
|
61114
61002
|
* @example
|
|
61115
|
-
* removeEmptyTextStyle()
|
|
61003
|
+
* editor.commands.removeEmptyTextStyle()
|
|
61116
61004
|
* @note Cleanup utility to prevent empty span elements
|
|
61117
61005
|
* @note Automatically checks if any style attributes exist before removal
|
|
61118
61006
|
*/
|
|
@@ -61134,10 +61022,6 @@ const Bold = Mark2.create({
|
|
|
61134
61022
|
},
|
|
61135
61023
|
addAttributes() {
|
|
61136
61024
|
return {
|
|
61137
|
-
/**
|
|
61138
|
-
* @category Attribute
|
|
61139
|
-
* @param {string} [value] - Bold weight value ('0' renders as normal)
|
|
61140
|
-
*/
|
|
61141
61025
|
value: {
|
|
61142
61026
|
default: null,
|
|
61143
61027
|
renderDOM: (attrs) => {
|
|
@@ -61166,26 +61050,23 @@ const Bold = Mark2.create({
|
|
|
61166
61050
|
/**
|
|
61167
61051
|
* Apply bold formatting
|
|
61168
61052
|
* @category Command
|
|
61169
|
-
* @returns {Function} Command
|
|
61170
61053
|
* @example
|
|
61171
|
-
* setBold()
|
|
61054
|
+
* editor.commands.setBold()
|
|
61172
61055
|
* @note '0' renders as normal weight
|
|
61173
61056
|
*/
|
|
61174
61057
|
setBold: () => ({ commands: commands2 }) => commands2.setMark(this.name),
|
|
61175
61058
|
/**
|
|
61176
61059
|
* Remove bold formatting
|
|
61177
61060
|
* @category Command
|
|
61178
|
-
* @returns {Function} Command
|
|
61179
61061
|
* @example
|
|
61180
|
-
* unsetBold()
|
|
61062
|
+
* editor.commands.unsetBold()
|
|
61181
61063
|
*/
|
|
61182
61064
|
unsetBold: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
61183
61065
|
/**
|
|
61184
61066
|
* Toggle bold formatting
|
|
61185
61067
|
* @category Command
|
|
61186
|
-
* @returns {Function} Command
|
|
61187
61068
|
* @example
|
|
61188
|
-
* toggleBold()
|
|
61069
|
+
* editor.commands.toggleBold()
|
|
61189
61070
|
*/
|
|
61190
61071
|
toggleBold: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
61191
61072
|
};
|
|
@@ -61220,25 +61101,22 @@ const Italic = Mark2.create({
|
|
|
61220
61101
|
/**
|
|
61221
61102
|
* Apply italic formatting
|
|
61222
61103
|
* @category Command
|
|
61223
|
-
* @returns {Function} Command
|
|
61224
61104
|
* @example
|
|
61225
|
-
* setItalic()
|
|
61105
|
+
* editor.commands.setItalic()
|
|
61226
61106
|
*/
|
|
61227
61107
|
setItalic: () => ({ commands: commands2 }) => commands2.setMark(this.name),
|
|
61228
61108
|
/**
|
|
61229
61109
|
* Remove italic formatting
|
|
61230
61110
|
* @category Command
|
|
61231
|
-
* @returns {Function} Command
|
|
61232
61111
|
* @example
|
|
61233
|
-
* unsetItalic()
|
|
61112
|
+
* editor.commands.unsetItalic()
|
|
61234
61113
|
*/
|
|
61235
61114
|
unsetItalic: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
61236
61115
|
/**
|
|
61237
61116
|
* Toggle italic formatting
|
|
61238
61117
|
* @category Command
|
|
61239
|
-
* @returns {Function} Command
|
|
61240
61118
|
* @example
|
|
61241
|
-
* toggleItalic()
|
|
61119
|
+
* editor.commands.toggleItalic()
|
|
61242
61120
|
*/
|
|
61243
61121
|
toggleItalic: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
61244
61122
|
};
|
|
@@ -61322,10 +61200,6 @@ const Highlight = Mark2.create({
|
|
|
61322
61200
|
},
|
|
61323
61201
|
addAttributes() {
|
|
61324
61202
|
return {
|
|
61325
|
-
/**
|
|
61326
|
-
* @category Attribute
|
|
61327
|
-
* @param {string} [color] - Background color (CSS color value)
|
|
61328
|
-
*/
|
|
61329
61203
|
color: {
|
|
61330
61204
|
default: null,
|
|
61331
61205
|
parseDOM: (element) => element.getAttribute("data-color") || element.style.backgroundColor,
|
|
@@ -61353,26 +61227,23 @@ const Highlight = Mark2.create({
|
|
|
61353
61227
|
* Apply highlight with specified color
|
|
61354
61228
|
* @category Command
|
|
61355
61229
|
* @param {string} color - CSS color value
|
|
61356
|
-
* @returns {Function} Command
|
|
61357
61230
|
* @example
|
|
61358
|
-
* setHighlight('#FFEB3B')
|
|
61359
|
-
* setHighlight('rgba(255, 235, 59, 0.5)')
|
|
61231
|
+
* editor.commands.setHighlight('#FFEB3B')
|
|
61232
|
+
* editor.commands.setHighlight('rgba(255, 235, 59, 0.5)')
|
|
61360
61233
|
*/
|
|
61361
61234
|
setHighlight: (color) => ({ commands: commands2 }) => commands2.setMark(this.name, { color }),
|
|
61362
61235
|
/**
|
|
61363
61236
|
* Remove highlight formatting
|
|
61364
61237
|
* @category Command
|
|
61365
|
-
* @returns {Function} Command
|
|
61366
61238
|
* @example
|
|
61367
|
-
* unsetHighlight()
|
|
61239
|
+
* editor.commands.unsetHighlight()
|
|
61368
61240
|
*/
|
|
61369
61241
|
unsetHighlight: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
61370
61242
|
/**
|
|
61371
61243
|
* Toggle highlight formatting
|
|
61372
61244
|
* @category Command
|
|
61373
|
-
* @returns {Function} Command
|
|
61374
61245
|
* @example
|
|
61375
|
-
* toggleHighlight()
|
|
61246
|
+
* editor.commands.toggleHighlight()
|
|
61376
61247
|
*/
|
|
61377
61248
|
toggleHighlight: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
61378
61249
|
};
|
|
@@ -61405,9 +61276,8 @@ const Strike = Mark2.create({
|
|
|
61405
61276
|
/**
|
|
61406
61277
|
* Apply strikethrough formatting
|
|
61407
61278
|
* @category Command
|
|
61408
|
-
* @returns {Function} Command
|
|
61409
61279
|
* @example
|
|
61410
|
-
* setStrike()
|
|
61280
|
+
* editor.commands.setStrike()
|
|
61411
61281
|
*/
|
|
61412
61282
|
setStrike: () => ({ commands: commands2 }) => {
|
|
61413
61283
|
return commands2.setMark(this.name);
|
|
@@ -61415,9 +61285,8 @@ const Strike = Mark2.create({
|
|
|
61415
61285
|
/**
|
|
61416
61286
|
* Remove strikethrough formatting
|
|
61417
61287
|
* @category Command
|
|
61418
|
-
* @returns {Function} Command
|
|
61419
61288
|
* @example
|
|
61420
|
-
* unsetStrike()
|
|
61289
|
+
* editor.commands.unsetStrike()
|
|
61421
61290
|
*/
|
|
61422
61291
|
unsetStrike: () => ({ commands: commands2 }) => {
|
|
61423
61292
|
return commands2.unsetMark(this.name);
|
|
@@ -61425,9 +61294,8 @@ const Strike = Mark2.create({
|
|
|
61425
61294
|
/**
|
|
61426
61295
|
* Toggle strikethrough formatting
|
|
61427
61296
|
* @category Command
|
|
61428
|
-
* @returns {Function} Command
|
|
61429
61297
|
* @example
|
|
61430
|
-
* toggleStrike()
|
|
61298
|
+
* editor.commands.toggleStrike()
|
|
61431
61299
|
*/
|
|
61432
61300
|
toggleStrike: () => ({ commands: commands2 }) => {
|
|
61433
61301
|
return commands2.toggleMark(this.name);
|
|
@@ -61447,11 +61315,6 @@ const Link = Mark2.create({
|
|
|
61447
61315
|
inclusive: false,
|
|
61448
61316
|
addOptions() {
|
|
61449
61317
|
return {
|
|
61450
|
-
/**
|
|
61451
|
-
* Allowed URL protocols
|
|
61452
|
-
* @type {string[]}
|
|
61453
|
-
* @default ['http', 'https']
|
|
61454
|
-
*/
|
|
61455
61318
|
protocols: ["http", "https"],
|
|
61456
61319
|
htmlAttributes: {
|
|
61457
61320
|
target: null,
|
|
@@ -61550,16 +61413,10 @@ const Link = Mark2.create({
|
|
|
61550
61413
|
/**
|
|
61551
61414
|
* Create or update a link
|
|
61552
61415
|
* @category Command
|
|
61553
|
-
* @param {
|
|
61554
|
-
* @param {string} [options.href] - URL for the link
|
|
61555
|
-
* @param {string} [options.text] - Display text (uses selection if omitted)
|
|
61556
|
-
* @returns {Function} Command - Creates link with underline
|
|
61416
|
+
* @param {SetLinkOptions} [options] - Link configuration
|
|
61557
61417
|
* @example
|
|
61558
|
-
*
|
|
61559
|
-
* setLink({
|
|
61560
|
-
*
|
|
61561
|
-
* // Link with custom text
|
|
61562
|
-
* setLink({
|
|
61418
|
+
* editor.commands.setLink({ href: 'https://example.com' })
|
|
61419
|
+
* editor.commands.setLink({
|
|
61563
61420
|
* href: 'https://example.com',
|
|
61564
61421
|
* text: 'Visit Example'
|
|
61565
61422
|
* })
|
|
@@ -61611,9 +61468,8 @@ const Link = Mark2.create({
|
|
|
61611
61468
|
/**
|
|
61612
61469
|
* Remove link and associated formatting
|
|
61613
61470
|
* @category Command
|
|
61614
|
-
* @returns {Function} Command - Removes link, underline, and color
|
|
61615
61471
|
* @example
|
|
61616
|
-
* unsetLink()
|
|
61472
|
+
* editor.commands.unsetLink()
|
|
61617
61473
|
* @note Also removes underline and text color
|
|
61618
61474
|
*/
|
|
61619
61475
|
unsetLink: () => ({ chain }) => {
|
|
@@ -61622,16 +61478,10 @@ const Link = Mark2.create({
|
|
|
61622
61478
|
/**
|
|
61623
61479
|
* Toggle link on selection
|
|
61624
61480
|
* @category Command
|
|
61625
|
-
* @param {
|
|
61626
|
-
* @param {string} [options.href] - URL for the link
|
|
61627
|
-
* @param {string} [options.text] - Display text
|
|
61628
|
-
* @returns {Function} Command - Creates link if href provided, removes otherwise
|
|
61481
|
+
* @param {SetLinkOptions} [options] - Link configuration
|
|
61629
61482
|
* @example
|
|
61630
|
-
*
|
|
61631
|
-
* toggleLink(
|
|
61632
|
-
*
|
|
61633
|
-
* // Remove link
|
|
61634
|
-
* toggleLink()
|
|
61483
|
+
* editor.commands.toggleLink({ href: 'https://example.com' })
|
|
61484
|
+
* editor.commands.toggleLink()
|
|
61635
61485
|
*/
|
|
61636
61486
|
toggleLink: ({ href, text } = {}) => ({ commands: commands2 }) => {
|
|
61637
61487
|
if (!href) return commands2.unsetLink();
|
|
@@ -64948,6 +64798,9 @@ const Mentions = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v
|
|
|
64948
64798
|
const popoverPluginKey = new PluginKey("popoverPlugin");
|
|
64949
64799
|
const PopoverPlugin = Extension.create({
|
|
64950
64800
|
name: "popoverPlugin",
|
|
64801
|
+
addOptions() {
|
|
64802
|
+
return {};
|
|
64803
|
+
},
|
|
64951
64804
|
addPmPlugins() {
|
|
64952
64805
|
const popover = new Plugin({
|
|
64953
64806
|
key: popoverPluginKey,
|
|
@@ -67175,12 +67028,11 @@ const Search = Extension.create({
|
|
|
67175
67028
|
addCommands() {
|
|
67176
67029
|
return {
|
|
67177
67030
|
/**
|
|
67178
|
-
*
|
|
67031
|
+
* Navigate to the first search match
|
|
67179
67032
|
* @category Command
|
|
67180
|
-
* @returns {Function} - Command function
|
|
67181
67033
|
* @example
|
|
67182
|
-
* goToFirstMatch()
|
|
67183
|
-
* @note Scrolls
|
|
67034
|
+
* editor.commands.goToFirstMatch()
|
|
67035
|
+
* @note Scrolls editor to the first match from previous search
|
|
67184
67036
|
*/
|
|
67185
67037
|
goToFirstMatch: () => (
|
|
67186
67038
|
/** @returns {boolean} */
|
|
@@ -67196,13 +67048,13 @@ const Search = Extension.create({
|
|
|
67196
67048
|
})
|
|
67197
67049
|
),
|
|
67198
67050
|
/**
|
|
67199
|
-
*
|
|
67051
|
+
* Search for string matches in editor content
|
|
67200
67052
|
* @category Command
|
|
67201
67053
|
* @param {String|RegExp} patternInput - Search string or pattern
|
|
67202
|
-
* @returns {Function} - Command function that returns matches
|
|
67203
67054
|
* @example
|
|
67204
|
-
* search('test string')
|
|
67205
|
-
*
|
|
67055
|
+
* const matches = editor.commands.search('test string')
|
|
67056
|
+
* const regexMatches = editor.commands.search(/test/i)
|
|
67057
|
+
* @note Returns array of SearchMatch objects with positions and IDs
|
|
67206
67058
|
*/
|
|
67207
67059
|
search: (patternInput) => (
|
|
67208
67060
|
/** @returns {SearchMatch[]} */
|
|
@@ -67245,14 +67097,13 @@ const Search = Extension.create({
|
|
|
67245
67097
|
})
|
|
67246
67098
|
),
|
|
67247
67099
|
/**
|
|
67248
|
-
*
|
|
67100
|
+
* Navigate to a specific search match
|
|
67249
67101
|
* @category Command
|
|
67250
|
-
* @param {SearchMatch} match Match
|
|
67251
|
-
* @returns {Function} - Command function
|
|
67102
|
+
* @param {SearchMatch} match - Match object to navigate to
|
|
67252
67103
|
* @example
|
|
67253
|
-
* const
|
|
67254
|
-
* goToSearchResult(
|
|
67255
|
-
* @note Scrolls
|
|
67104
|
+
* const searchResults = editor.commands.search('test string')
|
|
67105
|
+
* editor.commands.goToSearchResult(searchResults[3])
|
|
67106
|
+
* @note Scrolls to match and selects it
|
|
67256
67107
|
*/
|
|
67257
67108
|
goToSearchResult: (match) => (
|
|
67258
67109
|
/** @returns {boolean} */
|
|
@@ -67514,6 +67365,9 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
|
|
|
67514
67365
|
};
|
|
67515
67366
|
const NodeResizer = Extension.create({
|
|
67516
67367
|
name: "nodeResizer",
|
|
67368
|
+
addOptions() {
|
|
67369
|
+
return {};
|
|
67370
|
+
},
|
|
67517
67371
|
addPmPlugins() {
|
|
67518
67372
|
const isHeadless = this.editor.options.isHeadless;
|
|
67519
67373
|
const hasDocument = typeof document !== "undefined";
|