@harbour-enterprises/superdoc 0.20.0-next.8 → 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-BoDHZ2nW.es.js → PdfViewer-BZlsmhsJ.es.js} +1 -1
- package/dist/chunks/{PdfViewer-Ch0v9vA6.cjs → PdfViewer-BqGjx7hC.cjs} +1 -1
- package/dist/chunks/{index-BWPWqVxp.es.js → index-4GToG3C3.es.js} +2 -2
- package/dist/chunks/{index-DFOT300M.cjs → index-DPzgGSfg.cjs} +2 -2
- package/dist/chunks/{super-editor.es-BQ6kZTNg.cjs → super-editor.es-BkxUKZfn.cjs} +309 -574
- package/dist/chunks/{super-editor.es-sBfWb5tn.es.js → super-editor.es-DqX3Ipsk.es.js} +309 -574
- 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-C91Sr_5w.js → converter-C6YOTAXG.js} +64 -8
- package/dist/super-editor/chunks/{docx-zipper-Cl7LYpt6.js → docx-zipper-CSiwWpmr.js} +1 -1
- package/dist/super-editor/chunks/{editor-a7cQT9Dw.js → editor-chVid4VD.js} +247 -568
- package/dist/super-editor/chunks/{toolbar-DiNFtCKr.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/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/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 +309 -574
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -22584,6 +22584,14 @@
|
|
|
22584
22584
|
if (pt == null) return;
|
|
22585
22585
|
return pt * 20;
|
|
22586
22586
|
}
|
|
22587
|
+
function rotToDegrees(rot) {
|
|
22588
|
+
if (rot == null) return;
|
|
22589
|
+
return rot / 6e4;
|
|
22590
|
+
}
|
|
22591
|
+
function degreesToRot(degrees) {
|
|
22592
|
+
if (degrees == null) return;
|
|
22593
|
+
return degrees * 6e4;
|
|
22594
|
+
}
|
|
22587
22595
|
const getTextIndentExportValue = (indent) => {
|
|
22588
22596
|
const [value, unit] = parseSizeUnit(indent);
|
|
22589
22597
|
const functionsMap = {
|
|
@@ -34597,6 +34605,32 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34597
34605
|
if (!picture || !picture.elements) return null;
|
|
34598
34606
|
const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
|
|
34599
34607
|
const blip = blipFill.elements.find((el) => el.name === "a:blip");
|
|
34608
|
+
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
34609
|
+
let transformData = {};
|
|
34610
|
+
if (spPr) {
|
|
34611
|
+
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
34612
|
+
if (xfrm?.attributes) {
|
|
34613
|
+
transformData = {
|
|
34614
|
+
rotation: rotToDegrees(xfrm.attributes["rot"]),
|
|
34615
|
+
verticalFlip: xfrm.attributes["flipV"] === "1",
|
|
34616
|
+
horizontalFlip: xfrm.attributes["flipH"] === "1"
|
|
34617
|
+
};
|
|
34618
|
+
}
|
|
34619
|
+
}
|
|
34620
|
+
const effectExtent = node.elements.find((el) => el.name === "wp:effectExtent");
|
|
34621
|
+
if (effectExtent) {
|
|
34622
|
+
const sanitizeEmuValue = (value) => {
|
|
34623
|
+
if (value === null || value === void 0) return 0;
|
|
34624
|
+
const numeric = Number(value);
|
|
34625
|
+
return Number.isFinite(numeric) ? numeric : 0;
|
|
34626
|
+
};
|
|
34627
|
+
transformData.sizeExtension = {
|
|
34628
|
+
left: emuToPixels(sanitizeEmuValue(effectExtent.attributes["l"])),
|
|
34629
|
+
top: emuToPixels(sanitizeEmuValue(effectExtent.attributes["t"])),
|
|
34630
|
+
right: emuToPixels(sanitizeEmuValue(effectExtent.attributes["r"])),
|
|
34631
|
+
bottom: emuToPixels(sanitizeEmuValue(effectExtent.attributes["b"]))
|
|
34632
|
+
};
|
|
34633
|
+
}
|
|
34600
34634
|
const positionHTag = node.elements.find((el) => el.name === "wp:positionH");
|
|
34601
34635
|
const positionH = positionHTag?.elements.find((el) => el.name === "wp:posOffset");
|
|
34602
34636
|
const positionHValue = emuToPixels(positionH?.elements[0]?.text);
|
|
@@ -34653,6 +34687,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34653
34687
|
size: size2,
|
|
34654
34688
|
anchorData,
|
|
34655
34689
|
isAnchor,
|
|
34690
|
+
transformData,
|
|
34656
34691
|
...simplePos && {
|
|
34657
34692
|
simplePos: {
|
|
34658
34693
|
x: simplePos.attributes.x,
|
|
@@ -34804,6 +34839,31 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34804
34839
|
distL: 0,
|
|
34805
34840
|
distR: 0
|
|
34806
34841
|
};
|
|
34842
|
+
const xfrmAttrs = {};
|
|
34843
|
+
const effectExtentAttrs = {
|
|
34844
|
+
l: 0,
|
|
34845
|
+
t: 0,
|
|
34846
|
+
r: 0,
|
|
34847
|
+
b: 0
|
|
34848
|
+
};
|
|
34849
|
+
const transformData = attrs.transformData;
|
|
34850
|
+
if (transformData) {
|
|
34851
|
+
if (transformData.rotation) {
|
|
34852
|
+
xfrmAttrs.rot = degreesToRot(transformData.rotation);
|
|
34853
|
+
}
|
|
34854
|
+
if (transformData.verticalFlip) {
|
|
34855
|
+
xfrmAttrs.flipV = "1";
|
|
34856
|
+
}
|
|
34857
|
+
if (transformData.horizontalFlip) {
|
|
34858
|
+
xfrmAttrs.flipH = "1";
|
|
34859
|
+
}
|
|
34860
|
+
if (transformData.sizeExtension) {
|
|
34861
|
+
effectExtentAttrs.l = pixelsToEmu(transformData.sizeExtension.left);
|
|
34862
|
+
effectExtentAttrs.t = pixelsToEmu(transformData.sizeExtension.top);
|
|
34863
|
+
effectExtentAttrs.r = pixelsToEmu(transformData.sizeExtension.right);
|
|
34864
|
+
effectExtentAttrs.b = pixelsToEmu(transformData.sizeExtension.bottom);
|
|
34865
|
+
}
|
|
34866
|
+
}
|
|
34807
34867
|
const drawingXmlns = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
34808
34868
|
const pictureXmlns = "http://schemas.openxmlformats.org/drawingml/2006/picture";
|
|
34809
34869
|
return {
|
|
@@ -34818,12 +34878,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34818
34878
|
},
|
|
34819
34879
|
{
|
|
34820
34880
|
name: "wp:effectExtent",
|
|
34821
|
-
attributes:
|
|
34822
|
-
l: 0,
|
|
34823
|
-
t: 0,
|
|
34824
|
-
r: 0,
|
|
34825
|
-
b: 0
|
|
34826
|
-
}
|
|
34881
|
+
attributes: effectExtentAttrs
|
|
34827
34882
|
},
|
|
34828
34883
|
{
|
|
34829
34884
|
name: "wp:docPr",
|
|
@@ -34903,6 +34958,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34903
34958
|
elements: [
|
|
34904
34959
|
{
|
|
34905
34960
|
name: "a:xfrm",
|
|
34961
|
+
attributes: xfrmAttrs,
|
|
34906
34962
|
elements: [
|
|
34907
34963
|
{
|
|
34908
34964
|
name: "a:ext",
|
|
@@ -39078,8 +39134,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39078
39134
|
}
|
|
39079
39135
|
const importHeadersFooters = (docx, converter, mainEditor) => {
|
|
39080
39136
|
const rels = docx["word/_rels/document.xml.rels"];
|
|
39081
|
-
const relationships = rels
|
|
39082
|
-
const { elements } = relationships;
|
|
39137
|
+
const relationships = rels?.elements.find((el) => el.name === "Relationships");
|
|
39138
|
+
const { elements } = relationships || { elements: [] };
|
|
39083
39139
|
const headerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
|
|
39084
39140
|
const footerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
|
|
39085
39141
|
const headers = elements.filter((el) => el.attributes["Type"] === headerType);
|
|
@@ -50037,12 +50093,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
50037
50093
|
name: "history",
|
|
50038
50094
|
addOptions() {
|
|
50039
50095
|
return {
|
|
50040
|
-
/**
|
|
50041
|
-
* @typedef {Object} HistoryOptions
|
|
50042
|
-
* @category Options
|
|
50043
|
-
* @property {number} [depth=100] - Maximum undo/redo steps to remember
|
|
50044
|
-
* @property {number} [newGroupDelay=500] - Milliseconds to wait before starting a new history group
|
|
50045
|
-
*/
|
|
50046
50096
|
depth: 100,
|
|
50047
50097
|
newGroupDelay: 500
|
|
50048
50098
|
};
|
|
@@ -50061,9 +50111,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
50061
50111
|
/**
|
|
50062
50112
|
* Undo the last action
|
|
50063
50113
|
* @category Command
|
|
50064
|
-
* @returns {Function} Command function
|
|
50065
50114
|
* @example
|
|
50066
|
-
* undo()
|
|
50115
|
+
* editor.commands.undo()
|
|
50067
50116
|
* @note Groups changes within the newGroupDelay window
|
|
50068
50117
|
*/
|
|
50069
50118
|
undo: () => ({ state: state2, dispatch, tr }) => {
|
|
@@ -50077,9 +50126,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
50077
50126
|
/**
|
|
50078
50127
|
* Redo the last undone action
|
|
50079
50128
|
* @category Command
|
|
50080
|
-
* @returns {Function} Command function
|
|
50081
50129
|
* @example
|
|
50082
|
-
* redo()
|
|
50130
|
+
* editor.commands.redo()
|
|
50083
50131
|
* @note Only available after an undo action
|
|
50084
50132
|
*/
|
|
50085
50133
|
redo: () => ({ state: state2, dispatch, tr }) => {
|
|
@@ -56998,6 +57046,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56998
57046
|
return result;
|
|
56999
57047
|
} catch (error) {
|
|
57000
57048
|
this.emit("exception", { error, editor: this });
|
|
57049
|
+
console.error(error);
|
|
57001
57050
|
}
|
|
57002
57051
|
}
|
|
57003
57052
|
/**
|
|
@@ -57021,6 +57070,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57021
57070
|
this.converter.footerEditors.length = 0;
|
|
57022
57071
|
} catch (error) {
|
|
57023
57072
|
this.emit("exception", { error, editor: this });
|
|
57073
|
+
console.error(error);
|
|
57024
57074
|
}
|
|
57025
57075
|
}
|
|
57026
57076
|
/**
|
|
@@ -57609,6 +57659,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57609
57659
|
if (this.options.ydoc) this.options.ydoc.destroy();
|
|
57610
57660
|
} catch (error) {
|
|
57611
57661
|
this.emit("exception", { error, editor: this });
|
|
57662
|
+
console.error(error);
|
|
57612
57663
|
}
|
|
57613
57664
|
};
|
|
57614
57665
|
validateDocumentInit_fn = function() {
|
|
@@ -57635,11 +57686,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57635
57686
|
name: "color",
|
|
57636
57687
|
addOptions() {
|
|
57637
57688
|
return {
|
|
57638
|
-
/**
|
|
57639
|
-
* @typedef {Object} ColorOptions
|
|
57640
|
-
* @category Options
|
|
57641
|
-
* @property {string[]} [types=['textStyle']] - Mark types to add color support to
|
|
57642
|
-
*/
|
|
57643
57689
|
types: ["textStyle"]
|
|
57644
57690
|
};
|
|
57645
57691
|
},
|
|
@@ -57648,10 +57694,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57648
57694
|
{
|
|
57649
57695
|
types: this.options.types,
|
|
57650
57696
|
attributes: {
|
|
57651
|
-
/**
|
|
57652
|
-
* @category Attribute
|
|
57653
|
-
* @param {ColorValue} [color] - Text color value
|
|
57654
|
-
*/
|
|
57655
57697
|
color: {
|
|
57656
57698
|
default: null,
|
|
57657
57699
|
parseDOM: (el) => el.style.color?.replace(/['"]+/g, ""),
|
|
@@ -57670,16 +57712,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57670
57712
|
* Set text color
|
|
57671
57713
|
* @category Command
|
|
57672
57714
|
* @param {ColorValue} color - Color value to apply
|
|
57673
|
-
* @returns {Function} Command function
|
|
57674
57715
|
* @example
|
|
57675
57716
|
* // Set to red using hex
|
|
57676
|
-
* setColor('#ff0000')
|
|
57717
|
+
* editor.commands.setColor('#ff0000')
|
|
57677
57718
|
*
|
|
57719
|
+
* @example
|
|
57678
57720
|
* // Set using rgb
|
|
57679
|
-
* setColor('rgb(255, 0, 0)')
|
|
57721
|
+
* editor.commands.setColor('rgb(255, 0, 0)')
|
|
57680
57722
|
*
|
|
57723
|
+
* @example
|
|
57681
57724
|
* // Set using named color
|
|
57682
|
-
* setColor('blue')
|
|
57725
|
+
* editor.commands.setColor('blue')
|
|
57683
57726
|
* @note Preserves other text styling attributes
|
|
57684
57727
|
*/
|
|
57685
57728
|
setColor: (color) => ({ chain }) => {
|
|
@@ -57688,9 +57731,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57688
57731
|
/**
|
|
57689
57732
|
* Remove text color
|
|
57690
57733
|
* @category Command
|
|
57691
|
-
* @returns {Function} Command function
|
|
57692
57734
|
* @example
|
|
57693
|
-
* unsetColor()
|
|
57735
|
+
* editor.commands.unsetColor()
|
|
57694
57736
|
* @note Removes color while preserving other text styles
|
|
57695
57737
|
*/
|
|
57696
57738
|
unsetColor: () => ({ chain }) => {
|
|
@@ -57703,11 +57745,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57703
57745
|
name: "fontFamily",
|
|
57704
57746
|
addOptions() {
|
|
57705
57747
|
return {
|
|
57706
|
-
/**
|
|
57707
|
-
* @typedef {Object} FontFamilyOptions
|
|
57708
|
-
* @category Options
|
|
57709
|
-
* @property {string[]} [types=['textStyle']] - Mark types to add font family support to
|
|
57710
|
-
*/
|
|
57711
57748
|
types: ["textStyle"]
|
|
57712
57749
|
};
|
|
57713
57750
|
},
|
|
@@ -57716,10 +57753,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57716
57753
|
{
|
|
57717
57754
|
types: this.options.types,
|
|
57718
57755
|
attributes: {
|
|
57719
|
-
/**
|
|
57720
|
-
* @category Attribute
|
|
57721
|
-
* @param {FontFamilyValue} [fontFamily] - Font family for text
|
|
57722
|
-
*/
|
|
57723
57756
|
fontFamily: {
|
|
57724
57757
|
default: null,
|
|
57725
57758
|
parseDOM: (el) => el.style.fontFamily?.replace(/['"]+/g, ""),
|
|
@@ -57738,13 +57771,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57738
57771
|
* Set font family
|
|
57739
57772
|
* @category Command
|
|
57740
57773
|
* @param {FontFamilyValue} fontFamily - Font family to apply
|
|
57741
|
-
* @returns {Function} Command function
|
|
57742
57774
|
* @example
|
|
57743
57775
|
* // Set to Arial
|
|
57744
|
-
* setFontFamily('Arial')
|
|
57776
|
+
* editor.commands.setFontFamily('Arial')
|
|
57745
57777
|
*
|
|
57778
|
+
* @example
|
|
57746
57779
|
* // Set to serif font
|
|
57747
|
-
* setFontFamily('Georgia, serif')
|
|
57780
|
+
* editor.commands.setFontFamily('Georgia, serif')
|
|
57748
57781
|
* @note Preserves other text styling attributes
|
|
57749
57782
|
*/
|
|
57750
57783
|
setFontFamily: (fontFamily2) => ({ chain }) => {
|
|
@@ -57753,9 +57786,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57753
57786
|
/**
|
|
57754
57787
|
* Remove font family
|
|
57755
57788
|
* @category Command
|
|
57756
|
-
* @returns {Function} Command function
|
|
57757
57789
|
* @example
|
|
57758
|
-
* unsetFontFamily()
|
|
57790
|
+
* editor.commands.unsetFontFamily()
|
|
57759
57791
|
* @note Reverts to default document font
|
|
57760
57792
|
*/
|
|
57761
57793
|
unsetFontFamily: () => ({ chain }) => {
|
|
@@ -57768,12 +57800,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57768
57800
|
name: "fontSize",
|
|
57769
57801
|
addOptions() {
|
|
57770
57802
|
return {
|
|
57771
|
-
/**
|
|
57772
|
-
* @typedef {Object} FontSizeOptions
|
|
57773
|
-
* @category Options
|
|
57774
|
-
* @property {string[]} [types=['textStyle', 'tableCell']] - Node/mark types to add font size support to
|
|
57775
|
-
* @property {FontSizeDefaults} [defaults] - Default size configuration
|
|
57776
|
-
*/
|
|
57777
57803
|
types: ["textStyle", "tableCell"],
|
|
57778
57804
|
defaults: {
|
|
57779
57805
|
value: 12,
|
|
@@ -57788,10 +57814,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57788
57814
|
{
|
|
57789
57815
|
types: this.options.types,
|
|
57790
57816
|
attributes: {
|
|
57791
|
-
/**
|
|
57792
|
-
* @category Attribute
|
|
57793
|
-
* @param {FontSizeValue} [fontSize] - Font size with unit
|
|
57794
|
-
*/
|
|
57795
57817
|
fontSize: {
|
|
57796
57818
|
default: null,
|
|
57797
57819
|
parseDOM: (el) => el.style.fontSize,
|
|
@@ -57813,16 +57835,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57813
57835
|
* Set font size
|
|
57814
57836
|
* @category Command
|
|
57815
57837
|
* @param {FontSizeValue} fontSize - Size to apply (with optional unit)
|
|
57816
|
-
* @returns {Function} Command function
|
|
57817
57838
|
* @example
|
|
57818
|
-
*
|
|
57819
|
-
* setFontSize('
|
|
57820
|
-
*
|
|
57821
|
-
* // Set to 18px
|
|
57822
|
-
* setFontSize('18px')
|
|
57823
|
-
*
|
|
57824
|
-
* // Set without unit (uses default)
|
|
57825
|
-
* setFontSize(16)
|
|
57839
|
+
* editor.commands.setFontSize('14pt')
|
|
57840
|
+
* editor.commands.setFontSize('18px')
|
|
57841
|
+
* editor.commands.setFontSize(16)
|
|
57826
57842
|
* @note Automatically clamps to min/max values
|
|
57827
57843
|
*/
|
|
57828
57844
|
setFontSize: (fontSize2) => ({ chain }) => {
|
|
@@ -57844,9 +57860,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57844
57860
|
/**
|
|
57845
57861
|
* Remove font size
|
|
57846
57862
|
* @category Command
|
|
57847
|
-
* @returns {Function} Command function
|
|
57848
57863
|
* @example
|
|
57849
|
-
* unsetFontSize()
|
|
57864
|
+
* editor.commands.unsetFontSize()
|
|
57850
57865
|
* @note Reverts to default document size
|
|
57851
57866
|
*/
|
|
57852
57867
|
unsetFontSize: () => ({ chain }) => {
|
|
@@ -57896,13 +57911,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57896
57911
|
* Set text alignment
|
|
57897
57912
|
* @category Command
|
|
57898
57913
|
* @param {string} alignment - Alignment value (left, center, right, justify)
|
|
57899
|
-
* @returns {Function} Command function
|
|
57900
57914
|
* @example
|
|
57901
|
-
*
|
|
57902
|
-
* setTextAlign('
|
|
57903
|
-
*
|
|
57904
|
-
* // Set to justify
|
|
57905
|
-
* setTextAlign('justify')
|
|
57915
|
+
* editor.commands.setTextAlign('center')
|
|
57916
|
+
* editor.commands.setTextAlign('justify')
|
|
57906
57917
|
* @note Applies to all configured node types (heading, paragraph by default)
|
|
57907
57918
|
*/
|
|
57908
57919
|
setTextAlign: (alignment2) => ({ commands: commands2 }) => {
|
|
@@ -57913,9 +57924,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57913
57924
|
/**
|
|
57914
57925
|
* Remove text alignment (reset to default)
|
|
57915
57926
|
* @category Command
|
|
57916
|
-
* @returns {Function} Command function
|
|
57917
57927
|
* @example
|
|
57918
|
-
* unsetTextAlign()
|
|
57928
|
+
* editor.commands.unsetTextAlign()
|
|
57919
57929
|
* @note Resets alignment to the default value
|
|
57920
57930
|
*/
|
|
57921
57931
|
unsetTextAlign: () => ({ commands: commands2 }) => {
|
|
@@ -58056,13 +58066,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58056
58066
|
name: "lineHeight",
|
|
58057
58067
|
addOptions() {
|
|
58058
58068
|
return {
|
|
58059
|
-
/**
|
|
58060
|
-
* @typedef {Object} LineHeightOptions
|
|
58061
|
-
* @category Options
|
|
58062
|
-
* @property {string[]} [types=['heading', 'paragraph']] - Block types to add line height support to
|
|
58063
|
-
* @property {Object} [defaults] - Default configuration
|
|
58064
|
-
* @property {string} [defaults.unit=''] - Default unit for line height values
|
|
58065
|
-
*/
|
|
58066
58069
|
types: ["heading", "paragraph"],
|
|
58067
58070
|
defaults: {
|
|
58068
58071
|
unit: ""
|
|
@@ -58074,10 +58077,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58074
58077
|
{
|
|
58075
58078
|
types: this.options.types,
|
|
58076
58079
|
attributes: {
|
|
58077
|
-
/**
|
|
58078
|
-
* @category Attribute
|
|
58079
|
-
* @param {LineHeightValue} [lineHeight] - Line height value
|
|
58080
|
-
*/
|
|
58081
58080
|
lineHeight: {
|
|
58082
58081
|
default: null,
|
|
58083
58082
|
parseDOM: (el) => el.style.lineHeight,
|
|
@@ -58103,16 +58102,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58103
58102
|
* Set line height for blocks
|
|
58104
58103
|
* @category Command
|
|
58105
58104
|
* @param {LineHeightValue} lineHeight - Line height to apply
|
|
58106
|
-
* @returns {Function} Command function
|
|
58107
58105
|
* @example
|
|
58108
|
-
*
|
|
58109
|
-
* setLineHeight(
|
|
58110
|
-
*
|
|
58111
|
-
* // Set to 24px spacing
|
|
58112
|
-
* setLineHeight('24px')
|
|
58113
|
-
*
|
|
58114
|
-
* // Set to double spacing
|
|
58115
|
-
* setLineHeight(2)
|
|
58106
|
+
* editor.commands.setLineHeight(1.5)
|
|
58107
|
+
* editor.commands.setLineHeight('24px')
|
|
58108
|
+
* editor.commands.setLineHeight(2)
|
|
58116
58109
|
* @note Applies to paragraphs and headings
|
|
58117
58110
|
*/
|
|
58118
58111
|
setLineHeight: (lineHeight2) => ({ commands: commands2 }) => {
|
|
@@ -58122,9 +58115,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58122
58115
|
/**
|
|
58123
58116
|
* Remove line height
|
|
58124
58117
|
* @category Command
|
|
58125
|
-
* @returns {Function} Command function
|
|
58126
58118
|
* @example
|
|
58127
|
-
* unsetLineHeight()
|
|
58119
|
+
* editor.commands.unsetLineHeight()
|
|
58128
58120
|
* @note Reverts to default line spacing
|
|
58129
58121
|
*/
|
|
58130
58122
|
unsetLineHeight: () => ({ commands: commands2 }) => {
|
|
@@ -58152,9 +58144,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58152
58144
|
/**
|
|
58153
58145
|
* Clear all formatting (nodes and marks)
|
|
58154
58146
|
* @category Command
|
|
58155
|
-
* @returns {Function} Command function
|
|
58156
58147
|
* @example
|
|
58157
|
-
* clearFormat()
|
|
58148
|
+
* editor.commands.clearFormat()
|
|
58158
58149
|
* @note Removes all marks and resets nodes to default paragraph
|
|
58159
58150
|
*/
|
|
58160
58151
|
clearFormat: () => ({ chain }) => {
|
|
@@ -58163,9 +58154,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58163
58154
|
/**
|
|
58164
58155
|
* Clear only mark formatting
|
|
58165
58156
|
* @category Command
|
|
58166
|
-
* @returns {Function} Command function
|
|
58167
58157
|
* @example
|
|
58168
|
-
* clearMarksFormat()
|
|
58158
|
+
* editor.commands.clearMarksFormat()
|
|
58169
58159
|
* @note Removes bold, italic, underline, colors, etc. but preserves block structure
|
|
58170
58160
|
*/
|
|
58171
58161
|
clearMarksFormat: () => ({ chain }) => {
|
|
@@ -58174,9 +58164,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58174
58164
|
/**
|
|
58175
58165
|
* Clear only node formatting
|
|
58176
58166
|
* @category Command
|
|
58177
|
-
* @returns {Function} Command function
|
|
58178
58167
|
* @example
|
|
58179
|
-
* clearNodesFormat()
|
|
58168
|
+
* editor.commands.clearNodesFormat()
|
|
58180
58169
|
* @note Converts headings, lists, etc. to paragraphs but preserves text marks
|
|
58181
58170
|
*/
|
|
58182
58171
|
clearNodesFormat: () => ({ chain }) => {
|
|
@@ -58185,13 +58174,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58185
58174
|
/**
|
|
58186
58175
|
* Copy format from selection or apply copied format
|
|
58187
58176
|
* @category Command
|
|
58188
|
-
* @returns {Function} Command function
|
|
58189
58177
|
* @example
|
|
58190
|
-
*
|
|
58191
|
-
* copyFormat()
|
|
58192
|
-
*
|
|
58193
|
-
* // Second call: apply copied format to new selection
|
|
58194
|
-
* copyFormat()
|
|
58178
|
+
* editor.commands.copyFormat()
|
|
58195
58179
|
* @note Works like format painter - first click copies, second click applies
|
|
58196
58180
|
*/
|
|
58197
58181
|
copyFormat: () => ({ chain }) => {
|
|
@@ -58604,6 +58588,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58604
58588
|
}
|
|
58605
58589
|
const Gapcursor = Extension.create({
|
|
58606
58590
|
name: "gapCursor",
|
|
58591
|
+
addOptions() {
|
|
58592
|
+
return {};
|
|
58593
|
+
},
|
|
58607
58594
|
addPmPlugins() {
|
|
58608
58595
|
return [gapCursor()];
|
|
58609
58596
|
},
|
|
@@ -58944,6 +58931,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58944
58931
|
const SlashMenuPluginKey = new PluginKey("slashMenu");
|
|
58945
58932
|
const SlashMenu = Extension.create({
|
|
58946
58933
|
name: "slashMenu",
|
|
58934
|
+
addOptions() {
|
|
58935
|
+
return {};
|
|
58936
|
+
},
|
|
58947
58937
|
addPmPlugins() {
|
|
58948
58938
|
if (this.editor.options?.disableContextMenu) {
|
|
58949
58939
|
return [];
|
|
@@ -59081,11 +59071,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59081
59071
|
},
|
|
59082
59072
|
addAttributes() {
|
|
59083
59073
|
return {
|
|
59084
|
-
/**
|
|
59085
|
-
* @private
|
|
59086
|
-
* @category Attribute
|
|
59087
|
-
* @param {Object} [attributes] - Internal document attributes
|
|
59088
|
-
*/
|
|
59089
59074
|
attributes: {
|
|
59090
59075
|
rendered: false,
|
|
59091
59076
|
"aria-label": "Document node"
|
|
@@ -59097,10 +59082,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59097
59082
|
/**
|
|
59098
59083
|
* Get document statistics
|
|
59099
59084
|
* @category Command
|
|
59100
|
-
* @returns {Function} Command function
|
|
59101
59085
|
* @example
|
|
59102
59086
|
* // Get word and character count
|
|
59103
|
-
* getDocumentStats()
|
|
59087
|
+
* const stats = editor.commands.getDocumentStats()
|
|
59088
|
+
* console.log(`${stats.words} words, ${stats.characters} characters`)
|
|
59104
59089
|
* @note Returns word count, character count, and paragraph count
|
|
59105
59090
|
*/
|
|
59106
59091
|
getDocumentStats: () => ({ editor }) => {
|
|
@@ -59117,9 +59102,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59117
59102
|
/**
|
|
59118
59103
|
* Clear entire document
|
|
59119
59104
|
* @category Command
|
|
59120
|
-
* @returns {Function} Command function
|
|
59121
59105
|
* @example
|
|
59122
|
-
* clearDocument()
|
|
59106
|
+
* editor.commands.clearDocument()
|
|
59123
59107
|
* @note Replaces all content with an empty paragraph
|
|
59124
59108
|
*/
|
|
59125
59109
|
clearDocument: () => ({ commands: commands2 }) => {
|
|
@@ -59131,13 +59115,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59131
59115
|
const Text = Node$1.create({
|
|
59132
59116
|
name: "text",
|
|
59133
59117
|
group: "inline",
|
|
59134
|
-
inline: true
|
|
59118
|
+
inline: true,
|
|
59119
|
+
addOptions() {
|
|
59120
|
+
return {};
|
|
59121
|
+
}
|
|
59135
59122
|
});
|
|
59136
59123
|
const RunItem = Node$1.create({
|
|
59137
59124
|
name: "run",
|
|
59138
59125
|
group: "inline",
|
|
59139
59126
|
content: "text*",
|
|
59140
59127
|
inline: true,
|
|
59128
|
+
addOptions() {
|
|
59129
|
+
return {};
|
|
59130
|
+
},
|
|
59141
59131
|
parseDOM() {
|
|
59142
59132
|
return [{ tag: "run" }];
|
|
59143
59133
|
},
|
|
@@ -59163,14 +59153,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59163
59153
|
},
|
|
59164
59154
|
addOptions() {
|
|
59165
59155
|
return {
|
|
59166
|
-
/**
|
|
59167
|
-
* @typedef {Object} BulletListOptions
|
|
59168
|
-
* @category Options
|
|
59169
|
-
* @property {string} [itemTypeName='listItem'] - Name of the list item node type
|
|
59170
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the ul element
|
|
59171
|
-
* @property {boolean} [keepMarks=true] - Whether to preserve marks when splitting
|
|
59172
|
-
* @property {boolean} [keepAttributes=false] - Whether to preserve attributes when splitting
|
|
59173
|
-
*/
|
|
59174
59156
|
itemTypeName: "listItem",
|
|
59175
59157
|
htmlAttributes: {
|
|
59176
59158
|
"aria-label": "Bullet list node"
|
|
@@ -59188,27 +59170,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59188
59170
|
},
|
|
59189
59171
|
addAttributes() {
|
|
59190
59172
|
return {
|
|
59191
|
-
/**
|
|
59192
|
-
* @category Attribute
|
|
59193
|
-
* @param {string} [list-style-type='bullet'] - List style type for this list
|
|
59194
|
-
*/
|
|
59195
59173
|
"list-style-type": {
|
|
59196
59174
|
default: "bullet",
|
|
59197
59175
|
rendered: false
|
|
59198
59176
|
},
|
|
59199
|
-
/**
|
|
59200
|
-
* @private
|
|
59201
|
-
* @category Attribute
|
|
59202
|
-
* @param {string} [listId] - Internal list identifier for numbering
|
|
59203
|
-
*/
|
|
59204
59177
|
listId: {
|
|
59205
59178
|
rendered: false
|
|
59206
59179
|
},
|
|
59207
|
-
/**
|
|
59208
|
-
* @private
|
|
59209
|
-
* @category Attribute
|
|
59210
|
-
* @param {string} [sdBlockId] - Internal block tracking ID
|
|
59211
|
-
*/
|
|
59212
59180
|
sdBlockId: {
|
|
59213
59181
|
default: null,
|
|
59214
59182
|
keepOnSplit: false,
|
|
@@ -59217,11 +59185,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59217
59185
|
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
59218
59186
|
}
|
|
59219
59187
|
},
|
|
59220
|
-
/**
|
|
59221
|
-
* @private
|
|
59222
|
-
* @category Attribute
|
|
59223
|
-
* @param {Object} [attributes] - Additional attributes for the list
|
|
59224
|
-
*/
|
|
59225
59188
|
attributes: {
|
|
59226
59189
|
rendered: false,
|
|
59227
59190
|
keepOnSplit: true
|
|
@@ -59233,10 +59196,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59233
59196
|
/**
|
|
59234
59197
|
* Toggle a bullet list at the current selection
|
|
59235
59198
|
* @category Command
|
|
59236
|
-
* @returns {Function} Command function
|
|
59237
59199
|
* @example
|
|
59238
59200
|
* // Toggle bullet list on selected text
|
|
59239
|
-
* toggleBulletList()
|
|
59201
|
+
* editor.commands.toggleBulletList()
|
|
59240
59202
|
* @note Converts selected paragraphs to list items or removes list formatting
|
|
59241
59203
|
*/
|
|
59242
59204
|
toggleBulletList: () => (params2) => {
|
|
@@ -59355,9 +59317,25 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59355
59317
|
},
|
|
59356
59318
|
addCommands() {
|
|
59357
59319
|
return {
|
|
59320
|
+
/**
|
|
59321
|
+
* Toggle ordered list formatting
|
|
59322
|
+
* @category Command
|
|
59323
|
+
* @example
|
|
59324
|
+
* editor.commands.toggleOrderedList()
|
|
59325
|
+
* @note Converts selection to ordered list or back to paragraphs
|
|
59326
|
+
*/
|
|
59358
59327
|
toggleOrderedList: () => (params2) => {
|
|
59359
59328
|
return toggleList(this.type)(params2);
|
|
59360
59329
|
},
|
|
59330
|
+
/**
|
|
59331
|
+
* Restart list node numbering
|
|
59332
|
+
* @category Command
|
|
59333
|
+
* @param {Array} followingNodes - Nodes to restart
|
|
59334
|
+
* @param {number} pos - Starting position
|
|
59335
|
+
* @example
|
|
59336
|
+
* editor.commands.restartListNodes(nodes, position)
|
|
59337
|
+
* @note Resets list numbering for specified nodes
|
|
59338
|
+
*/
|
|
59361
59339
|
restartListNodes: (followingNodes, pos) => ({ tr }) => {
|
|
59362
59340
|
let currentNodePos = pos;
|
|
59363
59341
|
const nodes = followingNodes.map((node) => {
|
|
@@ -59376,8 +59354,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59376
59354
|
return true;
|
|
59377
59355
|
},
|
|
59378
59356
|
/**
|
|
59379
|
-
*
|
|
59380
|
-
* @
|
|
59357
|
+
* Update ordered list style type based on nesting level
|
|
59358
|
+
* @category Command
|
|
59359
|
+
* @example
|
|
59360
|
+
* editor.commands.updateOrderedListStyleType()
|
|
59361
|
+
* @note Cycles through decimal -> lowerAlpha -> lowerRoman based on depth
|
|
59381
59362
|
*/
|
|
59382
59363
|
updateOrderedListStyleType: () => ({ dispatch, tr }) => {
|
|
59383
59364
|
let list = findParentNode((node) => node.type.name === this.name)(tr.selection);
|
|
@@ -59654,7 +59635,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59654
59635
|
* @returns {Function} Command function
|
|
59655
59636
|
* @example
|
|
59656
59637
|
* // Restore selection after toolbar interaction
|
|
59657
|
-
* restorePreservedSelection()
|
|
59638
|
+
* editor.commands.restorePreservedSelection()
|
|
59658
59639
|
* @note Used internally to maintain selection when interacting with toolbar
|
|
59659
59640
|
*/
|
|
59660
59641
|
restorePreservedSelection: () => ({ tr, state: state2 }) => {
|
|
@@ -59943,6 +59924,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59943
59924
|
name: "linkedStyles",
|
|
59944
59925
|
priority: 1,
|
|
59945
59926
|
// We need this plugin to run before the list plugins
|
|
59927
|
+
addOptions() {
|
|
59928
|
+
return {};
|
|
59929
|
+
},
|
|
59946
59930
|
addPmPlugins() {
|
|
59947
59931
|
return [createLinkedStylesPlugin(this.editor)];
|
|
59948
59932
|
},
|
|
@@ -59951,11 +59935,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59951
59935
|
/**
|
|
59952
59936
|
* Apply a linked style to the selected paragraphs
|
|
59953
59937
|
* @category Command
|
|
59954
|
-
* @param {
|
|
59955
|
-
* @returns {Function} Command function
|
|
59938
|
+
* @param {LinkedStyle} style - The style object to apply
|
|
59956
59939
|
* @example
|
|
59957
59940
|
* const style = editor.helpers.linkedStyles.getStyleById('Heading1');
|
|
59958
|
-
* setLinkedStyle(style);
|
|
59941
|
+
* editor.commands.setLinkedStyle(style);
|
|
59959
59942
|
* @note Clears existing formatting when applying a style
|
|
59960
59943
|
* @note Works with custom selection preservation
|
|
59961
59944
|
*/
|
|
@@ -59966,16 +59949,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59966
59949
|
/**
|
|
59967
59950
|
* Toggle a linked style on the current selection
|
|
59968
59951
|
* @category Command
|
|
59969
|
-
* @param {
|
|
59952
|
+
* @param {LinkedStyle} style - The linked style to apply (with id property)
|
|
59970
59953
|
* @param {string|null} [nodeType=null] - Node type to restrict toggle to (e.g., 'paragraph')
|
|
59971
|
-
* @returns {Function} Command function
|
|
59972
59954
|
* @example
|
|
59973
|
-
* // Toggle a heading style
|
|
59974
59955
|
* const style = editor.helpers.linkedStyles.getStyleById('Heading1');
|
|
59975
|
-
* toggleLinkedStyle(style)
|
|
59976
|
-
*
|
|
59977
|
-
* // Toggle only on paragraph nodes
|
|
59978
|
-
* toggleLinkedStyle(style, 'paragraph')
|
|
59956
|
+
* editor.commands.toggleLinkedStyle(style)
|
|
59957
|
+
* editor.commands.toggleLinkedStyle(style, 'paragraph')
|
|
59979
59958
|
* @note If selection is empty, returns false
|
|
59980
59959
|
* @note Removes style if already applied, applies it if not
|
|
59981
59960
|
*/
|
|
@@ -60003,13 +59982,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60003
59982
|
* Apply a linked style by its ID
|
|
60004
59983
|
* @category Command
|
|
60005
59984
|
* @param {string} styleId - The style ID to apply (e.g., 'Heading1')
|
|
60006
|
-
* @returns {Function} Command function
|
|
60007
59985
|
* @example
|
|
60008
|
-
*
|
|
60009
|
-
* setStyleById('
|
|
60010
|
-
*
|
|
60011
|
-
* // Apply a normal style
|
|
60012
|
-
* setStyleById('Normal')
|
|
59986
|
+
* editor.commands.setStyleById('Heading1')
|
|
59987
|
+
* editor.commands.setStyleById('Normal')
|
|
60013
59988
|
* @note Looks up the style from loaded Word styles
|
|
60014
59989
|
*/
|
|
60015
59990
|
setStyleById: (styleId) => (params2) => {
|
|
@@ -60717,12 +60692,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60717
60692
|
inline: false,
|
|
60718
60693
|
addOptions() {
|
|
60719
60694
|
return {
|
|
60720
|
-
/**
|
|
60721
|
-
* @typedef {Object} HeadingOptions
|
|
60722
|
-
* @category Options
|
|
60723
|
-
* @property {number[]} [headingLevels=[1,2,3,4,5,6]] - Supported heading levels
|
|
60724
|
-
* @property {Object} [htmlAttributes] - HTML attributes for paragraph elements
|
|
60725
|
-
*/
|
|
60726
60695
|
headingLevels: [1, 2, 3, 4, 5, 6],
|
|
60727
60696
|
htmlAttributes: {}
|
|
60728
60697
|
};
|
|
@@ -60954,11 +60923,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60954
60923
|
name: "heading",
|
|
60955
60924
|
addOptions() {
|
|
60956
60925
|
return {
|
|
60957
|
-
/**
|
|
60958
|
-
* @typedef {Object} HeadingOptions
|
|
60959
|
-
* @category Options
|
|
60960
|
-
* @property {number[]} [levels=[1,2,3,4,5,6]] - Supported heading levels
|
|
60961
|
-
*/
|
|
60962
60926
|
levels: [1, 2, 3, 4, 5, 6]
|
|
60963
60927
|
};
|
|
60964
60928
|
},
|
|
@@ -60968,10 +60932,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60968
60932
|
* Set a heading with specified level
|
|
60969
60933
|
* @category Command
|
|
60970
60934
|
* @param {HeadingAttributes} attributes - Heading attributes including level
|
|
60971
|
-
* @returns {Function} Command function
|
|
60972
60935
|
* @example
|
|
60973
|
-
*
|
|
60974
|
-
* setHeading({ level: 2 })
|
|
60936
|
+
* editor.commands.setHeading({ level: 2 })
|
|
60975
60937
|
* @note Converts current block to heading
|
|
60976
60938
|
*/
|
|
60977
60939
|
setHeading: (attributes) => ({ commands: commands2 }) => {
|
|
@@ -60983,13 +60945,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60983
60945
|
* Toggle between heading and paragraph
|
|
60984
60946
|
* @category Command
|
|
60985
60947
|
* @param {HeadingAttributes} attributes - Heading attributes including level
|
|
60986
|
-
* @returns {Function} Command function
|
|
60987
60948
|
* @example
|
|
60988
|
-
*
|
|
60989
|
-
* toggleHeading({ level:
|
|
60990
|
-
*
|
|
60991
|
-
* // Toggle heading level 3
|
|
60992
|
-
* toggleHeading({ level: 3 })
|
|
60949
|
+
* editor.commands.toggleHeading({ level: 1 })
|
|
60950
|
+
* editor.commands.toggleHeading({ level: 3 })
|
|
60993
60951
|
* @note Switches between heading and paragraph for the same level
|
|
60994
60952
|
*/
|
|
60995
60953
|
toggleHeading: (attributes) => ({ commands: commands2 }) => {
|
|
@@ -61394,6 +61352,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61394
61352
|
selectable: false,
|
|
61395
61353
|
content: "",
|
|
61396
61354
|
atom: true,
|
|
61355
|
+
addOptions() {
|
|
61356
|
+
return {};
|
|
61357
|
+
},
|
|
61397
61358
|
parseDOM() {
|
|
61398
61359
|
return [{ tag: "br" }];
|
|
61399
61360
|
},
|
|
@@ -61402,17 +61363,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61402
61363
|
},
|
|
61403
61364
|
addAttributes() {
|
|
61404
61365
|
return {
|
|
61405
|
-
/**
|
|
61406
|
-
* @private
|
|
61407
|
-
* @category Attribute
|
|
61408
|
-
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
61409
|
-
*/
|
|
61410
61366
|
lineBreakType: { rendered: false },
|
|
61411
|
-
/**
|
|
61412
|
-
* @private
|
|
61413
|
-
* @category Attribute
|
|
61414
|
-
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
61415
|
-
*/
|
|
61416
61367
|
clear: { rendered: false }
|
|
61417
61368
|
};
|
|
61418
61369
|
},
|
|
@@ -61421,9 +61372,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61421
61372
|
/**
|
|
61422
61373
|
* Insert a line break
|
|
61423
61374
|
* @category Command
|
|
61424
|
-
* @returns {Function} Command function
|
|
61425
61375
|
* @example
|
|
61426
|
-
* insertLineBreak()
|
|
61376
|
+
* editor.commands.insertLineBreak()
|
|
61427
61377
|
* @note Creates a soft break within the same paragraph
|
|
61428
61378
|
*/
|
|
61429
61379
|
insertLineBreak: () => ({ commands: commands2 }) => {
|
|
@@ -61440,11 +61390,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61440
61390
|
atom: true,
|
|
61441
61391
|
addOptions() {
|
|
61442
61392
|
return {
|
|
61443
|
-
/**
|
|
61444
|
-
* @typedef {Object} HardBreakOptions
|
|
61445
|
-
* @category Options
|
|
61446
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the break element
|
|
61447
|
-
*/
|
|
61448
61393
|
htmlAttributes: {
|
|
61449
61394
|
contentEditable: "false",
|
|
61450
61395
|
lineBreakType: "page",
|
|
@@ -61455,35 +61400,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61455
61400
|
},
|
|
61456
61401
|
addAttributes() {
|
|
61457
61402
|
return {
|
|
61458
|
-
/**
|
|
61459
|
-
* @private
|
|
61460
|
-
* @category Attribute
|
|
61461
|
-
* @param {string} [pageBreakSource] - Source of the page break
|
|
61462
|
-
*/
|
|
61463
61403
|
pageBreakSource: {
|
|
61464
61404
|
rendered: false,
|
|
61465
61405
|
default: null
|
|
61466
61406
|
},
|
|
61467
|
-
/**
|
|
61468
|
-
* @private
|
|
61469
|
-
* @category Attribute
|
|
61470
|
-
* @param {string} [pageBreakType] - Type of page break
|
|
61471
|
-
*/
|
|
61472
61407
|
pageBreakType: {
|
|
61473
61408
|
default: null,
|
|
61474
61409
|
rendered: false
|
|
61475
61410
|
},
|
|
61476
|
-
/**
|
|
61477
|
-
* @private
|
|
61478
|
-
* @category Attribute
|
|
61479
|
-
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
61480
|
-
*/
|
|
61481
61411
|
lineBreakType: { rendered: false },
|
|
61482
|
-
/**
|
|
61483
|
-
* @private
|
|
61484
|
-
* @category Attribute
|
|
61485
|
-
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
61486
|
-
*/
|
|
61487
61412
|
clear: { rendered: false }
|
|
61488
61413
|
};
|
|
61489
61414
|
},
|
|
@@ -61509,9 +61434,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61509
61434
|
/**
|
|
61510
61435
|
* Insert a page break
|
|
61511
61436
|
* @category Command
|
|
61512
|
-
* @returns {Function} Command function
|
|
61513
61437
|
* @example
|
|
61514
|
-
* insertPageBreak()
|
|
61438
|
+
* editor.commands.insertPageBreak()
|
|
61515
61439
|
* @note Forces content to start on a new page when printed
|
|
61516
61440
|
*/
|
|
61517
61441
|
insertPageBreak: () => ({ commands: commands2 }) => {
|
|
@@ -63901,17 +63825,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63901
63825
|
group: "block",
|
|
63902
63826
|
isolating: true,
|
|
63903
63827
|
tableRole: "table",
|
|
63904
|
-
/**
|
|
63905
|
-
* Table extension options
|
|
63906
|
-
* @category Options
|
|
63907
|
-
* @typedef {Object} TableOptions
|
|
63908
|
-
* @property {Object} [htmlAttributes={'aria-label': 'Table node'}] - Default HTML attributes for all tables
|
|
63909
|
-
* @property {boolean} [resizable=true] - Enable column resizing functionality
|
|
63910
|
-
* @property {number} [handleWidth=5] - Width of resize handles in pixels
|
|
63911
|
-
* @property {number} [cellMinWidth=10] - Minimum cell width constraint in pixels
|
|
63912
|
-
* @property {boolean} [lastColumnResizable=true] - Allow resizing of the last column
|
|
63913
|
-
* @property {boolean} [allowTableNodeSelection=false] - Enable selecting the entire table node
|
|
63914
|
-
*/
|
|
63915
63828
|
addOptions() {
|
|
63916
63829
|
return {
|
|
63917
63830
|
htmlAttributes: {
|
|
@@ -64069,14 +63982,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64069
63982
|
* Insert a new table into the document
|
|
64070
63983
|
* @category Command
|
|
64071
63984
|
* @param {TableConfig} [config] - Table configuration options
|
|
64072
|
-
* @returns {Function} Command
|
|
64073
63985
|
* @example
|
|
64074
|
-
*
|
|
64075
|
-
* insertTable(
|
|
64076
|
-
*
|
|
64077
|
-
* // Using custom values
|
|
64078
|
-
* insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
64079
|
-
*
|
|
63986
|
+
* editor.commands.insertTable()
|
|
63987
|
+
* editor.commands.insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
64080
63988
|
*/
|
|
64081
63989
|
insertTable: ({ rows = 3, cols = 3, withHeaderRow = false } = {}) => ({ tr, dispatch, editor }) => {
|
|
64082
63990
|
const node = createTable(editor.schema, rows, cols, withHeaderRow);
|
|
@@ -64089,9 +63997,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64089
63997
|
/**
|
|
64090
63998
|
* Delete the entire table containing the cursor
|
|
64091
63999
|
* @category Command
|
|
64092
|
-
* @returns {Function} Command
|
|
64093
64000
|
* @example
|
|
64094
|
-
* deleteTable()
|
|
64001
|
+
* editor.commands.deleteTable()
|
|
64095
64002
|
*/
|
|
64096
64003
|
deleteTable: () => ({ state: state2, dispatch }) => {
|
|
64097
64004
|
return deleteTable(state2, dispatch);
|
|
@@ -64099,9 +64006,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64099
64006
|
/**
|
|
64100
64007
|
* Add a column before the current column
|
|
64101
64008
|
* @category Command
|
|
64102
|
-
* @returns {Function} Command
|
|
64103
64009
|
* @example
|
|
64104
|
-
* addColumnBefore()
|
|
64010
|
+
* editor.commands.addColumnBefore()
|
|
64105
64011
|
* @note Preserves cell attributes from current column
|
|
64106
64012
|
*/
|
|
64107
64013
|
addColumnBefore: () => ({ state: state2, dispatch, chain }) => {
|
|
@@ -64478,10 +64384,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64478
64384
|
* Set background color for selected cells
|
|
64479
64385
|
* @category Command
|
|
64480
64386
|
* @param {string} value - Color value (hex with or without #)
|
|
64481
|
-
* @returns {Function} Command
|
|
64482
64387
|
* @example
|
|
64483
|
-
* setCellBackground('#ff0000')
|
|
64484
|
-
* setCellBackground('ff0000')
|
|
64388
|
+
* editor.commands.setCellBackground('#ff0000')
|
|
64389
|
+
* editor.commands.setCellBackground('ff0000')
|
|
64485
64390
|
*/
|
|
64486
64391
|
setCellBackground: (value) => ({ editor, commands: commands2, dispatch }) => {
|
|
64487
64392
|
const { selection } = editor.state;
|
|
@@ -64607,24 +64512,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64607
64512
|
},
|
|
64608
64513
|
addAttributes() {
|
|
64609
64514
|
return {
|
|
64610
|
-
/**
|
|
64611
|
-
* @category Attribute
|
|
64612
|
-
* @param {number} [colspan=1] - Number of columns this header spans
|
|
64613
|
-
*/
|
|
64614
64515
|
colspan: {
|
|
64615
64516
|
default: 1
|
|
64616
64517
|
},
|
|
64617
|
-
/**
|
|
64618
|
-
* @category Attribute
|
|
64619
|
-
* @param {number} [rowspan=1] - Number of rows this header spans
|
|
64620
|
-
*/
|
|
64621
64518
|
rowspan: {
|
|
64622
64519
|
default: 1
|
|
64623
64520
|
},
|
|
64624
|
-
/**
|
|
64625
|
-
* @category Attribute
|
|
64626
|
-
* @param {number[]} [colwidth] - Column widths array in pixels
|
|
64627
|
-
*/
|
|
64628
64521
|
colwidth: {
|
|
64629
64522
|
default: null,
|
|
64630
64523
|
parseDOM: (element) => {
|
|
@@ -64661,10 +64554,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64661
64554
|
},
|
|
64662
64555
|
addAttributes() {
|
|
64663
64556
|
return {
|
|
64664
|
-
/**
|
|
64665
|
-
* @category Attribute
|
|
64666
|
-
* @param {number} [rowHeight] - Fixed row height in pixels
|
|
64667
|
-
*/
|
|
64668
64557
|
rowHeight: {
|
|
64669
64558
|
renderDOM({ rowHeight }) {
|
|
64670
64559
|
if (!rowHeight) return {};
|
|
@@ -64672,11 +64561,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64672
64561
|
return { style: style2 };
|
|
64673
64562
|
}
|
|
64674
64563
|
},
|
|
64675
|
-
/**
|
|
64676
|
-
* Indicates that this row should not be split across pages when paginating/exporting.
|
|
64677
|
-
* @category Attribute
|
|
64678
|
-
* @param {boolean} [cantSplit]
|
|
64679
|
-
*/
|
|
64680
64564
|
cantSplit: {
|
|
64681
64565
|
default: false,
|
|
64682
64566
|
parseDOM() {
|
|
@@ -64688,44 +64572,30 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64688
64572
|
}
|
|
64689
64573
|
},
|
|
64690
64574
|
/**
|
|
64691
|
-
* @category Attribute
|
|
64692
|
-
* @param {TableRowProperties} [tableRowProperties] - Properties for the table row.
|
|
64693
64575
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 377-482
|
|
64694
64576
|
*/
|
|
64695
64577
|
tableRowProperties: { rendered: false },
|
|
64696
64578
|
/**
|
|
64697
|
-
* @category Attribute
|
|
64698
|
-
* @param {string} [rsidDel] - Unique identifier used to track the editing session when the row was deleted from the main document.
|
|
64699
64579
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
64700
64580
|
*/
|
|
64701
64581
|
rsidDel: { rendered: false },
|
|
64702
64582
|
/**
|
|
64703
|
-
* @category Attribute
|
|
64704
|
-
* @param {string} [rsidR] - Unique identifier used to track the editing session when the table row was added to the main document.
|
|
64705
64583
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
64706
64584
|
*/
|
|
64707
64585
|
rsidR: { rendered: false },
|
|
64708
64586
|
/**
|
|
64709
|
-
* @category Attribute
|
|
64710
|
-
* @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.
|
|
64711
64587
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
64712
64588
|
*/
|
|
64713
64589
|
rsidRPr: { rendered: false },
|
|
64714
64590
|
/**
|
|
64715
|
-
* @category Attribute
|
|
64716
|
-
* @param {string} [rsidTr] - Unique identifier used to track the editing session when the table row's properties were last modified in this document.
|
|
64717
64591
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
64718
64592
|
*/
|
|
64719
64593
|
rsidTr: { rendered: false },
|
|
64720
64594
|
/**
|
|
64721
|
-
* @category Attribute
|
|
64722
|
-
* @param {string} [paraId] - A randomly generated unique identifier for the table row.
|
|
64723
64595
|
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/a0e7d2e2-2246-44c6-96e8-1cf009823615}
|
|
64724
64596
|
*/
|
|
64725
64597
|
paraId: { rendered: false },
|
|
64726
64598
|
/**
|
|
64727
|
-
* @category Attribute
|
|
64728
|
-
* @param {string} [textId] - A randomly generated unique identifier for the text of the table row.
|
|
64729
64599
|
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/b7eeddec-7c50-47fb-88b6-1feec3ed832c}
|
|
64730
64600
|
*/
|
|
64731
64601
|
textId: { rendered: false }
|
|
@@ -64752,24 +64622,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64752
64622
|
},
|
|
64753
64623
|
addAttributes() {
|
|
64754
64624
|
return {
|
|
64755
|
-
/**
|
|
64756
|
-
* @category Attribute
|
|
64757
|
-
* @param {number} [colspan=1] - Number of columns this cell spans
|
|
64758
|
-
*/
|
|
64759
64625
|
colspan: {
|
|
64760
64626
|
default: 1
|
|
64761
64627
|
},
|
|
64762
|
-
/**
|
|
64763
|
-
* @category Attribute
|
|
64764
|
-
* @param {number} [rowspan=1] - Number of rows this cell spans
|
|
64765
|
-
*/
|
|
64766
64628
|
rowspan: {
|
|
64767
64629
|
default: 1
|
|
64768
64630
|
},
|
|
64769
|
-
/**
|
|
64770
|
-
* @category Attribute
|
|
64771
|
-
* @param {number[]} [colwidth=[100]] - Column widths array in pixels
|
|
64772
|
-
*/
|
|
64773
64631
|
colwidth: {
|
|
64774
64632
|
default: [100],
|
|
64775
64633
|
parseDOM: (elem) => {
|
|
@@ -64784,10 +64642,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64784
64642
|
};
|
|
64785
64643
|
}
|
|
64786
64644
|
},
|
|
64787
|
-
/**
|
|
64788
|
-
* @category Attribute
|
|
64789
|
-
* @param {CellBackground} [background] - Cell background color configuration
|
|
64790
|
-
*/
|
|
64791
64645
|
background: {
|
|
64792
64646
|
renderDOM({ background }) {
|
|
64793
64647
|
if (!background) return {};
|
|
@@ -64796,10 +64650,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64796
64650
|
return { style: style2 };
|
|
64797
64651
|
}
|
|
64798
64652
|
},
|
|
64799
|
-
/**
|
|
64800
|
-
* @category Attribute
|
|
64801
|
-
* @param {string} [verticalAlign] - Vertical content alignment (top, middle, bottom)
|
|
64802
|
-
*/
|
|
64803
64653
|
verticalAlign: {
|
|
64804
64654
|
renderDOM({ verticalAlign }) {
|
|
64805
64655
|
if (!verticalAlign) return {};
|
|
@@ -64807,10 +64657,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64807
64657
|
return { style: style2 };
|
|
64808
64658
|
}
|
|
64809
64659
|
},
|
|
64810
|
-
/**
|
|
64811
|
-
* @category Attribute
|
|
64812
|
-
* @param {CellMargins} [cellMargins] - Internal cell padding
|
|
64813
|
-
*/
|
|
64814
64660
|
cellMargins: {
|
|
64815
64661
|
renderDOM({ cellMargins }) {
|
|
64816
64662
|
if (!cellMargins) return {};
|
|
@@ -64823,10 +64669,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64823
64669
|
return { style: style2 };
|
|
64824
64670
|
}
|
|
64825
64671
|
},
|
|
64826
|
-
/**
|
|
64827
|
-
* @category Attribute
|
|
64828
|
-
* @param {CellBorders} [borders] - Cell border configuration
|
|
64829
|
-
*/
|
|
64830
64672
|
borders: {
|
|
64831
64673
|
default: () => createCellBorders(),
|
|
64832
64674
|
renderDOM({ borders }) {
|
|
@@ -64841,20 +64683,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64841
64683
|
return { style: style2 };
|
|
64842
64684
|
}
|
|
64843
64685
|
},
|
|
64844
|
-
/**
|
|
64845
|
-
* @private
|
|
64846
|
-
* @category Attribute
|
|
64847
|
-
* @param {string} [widthType='auto'] - Internal width type
|
|
64848
|
-
*/
|
|
64849
64686
|
widthType: {
|
|
64850
64687
|
default: "auto",
|
|
64851
64688
|
rendered: false
|
|
64852
64689
|
},
|
|
64853
|
-
/**
|
|
64854
|
-
* @private
|
|
64855
|
-
* @category Attribute
|
|
64856
|
-
* @param {string} [widthUnit='px'] - Internal width unit
|
|
64857
|
-
*/
|
|
64858
64690
|
widthUnit: {
|
|
64859
64691
|
default: "px",
|
|
64860
64692
|
rendered: false
|
|
@@ -67057,6 +66889,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67057
66889
|
}
|
|
67058
66890
|
return null;
|
|
67059
66891
|
};
|
|
66892
|
+
const getRotationMargins = (w2, h2, angleDegrees) => {
|
|
66893
|
+
const rad = angleDegrees * (Math.PI / 180);
|
|
66894
|
+
const cos = Math.abs(Math.cos(rad));
|
|
66895
|
+
const sin = Math.abs(Math.sin(rad));
|
|
66896
|
+
const boundingWidth = w2 * cos + h2 * sin;
|
|
66897
|
+
const boundingHeight = w2 * sin + h2 * cos;
|
|
66898
|
+
const marginLeftRight = Math.round(Math.max(0, (boundingWidth - w2) / 2));
|
|
66899
|
+
const marginTopBottom = Math.round(Math.max(0, (boundingHeight - h2) / 2));
|
|
66900
|
+
return {
|
|
66901
|
+
horizontal: marginLeftRight,
|
|
66902
|
+
vertical: marginTopBottom
|
|
66903
|
+
};
|
|
66904
|
+
};
|
|
67060
66905
|
const Image = Node$1.create({
|
|
67061
66906
|
name: "image",
|
|
67062
66907
|
group: "inline",
|
|
@@ -67078,10 +66923,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67078
66923
|
},
|
|
67079
66924
|
addAttributes() {
|
|
67080
66925
|
return {
|
|
67081
|
-
/**
|
|
67082
|
-
* @category Attribute
|
|
67083
|
-
* @param {string} [src] - Image source URL or path
|
|
67084
|
-
*/
|
|
67085
66926
|
src: {
|
|
67086
66927
|
default: null,
|
|
67087
66928
|
renderDOM: ({ src }) => {
|
|
@@ -67090,95 +66931,75 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67090
66931
|
};
|
|
67091
66932
|
}
|
|
67092
66933
|
},
|
|
67093
|
-
/**
|
|
67094
|
-
* @category Attribute
|
|
67095
|
-
* @param {string} [alt='Uploaded picture'] - Alternative text for accessibility
|
|
67096
|
-
*/
|
|
67097
66934
|
alt: {
|
|
67098
66935
|
default: "Uploaded picture"
|
|
67099
66936
|
},
|
|
67100
|
-
/**
|
|
67101
|
-
* @category Attribute
|
|
67102
|
-
* @param {string} [id] - Image element ID
|
|
67103
|
-
* @private
|
|
67104
|
-
*/
|
|
67105
66937
|
id: { rendered: false },
|
|
67106
|
-
/**
|
|
67107
|
-
* @category Attribute
|
|
67108
|
-
* @param {string} [title] - Image title/tooltip text
|
|
67109
|
-
*/
|
|
67110
66938
|
title: {
|
|
67111
66939
|
default: null
|
|
67112
66940
|
},
|
|
67113
|
-
/**
|
|
67114
|
-
* @category Attribute
|
|
67115
|
-
* @param {string} [rId] - Relationship ID for Word export
|
|
67116
|
-
* @private
|
|
67117
|
-
*/
|
|
67118
66941
|
rId: {
|
|
67119
66942
|
default: null,
|
|
67120
66943
|
rendered: false
|
|
67121
66944
|
},
|
|
67122
|
-
/**
|
|
67123
|
-
* @category Attribute
|
|
67124
|
-
* @param {Object} [originalPadding] - Original padding values from Word import
|
|
67125
|
-
* @private
|
|
67126
|
-
*/
|
|
67127
66945
|
originalPadding: {
|
|
67128
66946
|
default: null,
|
|
67129
66947
|
rendered: false
|
|
67130
66948
|
},
|
|
67131
|
-
/**
|
|
67132
|
-
* @category Attribute
|
|
67133
|
-
* @param {Object} [originalAttributes] - Original attributes from Word import
|
|
67134
|
-
* @private
|
|
67135
|
-
*/
|
|
67136
66949
|
originalAttributes: { rendered: false },
|
|
67137
|
-
/**
|
|
67138
|
-
* @category Attribute
|
|
67139
|
-
* @param {boolean} [wrapTopAndBottom] - Wrap text above and below image
|
|
67140
|
-
* @private
|
|
67141
|
-
*/
|
|
67142
66950
|
wrapTopAndBottom: { rendered: false },
|
|
67143
|
-
/**
|
|
67144
|
-
* @category Attribute
|
|
67145
|
-
* @param {Object} [anchorData] - Anchor positioning data for Word
|
|
67146
|
-
* @private
|
|
67147
|
-
*/
|
|
67148
66951
|
anchorData: {
|
|
67149
66952
|
default: null,
|
|
67150
66953
|
rendered: false
|
|
67151
66954
|
},
|
|
66955
|
+
isAnchor: { rendered: false },
|
|
67152
66956
|
/**
|
|
67153
66957
|
* @category Attribute
|
|
67154
|
-
* @param {
|
|
66958
|
+
* @param {Object} [transformData] - Transform data for image (turn and flip)
|
|
66959
|
+
* @param {number} [transformData.rotation] - Turn angle in degrees
|
|
66960
|
+
* @param {boolean} [transformData.verticalFlip] - Whether to flip vertically
|
|
66961
|
+
* @param {boolean} [transformData.horizontalFlip] - Whether to flip horizontally
|
|
66962
|
+
* @param {Object} [transformData.sizeExtension] - Size extension for image due to transformation
|
|
66963
|
+
* @param {number} [transformData.sizeExtension.left] - Left size extension for image
|
|
66964
|
+
* @param {number} [transformData.sizeExtension.top] - Top size extension for image
|
|
66965
|
+
* @param {number} [transformData.sizeExtension.right] - Right size extension for image
|
|
66966
|
+
* @param {number} [transformData.sizeExtension.bottom] - Bottom size extension for image
|
|
66967
|
+
*
|
|
67155
66968
|
* @private
|
|
67156
66969
|
*/
|
|
67157
|
-
|
|
66970
|
+
transformData: {
|
|
66971
|
+
default: {},
|
|
66972
|
+
renderDOM: ({ transformData }) => {
|
|
66973
|
+
let style2 = "";
|
|
66974
|
+
if (transformData?.rotation) {
|
|
66975
|
+
style2 += `rotate(${Math.round(transformData.rotation)}deg) `;
|
|
66976
|
+
}
|
|
66977
|
+
if (transformData?.verticalFlip) {
|
|
66978
|
+
style2 += "scaleY(-1) ";
|
|
66979
|
+
}
|
|
66980
|
+
if (transformData?.horizontalFlip) {
|
|
66981
|
+
style2 += "scaleX(-1) ";
|
|
66982
|
+
}
|
|
66983
|
+
style2 = style2.trim();
|
|
66984
|
+
if (style2.length > 0) {
|
|
66985
|
+
return { style: `transform: ${style2};` };
|
|
66986
|
+
}
|
|
66987
|
+
return;
|
|
66988
|
+
}
|
|
66989
|
+
},
|
|
67158
66990
|
/**
|
|
67159
66991
|
* @category Attribute
|
|
67160
66992
|
* @param {boolean} [simplePos] - Simple positioning flag
|
|
67161
66993
|
* @private
|
|
67162
66994
|
*/
|
|
67163
66995
|
simplePos: { rendered: false },
|
|
67164
|
-
/**
|
|
67165
|
-
* @category Attribute
|
|
67166
|
-
* @param {string} [wrapText] - Text wrapping style
|
|
67167
|
-
* @private
|
|
67168
|
-
*/
|
|
67169
66996
|
wrapText: { rendered: false },
|
|
67170
66997
|
extension: { rendered: false },
|
|
67171
|
-
/**
|
|
67172
|
-
* @category Attribute
|
|
67173
|
-
* @param {Object} [size] - Image dimensions
|
|
67174
|
-
* @param {number} [size.width] - Width in pixels
|
|
67175
|
-
* @param {number} [size.height] - Height in pixels
|
|
67176
|
-
*/
|
|
67177
66998
|
size: {
|
|
67178
66999
|
default: {},
|
|
67179
67000
|
renderDOM: ({ size: size2, extension }) => {
|
|
67180
67001
|
let style2 = "";
|
|
67181
|
-
|
|
67002
|
+
let { width, height } = size2 ?? {};
|
|
67182
67003
|
if (width) style2 += `width: ${width}px;`;
|
|
67183
67004
|
if (height && ["emf", "wmf"].includes(extension))
|
|
67184
67005
|
style2 += `height: ${height}px; border: 1px solid black; position: absolute;`;
|
|
@@ -67186,51 +67007,58 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67186
67007
|
return { style: style2 };
|
|
67187
67008
|
}
|
|
67188
67009
|
},
|
|
67189
|
-
/**
|
|
67190
|
-
* @category Attribute
|
|
67191
|
-
* @param {Object} [padding] - Image padding/margins
|
|
67192
|
-
* @param {number} [padding.left] - Left padding in pixels
|
|
67193
|
-
* @param {number} [padding.top] - Top padding in pixels
|
|
67194
|
-
* @param {number} [padding.bottom] - Bottom padding in pixels
|
|
67195
|
-
* @param {number} [padding.right] - Right padding in pixels
|
|
67196
|
-
*/
|
|
67197
67010
|
padding: {
|
|
67198
67011
|
default: {},
|
|
67199
|
-
renderDOM: ({ padding, marginOffset }) => {
|
|
67200
|
-
|
|
67012
|
+
renderDOM: ({ size: size2 = {}, padding, marginOffset, transformData }) => {
|
|
67013
|
+
let { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
|
|
67014
|
+
const { rotation } = transformData ?? {};
|
|
67015
|
+
const { height, width } = size2 ?? {};
|
|
67016
|
+
if (rotation && height && width) {
|
|
67017
|
+
const { horizontal, vertical } = getRotationMargins(width, height, rotation);
|
|
67018
|
+
left2 += horizontal;
|
|
67019
|
+
right2 += horizontal;
|
|
67020
|
+
top2 += vertical;
|
|
67021
|
+
bottom2 += vertical;
|
|
67022
|
+
}
|
|
67201
67023
|
let style2 = "";
|
|
67202
|
-
if (left2 &&
|
|
67203
|
-
if (top2 &&
|
|
67024
|
+
if (left2 && marginOffset?.left == null) style2 += `margin-left: ${left2}px;`;
|
|
67025
|
+
if (top2 && marginOffset?.top == null) style2 += `margin-top: ${top2}px;`;
|
|
67204
67026
|
if (bottom2) style2 += `margin-bottom: ${bottom2}px;`;
|
|
67205
67027
|
if (right2) style2 += `margin-right: ${right2}px;`;
|
|
67206
67028
|
return { style: style2 };
|
|
67207
67029
|
}
|
|
67208
67030
|
},
|
|
67209
|
-
/**
|
|
67210
|
-
* @category Attribute
|
|
67211
|
-
* @param {Object} [marginOffset] - Margin offset for anchored images
|
|
67212
|
-
* @param {number} [marginOffset.left] - Left margin offset
|
|
67213
|
-
* @param {number} [marginOffset.top] - Top margin offset
|
|
67214
|
-
*/
|
|
67215
67031
|
marginOffset: {
|
|
67216
67032
|
default: {},
|
|
67217
|
-
renderDOM: ({ marginOffset, anchorData }) => {
|
|
67033
|
+
renderDOM: ({ marginOffset, anchorData, transformData, size: size2 }) => {
|
|
67034
|
+
const hasAnchorData = Boolean(anchorData);
|
|
67035
|
+
const hasMarginOffsets = marginOffset?.left != null || marginOffset?.top != null;
|
|
67036
|
+
if (!hasAnchorData && !hasMarginOffsets) return {};
|
|
67218
67037
|
const relativeFromPageV = anchorData?.vRelativeFrom === "page";
|
|
67219
67038
|
const maxMarginV = 500;
|
|
67220
|
-
const
|
|
67039
|
+
const baseLeft = marginOffset?.left ?? 0;
|
|
67040
|
+
const baseTop = marginOffset?.top ?? 0;
|
|
67041
|
+
let rotationLeft = 0;
|
|
67042
|
+
let rotationTop = 0;
|
|
67043
|
+
const { rotation } = transformData ?? {};
|
|
67044
|
+
const { height, width } = size2 ?? {};
|
|
67045
|
+
if (rotation && height && width) {
|
|
67046
|
+
const { horizontal, vertical } = getRotationMargins(width, height, rotation);
|
|
67047
|
+
rotationLeft = horizontal;
|
|
67048
|
+
rotationTop = vertical;
|
|
67049
|
+
}
|
|
67050
|
+
const left2 = baseLeft + rotationLeft;
|
|
67051
|
+
const top2 = baseTop + rotationTop;
|
|
67221
67052
|
let style2 = "";
|
|
67222
67053
|
if (left2) style2 += `margin-left: ${left2}px;`;
|
|
67223
67054
|
if (top2) {
|
|
67224
67055
|
if (relativeFromPageV && top2 >= maxMarginV) style2 += `margin-top: ${maxMarginV}px;`;
|
|
67225
67056
|
else style2 += `margin-top: ${top2}px;`;
|
|
67226
67057
|
}
|
|
67058
|
+
if (!style2) return {};
|
|
67227
67059
|
return { style: style2 };
|
|
67228
67060
|
}
|
|
67229
67061
|
},
|
|
67230
|
-
/**
|
|
67231
|
-
* @category Attribute
|
|
67232
|
-
* @param {string} [style] - Custom inline CSS styles
|
|
67233
|
-
*/
|
|
67234
67062
|
style: {
|
|
67235
67063
|
default: null,
|
|
67236
67064
|
rendered: true,
|
|
@@ -67256,18 +67084,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67256
67084
|
/**
|
|
67257
67085
|
* Insert an image at the current position
|
|
67258
67086
|
* @category Command
|
|
67259
|
-
* @param {
|
|
67260
|
-
* @param {string} options.src - Image source URL or data URI
|
|
67261
|
-
* @param {string} [options.alt] - Alternative text
|
|
67262
|
-
* @param {string} [options.title] - Image title
|
|
67263
|
-
* @param {Object} [options.size] - Image dimensions
|
|
67264
|
-
* @returns {Function} Command function
|
|
67087
|
+
* @param {ImageInsertOptions} options - Image insertion options
|
|
67265
67088
|
* @example
|
|
67266
|
-
*
|
|
67267
|
-
* setImage({
|
|
67268
|
-
*
|
|
67269
|
-
* // Insert a base64 encoded image
|
|
67270
|
-
* setImage({
|
|
67089
|
+
* editor.commands.setImage({ src: 'https://example.com/image.jpg' })
|
|
67090
|
+
* editor.commands.setImage({
|
|
67271
67091
|
* src: 'data:image/png;base64,...',
|
|
67272
67092
|
* alt: 'Company logo',
|
|
67273
67093
|
* size: { width: 200 }
|
|
@@ -67484,6 +67304,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67484
67304
|
},
|
|
67485
67305
|
addCommands() {
|
|
67486
67306
|
return {
|
|
67307
|
+
/**
|
|
67308
|
+
* Insert an automatic page number
|
|
67309
|
+
* @category Command
|
|
67310
|
+
* @returns {Function} Command function
|
|
67311
|
+
* @example
|
|
67312
|
+
* editor.commands.addAutoPageNumber()
|
|
67313
|
+
* @note Only works in header/footer contexts
|
|
67314
|
+
*/
|
|
67487
67315
|
addAutoPageNumber: () => ({ tr, dispatch, state: state2, editor }) => {
|
|
67488
67316
|
const { options } = editor;
|
|
67489
67317
|
if (!options.isHeaderOrFooter) return false;
|
|
@@ -67546,6 +67374,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67546
67374
|
},
|
|
67547
67375
|
addCommands() {
|
|
67548
67376
|
return {
|
|
67377
|
+
/**
|
|
67378
|
+
* Insert total page count
|
|
67379
|
+
* @category Command
|
|
67380
|
+
* @returns {Function} Command function
|
|
67381
|
+
* @example
|
|
67382
|
+
* editor.commands.addTotalPageCount()
|
|
67383
|
+
* @note Only works in header/footer contexts
|
|
67384
|
+
*/
|
|
67549
67385
|
addTotalPageCount: () => ({ tr, dispatch, state: state2, editor }) => {
|
|
67550
67386
|
const { options } = editor;
|
|
67551
67387
|
if (!options.isHeaderOrFooter) return false;
|
|
@@ -67812,11 +67648,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67812
67648
|
inline: true,
|
|
67813
67649
|
addOptions() {
|
|
67814
67650
|
return {
|
|
67815
|
-
/**
|
|
67816
|
-
* @typedef {Object} ContentBlockOptions
|
|
67817
|
-
* @category Options
|
|
67818
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the block element
|
|
67819
|
-
*/
|
|
67820
67651
|
htmlAttributes: {
|
|
67821
67652
|
contenteditable: false
|
|
67822
67653
|
}
|
|
@@ -67824,10 +67655,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67824
67655
|
},
|
|
67825
67656
|
addAttributes() {
|
|
67826
67657
|
return {
|
|
67827
|
-
/**
|
|
67828
|
-
* @category Attribute
|
|
67829
|
-
* @param {boolean} [horizontalRule=false] - Whether this block is a horizontal rule
|
|
67830
|
-
*/
|
|
67831
67658
|
horizontalRule: {
|
|
67832
67659
|
default: false,
|
|
67833
67660
|
renderDOM: ({ horizontalRule }) => {
|
|
@@ -67835,10 +67662,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67835
67662
|
return { "data-horizontal-rule": "true" };
|
|
67836
67663
|
}
|
|
67837
67664
|
},
|
|
67838
|
-
/**
|
|
67839
|
-
* @category Attribute
|
|
67840
|
-
* @param {ContentBlockSize} [size] - Size and position of the content block
|
|
67841
|
-
*/
|
|
67842
67665
|
size: {
|
|
67843
67666
|
default: null,
|
|
67844
67667
|
renderDOM: ({ size: size2 }) => {
|
|
@@ -67852,10 +67675,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67852
67675
|
return { style: style2 };
|
|
67853
67676
|
}
|
|
67854
67677
|
},
|
|
67855
|
-
/**
|
|
67856
|
-
* @category Attribute
|
|
67857
|
-
* @param {string} [background] - Background color for the block
|
|
67858
|
-
*/
|
|
67859
67678
|
background: {
|
|
67860
67679
|
default: null,
|
|
67861
67680
|
renderDOM: (attrs) => {
|
|
@@ -67865,19 +67684,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67865
67684
|
};
|
|
67866
67685
|
}
|
|
67867
67686
|
},
|
|
67868
|
-
/**
|
|
67869
|
-
* @private
|
|
67870
|
-
* @category Attribute
|
|
67871
|
-
* @param {Object} [drawingContent] - Internal drawing data
|
|
67872
|
-
*/
|
|
67873
67687
|
drawingContent: {
|
|
67874
67688
|
rendered: false
|
|
67875
67689
|
},
|
|
67876
|
-
/**
|
|
67877
|
-
* @private
|
|
67878
|
-
* @category Attribute
|
|
67879
|
-
* @param {Object} [attributes] - Additional internal attributes
|
|
67880
|
-
*/
|
|
67881
67690
|
attributes: {
|
|
67882
67691
|
rendered: false
|
|
67883
67692
|
}
|
|
@@ -67898,9 +67707,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67898
67707
|
/**
|
|
67899
67708
|
* Insert a horizontal rule
|
|
67900
67709
|
* @category Command
|
|
67901
|
-
* @returns {Function} Command function
|
|
67902
67710
|
* @example
|
|
67903
|
-
* insertHorizontalRule()
|
|
67711
|
+
* editor.commands.insertHorizontalRule()
|
|
67904
67712
|
* @note Creates a visual separator between content sections
|
|
67905
67713
|
*/
|
|
67906
67714
|
insertHorizontalRule: () => ({ commands: commands2 }) => {
|
|
@@ -67917,13 +67725,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67917
67725
|
* Insert a content block
|
|
67918
67726
|
* @category Command
|
|
67919
67727
|
* @param {ContentBlockConfig} config - Block configuration
|
|
67920
|
-
* @returns {Function} Command function
|
|
67921
67728
|
* @example
|
|
67922
67729
|
* // Insert a spacer block
|
|
67923
|
-
* insertContentBlock({ size: { height: 20 } })
|
|
67730
|
+
* editor.commands.insertContentBlock({ size: { height: 20 } })
|
|
67924
67731
|
*
|
|
67732
|
+
* @example
|
|
67925
67733
|
* // Insert a colored divider
|
|
67926
|
-
* insertContentBlock({
|
|
67734
|
+
* editor.commands.insertContentBlock({
|
|
67927
67735
|
* size: { width: '50%', height: 3 },
|
|
67928
67736
|
* background: '#3b82f6'
|
|
67929
67737
|
* })
|
|
@@ -68451,16 +68259,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68451
68259
|
},
|
|
68452
68260
|
addAttributes() {
|
|
68453
68261
|
return {
|
|
68454
|
-
/**
|
|
68455
|
-
* @category Attribute
|
|
68456
|
-
* @param {number} [id] - Unique section identifier
|
|
68457
|
-
*/
|
|
68458
68262
|
id: {},
|
|
68459
|
-
/**
|
|
68460
|
-
* @private
|
|
68461
|
-
* @category Attribute
|
|
68462
|
-
* @param {string} [sdBlockId] - Internal block tracking
|
|
68463
|
-
*/
|
|
68464
68263
|
sdBlockId: {
|
|
68465
68264
|
default: null,
|
|
68466
68265
|
keepOnSplit: false,
|
|
@@ -68469,25 +68268,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68469
68268
|
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
68470
68269
|
}
|
|
68471
68270
|
},
|
|
68472
|
-
/**
|
|
68473
|
-
* @category Attribute
|
|
68474
|
-
* @param {string} [title] - Section display label
|
|
68475
|
-
*/
|
|
68476
68271
|
title: {},
|
|
68477
|
-
/**
|
|
68478
|
-
* @category Attribute
|
|
68479
|
-
* @param {string} [description] - Section metadata
|
|
68480
|
-
*/
|
|
68481
68272
|
description: {},
|
|
68482
|
-
/**
|
|
68483
|
-
* @category Attribute
|
|
68484
|
-
* @param {string} [sectionType] - Business classification (e.g., 'legal', 'pricing')
|
|
68485
|
-
*/
|
|
68486
68273
|
sectionType: {},
|
|
68487
|
-
/**
|
|
68488
|
-
* @category Attribute
|
|
68489
|
-
* @param {boolean} [isLocked=false] - Lock state preventing edits
|
|
68490
|
-
*/
|
|
68491
68274
|
isLocked: { default: false }
|
|
68492
68275
|
};
|
|
68493
68276
|
},
|
|
@@ -68502,10 +68285,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68502
68285
|
* Create a lockable content section
|
|
68503
68286
|
* @category Command
|
|
68504
68287
|
* @param {SectionCreate} [options={}] - Section configuration
|
|
68505
|
-
* @returns {Function} Command - true if created, false if position invalid
|
|
68506
68288
|
* @example
|
|
68507
|
-
* createDocumentSection({
|
|
68508
|
-
* id:
|
|
68289
|
+
* editor.commands.createDocumentSection({
|
|
68290
|
+
* id: 1,
|
|
68509
68291
|
* title: 'Terms & Conditions',
|
|
68510
68292
|
* isLocked: true,
|
|
68511
68293
|
* html: '<p>Legal content...</p>'
|
|
@@ -68586,9 +68368,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68586
68368
|
/**
|
|
68587
68369
|
* Remove section wrapper at cursor, preserving its content
|
|
68588
68370
|
* @category Command
|
|
68589
|
-
* @returns {Function} Command - true if removed, false if no section at position
|
|
68590
68371
|
* @example
|
|
68591
|
-
* removeSectionAtSelection()
|
|
68372
|
+
* editor.commands.removeSectionAtSelection()
|
|
68592
68373
|
* @note Content stays in document, only section wrapper is removed
|
|
68593
68374
|
*/
|
|
68594
68375
|
removeSectionAtSelection: () => ({ tr, dispatch }) => {
|
|
@@ -68614,9 +68395,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68614
68395
|
* Delete section and all its content
|
|
68615
68396
|
* @category Command
|
|
68616
68397
|
* @param {number} id - Section to delete
|
|
68617
|
-
* @returns {Function} Command - true if deleted, false if ID doesn't exist
|
|
68618
68398
|
* @example
|
|
68619
|
-
* removeSectionById(123)
|
|
68399
|
+
* editor.commands.removeSectionById(123)
|
|
68620
68400
|
*/
|
|
68621
68401
|
removeSectionById: (id) => ({ tr, dispatch }) => {
|
|
68622
68402
|
const sections = SectionHelpers.getAllSections(this.editor);
|
|
@@ -68636,9 +68416,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68636
68416
|
* Lock section against edits
|
|
68637
68417
|
* @category Command
|
|
68638
68418
|
* @param {number} id - Section to lock
|
|
68639
|
-
* @returns {Function} Command - true if locked, false if ID doesn't exist
|
|
68640
68419
|
* @example
|
|
68641
|
-
* lockSectionById(123)
|
|
68420
|
+
* editor.commands.lockSectionById(123)
|
|
68642
68421
|
*/
|
|
68643
68422
|
lockSectionById: (id) => ({ tr, dispatch }) => {
|
|
68644
68423
|
const sections = SectionHelpers.getAllSections(this.editor);
|
|
@@ -68655,16 +68434,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68655
68434
|
* Modify section attributes or content
|
|
68656
68435
|
* @category Command
|
|
68657
68436
|
* @param {SectionUpdate} options - Changes to apply
|
|
68658
|
-
* @returns {Function} Command - true if updated, false if ID doesn't exist
|
|
68659
68437
|
* @example
|
|
68660
|
-
*
|
|
68661
|
-
* updateSectionById({ id: 123,
|
|
68662
|
-
*
|
|
68663
|
-
* // Replace content
|
|
68664
|
-
* updateSectionById({ id: 123, html: '<p>New content</p>' })
|
|
68665
|
-
*
|
|
68666
|
-
* // Both
|
|
68667
|
-
* updateSectionById({
|
|
68438
|
+
* editor.commands.updateSectionById({ id: 123, attrs: { isLocked: false } })
|
|
68439
|
+
* editor.commands.updateSectionById({ id: 123, html: '<p>New content</p>' })
|
|
68440
|
+
* editor.commands.updateSectionById({
|
|
68668
68441
|
* id: 123,
|
|
68669
68442
|
* html: '<p>Updated</p>',
|
|
68670
68443
|
* attrs: { title: 'New Title' }
|
|
@@ -68714,11 +68487,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68714
68487
|
* Replace a block node by its ID with new content
|
|
68715
68488
|
* @category Command
|
|
68716
68489
|
* @param {string} id - The sdBlockId of the node to replace
|
|
68717
|
-
* @param {
|
|
68718
|
-
* @returns {Function} Command function
|
|
68490
|
+
* @param {ProseMirrorNode} contentNode - The replacement ProseMirror node
|
|
68719
68491
|
* @example
|
|
68720
68492
|
* const newParagraph = editor.schema.nodes.paragraph.create({}, editor.schema.text('New content'))
|
|
68721
|
-
* replaceBlockNodeById('block-123', newParagraph)
|
|
68493
|
+
* editor.commands.replaceBlockNodeById('block-123', newParagraph)
|
|
68722
68494
|
* @note The replacement node should have the same type as the original
|
|
68723
68495
|
*/
|
|
68724
68496
|
replaceBlockNodeById: (id, contentNode) => ({ dispatch, tr }) => {
|
|
@@ -68741,9 +68513,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68741
68513
|
* Delete a block node by its ID
|
|
68742
68514
|
* @category Command
|
|
68743
68515
|
* @param {string} id - The sdBlockId of the node to delete
|
|
68744
|
-
* @returns {Function} Command function
|
|
68745
68516
|
* @example
|
|
68746
|
-
* deleteBlockNodeById('block-123')
|
|
68517
|
+
* editor.commands.deleteBlockNodeById('block-123')
|
|
68747
68518
|
* @note Completely removes the node from the document
|
|
68748
68519
|
*/
|
|
68749
68520
|
deleteBlockNodeById: (id) => ({ dispatch, tr }) => {
|
|
@@ -68767,11 +68538,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68767
68538
|
* @category Command
|
|
68768
68539
|
* @param {string} id - The sdBlockId of the node to update
|
|
68769
68540
|
* @param {Object} attrs - Attributes to update
|
|
68770
|
-
* @returns {Function} Command function
|
|
68771
68541
|
* @example
|
|
68772
|
-
* updateBlockNodeAttributes('block-123', { textAlign: 'center' })
|
|
68542
|
+
* editor.commands.updateBlockNodeAttributes('block-123', { textAlign: 'center' })
|
|
68773
68543
|
* @example
|
|
68774
|
-
* updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
|
|
68544
|
+
* editor.commands.updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
|
|
68775
68545
|
* @note Merges new attributes with existing ones
|
|
68776
68546
|
*/
|
|
68777
68547
|
updateBlockNodeAttributes: (id, attrs = {}) => ({ dispatch, tr }) => {
|
|
@@ -68865,7 +68635,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68865
68635
|
key: BlockNodePluginKey,
|
|
68866
68636
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
68867
68637
|
if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
|
|
68868
|
-
if (hasInitialized && !checkForNewBlockNodesInTrs(transactions)) return null;
|
|
68638
|
+
if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) return null;
|
|
68869
68639
|
const { tr } = newState;
|
|
68870
68640
|
let changed = false;
|
|
68871
68641
|
newState.doc.descendants((node, pos) => {
|
|
@@ -68944,9 +68714,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68944
68714
|
/**
|
|
68945
68715
|
* Remove empty text style marks
|
|
68946
68716
|
* @category Command
|
|
68947
|
-
* @returns {Function} Command function - Removes mark if no attributes present
|
|
68948
68717
|
* @example
|
|
68949
|
-
* removeEmptyTextStyle()
|
|
68718
|
+
* editor.commands.removeEmptyTextStyle()
|
|
68950
68719
|
* @note Cleanup utility to prevent empty span elements
|
|
68951
68720
|
* @note Automatically checks if any style attributes exist before removal
|
|
68952
68721
|
*/
|
|
@@ -68968,10 +68737,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68968
68737
|
},
|
|
68969
68738
|
addAttributes() {
|
|
68970
68739
|
return {
|
|
68971
|
-
/**
|
|
68972
|
-
* @category Attribute
|
|
68973
|
-
* @param {string} [value] - Bold weight value ('0' renders as normal)
|
|
68974
|
-
*/
|
|
68975
68740
|
value: {
|
|
68976
68741
|
default: null,
|
|
68977
68742
|
renderDOM: (attrs) => {
|
|
@@ -69000,26 +68765,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69000
68765
|
/**
|
|
69001
68766
|
* Apply bold formatting
|
|
69002
68767
|
* @category Command
|
|
69003
|
-
* @returns {Function} Command
|
|
69004
68768
|
* @example
|
|
69005
|
-
* setBold()
|
|
68769
|
+
* editor.commands.setBold()
|
|
69006
68770
|
* @note '0' renders as normal weight
|
|
69007
68771
|
*/
|
|
69008
68772
|
setBold: () => ({ commands: commands2 }) => commands2.setMark(this.name),
|
|
69009
68773
|
/**
|
|
69010
68774
|
* Remove bold formatting
|
|
69011
68775
|
* @category Command
|
|
69012
|
-
* @returns {Function} Command
|
|
69013
68776
|
* @example
|
|
69014
|
-
* unsetBold()
|
|
68777
|
+
* editor.commands.unsetBold()
|
|
69015
68778
|
*/
|
|
69016
68779
|
unsetBold: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
69017
68780
|
/**
|
|
69018
68781
|
* Toggle bold formatting
|
|
69019
68782
|
* @category Command
|
|
69020
|
-
* @returns {Function} Command
|
|
69021
68783
|
* @example
|
|
69022
|
-
* toggleBold()
|
|
68784
|
+
* editor.commands.toggleBold()
|
|
69023
68785
|
*/
|
|
69024
68786
|
toggleBold: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
69025
68787
|
};
|
|
@@ -69054,25 +68816,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69054
68816
|
/**
|
|
69055
68817
|
* Apply italic formatting
|
|
69056
68818
|
* @category Command
|
|
69057
|
-
* @returns {Function} Command
|
|
69058
68819
|
* @example
|
|
69059
|
-
* setItalic()
|
|
68820
|
+
* editor.commands.setItalic()
|
|
69060
68821
|
*/
|
|
69061
68822
|
setItalic: () => ({ commands: commands2 }) => commands2.setMark(this.name),
|
|
69062
68823
|
/**
|
|
69063
68824
|
* Remove italic formatting
|
|
69064
68825
|
* @category Command
|
|
69065
|
-
* @returns {Function} Command
|
|
69066
68826
|
* @example
|
|
69067
|
-
* unsetItalic()
|
|
68827
|
+
* editor.commands.unsetItalic()
|
|
69068
68828
|
*/
|
|
69069
68829
|
unsetItalic: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
69070
68830
|
/**
|
|
69071
68831
|
* Toggle italic formatting
|
|
69072
68832
|
* @category Command
|
|
69073
|
-
* @returns {Function} Command
|
|
69074
68833
|
* @example
|
|
69075
|
-
* toggleItalic()
|
|
68834
|
+
* editor.commands.toggleItalic()
|
|
69076
68835
|
*/
|
|
69077
68836
|
toggleItalic: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
69078
68837
|
};
|
|
@@ -69156,10 +68915,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69156
68915
|
},
|
|
69157
68916
|
addAttributes() {
|
|
69158
68917
|
return {
|
|
69159
|
-
/**
|
|
69160
|
-
* @category Attribute
|
|
69161
|
-
* @param {string} [color] - Background color (CSS color value)
|
|
69162
|
-
*/
|
|
69163
68918
|
color: {
|
|
69164
68919
|
default: null,
|
|
69165
68920
|
parseDOM: (element) => element.getAttribute("data-color") || element.style.backgroundColor,
|
|
@@ -69187,26 +68942,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69187
68942
|
* Apply highlight with specified color
|
|
69188
68943
|
* @category Command
|
|
69189
68944
|
* @param {string} color - CSS color value
|
|
69190
|
-
* @returns {Function} Command
|
|
69191
68945
|
* @example
|
|
69192
|
-
* setHighlight('#FFEB3B')
|
|
69193
|
-
* setHighlight('rgba(255, 235, 59, 0.5)')
|
|
68946
|
+
* editor.commands.setHighlight('#FFEB3B')
|
|
68947
|
+
* editor.commands.setHighlight('rgba(255, 235, 59, 0.5)')
|
|
69194
68948
|
*/
|
|
69195
68949
|
setHighlight: (color) => ({ commands: commands2 }) => commands2.setMark(this.name, { color }),
|
|
69196
68950
|
/**
|
|
69197
68951
|
* Remove highlight formatting
|
|
69198
68952
|
* @category Command
|
|
69199
|
-
* @returns {Function} Command
|
|
69200
68953
|
* @example
|
|
69201
|
-
* unsetHighlight()
|
|
68954
|
+
* editor.commands.unsetHighlight()
|
|
69202
68955
|
*/
|
|
69203
68956
|
unsetHighlight: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
69204
68957
|
/**
|
|
69205
68958
|
* Toggle highlight formatting
|
|
69206
68959
|
* @category Command
|
|
69207
|
-
* @returns {Function} Command
|
|
69208
68960
|
* @example
|
|
69209
|
-
* toggleHighlight()
|
|
68961
|
+
* editor.commands.toggleHighlight()
|
|
69210
68962
|
*/
|
|
69211
68963
|
toggleHighlight: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
69212
68964
|
};
|
|
@@ -69239,9 +68991,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69239
68991
|
/**
|
|
69240
68992
|
* Apply strikethrough formatting
|
|
69241
68993
|
* @category Command
|
|
69242
|
-
* @returns {Function} Command
|
|
69243
68994
|
* @example
|
|
69244
|
-
* setStrike()
|
|
68995
|
+
* editor.commands.setStrike()
|
|
69245
68996
|
*/
|
|
69246
68997
|
setStrike: () => ({ commands: commands2 }) => {
|
|
69247
68998
|
return commands2.setMark(this.name);
|
|
@@ -69249,9 +69000,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69249
69000
|
/**
|
|
69250
69001
|
* Remove strikethrough formatting
|
|
69251
69002
|
* @category Command
|
|
69252
|
-
* @returns {Function} Command
|
|
69253
69003
|
* @example
|
|
69254
|
-
* unsetStrike()
|
|
69004
|
+
* editor.commands.unsetStrike()
|
|
69255
69005
|
*/
|
|
69256
69006
|
unsetStrike: () => ({ commands: commands2 }) => {
|
|
69257
69007
|
return commands2.unsetMark(this.name);
|
|
@@ -69259,9 +69009,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69259
69009
|
/**
|
|
69260
69010
|
* Toggle strikethrough formatting
|
|
69261
69011
|
* @category Command
|
|
69262
|
-
* @returns {Function} Command
|
|
69263
69012
|
* @example
|
|
69264
|
-
* toggleStrike()
|
|
69013
|
+
* editor.commands.toggleStrike()
|
|
69265
69014
|
*/
|
|
69266
69015
|
toggleStrike: () => ({ commands: commands2 }) => {
|
|
69267
69016
|
return commands2.toggleMark(this.name);
|
|
@@ -69281,11 +69030,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69281
69030
|
inclusive: false,
|
|
69282
69031
|
addOptions() {
|
|
69283
69032
|
return {
|
|
69284
|
-
/**
|
|
69285
|
-
* Allowed URL protocols
|
|
69286
|
-
* @type {string[]}
|
|
69287
|
-
* @default ['http', 'https']
|
|
69288
|
-
*/
|
|
69289
69033
|
protocols: ["http", "https"],
|
|
69290
69034
|
htmlAttributes: {
|
|
69291
69035
|
target: null,
|
|
@@ -69384,16 +69128,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69384
69128
|
/**
|
|
69385
69129
|
* Create or update a link
|
|
69386
69130
|
* @category Command
|
|
69387
|
-
* @param {
|
|
69388
|
-
* @param {string} [options.href] - URL for the link
|
|
69389
|
-
* @param {string} [options.text] - Display text (uses selection if omitted)
|
|
69390
|
-
* @returns {Function} Command - Creates link with underline
|
|
69131
|
+
* @param {SetLinkOptions} [options] - Link configuration
|
|
69391
69132
|
* @example
|
|
69392
|
-
*
|
|
69393
|
-
* setLink({
|
|
69394
|
-
*
|
|
69395
|
-
* // Link with custom text
|
|
69396
|
-
* setLink({
|
|
69133
|
+
* editor.commands.setLink({ href: 'https://example.com' })
|
|
69134
|
+
* editor.commands.setLink({
|
|
69397
69135
|
* href: 'https://example.com',
|
|
69398
69136
|
* text: 'Visit Example'
|
|
69399
69137
|
* })
|
|
@@ -69445,9 +69183,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69445
69183
|
/**
|
|
69446
69184
|
* Remove link and associated formatting
|
|
69447
69185
|
* @category Command
|
|
69448
|
-
* @returns {Function} Command - Removes link, underline, and color
|
|
69449
69186
|
* @example
|
|
69450
|
-
* unsetLink()
|
|
69187
|
+
* editor.commands.unsetLink()
|
|
69451
69188
|
* @note Also removes underline and text color
|
|
69452
69189
|
*/
|
|
69453
69190
|
unsetLink: () => ({ chain }) => {
|
|
@@ -69456,16 +69193,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69456
69193
|
/**
|
|
69457
69194
|
* Toggle link on selection
|
|
69458
69195
|
* @category Command
|
|
69459
|
-
* @param {
|
|
69460
|
-
* @param {string} [options.href] - URL for the link
|
|
69461
|
-
* @param {string} [options.text] - Display text
|
|
69462
|
-
* @returns {Function} Command - Creates link if href provided, removes otherwise
|
|
69196
|
+
* @param {SetLinkOptions} [options] - Link configuration
|
|
69463
69197
|
* @example
|
|
69464
|
-
*
|
|
69465
|
-
* toggleLink(
|
|
69466
|
-
*
|
|
69467
|
-
* // Remove link
|
|
69468
|
-
* toggleLink()
|
|
69198
|
+
* editor.commands.toggleLink({ href: 'https://example.com' })
|
|
69199
|
+
* editor.commands.toggleLink()
|
|
69469
69200
|
*/
|
|
69470
69201
|
toggleLink: ({ href, text } = {}) => ({ commands: commands2 }) => {
|
|
69471
69202
|
if (!href) return commands2.unsetLink();
|
|
@@ -72782,6 +72513,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72782
72513
|
const popoverPluginKey = new PluginKey("popoverPlugin");
|
|
72783
72514
|
const PopoverPlugin = Extension.create({
|
|
72784
72515
|
name: "popoverPlugin",
|
|
72516
|
+
addOptions() {
|
|
72517
|
+
return {};
|
|
72518
|
+
},
|
|
72785
72519
|
addPmPlugins() {
|
|
72786
72520
|
const popover = new Plugin({
|
|
72787
72521
|
key: popoverPluginKey,
|
|
@@ -75009,12 +74743,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75009
74743
|
addCommands() {
|
|
75010
74744
|
return {
|
|
75011
74745
|
/**
|
|
75012
|
-
*
|
|
74746
|
+
* Navigate to the first search match
|
|
75013
74747
|
* @category Command
|
|
75014
|
-
* @returns {Function} - Command function
|
|
75015
74748
|
* @example
|
|
75016
|
-
* goToFirstMatch()
|
|
75017
|
-
* @note Scrolls
|
|
74749
|
+
* editor.commands.goToFirstMatch()
|
|
74750
|
+
* @note Scrolls editor to the first match from previous search
|
|
75018
74751
|
*/
|
|
75019
74752
|
goToFirstMatch: () => (
|
|
75020
74753
|
/** @returns {boolean} */
|
|
@@ -75030,13 +74763,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75030
74763
|
})
|
|
75031
74764
|
),
|
|
75032
74765
|
/**
|
|
75033
|
-
*
|
|
74766
|
+
* Search for string matches in editor content
|
|
75034
74767
|
* @category Command
|
|
75035
74768
|
* @param {String|RegExp} patternInput - Search string or pattern
|
|
75036
|
-
* @returns {Function} - Command function that returns matches
|
|
75037
74769
|
* @example
|
|
75038
|
-
* search('test string')
|
|
75039
|
-
*
|
|
74770
|
+
* const matches = editor.commands.search('test string')
|
|
74771
|
+
* const regexMatches = editor.commands.search(/test/i)
|
|
74772
|
+
* @note Returns array of SearchMatch objects with positions and IDs
|
|
75040
74773
|
*/
|
|
75041
74774
|
search: (patternInput) => (
|
|
75042
74775
|
/** @returns {SearchMatch[]} */
|
|
@@ -75079,14 +74812,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75079
74812
|
})
|
|
75080
74813
|
),
|
|
75081
74814
|
/**
|
|
75082
|
-
*
|
|
74815
|
+
* Navigate to a specific search match
|
|
75083
74816
|
* @category Command
|
|
75084
|
-
* @param {SearchMatch} match Match
|
|
75085
|
-
* @returns {Function} - Command function
|
|
74817
|
+
* @param {SearchMatch} match - Match object to navigate to
|
|
75086
74818
|
* @example
|
|
75087
|
-
* const
|
|
75088
|
-
* goToSearchResult(
|
|
75089
|
-
* @note Scrolls
|
|
74819
|
+
* const searchResults = editor.commands.search('test string')
|
|
74820
|
+
* editor.commands.goToSearchResult(searchResults[3])
|
|
74821
|
+
* @note Scrolls to match and selects it
|
|
75090
74822
|
*/
|
|
75091
74823
|
goToSearchResult: (match) => (
|
|
75092
74824
|
/** @returns {boolean} */
|
|
@@ -75348,6 +75080,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75348
75080
|
};
|
|
75349
75081
|
const NodeResizer = Extension.create({
|
|
75350
75082
|
name: "nodeResizer",
|
|
75083
|
+
addOptions() {
|
|
75084
|
+
return {};
|
|
75085
|
+
},
|
|
75351
75086
|
addPmPlugins() {
|
|
75352
75087
|
const isHeadless = this.editor.options.isHeadless;
|
|
75353
75088
|
const hasDocument = typeof document !== "undefined";
|