@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
|
@@ -14842,6 +14842,14 @@ function ptToTwips(pt) {
|
|
|
14842
14842
|
if (pt == null) return;
|
|
14843
14843
|
return pt * 20;
|
|
14844
14844
|
}
|
|
14845
|
+
function rotToDegrees(rot) {
|
|
14846
|
+
if (rot == null) return;
|
|
14847
|
+
return rot / 6e4;
|
|
14848
|
+
}
|
|
14849
|
+
function degreesToRot(degrees) {
|
|
14850
|
+
if (degrees == null) return;
|
|
14851
|
+
return degrees * 6e4;
|
|
14852
|
+
}
|
|
14845
14853
|
const getTextIndentExportValue = (indent) => {
|
|
14846
14854
|
const [value, unit] = parseSizeUnit(indent);
|
|
14847
14855
|
const functionsMap = {
|
|
@@ -26855,6 +26863,32 @@ function handleImageNode(node, params2, isAnchor) {
|
|
|
26855
26863
|
if (!picture || !picture.elements) return null;
|
|
26856
26864
|
const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
|
|
26857
26865
|
const blip = blipFill.elements.find((el) => el.name === "a:blip");
|
|
26866
|
+
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
26867
|
+
let transformData = {};
|
|
26868
|
+
if (spPr) {
|
|
26869
|
+
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
26870
|
+
if (xfrm?.attributes) {
|
|
26871
|
+
transformData = {
|
|
26872
|
+
rotation: rotToDegrees(xfrm.attributes["rot"]),
|
|
26873
|
+
verticalFlip: xfrm.attributes["flipV"] === "1",
|
|
26874
|
+
horizontalFlip: xfrm.attributes["flipH"] === "1"
|
|
26875
|
+
};
|
|
26876
|
+
}
|
|
26877
|
+
}
|
|
26878
|
+
const effectExtent = node.elements.find((el) => el.name === "wp:effectExtent");
|
|
26879
|
+
if (effectExtent) {
|
|
26880
|
+
const sanitizeEmuValue = (value) => {
|
|
26881
|
+
if (value === null || value === void 0) return 0;
|
|
26882
|
+
const numeric = Number(value);
|
|
26883
|
+
return Number.isFinite(numeric) ? numeric : 0;
|
|
26884
|
+
};
|
|
26885
|
+
transformData.sizeExtension = {
|
|
26886
|
+
left: emuToPixels(sanitizeEmuValue(effectExtent.attributes["l"])),
|
|
26887
|
+
top: emuToPixels(sanitizeEmuValue(effectExtent.attributes["t"])),
|
|
26888
|
+
right: emuToPixels(sanitizeEmuValue(effectExtent.attributes["r"])),
|
|
26889
|
+
bottom: emuToPixels(sanitizeEmuValue(effectExtent.attributes["b"]))
|
|
26890
|
+
};
|
|
26891
|
+
}
|
|
26858
26892
|
const positionHTag = node.elements.find((el) => el.name === "wp:positionH");
|
|
26859
26893
|
const positionH = positionHTag?.elements.find((el) => el.name === "wp:posOffset");
|
|
26860
26894
|
const positionHValue = emuToPixels(positionH?.elements[0]?.text);
|
|
@@ -26911,6 +26945,7 @@ function handleImageNode(node, params2, isAnchor) {
|
|
|
26911
26945
|
size: size2,
|
|
26912
26946
|
anchorData,
|
|
26913
26947
|
isAnchor,
|
|
26948
|
+
transformData,
|
|
26914
26949
|
...simplePos && {
|
|
26915
26950
|
simplePos: {
|
|
26916
26951
|
x: simplePos.attributes.x,
|
|
@@ -27062,6 +27097,31 @@ const translateImageNode = (params2) => {
|
|
|
27062
27097
|
distL: 0,
|
|
27063
27098
|
distR: 0
|
|
27064
27099
|
};
|
|
27100
|
+
const xfrmAttrs = {};
|
|
27101
|
+
const effectExtentAttrs = {
|
|
27102
|
+
l: 0,
|
|
27103
|
+
t: 0,
|
|
27104
|
+
r: 0,
|
|
27105
|
+
b: 0
|
|
27106
|
+
};
|
|
27107
|
+
const transformData = attrs.transformData;
|
|
27108
|
+
if (transformData) {
|
|
27109
|
+
if (transformData.rotation) {
|
|
27110
|
+
xfrmAttrs.rot = degreesToRot(transformData.rotation);
|
|
27111
|
+
}
|
|
27112
|
+
if (transformData.verticalFlip) {
|
|
27113
|
+
xfrmAttrs.flipV = "1";
|
|
27114
|
+
}
|
|
27115
|
+
if (transformData.horizontalFlip) {
|
|
27116
|
+
xfrmAttrs.flipH = "1";
|
|
27117
|
+
}
|
|
27118
|
+
if (transformData.sizeExtension) {
|
|
27119
|
+
effectExtentAttrs.l = pixelsToEmu(transformData.sizeExtension.left);
|
|
27120
|
+
effectExtentAttrs.t = pixelsToEmu(transformData.sizeExtension.top);
|
|
27121
|
+
effectExtentAttrs.r = pixelsToEmu(transformData.sizeExtension.right);
|
|
27122
|
+
effectExtentAttrs.b = pixelsToEmu(transformData.sizeExtension.bottom);
|
|
27123
|
+
}
|
|
27124
|
+
}
|
|
27065
27125
|
const drawingXmlns = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
27066
27126
|
const pictureXmlns = "http://schemas.openxmlformats.org/drawingml/2006/picture";
|
|
27067
27127
|
return {
|
|
@@ -27076,12 +27136,7 @@ const translateImageNode = (params2) => {
|
|
|
27076
27136
|
},
|
|
27077
27137
|
{
|
|
27078
27138
|
name: "wp:effectExtent",
|
|
27079
|
-
attributes:
|
|
27080
|
-
l: 0,
|
|
27081
|
-
t: 0,
|
|
27082
|
-
r: 0,
|
|
27083
|
-
b: 0
|
|
27084
|
-
}
|
|
27139
|
+
attributes: effectExtentAttrs
|
|
27085
27140
|
},
|
|
27086
27141
|
{
|
|
27087
27142
|
name: "wp:docPr",
|
|
@@ -27161,6 +27216,7 @@ const translateImageNode = (params2) => {
|
|
|
27161
27216
|
elements: [
|
|
27162
27217
|
{
|
|
27163
27218
|
name: "a:xfrm",
|
|
27219
|
+
attributes: xfrmAttrs,
|
|
27164
27220
|
elements: [
|
|
27165
27221
|
{
|
|
27166
27222
|
name: "a:ext",
|
|
@@ -31363,8 +31419,8 @@ function addDefaultStylesIfMissing(styles) {
|
|
|
31363
31419
|
}
|
|
31364
31420
|
const importHeadersFooters = (docx, converter, mainEditor) => {
|
|
31365
31421
|
const rels = docx["word/_rels/document.xml.rels"];
|
|
31366
|
-
const relationships = rels
|
|
31367
|
-
const { elements } = relationships;
|
|
31422
|
+
const relationships = rels?.elements.find((el) => el.name === "Relationships");
|
|
31423
|
+
const { elements } = relationships || { elements: [] };
|
|
31368
31424
|
const headerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
|
|
31369
31425
|
const footerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
|
|
31370
31426
|
const headers = elements.filter((el) => el.attributes["Type"] === headerType);
|
|
@@ -42322,12 +42378,6 @@ const History = Extension.create({
|
|
|
42322
42378
|
name: "history",
|
|
42323
42379
|
addOptions() {
|
|
42324
42380
|
return {
|
|
42325
|
-
/**
|
|
42326
|
-
* @typedef {Object} HistoryOptions
|
|
42327
|
-
* @category Options
|
|
42328
|
-
* @property {number} [depth=100] - Maximum undo/redo steps to remember
|
|
42329
|
-
* @property {number} [newGroupDelay=500] - Milliseconds to wait before starting a new history group
|
|
42330
|
-
*/
|
|
42331
42381
|
depth: 100,
|
|
42332
42382
|
newGroupDelay: 500
|
|
42333
42383
|
};
|
|
@@ -42346,9 +42396,8 @@ const History = Extension.create({
|
|
|
42346
42396
|
/**
|
|
42347
42397
|
* Undo the last action
|
|
42348
42398
|
* @category Command
|
|
42349
|
-
* @returns {Function} Command function
|
|
42350
42399
|
* @example
|
|
42351
|
-
* undo()
|
|
42400
|
+
* editor.commands.undo()
|
|
42352
42401
|
* @note Groups changes within the newGroupDelay window
|
|
42353
42402
|
*/
|
|
42354
42403
|
undo: () => ({ state: state2, dispatch, tr }) => {
|
|
@@ -42362,9 +42411,8 @@ const History = Extension.create({
|
|
|
42362
42411
|
/**
|
|
42363
42412
|
* Redo the last undone action
|
|
42364
42413
|
* @category Command
|
|
42365
|
-
* @returns {Function} Command function
|
|
42366
42414
|
* @example
|
|
42367
|
-
* redo()
|
|
42415
|
+
* editor.commands.redo()
|
|
42368
42416
|
* @note Only available after an undo action
|
|
42369
42417
|
*/
|
|
42370
42418
|
redo: () => ({ state: state2, dispatch, tr }) => {
|
|
@@ -49283,6 +49331,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
49283
49331
|
return result;
|
|
49284
49332
|
} catch (error) {
|
|
49285
49333
|
this.emit("exception", { error, editor: this });
|
|
49334
|
+
console.error(error);
|
|
49286
49335
|
}
|
|
49287
49336
|
}
|
|
49288
49337
|
/**
|
|
@@ -49306,6 +49355,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
49306
49355
|
this.converter.footerEditors.length = 0;
|
|
49307
49356
|
} catch (error) {
|
|
49308
49357
|
this.emit("exception", { error, editor: this });
|
|
49358
|
+
console.error(error);
|
|
49309
49359
|
}
|
|
49310
49360
|
}
|
|
49311
49361
|
/**
|
|
@@ -49894,6 +49944,7 @@ endCollaboration_fn = function() {
|
|
|
49894
49944
|
if (this.options.ydoc) this.options.ydoc.destroy();
|
|
49895
49945
|
} catch (error) {
|
|
49896
49946
|
this.emit("exception", { error, editor: this });
|
|
49947
|
+
console.error(error);
|
|
49897
49948
|
}
|
|
49898
49949
|
};
|
|
49899
49950
|
validateDocumentInit_fn = function() {
|
|
@@ -49920,11 +49971,6 @@ const Color = Extension.create({
|
|
|
49920
49971
|
name: "color",
|
|
49921
49972
|
addOptions() {
|
|
49922
49973
|
return {
|
|
49923
|
-
/**
|
|
49924
|
-
* @typedef {Object} ColorOptions
|
|
49925
|
-
* @category Options
|
|
49926
|
-
* @property {string[]} [types=['textStyle']] - Mark types to add color support to
|
|
49927
|
-
*/
|
|
49928
49974
|
types: ["textStyle"]
|
|
49929
49975
|
};
|
|
49930
49976
|
},
|
|
@@ -49933,10 +49979,6 @@ const Color = Extension.create({
|
|
|
49933
49979
|
{
|
|
49934
49980
|
types: this.options.types,
|
|
49935
49981
|
attributes: {
|
|
49936
|
-
/**
|
|
49937
|
-
* @category Attribute
|
|
49938
|
-
* @param {ColorValue} [color] - Text color value
|
|
49939
|
-
*/
|
|
49940
49982
|
color: {
|
|
49941
49983
|
default: null,
|
|
49942
49984
|
parseDOM: (el) => el.style.color?.replace(/['"]+/g, ""),
|
|
@@ -49955,16 +49997,17 @@ const Color = Extension.create({
|
|
|
49955
49997
|
* Set text color
|
|
49956
49998
|
* @category Command
|
|
49957
49999
|
* @param {ColorValue} color - Color value to apply
|
|
49958
|
-
* @returns {Function} Command function
|
|
49959
50000
|
* @example
|
|
49960
50001
|
* // Set to red using hex
|
|
49961
|
-
* setColor('#ff0000')
|
|
50002
|
+
* editor.commands.setColor('#ff0000')
|
|
49962
50003
|
*
|
|
50004
|
+
* @example
|
|
49963
50005
|
* // Set using rgb
|
|
49964
|
-
* setColor('rgb(255, 0, 0)')
|
|
50006
|
+
* editor.commands.setColor('rgb(255, 0, 0)')
|
|
49965
50007
|
*
|
|
50008
|
+
* @example
|
|
49966
50009
|
* // Set using named color
|
|
49967
|
-
* setColor('blue')
|
|
50010
|
+
* editor.commands.setColor('blue')
|
|
49968
50011
|
* @note Preserves other text styling attributes
|
|
49969
50012
|
*/
|
|
49970
50013
|
setColor: (color) => ({ chain }) => {
|
|
@@ -49973,9 +50016,8 @@ const Color = Extension.create({
|
|
|
49973
50016
|
/**
|
|
49974
50017
|
* Remove text color
|
|
49975
50018
|
* @category Command
|
|
49976
|
-
* @returns {Function} Command function
|
|
49977
50019
|
* @example
|
|
49978
|
-
* unsetColor()
|
|
50020
|
+
* editor.commands.unsetColor()
|
|
49979
50021
|
* @note Removes color while preserving other text styles
|
|
49980
50022
|
*/
|
|
49981
50023
|
unsetColor: () => ({ chain }) => {
|
|
@@ -49988,11 +50030,6 @@ const FontFamily = Extension.create({
|
|
|
49988
50030
|
name: "fontFamily",
|
|
49989
50031
|
addOptions() {
|
|
49990
50032
|
return {
|
|
49991
|
-
/**
|
|
49992
|
-
* @typedef {Object} FontFamilyOptions
|
|
49993
|
-
* @category Options
|
|
49994
|
-
* @property {string[]} [types=['textStyle']] - Mark types to add font family support to
|
|
49995
|
-
*/
|
|
49996
50033
|
types: ["textStyle"]
|
|
49997
50034
|
};
|
|
49998
50035
|
},
|
|
@@ -50001,10 +50038,6 @@ const FontFamily = Extension.create({
|
|
|
50001
50038
|
{
|
|
50002
50039
|
types: this.options.types,
|
|
50003
50040
|
attributes: {
|
|
50004
|
-
/**
|
|
50005
|
-
* @category Attribute
|
|
50006
|
-
* @param {FontFamilyValue} [fontFamily] - Font family for text
|
|
50007
|
-
*/
|
|
50008
50041
|
fontFamily: {
|
|
50009
50042
|
default: null,
|
|
50010
50043
|
parseDOM: (el) => el.style.fontFamily?.replace(/['"]+/g, ""),
|
|
@@ -50023,13 +50056,13 @@ const FontFamily = Extension.create({
|
|
|
50023
50056
|
* Set font family
|
|
50024
50057
|
* @category Command
|
|
50025
50058
|
* @param {FontFamilyValue} fontFamily - Font family to apply
|
|
50026
|
-
* @returns {Function} Command function
|
|
50027
50059
|
* @example
|
|
50028
50060
|
* // Set to Arial
|
|
50029
|
-
* setFontFamily('Arial')
|
|
50061
|
+
* editor.commands.setFontFamily('Arial')
|
|
50030
50062
|
*
|
|
50063
|
+
* @example
|
|
50031
50064
|
* // Set to serif font
|
|
50032
|
-
* setFontFamily('Georgia, serif')
|
|
50065
|
+
* editor.commands.setFontFamily('Georgia, serif')
|
|
50033
50066
|
* @note Preserves other text styling attributes
|
|
50034
50067
|
*/
|
|
50035
50068
|
setFontFamily: (fontFamily2) => ({ chain }) => {
|
|
@@ -50038,9 +50071,8 @@ const FontFamily = Extension.create({
|
|
|
50038
50071
|
/**
|
|
50039
50072
|
* Remove font family
|
|
50040
50073
|
* @category Command
|
|
50041
|
-
* @returns {Function} Command function
|
|
50042
50074
|
* @example
|
|
50043
|
-
* unsetFontFamily()
|
|
50075
|
+
* editor.commands.unsetFontFamily()
|
|
50044
50076
|
* @note Reverts to default document font
|
|
50045
50077
|
*/
|
|
50046
50078
|
unsetFontFamily: () => ({ chain }) => {
|
|
@@ -50053,12 +50085,6 @@ const FontSize = Extension.create({
|
|
|
50053
50085
|
name: "fontSize",
|
|
50054
50086
|
addOptions() {
|
|
50055
50087
|
return {
|
|
50056
|
-
/**
|
|
50057
|
-
* @typedef {Object} FontSizeOptions
|
|
50058
|
-
* @category Options
|
|
50059
|
-
* @property {string[]} [types=['textStyle', 'tableCell']] - Node/mark types to add font size support to
|
|
50060
|
-
* @property {FontSizeDefaults} [defaults] - Default size configuration
|
|
50061
|
-
*/
|
|
50062
50088
|
types: ["textStyle", "tableCell"],
|
|
50063
50089
|
defaults: {
|
|
50064
50090
|
value: 12,
|
|
@@ -50073,10 +50099,6 @@ const FontSize = Extension.create({
|
|
|
50073
50099
|
{
|
|
50074
50100
|
types: this.options.types,
|
|
50075
50101
|
attributes: {
|
|
50076
|
-
/**
|
|
50077
|
-
* @category Attribute
|
|
50078
|
-
* @param {FontSizeValue} [fontSize] - Font size with unit
|
|
50079
|
-
*/
|
|
50080
50102
|
fontSize: {
|
|
50081
50103
|
default: null,
|
|
50082
50104
|
parseDOM: (el) => el.style.fontSize,
|
|
@@ -50098,16 +50120,10 @@ const FontSize = Extension.create({
|
|
|
50098
50120
|
* Set font size
|
|
50099
50121
|
* @category Command
|
|
50100
50122
|
* @param {FontSizeValue} fontSize - Size to apply (with optional unit)
|
|
50101
|
-
* @returns {Function} Command function
|
|
50102
50123
|
* @example
|
|
50103
|
-
*
|
|
50104
|
-
* setFontSize('
|
|
50105
|
-
*
|
|
50106
|
-
* // Set to 18px
|
|
50107
|
-
* setFontSize('18px')
|
|
50108
|
-
*
|
|
50109
|
-
* // Set without unit (uses default)
|
|
50110
|
-
* setFontSize(16)
|
|
50124
|
+
* editor.commands.setFontSize('14pt')
|
|
50125
|
+
* editor.commands.setFontSize('18px')
|
|
50126
|
+
* editor.commands.setFontSize(16)
|
|
50111
50127
|
* @note Automatically clamps to min/max values
|
|
50112
50128
|
*/
|
|
50113
50129
|
setFontSize: (fontSize2) => ({ chain }) => {
|
|
@@ -50129,9 +50145,8 @@ const FontSize = Extension.create({
|
|
|
50129
50145
|
/**
|
|
50130
50146
|
* Remove font size
|
|
50131
50147
|
* @category Command
|
|
50132
|
-
* @returns {Function} Command function
|
|
50133
50148
|
* @example
|
|
50134
|
-
* unsetFontSize()
|
|
50149
|
+
* editor.commands.unsetFontSize()
|
|
50135
50150
|
* @note Reverts to default document size
|
|
50136
50151
|
*/
|
|
50137
50152
|
unsetFontSize: () => ({ chain }) => {
|
|
@@ -50181,13 +50196,9 @@ const TextAlign = Extension.create({
|
|
|
50181
50196
|
* Set text alignment
|
|
50182
50197
|
* @category Command
|
|
50183
50198
|
* @param {string} alignment - Alignment value (left, center, right, justify)
|
|
50184
|
-
* @returns {Function} Command function
|
|
50185
50199
|
* @example
|
|
50186
|
-
*
|
|
50187
|
-
* setTextAlign('
|
|
50188
|
-
*
|
|
50189
|
-
* // Set to justify
|
|
50190
|
-
* setTextAlign('justify')
|
|
50200
|
+
* editor.commands.setTextAlign('center')
|
|
50201
|
+
* editor.commands.setTextAlign('justify')
|
|
50191
50202
|
* @note Applies to all configured node types (heading, paragraph by default)
|
|
50192
50203
|
*/
|
|
50193
50204
|
setTextAlign: (alignment2) => ({ commands: commands2 }) => {
|
|
@@ -50198,9 +50209,8 @@ const TextAlign = Extension.create({
|
|
|
50198
50209
|
/**
|
|
50199
50210
|
* Remove text alignment (reset to default)
|
|
50200
50211
|
* @category Command
|
|
50201
|
-
* @returns {Function} Command function
|
|
50202
50212
|
* @example
|
|
50203
|
-
* unsetTextAlign()
|
|
50213
|
+
* editor.commands.unsetTextAlign()
|
|
50204
50214
|
* @note Resets alignment to the default value
|
|
50205
50215
|
*/
|
|
50206
50216
|
unsetTextAlign: () => ({ commands: commands2 }) => {
|
|
@@ -50341,13 +50351,6 @@ const LineHeight = Extension.create({
|
|
|
50341
50351
|
name: "lineHeight",
|
|
50342
50352
|
addOptions() {
|
|
50343
50353
|
return {
|
|
50344
|
-
/**
|
|
50345
|
-
* @typedef {Object} LineHeightOptions
|
|
50346
|
-
* @category Options
|
|
50347
|
-
* @property {string[]} [types=['heading', 'paragraph']] - Block types to add line height support to
|
|
50348
|
-
* @property {Object} [defaults] - Default configuration
|
|
50349
|
-
* @property {string} [defaults.unit=''] - Default unit for line height values
|
|
50350
|
-
*/
|
|
50351
50354
|
types: ["heading", "paragraph"],
|
|
50352
50355
|
defaults: {
|
|
50353
50356
|
unit: ""
|
|
@@ -50359,10 +50362,6 @@ const LineHeight = Extension.create({
|
|
|
50359
50362
|
{
|
|
50360
50363
|
types: this.options.types,
|
|
50361
50364
|
attributes: {
|
|
50362
|
-
/**
|
|
50363
|
-
* @category Attribute
|
|
50364
|
-
* @param {LineHeightValue} [lineHeight] - Line height value
|
|
50365
|
-
*/
|
|
50366
50365
|
lineHeight: {
|
|
50367
50366
|
default: null,
|
|
50368
50367
|
parseDOM: (el) => el.style.lineHeight,
|
|
@@ -50388,16 +50387,10 @@ const LineHeight = Extension.create({
|
|
|
50388
50387
|
* Set line height for blocks
|
|
50389
50388
|
* @category Command
|
|
50390
50389
|
* @param {LineHeightValue} lineHeight - Line height to apply
|
|
50391
|
-
* @returns {Function} Command function
|
|
50392
50390
|
* @example
|
|
50393
|
-
*
|
|
50394
|
-
* setLineHeight(
|
|
50395
|
-
*
|
|
50396
|
-
* // Set to 24px spacing
|
|
50397
|
-
* setLineHeight('24px')
|
|
50398
|
-
*
|
|
50399
|
-
* // Set to double spacing
|
|
50400
|
-
* setLineHeight(2)
|
|
50391
|
+
* editor.commands.setLineHeight(1.5)
|
|
50392
|
+
* editor.commands.setLineHeight('24px')
|
|
50393
|
+
* editor.commands.setLineHeight(2)
|
|
50401
50394
|
* @note Applies to paragraphs and headings
|
|
50402
50395
|
*/
|
|
50403
50396
|
setLineHeight: (lineHeight2) => ({ commands: commands2 }) => {
|
|
@@ -50407,9 +50400,8 @@ const LineHeight = Extension.create({
|
|
|
50407
50400
|
/**
|
|
50408
50401
|
* Remove line height
|
|
50409
50402
|
* @category Command
|
|
50410
|
-
* @returns {Function} Command function
|
|
50411
50403
|
* @example
|
|
50412
|
-
* unsetLineHeight()
|
|
50404
|
+
* editor.commands.unsetLineHeight()
|
|
50413
50405
|
* @note Reverts to default line spacing
|
|
50414
50406
|
*/
|
|
50415
50407
|
unsetLineHeight: () => ({ commands: commands2 }) => {
|
|
@@ -50437,9 +50429,8 @@ const FormatCommands = Extension.create({
|
|
|
50437
50429
|
/**
|
|
50438
50430
|
* Clear all formatting (nodes and marks)
|
|
50439
50431
|
* @category Command
|
|
50440
|
-
* @returns {Function} Command function
|
|
50441
50432
|
* @example
|
|
50442
|
-
* clearFormat()
|
|
50433
|
+
* editor.commands.clearFormat()
|
|
50443
50434
|
* @note Removes all marks and resets nodes to default paragraph
|
|
50444
50435
|
*/
|
|
50445
50436
|
clearFormat: () => ({ chain }) => {
|
|
@@ -50448,9 +50439,8 @@ const FormatCommands = Extension.create({
|
|
|
50448
50439
|
/**
|
|
50449
50440
|
* Clear only mark formatting
|
|
50450
50441
|
* @category Command
|
|
50451
|
-
* @returns {Function} Command function
|
|
50452
50442
|
* @example
|
|
50453
|
-
* clearMarksFormat()
|
|
50443
|
+
* editor.commands.clearMarksFormat()
|
|
50454
50444
|
* @note Removes bold, italic, underline, colors, etc. but preserves block structure
|
|
50455
50445
|
*/
|
|
50456
50446
|
clearMarksFormat: () => ({ chain }) => {
|
|
@@ -50459,9 +50449,8 @@ const FormatCommands = Extension.create({
|
|
|
50459
50449
|
/**
|
|
50460
50450
|
* Clear only node formatting
|
|
50461
50451
|
* @category Command
|
|
50462
|
-
* @returns {Function} Command function
|
|
50463
50452
|
* @example
|
|
50464
|
-
* clearNodesFormat()
|
|
50453
|
+
* editor.commands.clearNodesFormat()
|
|
50465
50454
|
* @note Converts headings, lists, etc. to paragraphs but preserves text marks
|
|
50466
50455
|
*/
|
|
50467
50456
|
clearNodesFormat: () => ({ chain }) => {
|
|
@@ -50470,13 +50459,8 @@ const FormatCommands = Extension.create({
|
|
|
50470
50459
|
/**
|
|
50471
50460
|
* Copy format from selection or apply copied format
|
|
50472
50461
|
* @category Command
|
|
50473
|
-
* @returns {Function} Command function
|
|
50474
50462
|
* @example
|
|
50475
|
-
*
|
|
50476
|
-
* copyFormat()
|
|
50477
|
-
*
|
|
50478
|
-
* // Second call: apply copied format to new selection
|
|
50479
|
-
* copyFormat()
|
|
50463
|
+
* editor.commands.copyFormat()
|
|
50480
50464
|
* @note Works like format painter - first click copies, second click applies
|
|
50481
50465
|
*/
|
|
50482
50466
|
copyFormat: () => ({ chain }) => {
|
|
@@ -50889,6 +50873,9 @@ function drawGapCursor(state2) {
|
|
|
50889
50873
|
}
|
|
50890
50874
|
const Gapcursor = Extension.create({
|
|
50891
50875
|
name: "gapCursor",
|
|
50876
|
+
addOptions() {
|
|
50877
|
+
return {};
|
|
50878
|
+
},
|
|
50892
50879
|
addPmPlugins() {
|
|
50893
50880
|
return [gapCursor()];
|
|
50894
50881
|
},
|
|
@@ -51229,6 +51216,9 @@ function getCursorPositionRelativeToContainer(view, eventLocation) {
|
|
|
51229
51216
|
const SlashMenuPluginKey = new PluginKey("slashMenu");
|
|
51230
51217
|
const SlashMenu = Extension.create({
|
|
51231
51218
|
name: "slashMenu",
|
|
51219
|
+
addOptions() {
|
|
51220
|
+
return {};
|
|
51221
|
+
},
|
|
51232
51222
|
addPmPlugins() {
|
|
51233
51223
|
if (this.editor.options?.disableContextMenu) {
|
|
51234
51224
|
return [];
|
|
@@ -51366,11 +51356,6 @@ const Document = Node$1.create({
|
|
|
51366
51356
|
},
|
|
51367
51357
|
addAttributes() {
|
|
51368
51358
|
return {
|
|
51369
|
-
/**
|
|
51370
|
-
* @private
|
|
51371
|
-
* @category Attribute
|
|
51372
|
-
* @param {Object} [attributes] - Internal document attributes
|
|
51373
|
-
*/
|
|
51374
51359
|
attributes: {
|
|
51375
51360
|
rendered: false,
|
|
51376
51361
|
"aria-label": "Document node"
|
|
@@ -51382,10 +51367,10 @@ const Document = Node$1.create({
|
|
|
51382
51367
|
/**
|
|
51383
51368
|
* Get document statistics
|
|
51384
51369
|
* @category Command
|
|
51385
|
-
* @returns {Function} Command function
|
|
51386
51370
|
* @example
|
|
51387
51371
|
* // Get word and character count
|
|
51388
|
-
* getDocumentStats()
|
|
51372
|
+
* const stats = editor.commands.getDocumentStats()
|
|
51373
|
+
* console.log(`${stats.words} words, ${stats.characters} characters`)
|
|
51389
51374
|
* @note Returns word count, character count, and paragraph count
|
|
51390
51375
|
*/
|
|
51391
51376
|
getDocumentStats: () => ({ editor }) => {
|
|
@@ -51402,9 +51387,8 @@ const Document = Node$1.create({
|
|
|
51402
51387
|
/**
|
|
51403
51388
|
* Clear entire document
|
|
51404
51389
|
* @category Command
|
|
51405
|
-
* @returns {Function} Command function
|
|
51406
51390
|
* @example
|
|
51407
|
-
* clearDocument()
|
|
51391
|
+
* editor.commands.clearDocument()
|
|
51408
51392
|
* @note Replaces all content with an empty paragraph
|
|
51409
51393
|
*/
|
|
51410
51394
|
clearDocument: () => ({ commands: commands2 }) => {
|
|
@@ -51416,13 +51400,19 @@ const Document = Node$1.create({
|
|
|
51416
51400
|
const Text = Node$1.create({
|
|
51417
51401
|
name: "text",
|
|
51418
51402
|
group: "inline",
|
|
51419
|
-
inline: true
|
|
51403
|
+
inline: true,
|
|
51404
|
+
addOptions() {
|
|
51405
|
+
return {};
|
|
51406
|
+
}
|
|
51420
51407
|
});
|
|
51421
51408
|
const RunItem = Node$1.create({
|
|
51422
51409
|
name: "run",
|
|
51423
51410
|
group: "inline",
|
|
51424
51411
|
content: "text*",
|
|
51425
51412
|
inline: true,
|
|
51413
|
+
addOptions() {
|
|
51414
|
+
return {};
|
|
51415
|
+
},
|
|
51426
51416
|
parseDOM() {
|
|
51427
51417
|
return [{ tag: "run" }];
|
|
51428
51418
|
},
|
|
@@ -51448,14 +51438,6 @@ const BulletList = Node$1.create({
|
|
|
51448
51438
|
},
|
|
51449
51439
|
addOptions() {
|
|
51450
51440
|
return {
|
|
51451
|
-
/**
|
|
51452
|
-
* @typedef {Object} BulletListOptions
|
|
51453
|
-
* @category Options
|
|
51454
|
-
* @property {string} [itemTypeName='listItem'] - Name of the list item node type
|
|
51455
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the ul element
|
|
51456
|
-
* @property {boolean} [keepMarks=true] - Whether to preserve marks when splitting
|
|
51457
|
-
* @property {boolean} [keepAttributes=false] - Whether to preserve attributes when splitting
|
|
51458
|
-
*/
|
|
51459
51441
|
itemTypeName: "listItem",
|
|
51460
51442
|
htmlAttributes: {
|
|
51461
51443
|
"aria-label": "Bullet list node"
|
|
@@ -51473,27 +51455,13 @@ const BulletList = Node$1.create({
|
|
|
51473
51455
|
},
|
|
51474
51456
|
addAttributes() {
|
|
51475
51457
|
return {
|
|
51476
|
-
/**
|
|
51477
|
-
* @category Attribute
|
|
51478
|
-
* @param {string} [list-style-type='bullet'] - List style type for this list
|
|
51479
|
-
*/
|
|
51480
51458
|
"list-style-type": {
|
|
51481
51459
|
default: "bullet",
|
|
51482
51460
|
rendered: false
|
|
51483
51461
|
},
|
|
51484
|
-
/**
|
|
51485
|
-
* @private
|
|
51486
|
-
* @category Attribute
|
|
51487
|
-
* @param {string} [listId] - Internal list identifier for numbering
|
|
51488
|
-
*/
|
|
51489
51462
|
listId: {
|
|
51490
51463
|
rendered: false
|
|
51491
51464
|
},
|
|
51492
|
-
/**
|
|
51493
|
-
* @private
|
|
51494
|
-
* @category Attribute
|
|
51495
|
-
* @param {string} [sdBlockId] - Internal block tracking ID
|
|
51496
|
-
*/
|
|
51497
51465
|
sdBlockId: {
|
|
51498
51466
|
default: null,
|
|
51499
51467
|
keepOnSplit: false,
|
|
@@ -51502,11 +51470,6 @@ const BulletList = Node$1.create({
|
|
|
51502
51470
|
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
51503
51471
|
}
|
|
51504
51472
|
},
|
|
51505
|
-
/**
|
|
51506
|
-
* @private
|
|
51507
|
-
* @category Attribute
|
|
51508
|
-
* @param {Object} [attributes] - Additional attributes for the list
|
|
51509
|
-
*/
|
|
51510
51473
|
attributes: {
|
|
51511
51474
|
rendered: false,
|
|
51512
51475
|
keepOnSplit: true
|
|
@@ -51518,10 +51481,9 @@ const BulletList = Node$1.create({
|
|
|
51518
51481
|
/**
|
|
51519
51482
|
* Toggle a bullet list at the current selection
|
|
51520
51483
|
* @category Command
|
|
51521
|
-
* @returns {Function} Command function
|
|
51522
51484
|
* @example
|
|
51523
51485
|
* // Toggle bullet list on selected text
|
|
51524
|
-
* toggleBulletList()
|
|
51486
|
+
* editor.commands.toggleBulletList()
|
|
51525
51487
|
* @note Converts selected paragraphs to list items or removes list formatting
|
|
51526
51488
|
*/
|
|
51527
51489
|
toggleBulletList: () => (params2) => {
|
|
@@ -51640,9 +51602,25 @@ const OrderedList = Node$1.create({
|
|
|
51640
51602
|
},
|
|
51641
51603
|
addCommands() {
|
|
51642
51604
|
return {
|
|
51605
|
+
/**
|
|
51606
|
+
* Toggle ordered list formatting
|
|
51607
|
+
* @category Command
|
|
51608
|
+
* @example
|
|
51609
|
+
* editor.commands.toggleOrderedList()
|
|
51610
|
+
* @note Converts selection to ordered list or back to paragraphs
|
|
51611
|
+
*/
|
|
51643
51612
|
toggleOrderedList: () => (params2) => {
|
|
51644
51613
|
return toggleList(this.type)(params2);
|
|
51645
51614
|
},
|
|
51615
|
+
/**
|
|
51616
|
+
* Restart list node numbering
|
|
51617
|
+
* @category Command
|
|
51618
|
+
* @param {Array} followingNodes - Nodes to restart
|
|
51619
|
+
* @param {number} pos - Starting position
|
|
51620
|
+
* @example
|
|
51621
|
+
* editor.commands.restartListNodes(nodes, position)
|
|
51622
|
+
* @note Resets list numbering for specified nodes
|
|
51623
|
+
*/
|
|
51646
51624
|
restartListNodes: (followingNodes, pos) => ({ tr }) => {
|
|
51647
51625
|
let currentNodePos = pos;
|
|
51648
51626
|
const nodes = followingNodes.map((node) => {
|
|
@@ -51661,8 +51639,11 @@ const OrderedList = Node$1.create({
|
|
|
51661
51639
|
return true;
|
|
51662
51640
|
},
|
|
51663
51641
|
/**
|
|
51664
|
-
*
|
|
51665
|
-
* @
|
|
51642
|
+
* Update ordered list style type based on nesting level
|
|
51643
|
+
* @category Command
|
|
51644
|
+
* @example
|
|
51645
|
+
* editor.commands.updateOrderedListStyleType()
|
|
51646
|
+
* @note Cycles through decimal -> lowerAlpha -> lowerRoman based on depth
|
|
51666
51647
|
*/
|
|
51667
51648
|
updateOrderedListStyleType: () => ({ dispatch, tr }) => {
|
|
51668
51649
|
let list = findParentNode((node) => node.type.name === this.name)(tr.selection);
|
|
@@ -51939,7 +51920,7 @@ const CustomSelection = Extension.create({
|
|
|
51939
51920
|
* @returns {Function} Command function
|
|
51940
51921
|
* @example
|
|
51941
51922
|
* // Restore selection after toolbar interaction
|
|
51942
|
-
* restorePreservedSelection()
|
|
51923
|
+
* editor.commands.restorePreservedSelection()
|
|
51943
51924
|
* @note Used internally to maintain selection when interacting with toolbar
|
|
51944
51925
|
*/
|
|
51945
51926
|
restorePreservedSelection: () => ({ tr, state: state2 }) => {
|
|
@@ -52228,6 +52209,9 @@ const LinkedStyles = Extension.create({
|
|
|
52228
52209
|
name: "linkedStyles",
|
|
52229
52210
|
priority: 1,
|
|
52230
52211
|
// We need this plugin to run before the list plugins
|
|
52212
|
+
addOptions() {
|
|
52213
|
+
return {};
|
|
52214
|
+
},
|
|
52231
52215
|
addPmPlugins() {
|
|
52232
52216
|
return [createLinkedStylesPlugin(this.editor)];
|
|
52233
52217
|
},
|
|
@@ -52236,11 +52220,10 @@ const LinkedStyles = Extension.create({
|
|
|
52236
52220
|
/**
|
|
52237
52221
|
* Apply a linked style to the selected paragraphs
|
|
52238
52222
|
* @category Command
|
|
52239
|
-
* @param {
|
|
52240
|
-
* @returns {Function} Command function
|
|
52223
|
+
* @param {LinkedStyle} style - The style object to apply
|
|
52241
52224
|
* @example
|
|
52242
52225
|
* const style = editor.helpers.linkedStyles.getStyleById('Heading1');
|
|
52243
|
-
* setLinkedStyle(style);
|
|
52226
|
+
* editor.commands.setLinkedStyle(style);
|
|
52244
52227
|
* @note Clears existing formatting when applying a style
|
|
52245
52228
|
* @note Works with custom selection preservation
|
|
52246
52229
|
*/
|
|
@@ -52251,16 +52234,12 @@ const LinkedStyles = Extension.create({
|
|
|
52251
52234
|
/**
|
|
52252
52235
|
* Toggle a linked style on the current selection
|
|
52253
52236
|
* @category Command
|
|
52254
|
-
* @param {
|
|
52237
|
+
* @param {LinkedStyle} style - The linked style to apply (with id property)
|
|
52255
52238
|
* @param {string|null} [nodeType=null] - Node type to restrict toggle to (e.g., 'paragraph')
|
|
52256
|
-
* @returns {Function} Command function
|
|
52257
52239
|
* @example
|
|
52258
|
-
* // Toggle a heading style
|
|
52259
52240
|
* const style = editor.helpers.linkedStyles.getStyleById('Heading1');
|
|
52260
|
-
* toggleLinkedStyle(style)
|
|
52261
|
-
*
|
|
52262
|
-
* // Toggle only on paragraph nodes
|
|
52263
|
-
* toggleLinkedStyle(style, 'paragraph')
|
|
52241
|
+
* editor.commands.toggleLinkedStyle(style)
|
|
52242
|
+
* editor.commands.toggleLinkedStyle(style, 'paragraph')
|
|
52264
52243
|
* @note If selection is empty, returns false
|
|
52265
52244
|
* @note Removes style if already applied, applies it if not
|
|
52266
52245
|
*/
|
|
@@ -52288,13 +52267,9 @@ const LinkedStyles = Extension.create({
|
|
|
52288
52267
|
* Apply a linked style by its ID
|
|
52289
52268
|
* @category Command
|
|
52290
52269
|
* @param {string} styleId - The style ID to apply (e.g., 'Heading1')
|
|
52291
|
-
* @returns {Function} Command function
|
|
52292
52270
|
* @example
|
|
52293
|
-
*
|
|
52294
|
-
* setStyleById('
|
|
52295
|
-
*
|
|
52296
|
-
* // Apply a normal style
|
|
52297
|
-
* setStyleById('Normal')
|
|
52271
|
+
* editor.commands.setStyleById('Heading1')
|
|
52272
|
+
* editor.commands.setStyleById('Normal')
|
|
52298
52273
|
* @note Looks up the style from loaded Word styles
|
|
52299
52274
|
*/
|
|
52300
52275
|
setStyleById: (styleId) => (params2) => {
|
|
@@ -53002,12 +52977,6 @@ const Paragraph = OxmlNode.create({
|
|
|
53002
52977
|
inline: false,
|
|
53003
52978
|
addOptions() {
|
|
53004
52979
|
return {
|
|
53005
|
-
/**
|
|
53006
|
-
* @typedef {Object} HeadingOptions
|
|
53007
|
-
* @category Options
|
|
53008
|
-
* @property {number[]} [headingLevels=[1,2,3,4,5,6]] - Supported heading levels
|
|
53009
|
-
* @property {Object} [htmlAttributes] - HTML attributes for paragraph elements
|
|
53010
|
-
*/
|
|
53011
52980
|
headingLevels: [1, 2, 3, 4, 5, 6],
|
|
53012
52981
|
htmlAttributes: {}
|
|
53013
52982
|
};
|
|
@@ -53239,11 +53208,6 @@ const Heading = Extension.create({
|
|
|
53239
53208
|
name: "heading",
|
|
53240
53209
|
addOptions() {
|
|
53241
53210
|
return {
|
|
53242
|
-
/**
|
|
53243
|
-
* @typedef {Object} HeadingOptions
|
|
53244
|
-
* @category Options
|
|
53245
|
-
* @property {number[]} [levels=[1,2,3,4,5,6]] - Supported heading levels
|
|
53246
|
-
*/
|
|
53247
53211
|
levels: [1, 2, 3, 4, 5, 6]
|
|
53248
53212
|
};
|
|
53249
53213
|
},
|
|
@@ -53253,10 +53217,8 @@ const Heading = Extension.create({
|
|
|
53253
53217
|
* Set a heading with specified level
|
|
53254
53218
|
* @category Command
|
|
53255
53219
|
* @param {HeadingAttributes} attributes - Heading attributes including level
|
|
53256
|
-
* @returns {Function} Command function
|
|
53257
53220
|
* @example
|
|
53258
|
-
*
|
|
53259
|
-
* setHeading({ level: 2 })
|
|
53221
|
+
* editor.commands.setHeading({ level: 2 })
|
|
53260
53222
|
* @note Converts current block to heading
|
|
53261
53223
|
*/
|
|
53262
53224
|
setHeading: (attributes) => ({ commands: commands2 }) => {
|
|
@@ -53268,13 +53230,9 @@ const Heading = Extension.create({
|
|
|
53268
53230
|
* Toggle between heading and paragraph
|
|
53269
53231
|
* @category Command
|
|
53270
53232
|
* @param {HeadingAttributes} attributes - Heading attributes including level
|
|
53271
|
-
* @returns {Function} Command function
|
|
53272
53233
|
* @example
|
|
53273
|
-
*
|
|
53274
|
-
* toggleHeading({ level:
|
|
53275
|
-
*
|
|
53276
|
-
* // Toggle heading level 3
|
|
53277
|
-
* toggleHeading({ level: 3 })
|
|
53234
|
+
* editor.commands.toggleHeading({ level: 1 })
|
|
53235
|
+
* editor.commands.toggleHeading({ level: 3 })
|
|
53278
53236
|
* @note Switches between heading and paragraph for the same level
|
|
53279
53237
|
*/
|
|
53280
53238
|
toggleHeading: (attributes) => ({ commands: commands2 }) => {
|
|
@@ -53679,6 +53637,9 @@ const LineBreak = Node$1.create({
|
|
|
53679
53637
|
selectable: false,
|
|
53680
53638
|
content: "",
|
|
53681
53639
|
atom: true,
|
|
53640
|
+
addOptions() {
|
|
53641
|
+
return {};
|
|
53642
|
+
},
|
|
53682
53643
|
parseDOM() {
|
|
53683
53644
|
return [{ tag: "br" }];
|
|
53684
53645
|
},
|
|
@@ -53687,17 +53648,7 @@ const LineBreak = Node$1.create({
|
|
|
53687
53648
|
},
|
|
53688
53649
|
addAttributes() {
|
|
53689
53650
|
return {
|
|
53690
|
-
/**
|
|
53691
|
-
* @private
|
|
53692
|
-
* @category Attribute
|
|
53693
|
-
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
53694
|
-
*/
|
|
53695
53651
|
lineBreakType: { rendered: false },
|
|
53696
|
-
/**
|
|
53697
|
-
* @private
|
|
53698
|
-
* @category Attribute
|
|
53699
|
-
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
53700
|
-
*/
|
|
53701
53652
|
clear: { rendered: false }
|
|
53702
53653
|
};
|
|
53703
53654
|
},
|
|
@@ -53706,9 +53657,8 @@ const LineBreak = Node$1.create({
|
|
|
53706
53657
|
/**
|
|
53707
53658
|
* Insert a line break
|
|
53708
53659
|
* @category Command
|
|
53709
|
-
* @returns {Function} Command function
|
|
53710
53660
|
* @example
|
|
53711
|
-
* insertLineBreak()
|
|
53661
|
+
* editor.commands.insertLineBreak()
|
|
53712
53662
|
* @note Creates a soft break within the same paragraph
|
|
53713
53663
|
*/
|
|
53714
53664
|
insertLineBreak: () => ({ commands: commands2 }) => {
|
|
@@ -53725,11 +53675,6 @@ const HardBreak = Node$1.create({
|
|
|
53725
53675
|
atom: true,
|
|
53726
53676
|
addOptions() {
|
|
53727
53677
|
return {
|
|
53728
|
-
/**
|
|
53729
|
-
* @typedef {Object} HardBreakOptions
|
|
53730
|
-
* @category Options
|
|
53731
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the break element
|
|
53732
|
-
*/
|
|
53733
53678
|
htmlAttributes: {
|
|
53734
53679
|
contentEditable: "false",
|
|
53735
53680
|
lineBreakType: "page",
|
|
@@ -53740,35 +53685,15 @@ const HardBreak = Node$1.create({
|
|
|
53740
53685
|
},
|
|
53741
53686
|
addAttributes() {
|
|
53742
53687
|
return {
|
|
53743
|
-
/**
|
|
53744
|
-
* @private
|
|
53745
|
-
* @category Attribute
|
|
53746
|
-
* @param {string} [pageBreakSource] - Source of the page break
|
|
53747
|
-
*/
|
|
53748
53688
|
pageBreakSource: {
|
|
53749
53689
|
rendered: false,
|
|
53750
53690
|
default: null
|
|
53751
53691
|
},
|
|
53752
|
-
/**
|
|
53753
|
-
* @private
|
|
53754
|
-
* @category Attribute
|
|
53755
|
-
* @param {string} [pageBreakType] - Type of page break
|
|
53756
|
-
*/
|
|
53757
53692
|
pageBreakType: {
|
|
53758
53693
|
default: null,
|
|
53759
53694
|
rendered: false
|
|
53760
53695
|
},
|
|
53761
|
-
/**
|
|
53762
|
-
* @private
|
|
53763
|
-
* @category Attribute
|
|
53764
|
-
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
53765
|
-
*/
|
|
53766
53696
|
lineBreakType: { rendered: false },
|
|
53767
|
-
/**
|
|
53768
|
-
* @private
|
|
53769
|
-
* @category Attribute
|
|
53770
|
-
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
53771
|
-
*/
|
|
53772
53697
|
clear: { rendered: false }
|
|
53773
53698
|
};
|
|
53774
53699
|
},
|
|
@@ -53794,9 +53719,8 @@ const HardBreak = Node$1.create({
|
|
|
53794
53719
|
/**
|
|
53795
53720
|
* Insert a page break
|
|
53796
53721
|
* @category Command
|
|
53797
|
-
* @returns {Function} Command function
|
|
53798
53722
|
* @example
|
|
53799
|
-
* insertPageBreak()
|
|
53723
|
+
* editor.commands.insertPageBreak()
|
|
53800
53724
|
* @note Forces content to start on a new page when printed
|
|
53801
53725
|
*/
|
|
53802
53726
|
insertPageBreak: () => ({ commands: commands2 }) => {
|
|
@@ -56186,17 +56110,6 @@ const Table = Node$1.create({
|
|
|
56186
56110
|
group: "block",
|
|
56187
56111
|
isolating: true,
|
|
56188
56112
|
tableRole: "table",
|
|
56189
|
-
/**
|
|
56190
|
-
* Table extension options
|
|
56191
|
-
* @category Options
|
|
56192
|
-
* @typedef {Object} TableOptions
|
|
56193
|
-
* @property {Object} [htmlAttributes={'aria-label': 'Table node'}] - Default HTML attributes for all tables
|
|
56194
|
-
* @property {boolean} [resizable=true] - Enable column resizing functionality
|
|
56195
|
-
* @property {number} [handleWidth=5] - Width of resize handles in pixels
|
|
56196
|
-
* @property {number} [cellMinWidth=10] - Minimum cell width constraint in pixels
|
|
56197
|
-
* @property {boolean} [lastColumnResizable=true] - Allow resizing of the last column
|
|
56198
|
-
* @property {boolean} [allowTableNodeSelection=false] - Enable selecting the entire table node
|
|
56199
|
-
*/
|
|
56200
56113
|
addOptions() {
|
|
56201
56114
|
return {
|
|
56202
56115
|
htmlAttributes: {
|
|
@@ -56354,14 +56267,9 @@ const Table = Node$1.create({
|
|
|
56354
56267
|
* Insert a new table into the document
|
|
56355
56268
|
* @category Command
|
|
56356
56269
|
* @param {TableConfig} [config] - Table configuration options
|
|
56357
|
-
* @returns {Function} Command
|
|
56358
56270
|
* @example
|
|
56359
|
-
*
|
|
56360
|
-
* insertTable(
|
|
56361
|
-
*
|
|
56362
|
-
* // Using custom values
|
|
56363
|
-
* insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
56364
|
-
*
|
|
56271
|
+
* editor.commands.insertTable()
|
|
56272
|
+
* editor.commands.insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
56365
56273
|
*/
|
|
56366
56274
|
insertTable: ({ rows = 3, cols = 3, withHeaderRow = false } = {}) => ({ tr, dispatch, editor }) => {
|
|
56367
56275
|
const node = createTable(editor.schema, rows, cols, withHeaderRow);
|
|
@@ -56374,9 +56282,8 @@ const Table = Node$1.create({
|
|
|
56374
56282
|
/**
|
|
56375
56283
|
* Delete the entire table containing the cursor
|
|
56376
56284
|
* @category Command
|
|
56377
|
-
* @returns {Function} Command
|
|
56378
56285
|
* @example
|
|
56379
|
-
* deleteTable()
|
|
56286
|
+
* editor.commands.deleteTable()
|
|
56380
56287
|
*/
|
|
56381
56288
|
deleteTable: () => ({ state: state2, dispatch }) => {
|
|
56382
56289
|
return deleteTable(state2, dispatch);
|
|
@@ -56384,9 +56291,8 @@ const Table = Node$1.create({
|
|
|
56384
56291
|
/**
|
|
56385
56292
|
* Add a column before the current column
|
|
56386
56293
|
* @category Command
|
|
56387
|
-
* @returns {Function} Command
|
|
56388
56294
|
* @example
|
|
56389
|
-
* addColumnBefore()
|
|
56295
|
+
* editor.commands.addColumnBefore()
|
|
56390
56296
|
* @note Preserves cell attributes from current column
|
|
56391
56297
|
*/
|
|
56392
56298
|
addColumnBefore: () => ({ state: state2, dispatch, chain }) => {
|
|
@@ -56763,10 +56669,9 @@ const Table = Node$1.create({
|
|
|
56763
56669
|
* Set background color for selected cells
|
|
56764
56670
|
* @category Command
|
|
56765
56671
|
* @param {string} value - Color value (hex with or without #)
|
|
56766
|
-
* @returns {Function} Command
|
|
56767
56672
|
* @example
|
|
56768
|
-
* setCellBackground('#ff0000')
|
|
56769
|
-
* setCellBackground('ff0000')
|
|
56673
|
+
* editor.commands.setCellBackground('#ff0000')
|
|
56674
|
+
* editor.commands.setCellBackground('ff0000')
|
|
56770
56675
|
*/
|
|
56771
56676
|
setCellBackground: (value) => ({ editor, commands: commands2, dispatch }) => {
|
|
56772
56677
|
const { selection } = editor.state;
|
|
@@ -56892,24 +56797,12 @@ const TableHeader = Node$1.create({
|
|
|
56892
56797
|
},
|
|
56893
56798
|
addAttributes() {
|
|
56894
56799
|
return {
|
|
56895
|
-
/**
|
|
56896
|
-
* @category Attribute
|
|
56897
|
-
* @param {number} [colspan=1] - Number of columns this header spans
|
|
56898
|
-
*/
|
|
56899
56800
|
colspan: {
|
|
56900
56801
|
default: 1
|
|
56901
56802
|
},
|
|
56902
|
-
/**
|
|
56903
|
-
* @category Attribute
|
|
56904
|
-
* @param {number} [rowspan=1] - Number of rows this header spans
|
|
56905
|
-
*/
|
|
56906
56803
|
rowspan: {
|
|
56907
56804
|
default: 1
|
|
56908
56805
|
},
|
|
56909
|
-
/**
|
|
56910
|
-
* @category Attribute
|
|
56911
|
-
* @param {number[]} [colwidth] - Column widths array in pixels
|
|
56912
|
-
*/
|
|
56913
56806
|
colwidth: {
|
|
56914
56807
|
default: null,
|
|
56915
56808
|
parseDOM: (element) => {
|
|
@@ -56946,10 +56839,6 @@ const TableRow = Node$1.create({
|
|
|
56946
56839
|
},
|
|
56947
56840
|
addAttributes() {
|
|
56948
56841
|
return {
|
|
56949
|
-
/**
|
|
56950
|
-
* @category Attribute
|
|
56951
|
-
* @param {number} [rowHeight] - Fixed row height in pixels
|
|
56952
|
-
*/
|
|
56953
56842
|
rowHeight: {
|
|
56954
56843
|
renderDOM({ rowHeight }) {
|
|
56955
56844
|
if (!rowHeight) return {};
|
|
@@ -56957,11 +56846,6 @@ const TableRow = Node$1.create({
|
|
|
56957
56846
|
return { style: style2 };
|
|
56958
56847
|
}
|
|
56959
56848
|
},
|
|
56960
|
-
/**
|
|
56961
|
-
* Indicates that this row should not be split across pages when paginating/exporting.
|
|
56962
|
-
* @category Attribute
|
|
56963
|
-
* @param {boolean} [cantSplit]
|
|
56964
|
-
*/
|
|
56965
56849
|
cantSplit: {
|
|
56966
56850
|
default: false,
|
|
56967
56851
|
parseDOM() {
|
|
@@ -56973,44 +56857,30 @@ const TableRow = Node$1.create({
|
|
|
56973
56857
|
}
|
|
56974
56858
|
},
|
|
56975
56859
|
/**
|
|
56976
|
-
* @category Attribute
|
|
56977
|
-
* @param {TableRowProperties} [tableRowProperties] - Properties for the table row.
|
|
56978
56860
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 377-482
|
|
56979
56861
|
*/
|
|
56980
56862
|
tableRowProperties: { rendered: false },
|
|
56981
56863
|
/**
|
|
56982
|
-
* @category Attribute
|
|
56983
|
-
* @param {string} [rsidDel] - Unique identifier used to track the editing session when the row was deleted from the main document.
|
|
56984
56864
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
56985
56865
|
*/
|
|
56986
56866
|
rsidDel: { rendered: false },
|
|
56987
56867
|
/**
|
|
56988
|
-
* @category Attribute
|
|
56989
|
-
* @param {string} [rsidR] - Unique identifier used to track the editing session when the table row was added to the main document.
|
|
56990
56868
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
56991
56869
|
*/
|
|
56992
56870
|
rsidR: { rendered: false },
|
|
56993
56871
|
/**
|
|
56994
|
-
* @category Attribute
|
|
56995
|
-
* @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.
|
|
56996
56872
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
56997
56873
|
*/
|
|
56998
56874
|
rsidRPr: { rendered: false },
|
|
56999
56875
|
/**
|
|
57000
|
-
* @category Attribute
|
|
57001
|
-
* @param {string} [rsidTr] - Unique identifier used to track the editing session when the table row's properties were last modified in this document.
|
|
57002
56876
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
57003
56877
|
*/
|
|
57004
56878
|
rsidTr: { rendered: false },
|
|
57005
56879
|
/**
|
|
57006
|
-
* @category Attribute
|
|
57007
|
-
* @param {string} [paraId] - A randomly generated unique identifier for the table row.
|
|
57008
56880
|
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/a0e7d2e2-2246-44c6-96e8-1cf009823615}
|
|
57009
56881
|
*/
|
|
57010
56882
|
paraId: { rendered: false },
|
|
57011
56883
|
/**
|
|
57012
|
-
* @category Attribute
|
|
57013
|
-
* @param {string} [textId] - A randomly generated unique identifier for the text of the table row.
|
|
57014
56884
|
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/b7eeddec-7c50-47fb-88b6-1feec3ed832c}
|
|
57015
56885
|
*/
|
|
57016
56886
|
textId: { rendered: false }
|
|
@@ -57037,24 +56907,12 @@ const TableCell = Node$1.create({
|
|
|
57037
56907
|
},
|
|
57038
56908
|
addAttributes() {
|
|
57039
56909
|
return {
|
|
57040
|
-
/**
|
|
57041
|
-
* @category Attribute
|
|
57042
|
-
* @param {number} [colspan=1] - Number of columns this cell spans
|
|
57043
|
-
*/
|
|
57044
56910
|
colspan: {
|
|
57045
56911
|
default: 1
|
|
57046
56912
|
},
|
|
57047
|
-
/**
|
|
57048
|
-
* @category Attribute
|
|
57049
|
-
* @param {number} [rowspan=1] - Number of rows this cell spans
|
|
57050
|
-
*/
|
|
57051
56913
|
rowspan: {
|
|
57052
56914
|
default: 1
|
|
57053
56915
|
},
|
|
57054
|
-
/**
|
|
57055
|
-
* @category Attribute
|
|
57056
|
-
* @param {number[]} [colwidth=[100]] - Column widths array in pixels
|
|
57057
|
-
*/
|
|
57058
56916
|
colwidth: {
|
|
57059
56917
|
default: [100],
|
|
57060
56918
|
parseDOM: (elem) => {
|
|
@@ -57069,10 +56927,6 @@ const TableCell = Node$1.create({
|
|
|
57069
56927
|
};
|
|
57070
56928
|
}
|
|
57071
56929
|
},
|
|
57072
|
-
/**
|
|
57073
|
-
* @category Attribute
|
|
57074
|
-
* @param {CellBackground} [background] - Cell background color configuration
|
|
57075
|
-
*/
|
|
57076
56930
|
background: {
|
|
57077
56931
|
renderDOM({ background }) {
|
|
57078
56932
|
if (!background) return {};
|
|
@@ -57081,10 +56935,6 @@ const TableCell = Node$1.create({
|
|
|
57081
56935
|
return { style: style2 };
|
|
57082
56936
|
}
|
|
57083
56937
|
},
|
|
57084
|
-
/**
|
|
57085
|
-
* @category Attribute
|
|
57086
|
-
* @param {string} [verticalAlign] - Vertical content alignment (top, middle, bottom)
|
|
57087
|
-
*/
|
|
57088
56938
|
verticalAlign: {
|
|
57089
56939
|
renderDOM({ verticalAlign }) {
|
|
57090
56940
|
if (!verticalAlign) return {};
|
|
@@ -57092,10 +56942,6 @@ const TableCell = Node$1.create({
|
|
|
57092
56942
|
return { style: style2 };
|
|
57093
56943
|
}
|
|
57094
56944
|
},
|
|
57095
|
-
/**
|
|
57096
|
-
* @category Attribute
|
|
57097
|
-
* @param {CellMargins} [cellMargins] - Internal cell padding
|
|
57098
|
-
*/
|
|
57099
56945
|
cellMargins: {
|
|
57100
56946
|
renderDOM({ cellMargins }) {
|
|
57101
56947
|
if (!cellMargins) return {};
|
|
@@ -57108,10 +56954,6 @@ const TableCell = Node$1.create({
|
|
|
57108
56954
|
return { style: style2 };
|
|
57109
56955
|
}
|
|
57110
56956
|
},
|
|
57111
|
-
/**
|
|
57112
|
-
* @category Attribute
|
|
57113
|
-
* @param {CellBorders} [borders] - Cell border configuration
|
|
57114
|
-
*/
|
|
57115
56957
|
borders: {
|
|
57116
56958
|
default: () => createCellBorders(),
|
|
57117
56959
|
renderDOM({ borders }) {
|
|
@@ -57126,20 +56968,10 @@ const TableCell = Node$1.create({
|
|
|
57126
56968
|
return { style: style2 };
|
|
57127
56969
|
}
|
|
57128
56970
|
},
|
|
57129
|
-
/**
|
|
57130
|
-
* @private
|
|
57131
|
-
* @category Attribute
|
|
57132
|
-
* @param {string} [widthType='auto'] - Internal width type
|
|
57133
|
-
*/
|
|
57134
56971
|
widthType: {
|
|
57135
56972
|
default: "auto",
|
|
57136
56973
|
rendered: false
|
|
57137
56974
|
},
|
|
57138
|
-
/**
|
|
57139
|
-
* @private
|
|
57140
|
-
* @category Attribute
|
|
57141
|
-
* @param {string} [widthUnit='px'] - Internal width unit
|
|
57142
|
-
*/
|
|
57143
56975
|
widthUnit: {
|
|
57144
56976
|
default: "px",
|
|
57145
56977
|
rendered: false
|
|
@@ -59342,6 +59174,19 @@ const findPreviousDomNodeWithClass = (view, pos, className) => {
|
|
|
59342
59174
|
}
|
|
59343
59175
|
return null;
|
|
59344
59176
|
};
|
|
59177
|
+
const getRotationMargins = (w2, h2, angleDegrees) => {
|
|
59178
|
+
const rad = angleDegrees * (Math.PI / 180);
|
|
59179
|
+
const cos = Math.abs(Math.cos(rad));
|
|
59180
|
+
const sin = Math.abs(Math.sin(rad));
|
|
59181
|
+
const boundingWidth = w2 * cos + h2 * sin;
|
|
59182
|
+
const boundingHeight = w2 * sin + h2 * cos;
|
|
59183
|
+
const marginLeftRight = Math.round(Math.max(0, (boundingWidth - w2) / 2));
|
|
59184
|
+
const marginTopBottom = Math.round(Math.max(0, (boundingHeight - h2) / 2));
|
|
59185
|
+
return {
|
|
59186
|
+
horizontal: marginLeftRight,
|
|
59187
|
+
vertical: marginTopBottom
|
|
59188
|
+
};
|
|
59189
|
+
};
|
|
59345
59190
|
const Image = Node$1.create({
|
|
59346
59191
|
name: "image",
|
|
59347
59192
|
group: "inline",
|
|
@@ -59363,10 +59208,6 @@ const Image = Node$1.create({
|
|
|
59363
59208
|
},
|
|
59364
59209
|
addAttributes() {
|
|
59365
59210
|
return {
|
|
59366
|
-
/**
|
|
59367
|
-
* @category Attribute
|
|
59368
|
-
* @param {string} [src] - Image source URL or path
|
|
59369
|
-
*/
|
|
59370
59211
|
src: {
|
|
59371
59212
|
default: null,
|
|
59372
59213
|
renderDOM: ({ src }) => {
|
|
@@ -59375,95 +59216,75 @@ const Image = Node$1.create({
|
|
|
59375
59216
|
};
|
|
59376
59217
|
}
|
|
59377
59218
|
},
|
|
59378
|
-
/**
|
|
59379
|
-
* @category Attribute
|
|
59380
|
-
* @param {string} [alt='Uploaded picture'] - Alternative text for accessibility
|
|
59381
|
-
*/
|
|
59382
59219
|
alt: {
|
|
59383
59220
|
default: "Uploaded picture"
|
|
59384
59221
|
},
|
|
59385
|
-
/**
|
|
59386
|
-
* @category Attribute
|
|
59387
|
-
* @param {string} [id] - Image element ID
|
|
59388
|
-
* @private
|
|
59389
|
-
*/
|
|
59390
59222
|
id: { rendered: false },
|
|
59391
|
-
/**
|
|
59392
|
-
* @category Attribute
|
|
59393
|
-
* @param {string} [title] - Image title/tooltip text
|
|
59394
|
-
*/
|
|
59395
59223
|
title: {
|
|
59396
59224
|
default: null
|
|
59397
59225
|
},
|
|
59398
|
-
/**
|
|
59399
|
-
* @category Attribute
|
|
59400
|
-
* @param {string} [rId] - Relationship ID for Word export
|
|
59401
|
-
* @private
|
|
59402
|
-
*/
|
|
59403
59226
|
rId: {
|
|
59404
59227
|
default: null,
|
|
59405
59228
|
rendered: false
|
|
59406
59229
|
},
|
|
59407
|
-
/**
|
|
59408
|
-
* @category Attribute
|
|
59409
|
-
* @param {Object} [originalPadding] - Original padding values from Word import
|
|
59410
|
-
* @private
|
|
59411
|
-
*/
|
|
59412
59230
|
originalPadding: {
|
|
59413
59231
|
default: null,
|
|
59414
59232
|
rendered: false
|
|
59415
59233
|
},
|
|
59416
|
-
/**
|
|
59417
|
-
* @category Attribute
|
|
59418
|
-
* @param {Object} [originalAttributes] - Original attributes from Word import
|
|
59419
|
-
* @private
|
|
59420
|
-
*/
|
|
59421
59234
|
originalAttributes: { rendered: false },
|
|
59422
|
-
/**
|
|
59423
|
-
* @category Attribute
|
|
59424
|
-
* @param {boolean} [wrapTopAndBottom] - Wrap text above and below image
|
|
59425
|
-
* @private
|
|
59426
|
-
*/
|
|
59427
59235
|
wrapTopAndBottom: { rendered: false },
|
|
59428
|
-
/**
|
|
59429
|
-
* @category Attribute
|
|
59430
|
-
* @param {Object} [anchorData] - Anchor positioning data for Word
|
|
59431
|
-
* @private
|
|
59432
|
-
*/
|
|
59433
59236
|
anchorData: {
|
|
59434
59237
|
default: null,
|
|
59435
59238
|
rendered: false
|
|
59436
59239
|
},
|
|
59240
|
+
isAnchor: { rendered: false },
|
|
59437
59241
|
/**
|
|
59438
59242
|
* @category Attribute
|
|
59439
|
-
* @param {
|
|
59243
|
+
* @param {Object} [transformData] - Transform data for image (turn and flip)
|
|
59244
|
+
* @param {number} [transformData.rotation] - Turn angle in degrees
|
|
59245
|
+
* @param {boolean} [transformData.verticalFlip] - Whether to flip vertically
|
|
59246
|
+
* @param {boolean} [transformData.horizontalFlip] - Whether to flip horizontally
|
|
59247
|
+
* @param {Object} [transformData.sizeExtension] - Size extension for image due to transformation
|
|
59248
|
+
* @param {number} [transformData.sizeExtension.left] - Left size extension for image
|
|
59249
|
+
* @param {number} [transformData.sizeExtension.top] - Top size extension for image
|
|
59250
|
+
* @param {number} [transformData.sizeExtension.right] - Right size extension for image
|
|
59251
|
+
* @param {number} [transformData.sizeExtension.bottom] - Bottom size extension for image
|
|
59252
|
+
*
|
|
59440
59253
|
* @private
|
|
59441
59254
|
*/
|
|
59442
|
-
|
|
59255
|
+
transformData: {
|
|
59256
|
+
default: {},
|
|
59257
|
+
renderDOM: ({ transformData }) => {
|
|
59258
|
+
let style2 = "";
|
|
59259
|
+
if (transformData?.rotation) {
|
|
59260
|
+
style2 += `rotate(${Math.round(transformData.rotation)}deg) `;
|
|
59261
|
+
}
|
|
59262
|
+
if (transformData?.verticalFlip) {
|
|
59263
|
+
style2 += "scaleY(-1) ";
|
|
59264
|
+
}
|
|
59265
|
+
if (transformData?.horizontalFlip) {
|
|
59266
|
+
style2 += "scaleX(-1) ";
|
|
59267
|
+
}
|
|
59268
|
+
style2 = style2.trim();
|
|
59269
|
+
if (style2.length > 0) {
|
|
59270
|
+
return { style: `transform: ${style2};` };
|
|
59271
|
+
}
|
|
59272
|
+
return;
|
|
59273
|
+
}
|
|
59274
|
+
},
|
|
59443
59275
|
/**
|
|
59444
59276
|
* @category Attribute
|
|
59445
59277
|
* @param {boolean} [simplePos] - Simple positioning flag
|
|
59446
59278
|
* @private
|
|
59447
59279
|
*/
|
|
59448
59280
|
simplePos: { rendered: false },
|
|
59449
|
-
/**
|
|
59450
|
-
* @category Attribute
|
|
59451
|
-
* @param {string} [wrapText] - Text wrapping style
|
|
59452
|
-
* @private
|
|
59453
|
-
*/
|
|
59454
59281
|
wrapText: { rendered: false },
|
|
59455
59282
|
extension: { rendered: false },
|
|
59456
|
-
/**
|
|
59457
|
-
* @category Attribute
|
|
59458
|
-
* @param {Object} [size] - Image dimensions
|
|
59459
|
-
* @param {number} [size.width] - Width in pixels
|
|
59460
|
-
* @param {number} [size.height] - Height in pixels
|
|
59461
|
-
*/
|
|
59462
59283
|
size: {
|
|
59463
59284
|
default: {},
|
|
59464
59285
|
renderDOM: ({ size: size2, extension }) => {
|
|
59465
59286
|
let style2 = "";
|
|
59466
|
-
|
|
59287
|
+
let { width, height } = size2 ?? {};
|
|
59467
59288
|
if (width) style2 += `width: ${width}px;`;
|
|
59468
59289
|
if (height && ["emf", "wmf"].includes(extension))
|
|
59469
59290
|
style2 += `height: ${height}px; border: 1px solid black; position: absolute;`;
|
|
@@ -59471,51 +59292,58 @@ const Image = Node$1.create({
|
|
|
59471
59292
|
return { style: style2 };
|
|
59472
59293
|
}
|
|
59473
59294
|
},
|
|
59474
|
-
/**
|
|
59475
|
-
* @category Attribute
|
|
59476
|
-
* @param {Object} [padding] - Image padding/margins
|
|
59477
|
-
* @param {number} [padding.left] - Left padding in pixels
|
|
59478
|
-
* @param {number} [padding.top] - Top padding in pixels
|
|
59479
|
-
* @param {number} [padding.bottom] - Bottom padding in pixels
|
|
59480
|
-
* @param {number} [padding.right] - Right padding in pixels
|
|
59481
|
-
*/
|
|
59482
59295
|
padding: {
|
|
59483
59296
|
default: {},
|
|
59484
|
-
renderDOM: ({ padding, marginOffset }) => {
|
|
59485
|
-
|
|
59297
|
+
renderDOM: ({ size: size2 = {}, padding, marginOffset, transformData }) => {
|
|
59298
|
+
let { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
|
|
59299
|
+
const { rotation } = transformData ?? {};
|
|
59300
|
+
const { height, width } = size2 ?? {};
|
|
59301
|
+
if (rotation && height && width) {
|
|
59302
|
+
const { horizontal, vertical } = getRotationMargins(width, height, rotation);
|
|
59303
|
+
left2 += horizontal;
|
|
59304
|
+
right2 += horizontal;
|
|
59305
|
+
top2 += vertical;
|
|
59306
|
+
bottom2 += vertical;
|
|
59307
|
+
}
|
|
59486
59308
|
let style2 = "";
|
|
59487
|
-
if (left2 &&
|
|
59488
|
-
if (top2 &&
|
|
59309
|
+
if (left2 && marginOffset?.left == null) style2 += `margin-left: ${left2}px;`;
|
|
59310
|
+
if (top2 && marginOffset?.top == null) style2 += `margin-top: ${top2}px;`;
|
|
59489
59311
|
if (bottom2) style2 += `margin-bottom: ${bottom2}px;`;
|
|
59490
59312
|
if (right2) style2 += `margin-right: ${right2}px;`;
|
|
59491
59313
|
return { style: style2 };
|
|
59492
59314
|
}
|
|
59493
59315
|
},
|
|
59494
|
-
/**
|
|
59495
|
-
* @category Attribute
|
|
59496
|
-
* @param {Object} [marginOffset] - Margin offset for anchored images
|
|
59497
|
-
* @param {number} [marginOffset.left] - Left margin offset
|
|
59498
|
-
* @param {number} [marginOffset.top] - Top margin offset
|
|
59499
|
-
*/
|
|
59500
59316
|
marginOffset: {
|
|
59501
59317
|
default: {},
|
|
59502
|
-
renderDOM: ({ marginOffset, anchorData }) => {
|
|
59318
|
+
renderDOM: ({ marginOffset, anchorData, transformData, size: size2 }) => {
|
|
59319
|
+
const hasAnchorData = Boolean(anchorData);
|
|
59320
|
+
const hasMarginOffsets = marginOffset?.left != null || marginOffset?.top != null;
|
|
59321
|
+
if (!hasAnchorData && !hasMarginOffsets) return {};
|
|
59503
59322
|
const relativeFromPageV = anchorData?.vRelativeFrom === "page";
|
|
59504
59323
|
const maxMarginV = 500;
|
|
59505
|
-
const
|
|
59324
|
+
const baseLeft = marginOffset?.left ?? 0;
|
|
59325
|
+
const baseTop = marginOffset?.top ?? 0;
|
|
59326
|
+
let rotationLeft = 0;
|
|
59327
|
+
let rotationTop = 0;
|
|
59328
|
+
const { rotation } = transformData ?? {};
|
|
59329
|
+
const { height, width } = size2 ?? {};
|
|
59330
|
+
if (rotation && height && width) {
|
|
59331
|
+
const { horizontal, vertical } = getRotationMargins(width, height, rotation);
|
|
59332
|
+
rotationLeft = horizontal;
|
|
59333
|
+
rotationTop = vertical;
|
|
59334
|
+
}
|
|
59335
|
+
const left2 = baseLeft + rotationLeft;
|
|
59336
|
+
const top2 = baseTop + rotationTop;
|
|
59506
59337
|
let style2 = "";
|
|
59507
59338
|
if (left2) style2 += `margin-left: ${left2}px;`;
|
|
59508
59339
|
if (top2) {
|
|
59509
59340
|
if (relativeFromPageV && top2 >= maxMarginV) style2 += `margin-top: ${maxMarginV}px;`;
|
|
59510
59341
|
else style2 += `margin-top: ${top2}px;`;
|
|
59511
59342
|
}
|
|
59343
|
+
if (!style2) return {};
|
|
59512
59344
|
return { style: style2 };
|
|
59513
59345
|
}
|
|
59514
59346
|
},
|
|
59515
|
-
/**
|
|
59516
|
-
* @category Attribute
|
|
59517
|
-
* @param {string} [style] - Custom inline CSS styles
|
|
59518
|
-
*/
|
|
59519
59347
|
style: {
|
|
59520
59348
|
default: null,
|
|
59521
59349
|
rendered: true,
|
|
@@ -59541,18 +59369,10 @@ const Image = Node$1.create({
|
|
|
59541
59369
|
/**
|
|
59542
59370
|
* Insert an image at the current position
|
|
59543
59371
|
* @category Command
|
|
59544
|
-
* @param {
|
|
59545
|
-
* @param {string} options.src - Image source URL or data URI
|
|
59546
|
-
* @param {string} [options.alt] - Alternative text
|
|
59547
|
-
* @param {string} [options.title] - Image title
|
|
59548
|
-
* @param {Object} [options.size] - Image dimensions
|
|
59549
|
-
* @returns {Function} Command function
|
|
59372
|
+
* @param {ImageInsertOptions} options - Image insertion options
|
|
59550
59373
|
* @example
|
|
59551
|
-
*
|
|
59552
|
-
* setImage({
|
|
59553
|
-
*
|
|
59554
|
-
* // Insert a base64 encoded image
|
|
59555
|
-
* setImage({
|
|
59374
|
+
* editor.commands.setImage({ src: 'https://example.com/image.jpg' })
|
|
59375
|
+
* editor.commands.setImage({
|
|
59556
59376
|
* src: 'data:image/png;base64,...',
|
|
59557
59377
|
* alt: 'Company logo',
|
|
59558
59378
|
* size: { width: 200 }
|
|
@@ -59769,6 +59589,14 @@ const PageNumber = Node$1.create({
|
|
|
59769
59589
|
},
|
|
59770
59590
|
addCommands() {
|
|
59771
59591
|
return {
|
|
59592
|
+
/**
|
|
59593
|
+
* Insert an automatic page number
|
|
59594
|
+
* @category Command
|
|
59595
|
+
* @returns {Function} Command function
|
|
59596
|
+
* @example
|
|
59597
|
+
* editor.commands.addAutoPageNumber()
|
|
59598
|
+
* @note Only works in header/footer contexts
|
|
59599
|
+
*/
|
|
59772
59600
|
addAutoPageNumber: () => ({ tr, dispatch, state: state2, editor }) => {
|
|
59773
59601
|
const { options } = editor;
|
|
59774
59602
|
if (!options.isHeaderOrFooter) return false;
|
|
@@ -59831,6 +59659,14 @@ const TotalPageCount = Node$1.create({
|
|
|
59831
59659
|
},
|
|
59832
59660
|
addCommands() {
|
|
59833
59661
|
return {
|
|
59662
|
+
/**
|
|
59663
|
+
* Insert total page count
|
|
59664
|
+
* @category Command
|
|
59665
|
+
* @returns {Function} Command function
|
|
59666
|
+
* @example
|
|
59667
|
+
* editor.commands.addTotalPageCount()
|
|
59668
|
+
* @note Only works in header/footer contexts
|
|
59669
|
+
*/
|
|
59834
59670
|
addTotalPageCount: () => ({ tr, dispatch, state: state2, editor }) => {
|
|
59835
59671
|
const { options } = editor;
|
|
59836
59672
|
if (!options.isHeaderOrFooter) return false;
|
|
@@ -60097,11 +59933,6 @@ const ContentBlock = Node$1.create({
|
|
|
60097
59933
|
inline: true,
|
|
60098
59934
|
addOptions() {
|
|
60099
59935
|
return {
|
|
60100
|
-
/**
|
|
60101
|
-
* @typedef {Object} ContentBlockOptions
|
|
60102
|
-
* @category Options
|
|
60103
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the block element
|
|
60104
|
-
*/
|
|
60105
59936
|
htmlAttributes: {
|
|
60106
59937
|
contenteditable: false
|
|
60107
59938
|
}
|
|
@@ -60109,10 +59940,6 @@ const ContentBlock = Node$1.create({
|
|
|
60109
59940
|
},
|
|
60110
59941
|
addAttributes() {
|
|
60111
59942
|
return {
|
|
60112
|
-
/**
|
|
60113
|
-
* @category Attribute
|
|
60114
|
-
* @param {boolean} [horizontalRule=false] - Whether this block is a horizontal rule
|
|
60115
|
-
*/
|
|
60116
59943
|
horizontalRule: {
|
|
60117
59944
|
default: false,
|
|
60118
59945
|
renderDOM: ({ horizontalRule }) => {
|
|
@@ -60120,10 +59947,6 @@ const ContentBlock = Node$1.create({
|
|
|
60120
59947
|
return { "data-horizontal-rule": "true" };
|
|
60121
59948
|
}
|
|
60122
59949
|
},
|
|
60123
|
-
/**
|
|
60124
|
-
* @category Attribute
|
|
60125
|
-
* @param {ContentBlockSize} [size] - Size and position of the content block
|
|
60126
|
-
*/
|
|
60127
59950
|
size: {
|
|
60128
59951
|
default: null,
|
|
60129
59952
|
renderDOM: ({ size: size2 }) => {
|
|
@@ -60137,10 +59960,6 @@ const ContentBlock = Node$1.create({
|
|
|
60137
59960
|
return { style: style2 };
|
|
60138
59961
|
}
|
|
60139
59962
|
},
|
|
60140
|
-
/**
|
|
60141
|
-
* @category Attribute
|
|
60142
|
-
* @param {string} [background] - Background color for the block
|
|
60143
|
-
*/
|
|
60144
59963
|
background: {
|
|
60145
59964
|
default: null,
|
|
60146
59965
|
renderDOM: (attrs) => {
|
|
@@ -60150,19 +59969,9 @@ const ContentBlock = Node$1.create({
|
|
|
60150
59969
|
};
|
|
60151
59970
|
}
|
|
60152
59971
|
},
|
|
60153
|
-
/**
|
|
60154
|
-
* @private
|
|
60155
|
-
* @category Attribute
|
|
60156
|
-
* @param {Object} [drawingContent] - Internal drawing data
|
|
60157
|
-
*/
|
|
60158
59972
|
drawingContent: {
|
|
60159
59973
|
rendered: false
|
|
60160
59974
|
},
|
|
60161
|
-
/**
|
|
60162
|
-
* @private
|
|
60163
|
-
* @category Attribute
|
|
60164
|
-
* @param {Object} [attributes] - Additional internal attributes
|
|
60165
|
-
*/
|
|
60166
59975
|
attributes: {
|
|
60167
59976
|
rendered: false
|
|
60168
59977
|
}
|
|
@@ -60183,9 +59992,8 @@ const ContentBlock = Node$1.create({
|
|
|
60183
59992
|
/**
|
|
60184
59993
|
* Insert a horizontal rule
|
|
60185
59994
|
* @category Command
|
|
60186
|
-
* @returns {Function} Command function
|
|
60187
59995
|
* @example
|
|
60188
|
-
* insertHorizontalRule()
|
|
59996
|
+
* editor.commands.insertHorizontalRule()
|
|
60189
59997
|
* @note Creates a visual separator between content sections
|
|
60190
59998
|
*/
|
|
60191
59999
|
insertHorizontalRule: () => ({ commands: commands2 }) => {
|
|
@@ -60202,13 +60010,13 @@ const ContentBlock = Node$1.create({
|
|
|
60202
60010
|
* Insert a content block
|
|
60203
60011
|
* @category Command
|
|
60204
60012
|
* @param {ContentBlockConfig} config - Block configuration
|
|
60205
|
-
* @returns {Function} Command function
|
|
60206
60013
|
* @example
|
|
60207
60014
|
* // Insert a spacer block
|
|
60208
|
-
* insertContentBlock({ size: { height: 20 } })
|
|
60015
|
+
* editor.commands.insertContentBlock({ size: { height: 20 } })
|
|
60209
60016
|
*
|
|
60017
|
+
* @example
|
|
60210
60018
|
* // Insert a colored divider
|
|
60211
|
-
* insertContentBlock({
|
|
60019
|
+
* editor.commands.insertContentBlock({
|
|
60212
60020
|
* size: { width: '50%', height: 3 },
|
|
60213
60021
|
* background: '#3b82f6'
|
|
60214
60022
|
* })
|
|
@@ -60736,16 +60544,7 @@ const DocumentSection = Node$1.create({
|
|
|
60736
60544
|
},
|
|
60737
60545
|
addAttributes() {
|
|
60738
60546
|
return {
|
|
60739
|
-
/**
|
|
60740
|
-
* @category Attribute
|
|
60741
|
-
* @param {number} [id] - Unique section identifier
|
|
60742
|
-
*/
|
|
60743
60547
|
id: {},
|
|
60744
|
-
/**
|
|
60745
|
-
* @private
|
|
60746
|
-
* @category Attribute
|
|
60747
|
-
* @param {string} [sdBlockId] - Internal block tracking
|
|
60748
|
-
*/
|
|
60749
60548
|
sdBlockId: {
|
|
60750
60549
|
default: null,
|
|
60751
60550
|
keepOnSplit: false,
|
|
@@ -60754,25 +60553,9 @@ const DocumentSection = Node$1.create({
|
|
|
60754
60553
|
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
60755
60554
|
}
|
|
60756
60555
|
},
|
|
60757
|
-
/**
|
|
60758
|
-
* @category Attribute
|
|
60759
|
-
* @param {string} [title] - Section display label
|
|
60760
|
-
*/
|
|
60761
60556
|
title: {},
|
|
60762
|
-
/**
|
|
60763
|
-
* @category Attribute
|
|
60764
|
-
* @param {string} [description] - Section metadata
|
|
60765
|
-
*/
|
|
60766
60557
|
description: {},
|
|
60767
|
-
/**
|
|
60768
|
-
* @category Attribute
|
|
60769
|
-
* @param {string} [sectionType] - Business classification (e.g., 'legal', 'pricing')
|
|
60770
|
-
*/
|
|
60771
60558
|
sectionType: {},
|
|
60772
|
-
/**
|
|
60773
|
-
* @category Attribute
|
|
60774
|
-
* @param {boolean} [isLocked=false] - Lock state preventing edits
|
|
60775
|
-
*/
|
|
60776
60559
|
isLocked: { default: false }
|
|
60777
60560
|
};
|
|
60778
60561
|
},
|
|
@@ -60787,10 +60570,9 @@ const DocumentSection = Node$1.create({
|
|
|
60787
60570
|
* Create a lockable content section
|
|
60788
60571
|
* @category Command
|
|
60789
60572
|
* @param {SectionCreate} [options={}] - Section configuration
|
|
60790
|
-
* @returns {Function} Command - true if created, false if position invalid
|
|
60791
60573
|
* @example
|
|
60792
|
-
* createDocumentSection({
|
|
60793
|
-
* id:
|
|
60574
|
+
* editor.commands.createDocumentSection({
|
|
60575
|
+
* id: 1,
|
|
60794
60576
|
* title: 'Terms & Conditions',
|
|
60795
60577
|
* isLocked: true,
|
|
60796
60578
|
* html: '<p>Legal content...</p>'
|
|
@@ -60871,9 +60653,8 @@ const DocumentSection = Node$1.create({
|
|
|
60871
60653
|
/**
|
|
60872
60654
|
* Remove section wrapper at cursor, preserving its content
|
|
60873
60655
|
* @category Command
|
|
60874
|
-
* @returns {Function} Command - true if removed, false if no section at position
|
|
60875
60656
|
* @example
|
|
60876
|
-
* removeSectionAtSelection()
|
|
60657
|
+
* editor.commands.removeSectionAtSelection()
|
|
60877
60658
|
* @note Content stays in document, only section wrapper is removed
|
|
60878
60659
|
*/
|
|
60879
60660
|
removeSectionAtSelection: () => ({ tr, dispatch }) => {
|
|
@@ -60899,9 +60680,8 @@ const DocumentSection = Node$1.create({
|
|
|
60899
60680
|
* Delete section and all its content
|
|
60900
60681
|
* @category Command
|
|
60901
60682
|
* @param {number} id - Section to delete
|
|
60902
|
-
* @returns {Function} Command - true if deleted, false if ID doesn't exist
|
|
60903
60683
|
* @example
|
|
60904
|
-
* removeSectionById(123)
|
|
60684
|
+
* editor.commands.removeSectionById(123)
|
|
60905
60685
|
*/
|
|
60906
60686
|
removeSectionById: (id) => ({ tr, dispatch }) => {
|
|
60907
60687
|
const sections = SectionHelpers.getAllSections(this.editor);
|
|
@@ -60921,9 +60701,8 @@ const DocumentSection = Node$1.create({
|
|
|
60921
60701
|
* Lock section against edits
|
|
60922
60702
|
* @category Command
|
|
60923
60703
|
* @param {number} id - Section to lock
|
|
60924
|
-
* @returns {Function} Command - true if locked, false if ID doesn't exist
|
|
60925
60704
|
* @example
|
|
60926
|
-
* lockSectionById(123)
|
|
60705
|
+
* editor.commands.lockSectionById(123)
|
|
60927
60706
|
*/
|
|
60928
60707
|
lockSectionById: (id) => ({ tr, dispatch }) => {
|
|
60929
60708
|
const sections = SectionHelpers.getAllSections(this.editor);
|
|
@@ -60940,16 +60719,10 @@ const DocumentSection = Node$1.create({
|
|
|
60940
60719
|
* Modify section attributes or content
|
|
60941
60720
|
* @category Command
|
|
60942
60721
|
* @param {SectionUpdate} options - Changes to apply
|
|
60943
|
-
* @returns {Function} Command - true if updated, false if ID doesn't exist
|
|
60944
60722
|
* @example
|
|
60945
|
-
*
|
|
60946
|
-
* updateSectionById({ id: 123,
|
|
60947
|
-
*
|
|
60948
|
-
* // Replace content
|
|
60949
|
-
* updateSectionById({ id: 123, html: '<p>New content</p>' })
|
|
60950
|
-
*
|
|
60951
|
-
* // Both
|
|
60952
|
-
* updateSectionById({
|
|
60723
|
+
* editor.commands.updateSectionById({ id: 123, attrs: { isLocked: false } })
|
|
60724
|
+
* editor.commands.updateSectionById({ id: 123, html: '<p>New content</p>' })
|
|
60725
|
+
* editor.commands.updateSectionById({
|
|
60953
60726
|
* id: 123,
|
|
60954
60727
|
* html: '<p>Updated</p>',
|
|
60955
60728
|
* attrs: { title: 'New Title' }
|
|
@@ -60999,11 +60772,10 @@ const BlockNode = Extension.create({
|
|
|
60999
60772
|
* Replace a block node by its ID with new content
|
|
61000
60773
|
* @category Command
|
|
61001
60774
|
* @param {string} id - The sdBlockId of the node to replace
|
|
61002
|
-
* @param {
|
|
61003
|
-
* @returns {Function} Command function
|
|
60775
|
+
* @param {ProseMirrorNode} contentNode - The replacement ProseMirror node
|
|
61004
60776
|
* @example
|
|
61005
60777
|
* const newParagraph = editor.schema.nodes.paragraph.create({}, editor.schema.text('New content'))
|
|
61006
|
-
* replaceBlockNodeById('block-123', newParagraph)
|
|
60778
|
+
* editor.commands.replaceBlockNodeById('block-123', newParagraph)
|
|
61007
60779
|
* @note The replacement node should have the same type as the original
|
|
61008
60780
|
*/
|
|
61009
60781
|
replaceBlockNodeById: (id, contentNode) => ({ dispatch, tr }) => {
|
|
@@ -61026,9 +60798,8 @@ const BlockNode = Extension.create({
|
|
|
61026
60798
|
* Delete a block node by its ID
|
|
61027
60799
|
* @category Command
|
|
61028
60800
|
* @param {string} id - The sdBlockId of the node to delete
|
|
61029
|
-
* @returns {Function} Command function
|
|
61030
60801
|
* @example
|
|
61031
|
-
* deleteBlockNodeById('block-123')
|
|
60802
|
+
* editor.commands.deleteBlockNodeById('block-123')
|
|
61032
60803
|
* @note Completely removes the node from the document
|
|
61033
60804
|
*/
|
|
61034
60805
|
deleteBlockNodeById: (id) => ({ dispatch, tr }) => {
|
|
@@ -61052,11 +60823,10 @@ const BlockNode = Extension.create({
|
|
|
61052
60823
|
* @category Command
|
|
61053
60824
|
* @param {string} id - The sdBlockId of the node to update
|
|
61054
60825
|
* @param {Object} attrs - Attributes to update
|
|
61055
|
-
* @returns {Function} Command function
|
|
61056
60826
|
* @example
|
|
61057
|
-
* updateBlockNodeAttributes('block-123', { textAlign: 'center' })
|
|
60827
|
+
* editor.commands.updateBlockNodeAttributes('block-123', { textAlign: 'center' })
|
|
61058
60828
|
* @example
|
|
61059
|
-
* updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
|
|
60829
|
+
* editor.commands.updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
|
|
61060
60830
|
* @note Merges new attributes with existing ones
|
|
61061
60831
|
*/
|
|
61062
60832
|
updateBlockNodeAttributes: (id, attrs = {}) => ({ dispatch, tr }) => {
|
|
@@ -61150,7 +60920,7 @@ const BlockNode = Extension.create({
|
|
|
61150
60920
|
key: BlockNodePluginKey,
|
|
61151
60921
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
61152
60922
|
if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
|
|
61153
|
-
if (hasInitialized && !checkForNewBlockNodesInTrs(transactions)) return null;
|
|
60923
|
+
if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) return null;
|
|
61154
60924
|
const { tr } = newState;
|
|
61155
60925
|
let changed = false;
|
|
61156
60926
|
newState.doc.descendants((node, pos) => {
|
|
@@ -61229,9 +60999,8 @@ const TextStyle = Mark2.create({
|
|
|
61229
60999
|
/**
|
|
61230
61000
|
* Remove empty text style marks
|
|
61231
61001
|
* @category Command
|
|
61232
|
-
* @returns {Function} Command function - Removes mark if no attributes present
|
|
61233
61002
|
* @example
|
|
61234
|
-
* removeEmptyTextStyle()
|
|
61003
|
+
* editor.commands.removeEmptyTextStyle()
|
|
61235
61004
|
* @note Cleanup utility to prevent empty span elements
|
|
61236
61005
|
* @note Automatically checks if any style attributes exist before removal
|
|
61237
61006
|
*/
|
|
@@ -61253,10 +61022,6 @@ const Bold = Mark2.create({
|
|
|
61253
61022
|
},
|
|
61254
61023
|
addAttributes() {
|
|
61255
61024
|
return {
|
|
61256
|
-
/**
|
|
61257
|
-
* @category Attribute
|
|
61258
|
-
* @param {string} [value] - Bold weight value ('0' renders as normal)
|
|
61259
|
-
*/
|
|
61260
61025
|
value: {
|
|
61261
61026
|
default: null,
|
|
61262
61027
|
renderDOM: (attrs) => {
|
|
@@ -61285,26 +61050,23 @@ const Bold = Mark2.create({
|
|
|
61285
61050
|
/**
|
|
61286
61051
|
* Apply bold formatting
|
|
61287
61052
|
* @category Command
|
|
61288
|
-
* @returns {Function} Command
|
|
61289
61053
|
* @example
|
|
61290
|
-
* setBold()
|
|
61054
|
+
* editor.commands.setBold()
|
|
61291
61055
|
* @note '0' renders as normal weight
|
|
61292
61056
|
*/
|
|
61293
61057
|
setBold: () => ({ commands: commands2 }) => commands2.setMark(this.name),
|
|
61294
61058
|
/**
|
|
61295
61059
|
* Remove bold formatting
|
|
61296
61060
|
* @category Command
|
|
61297
|
-
* @returns {Function} Command
|
|
61298
61061
|
* @example
|
|
61299
|
-
* unsetBold()
|
|
61062
|
+
* editor.commands.unsetBold()
|
|
61300
61063
|
*/
|
|
61301
61064
|
unsetBold: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
61302
61065
|
/**
|
|
61303
61066
|
* Toggle bold formatting
|
|
61304
61067
|
* @category Command
|
|
61305
|
-
* @returns {Function} Command
|
|
61306
61068
|
* @example
|
|
61307
|
-
* toggleBold()
|
|
61069
|
+
* editor.commands.toggleBold()
|
|
61308
61070
|
*/
|
|
61309
61071
|
toggleBold: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
61310
61072
|
};
|
|
@@ -61339,25 +61101,22 @@ const Italic = Mark2.create({
|
|
|
61339
61101
|
/**
|
|
61340
61102
|
* Apply italic formatting
|
|
61341
61103
|
* @category Command
|
|
61342
|
-
* @returns {Function} Command
|
|
61343
61104
|
* @example
|
|
61344
|
-
* setItalic()
|
|
61105
|
+
* editor.commands.setItalic()
|
|
61345
61106
|
*/
|
|
61346
61107
|
setItalic: () => ({ commands: commands2 }) => commands2.setMark(this.name),
|
|
61347
61108
|
/**
|
|
61348
61109
|
* Remove italic formatting
|
|
61349
61110
|
* @category Command
|
|
61350
|
-
* @returns {Function} Command
|
|
61351
61111
|
* @example
|
|
61352
|
-
* unsetItalic()
|
|
61112
|
+
* editor.commands.unsetItalic()
|
|
61353
61113
|
*/
|
|
61354
61114
|
unsetItalic: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
61355
61115
|
/**
|
|
61356
61116
|
* Toggle italic formatting
|
|
61357
61117
|
* @category Command
|
|
61358
|
-
* @returns {Function} Command
|
|
61359
61118
|
* @example
|
|
61360
|
-
* toggleItalic()
|
|
61119
|
+
* editor.commands.toggleItalic()
|
|
61361
61120
|
*/
|
|
61362
61121
|
toggleItalic: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
61363
61122
|
};
|
|
@@ -61441,10 +61200,6 @@ const Highlight = Mark2.create({
|
|
|
61441
61200
|
},
|
|
61442
61201
|
addAttributes() {
|
|
61443
61202
|
return {
|
|
61444
|
-
/**
|
|
61445
|
-
* @category Attribute
|
|
61446
|
-
* @param {string} [color] - Background color (CSS color value)
|
|
61447
|
-
*/
|
|
61448
61203
|
color: {
|
|
61449
61204
|
default: null,
|
|
61450
61205
|
parseDOM: (element) => element.getAttribute("data-color") || element.style.backgroundColor,
|
|
@@ -61472,26 +61227,23 @@ const Highlight = Mark2.create({
|
|
|
61472
61227
|
* Apply highlight with specified color
|
|
61473
61228
|
* @category Command
|
|
61474
61229
|
* @param {string} color - CSS color value
|
|
61475
|
-
* @returns {Function} Command
|
|
61476
61230
|
* @example
|
|
61477
|
-
* setHighlight('#FFEB3B')
|
|
61478
|
-
* setHighlight('rgba(255, 235, 59, 0.5)')
|
|
61231
|
+
* editor.commands.setHighlight('#FFEB3B')
|
|
61232
|
+
* editor.commands.setHighlight('rgba(255, 235, 59, 0.5)')
|
|
61479
61233
|
*/
|
|
61480
61234
|
setHighlight: (color) => ({ commands: commands2 }) => commands2.setMark(this.name, { color }),
|
|
61481
61235
|
/**
|
|
61482
61236
|
* Remove highlight formatting
|
|
61483
61237
|
* @category Command
|
|
61484
|
-
* @returns {Function} Command
|
|
61485
61238
|
* @example
|
|
61486
|
-
* unsetHighlight()
|
|
61239
|
+
* editor.commands.unsetHighlight()
|
|
61487
61240
|
*/
|
|
61488
61241
|
unsetHighlight: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
61489
61242
|
/**
|
|
61490
61243
|
* Toggle highlight formatting
|
|
61491
61244
|
* @category Command
|
|
61492
|
-
* @returns {Function} Command
|
|
61493
61245
|
* @example
|
|
61494
|
-
* toggleHighlight()
|
|
61246
|
+
* editor.commands.toggleHighlight()
|
|
61495
61247
|
*/
|
|
61496
61248
|
toggleHighlight: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
61497
61249
|
};
|
|
@@ -61524,9 +61276,8 @@ const Strike = Mark2.create({
|
|
|
61524
61276
|
/**
|
|
61525
61277
|
* Apply strikethrough formatting
|
|
61526
61278
|
* @category Command
|
|
61527
|
-
* @returns {Function} Command
|
|
61528
61279
|
* @example
|
|
61529
|
-
* setStrike()
|
|
61280
|
+
* editor.commands.setStrike()
|
|
61530
61281
|
*/
|
|
61531
61282
|
setStrike: () => ({ commands: commands2 }) => {
|
|
61532
61283
|
return commands2.setMark(this.name);
|
|
@@ -61534,9 +61285,8 @@ const Strike = Mark2.create({
|
|
|
61534
61285
|
/**
|
|
61535
61286
|
* Remove strikethrough formatting
|
|
61536
61287
|
* @category Command
|
|
61537
|
-
* @returns {Function} Command
|
|
61538
61288
|
* @example
|
|
61539
|
-
* unsetStrike()
|
|
61289
|
+
* editor.commands.unsetStrike()
|
|
61540
61290
|
*/
|
|
61541
61291
|
unsetStrike: () => ({ commands: commands2 }) => {
|
|
61542
61292
|
return commands2.unsetMark(this.name);
|
|
@@ -61544,9 +61294,8 @@ const Strike = Mark2.create({
|
|
|
61544
61294
|
/**
|
|
61545
61295
|
* Toggle strikethrough formatting
|
|
61546
61296
|
* @category Command
|
|
61547
|
-
* @returns {Function} Command
|
|
61548
61297
|
* @example
|
|
61549
|
-
* toggleStrike()
|
|
61298
|
+
* editor.commands.toggleStrike()
|
|
61550
61299
|
*/
|
|
61551
61300
|
toggleStrike: () => ({ commands: commands2 }) => {
|
|
61552
61301
|
return commands2.toggleMark(this.name);
|
|
@@ -61566,11 +61315,6 @@ const Link = Mark2.create({
|
|
|
61566
61315
|
inclusive: false,
|
|
61567
61316
|
addOptions() {
|
|
61568
61317
|
return {
|
|
61569
|
-
/**
|
|
61570
|
-
* Allowed URL protocols
|
|
61571
|
-
* @type {string[]}
|
|
61572
|
-
* @default ['http', 'https']
|
|
61573
|
-
*/
|
|
61574
61318
|
protocols: ["http", "https"],
|
|
61575
61319
|
htmlAttributes: {
|
|
61576
61320
|
target: null,
|
|
@@ -61669,16 +61413,10 @@ const Link = Mark2.create({
|
|
|
61669
61413
|
/**
|
|
61670
61414
|
* Create or update a link
|
|
61671
61415
|
* @category Command
|
|
61672
|
-
* @param {
|
|
61673
|
-
* @param {string} [options.href] - URL for the link
|
|
61674
|
-
* @param {string} [options.text] - Display text (uses selection if omitted)
|
|
61675
|
-
* @returns {Function} Command - Creates link with underline
|
|
61416
|
+
* @param {SetLinkOptions} [options] - Link configuration
|
|
61676
61417
|
* @example
|
|
61677
|
-
*
|
|
61678
|
-
* setLink({
|
|
61679
|
-
*
|
|
61680
|
-
* // Link with custom text
|
|
61681
|
-
* setLink({
|
|
61418
|
+
* editor.commands.setLink({ href: 'https://example.com' })
|
|
61419
|
+
* editor.commands.setLink({
|
|
61682
61420
|
* href: 'https://example.com',
|
|
61683
61421
|
* text: 'Visit Example'
|
|
61684
61422
|
* })
|
|
@@ -61730,9 +61468,8 @@ const Link = Mark2.create({
|
|
|
61730
61468
|
/**
|
|
61731
61469
|
* Remove link and associated formatting
|
|
61732
61470
|
* @category Command
|
|
61733
|
-
* @returns {Function} Command - Removes link, underline, and color
|
|
61734
61471
|
* @example
|
|
61735
|
-
* unsetLink()
|
|
61472
|
+
* editor.commands.unsetLink()
|
|
61736
61473
|
* @note Also removes underline and text color
|
|
61737
61474
|
*/
|
|
61738
61475
|
unsetLink: () => ({ chain }) => {
|
|
@@ -61741,16 +61478,10 @@ const Link = Mark2.create({
|
|
|
61741
61478
|
/**
|
|
61742
61479
|
* Toggle link on selection
|
|
61743
61480
|
* @category Command
|
|
61744
|
-
* @param {
|
|
61745
|
-
* @param {string} [options.href] - URL for the link
|
|
61746
|
-
* @param {string} [options.text] - Display text
|
|
61747
|
-
* @returns {Function} Command - Creates link if href provided, removes otherwise
|
|
61481
|
+
* @param {SetLinkOptions} [options] - Link configuration
|
|
61748
61482
|
* @example
|
|
61749
|
-
*
|
|
61750
|
-
* toggleLink(
|
|
61751
|
-
*
|
|
61752
|
-
* // Remove link
|
|
61753
|
-
* toggleLink()
|
|
61483
|
+
* editor.commands.toggleLink({ href: 'https://example.com' })
|
|
61484
|
+
* editor.commands.toggleLink()
|
|
61754
61485
|
*/
|
|
61755
61486
|
toggleLink: ({ href, text } = {}) => ({ commands: commands2 }) => {
|
|
61756
61487
|
if (!href) return commands2.unsetLink();
|
|
@@ -65067,6 +64798,9 @@ const Mentions = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v
|
|
|
65067
64798
|
const popoverPluginKey = new PluginKey("popoverPlugin");
|
|
65068
64799
|
const PopoverPlugin = Extension.create({
|
|
65069
64800
|
name: "popoverPlugin",
|
|
64801
|
+
addOptions() {
|
|
64802
|
+
return {};
|
|
64803
|
+
},
|
|
65070
64804
|
addPmPlugins() {
|
|
65071
64805
|
const popover = new Plugin({
|
|
65072
64806
|
key: popoverPluginKey,
|
|
@@ -67294,12 +67028,11 @@ const Search = Extension.create({
|
|
|
67294
67028
|
addCommands() {
|
|
67295
67029
|
return {
|
|
67296
67030
|
/**
|
|
67297
|
-
*
|
|
67031
|
+
* Navigate to the first search match
|
|
67298
67032
|
* @category Command
|
|
67299
|
-
* @returns {Function} - Command function
|
|
67300
67033
|
* @example
|
|
67301
|
-
* goToFirstMatch()
|
|
67302
|
-
* @note Scrolls
|
|
67034
|
+
* editor.commands.goToFirstMatch()
|
|
67035
|
+
* @note Scrolls editor to the first match from previous search
|
|
67303
67036
|
*/
|
|
67304
67037
|
goToFirstMatch: () => (
|
|
67305
67038
|
/** @returns {boolean} */
|
|
@@ -67315,13 +67048,13 @@ const Search = Extension.create({
|
|
|
67315
67048
|
})
|
|
67316
67049
|
),
|
|
67317
67050
|
/**
|
|
67318
|
-
*
|
|
67051
|
+
* Search for string matches in editor content
|
|
67319
67052
|
* @category Command
|
|
67320
67053
|
* @param {String|RegExp} patternInput - Search string or pattern
|
|
67321
|
-
* @returns {Function} - Command function that returns matches
|
|
67322
67054
|
* @example
|
|
67323
|
-
* search('test string')
|
|
67324
|
-
*
|
|
67055
|
+
* const matches = editor.commands.search('test string')
|
|
67056
|
+
* const regexMatches = editor.commands.search(/test/i)
|
|
67057
|
+
* @note Returns array of SearchMatch objects with positions and IDs
|
|
67325
67058
|
*/
|
|
67326
67059
|
search: (patternInput) => (
|
|
67327
67060
|
/** @returns {SearchMatch[]} */
|
|
@@ -67364,14 +67097,13 @@ const Search = Extension.create({
|
|
|
67364
67097
|
})
|
|
67365
67098
|
),
|
|
67366
67099
|
/**
|
|
67367
|
-
*
|
|
67100
|
+
* Navigate to a specific search match
|
|
67368
67101
|
* @category Command
|
|
67369
|
-
* @param {SearchMatch} match Match
|
|
67370
|
-
* @returns {Function} - Command function
|
|
67102
|
+
* @param {SearchMatch} match - Match object to navigate to
|
|
67371
67103
|
* @example
|
|
67372
|
-
* const
|
|
67373
|
-
* goToSearchResult(
|
|
67374
|
-
* @note Scrolls
|
|
67104
|
+
* const searchResults = editor.commands.search('test string')
|
|
67105
|
+
* editor.commands.goToSearchResult(searchResults[3])
|
|
67106
|
+
* @note Scrolls to match and selects it
|
|
67375
67107
|
*/
|
|
67376
67108
|
goToSearchResult: (match) => (
|
|
67377
67109
|
/** @returns {boolean} */
|
|
@@ -67633,6 +67365,9 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
|
|
|
67633
67365
|
};
|
|
67634
67366
|
const NodeResizer = Extension.create({
|
|
67635
67367
|
name: "nodeResizer",
|
|
67368
|
+
addOptions() {
|
|
67369
|
+
return {};
|
|
67370
|
+
},
|
|
67636
67371
|
addPmPlugins() {
|
|
67637
67372
|
const isHeadless = this.editor.options.isHeadless;
|
|
67638
67373
|
const hasDocument = typeof document !== "undefined";
|