@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.
Files changed (79) hide show
  1. package/dist/chunks/{PdfViewer-BoDHZ2nW.es.js → PdfViewer-BZlsmhsJ.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-Ch0v9vA6.cjs → PdfViewer-BqGjx7hC.cjs} +1 -1
  3. package/dist/chunks/{index-BWPWqVxp.es.js → index-4GToG3C3.es.js} +2 -2
  4. package/dist/chunks/{index-DFOT300M.cjs → index-DPzgGSfg.cjs} +2 -2
  5. package/dist/chunks/{super-editor.es-BQ6kZTNg.cjs → super-editor.es-BkxUKZfn.cjs} +309 -574
  6. package/dist/chunks/{super-editor.es-sBfWb5tn.es.js → super-editor.es-DqX3Ipsk.es.js} +309 -574
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/super-editor/ai-writer.es.js +2 -2
  9. package/dist/super-editor/chunks/{converter-C91Sr_5w.js → converter-C6YOTAXG.js} +64 -8
  10. package/dist/super-editor/chunks/{docx-zipper-Cl7LYpt6.js → docx-zipper-CSiwWpmr.js} +1 -1
  11. package/dist/super-editor/chunks/{editor-a7cQT9Dw.js → editor-chVid4VD.js} +247 -568
  12. package/dist/super-editor/chunks/{toolbar-DiNFtCKr.js → toolbar-ancqgN0p.js} +2 -2
  13. package/dist/super-editor/converter.es.js +1 -1
  14. package/dist/super-editor/docx-zipper.es.js +2 -2
  15. package/dist/super-editor/editor.es.js +3 -3
  16. package/dist/super-editor/file-zipper.es.js +1 -1
  17. package/dist/super-editor/src/core/super-converter/helpers.d.ts +2 -0
  18. package/dist/super-editor/src/core/super-converter/v2/importer/imageImporter.d.ts +1 -0
  19. package/dist/super-editor/src/extensions/block-node/block-node.d.ts +30 -5
  20. package/dist/super-editor/src/extensions/bold/bold.d.ts +20 -0
  21. package/dist/super-editor/src/extensions/bullet-list/bullet-list.d.ts +12 -0
  22. package/dist/super-editor/src/extensions/color/color.d.ts +26 -0
  23. package/dist/super-editor/src/extensions/content-block/content-block.d.ts +30 -0
  24. package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +16 -0
  25. package/dist/super-editor/src/extensions/document/document.d.ts +26 -0
  26. package/dist/super-editor/src/extensions/dropcursor/dropcursor.d.ts +26 -0
  27. package/dist/super-editor/src/extensions/font-family/font-family.d.ts +29 -0
  28. package/dist/super-editor/src/extensions/font-size/font-size.d.ts +21 -0
  29. package/dist/super-editor/src/extensions/format-commands/format-commands.d.ts +9 -0
  30. package/dist/super-editor/src/extensions/gapcursor/gapcursor.d.ts +9 -0
  31. package/dist/super-editor/src/extensions/heading/heading.d.ts +12 -6
  32. package/dist/super-editor/src/extensions/highlight/highlight.d.ts +20 -0
  33. package/dist/super-editor/src/extensions/history/history.d.ts +7 -15
  34. package/dist/super-editor/src/extensions/image/image.d.ts +78 -0
  35. package/dist/super-editor/src/extensions/image/imageHelpers/index.d.ts +1 -0
  36. package/dist/super-editor/src/extensions/image/imageHelpers/rotation.d.ts +4 -0
  37. package/dist/super-editor/src/extensions/italic/italic.d.ts +10 -0
  38. package/dist/super-editor/src/extensions/line-break/line-break.d.ts +43 -0
  39. package/dist/super-editor/src/extensions/line-height/line-height.d.ts +22 -0
  40. package/dist/super-editor/src/extensions/link/link.d.ts +53 -25
  41. package/dist/super-editor/src/extensions/linked-styles/linked-styles.d.ts +9 -0
  42. package/dist/super-editor/src/extensions/list-item/list-item.d.ts +48 -0
  43. package/dist/super-editor/src/extensions/mention/mention.d.ts +26 -0
  44. package/dist/super-editor/src/extensions/noderesizer/noderesizer.d.ts +14 -0
  45. package/dist/super-editor/src/extensions/ordered-list/ordered-list.d.ts +35 -0
  46. package/dist/super-editor/src/extensions/page-number/page-number.d.ts +52 -0
  47. package/dist/super-editor/src/extensions/paragraph/paragraph.d.ts +49 -0
  48. package/dist/super-editor/src/extensions/placeholder/placeholder.d.ts +15 -0
  49. package/dist/super-editor/src/extensions/popover-plugin/popover-plugin.d.ts +9 -0
  50. package/dist/super-editor/src/extensions/run-item/run-item.d.ts +24 -0
  51. package/dist/super-editor/src/extensions/search/search.d.ts +11 -2
  52. package/dist/super-editor/src/extensions/shape-container/shape-container.d.ts +29 -0
  53. package/dist/super-editor/src/extensions/shape-textbox/shape-textbox.d.ts +26 -0
  54. package/dist/super-editor/src/extensions/slash-menu/slash-menu.d.ts +9 -0
  55. package/dist/super-editor/src/extensions/strike/strike.d.ts +10 -0
  56. package/dist/super-editor/src/extensions/structured-content/document-section.d.ts +46 -27
  57. package/dist/super-editor/src/extensions/structured-content/structured-content-block.d.ts +26 -0
  58. package/dist/super-editor/src/extensions/structured-content/structured-content.d.ts +26 -0
  59. package/dist/super-editor/src/extensions/tab/tab.d.ts +25 -0
  60. package/dist/super-editor/src/extensions/table/table.d.ts +112 -121
  61. package/dist/super-editor/src/extensions/table-cell/table-cell.d.ts +41 -0
  62. package/dist/super-editor/src/extensions/table-header/table-header.d.ts +22 -0
  63. package/dist/super-editor/src/extensions/table-row/table-row.d.ts +28 -0
  64. package/dist/super-editor/src/extensions/text/text.d.ts +14 -0
  65. package/dist/super-editor/src/extensions/text-align/text-align.d.ts +22 -0
  66. package/dist/super-editor/src/extensions/text-indent/text-indent.d.ts +19 -10
  67. package/dist/super-editor/src/extensions/text-style/text-style.d.ts +20 -0
  68. package/dist/super-editor/src/extensions/text-transform/text-transform.d.ts +20 -0
  69. package/dist/super-editor/src/extensions/underline/underline.d.ts +25 -0
  70. package/dist/super-editor/src/tests/helpers/editor-test-utils.d.ts +14 -0
  71. package/dist/super-editor/super-editor.es.js +6 -6
  72. package/dist/super-editor/toolbar.es.js +2 -2
  73. package/dist/super-editor.cjs +1 -1
  74. package/dist/super-editor.es.js +1 -1
  75. package/dist/superdoc.cjs +2 -2
  76. package/dist/superdoc.es.js +2 -2
  77. package/dist/superdoc.umd.js +309 -574
  78. package/dist/superdoc.umd.js.map +1 -1
  79. package/package.json +1 -1
@@ -14859,6 +14859,14 @@ function ptToTwips(pt) {
14859
14859
  if (pt == null) return;
14860
14860
  return pt * 20;
14861
14861
  }
14862
+ function rotToDegrees(rot) {
14863
+ if (rot == null) return;
14864
+ return rot / 6e4;
14865
+ }
14866
+ function degreesToRot(degrees) {
14867
+ if (degrees == null) return;
14868
+ return degrees * 6e4;
14869
+ }
14862
14870
  const getTextIndentExportValue = (indent) => {
14863
14871
  const [value, unit] = parseSizeUnit(indent);
14864
14872
  const functionsMap = {
@@ -26872,6 +26880,32 @@ function handleImageNode(node, params2, isAnchor) {
26872
26880
  if (!picture || !picture.elements) return null;
26873
26881
  const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
26874
26882
  const blip = blipFill.elements.find((el) => el.name === "a:blip");
26883
+ const spPr = picture.elements.find((el) => el.name === "pic:spPr");
26884
+ let transformData = {};
26885
+ if (spPr) {
26886
+ const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
26887
+ if (xfrm?.attributes) {
26888
+ transformData = {
26889
+ rotation: rotToDegrees(xfrm.attributes["rot"]),
26890
+ verticalFlip: xfrm.attributes["flipV"] === "1",
26891
+ horizontalFlip: xfrm.attributes["flipH"] === "1"
26892
+ };
26893
+ }
26894
+ }
26895
+ const effectExtent = node.elements.find((el) => el.name === "wp:effectExtent");
26896
+ if (effectExtent) {
26897
+ const sanitizeEmuValue = (value) => {
26898
+ if (value === null || value === void 0) return 0;
26899
+ const numeric = Number(value);
26900
+ return Number.isFinite(numeric) ? numeric : 0;
26901
+ };
26902
+ transformData.sizeExtension = {
26903
+ left: emuToPixels(sanitizeEmuValue(effectExtent.attributes["l"])),
26904
+ top: emuToPixels(sanitizeEmuValue(effectExtent.attributes["t"])),
26905
+ right: emuToPixels(sanitizeEmuValue(effectExtent.attributes["r"])),
26906
+ bottom: emuToPixels(sanitizeEmuValue(effectExtent.attributes["b"]))
26907
+ };
26908
+ }
26875
26909
  const positionHTag = node.elements.find((el) => el.name === "wp:positionH");
26876
26910
  const positionH = positionHTag?.elements.find((el) => el.name === "wp:posOffset");
26877
26911
  const positionHValue = emuToPixels(positionH?.elements[0]?.text);
@@ -26928,6 +26962,7 @@ function handleImageNode(node, params2, isAnchor) {
26928
26962
  size: size2,
26929
26963
  anchorData,
26930
26964
  isAnchor,
26965
+ transformData,
26931
26966
  ...simplePos && {
26932
26967
  simplePos: {
26933
26968
  x: simplePos.attributes.x,
@@ -27079,6 +27114,31 @@ const translateImageNode = (params2) => {
27079
27114
  distL: 0,
27080
27115
  distR: 0
27081
27116
  };
27117
+ const xfrmAttrs = {};
27118
+ const effectExtentAttrs = {
27119
+ l: 0,
27120
+ t: 0,
27121
+ r: 0,
27122
+ b: 0
27123
+ };
27124
+ const transformData = attrs.transformData;
27125
+ if (transformData) {
27126
+ if (transformData.rotation) {
27127
+ xfrmAttrs.rot = degreesToRot(transformData.rotation);
27128
+ }
27129
+ if (transformData.verticalFlip) {
27130
+ xfrmAttrs.flipV = "1";
27131
+ }
27132
+ if (transformData.horizontalFlip) {
27133
+ xfrmAttrs.flipH = "1";
27134
+ }
27135
+ if (transformData.sizeExtension) {
27136
+ effectExtentAttrs.l = pixelsToEmu(transformData.sizeExtension.left);
27137
+ effectExtentAttrs.t = pixelsToEmu(transformData.sizeExtension.top);
27138
+ effectExtentAttrs.r = pixelsToEmu(transformData.sizeExtension.right);
27139
+ effectExtentAttrs.b = pixelsToEmu(transformData.sizeExtension.bottom);
27140
+ }
27141
+ }
27082
27142
  const drawingXmlns = "http://schemas.openxmlformats.org/drawingml/2006/main";
27083
27143
  const pictureXmlns = "http://schemas.openxmlformats.org/drawingml/2006/picture";
27084
27144
  return {
@@ -27093,12 +27153,7 @@ const translateImageNode = (params2) => {
27093
27153
  },
27094
27154
  {
27095
27155
  name: "wp:effectExtent",
27096
- attributes: {
27097
- l: 0,
27098
- t: 0,
27099
- r: 0,
27100
- b: 0
27101
- }
27156
+ attributes: effectExtentAttrs
27102
27157
  },
27103
27158
  {
27104
27159
  name: "wp:docPr",
@@ -27178,6 +27233,7 @@ const translateImageNode = (params2) => {
27178
27233
  elements: [
27179
27234
  {
27180
27235
  name: "a:xfrm",
27236
+ attributes: xfrmAttrs,
27181
27237
  elements: [
27182
27238
  {
27183
27239
  name: "a:ext",
@@ -31380,8 +31436,8 @@ function addDefaultStylesIfMissing(styles) {
31380
31436
  }
31381
31437
  const importHeadersFooters = (docx, converter, mainEditor) => {
31382
31438
  const rels = docx["word/_rels/document.xml.rels"];
31383
- const relationships = rels.elements.find((el) => el.name === "Relationships");
31384
- const { elements } = relationships;
31439
+ const relationships = rels?.elements.find((el) => el.name === "Relationships");
31440
+ const { elements } = relationships || { elements: [] };
31385
31441
  const headerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
31386
31442
  const footerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
31387
31443
  const headers = elements.filter((el) => el.attributes["Type"] === headerType);
@@ -42339,12 +42395,6 @@ const History = Extension.create({
42339
42395
  name: "history",
42340
42396
  addOptions() {
42341
42397
  return {
42342
- /**
42343
- * @typedef {Object} HistoryOptions
42344
- * @category Options
42345
- * @property {number} [depth=100] - Maximum undo/redo steps to remember
42346
- * @property {number} [newGroupDelay=500] - Milliseconds to wait before starting a new history group
42347
- */
42348
42398
  depth: 100,
42349
42399
  newGroupDelay: 500
42350
42400
  };
@@ -42363,9 +42413,8 @@ const History = Extension.create({
42363
42413
  /**
42364
42414
  * Undo the last action
42365
42415
  * @category Command
42366
- * @returns {Function} Command function
42367
42416
  * @example
42368
- * undo()
42417
+ * editor.commands.undo()
42369
42418
  * @note Groups changes within the newGroupDelay window
42370
42419
  */
42371
42420
  undo: () => ({ state: state2, dispatch, tr }) => {
@@ -42379,9 +42428,8 @@ const History = Extension.create({
42379
42428
  /**
42380
42429
  * Redo the last undone action
42381
42430
  * @category Command
42382
- * @returns {Function} Command function
42383
42431
  * @example
42384
- * redo()
42432
+ * editor.commands.redo()
42385
42433
  * @note Only available after an undo action
42386
42434
  */
42387
42435
  redo: () => ({ state: state2, dispatch, tr }) => {
@@ -49300,6 +49348,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
49300
49348
  return result;
49301
49349
  } catch (error) {
49302
49350
  this.emit("exception", { error, editor: this });
49351
+ console.error(error);
49303
49352
  }
49304
49353
  }
49305
49354
  /**
@@ -49323,6 +49372,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
49323
49372
  this.converter.footerEditors.length = 0;
49324
49373
  } catch (error) {
49325
49374
  this.emit("exception", { error, editor: this });
49375
+ console.error(error);
49326
49376
  }
49327
49377
  }
49328
49378
  /**
@@ -49911,6 +49961,7 @@ endCollaboration_fn = function() {
49911
49961
  if (this.options.ydoc) this.options.ydoc.destroy();
49912
49962
  } catch (error) {
49913
49963
  this.emit("exception", { error, editor: this });
49964
+ console.error(error);
49914
49965
  }
49915
49966
  };
49916
49967
  validateDocumentInit_fn = function() {
@@ -49937,11 +49988,6 @@ const Color = Extension.create({
49937
49988
  name: "color",
49938
49989
  addOptions() {
49939
49990
  return {
49940
- /**
49941
- * @typedef {Object} ColorOptions
49942
- * @category Options
49943
- * @property {string[]} [types=['textStyle']] - Mark types to add color support to
49944
- */
49945
49991
  types: ["textStyle"]
49946
49992
  };
49947
49993
  },
@@ -49950,10 +49996,6 @@ const Color = Extension.create({
49950
49996
  {
49951
49997
  types: this.options.types,
49952
49998
  attributes: {
49953
- /**
49954
- * @category Attribute
49955
- * @param {ColorValue} [color] - Text color value
49956
- */
49957
49999
  color: {
49958
50000
  default: null,
49959
50001
  parseDOM: (el) => el.style.color?.replace(/['"]+/g, ""),
@@ -49972,16 +50014,17 @@ const Color = Extension.create({
49972
50014
  * Set text color
49973
50015
  * @category Command
49974
50016
  * @param {ColorValue} color - Color value to apply
49975
- * @returns {Function} Command function
49976
50017
  * @example
49977
50018
  * // Set to red using hex
49978
- * setColor('#ff0000')
50019
+ * editor.commands.setColor('#ff0000')
49979
50020
  *
50021
+ * @example
49980
50022
  * // Set using rgb
49981
- * setColor('rgb(255, 0, 0)')
50023
+ * editor.commands.setColor('rgb(255, 0, 0)')
49982
50024
  *
50025
+ * @example
49983
50026
  * // Set using named color
49984
- * setColor('blue')
50027
+ * editor.commands.setColor('blue')
49985
50028
  * @note Preserves other text styling attributes
49986
50029
  */
49987
50030
  setColor: (color) => ({ chain }) => {
@@ -49990,9 +50033,8 @@ const Color = Extension.create({
49990
50033
  /**
49991
50034
  * Remove text color
49992
50035
  * @category Command
49993
- * @returns {Function} Command function
49994
50036
  * @example
49995
- * unsetColor()
50037
+ * editor.commands.unsetColor()
49996
50038
  * @note Removes color while preserving other text styles
49997
50039
  */
49998
50040
  unsetColor: () => ({ chain }) => {
@@ -50005,11 +50047,6 @@ const FontFamily = Extension.create({
50005
50047
  name: "fontFamily",
50006
50048
  addOptions() {
50007
50049
  return {
50008
- /**
50009
- * @typedef {Object} FontFamilyOptions
50010
- * @category Options
50011
- * @property {string[]} [types=['textStyle']] - Mark types to add font family support to
50012
- */
50013
50050
  types: ["textStyle"]
50014
50051
  };
50015
50052
  },
@@ -50018,10 +50055,6 @@ const FontFamily = Extension.create({
50018
50055
  {
50019
50056
  types: this.options.types,
50020
50057
  attributes: {
50021
- /**
50022
- * @category Attribute
50023
- * @param {FontFamilyValue} [fontFamily] - Font family for text
50024
- */
50025
50058
  fontFamily: {
50026
50059
  default: null,
50027
50060
  parseDOM: (el) => el.style.fontFamily?.replace(/['"]+/g, ""),
@@ -50040,13 +50073,13 @@ const FontFamily = Extension.create({
50040
50073
  * Set font family
50041
50074
  * @category Command
50042
50075
  * @param {FontFamilyValue} fontFamily - Font family to apply
50043
- * @returns {Function} Command function
50044
50076
  * @example
50045
50077
  * // Set to Arial
50046
- * setFontFamily('Arial')
50078
+ * editor.commands.setFontFamily('Arial')
50047
50079
  *
50080
+ * @example
50048
50081
  * // Set to serif font
50049
- * setFontFamily('Georgia, serif')
50082
+ * editor.commands.setFontFamily('Georgia, serif')
50050
50083
  * @note Preserves other text styling attributes
50051
50084
  */
50052
50085
  setFontFamily: (fontFamily2) => ({ chain }) => {
@@ -50055,9 +50088,8 @@ const FontFamily = Extension.create({
50055
50088
  /**
50056
50089
  * Remove font family
50057
50090
  * @category Command
50058
- * @returns {Function} Command function
50059
50091
  * @example
50060
- * unsetFontFamily()
50092
+ * editor.commands.unsetFontFamily()
50061
50093
  * @note Reverts to default document font
50062
50094
  */
50063
50095
  unsetFontFamily: () => ({ chain }) => {
@@ -50070,12 +50102,6 @@ const FontSize = Extension.create({
50070
50102
  name: "fontSize",
50071
50103
  addOptions() {
50072
50104
  return {
50073
- /**
50074
- * @typedef {Object} FontSizeOptions
50075
- * @category Options
50076
- * @property {string[]} [types=['textStyle', 'tableCell']] - Node/mark types to add font size support to
50077
- * @property {FontSizeDefaults} [defaults] - Default size configuration
50078
- */
50079
50105
  types: ["textStyle", "tableCell"],
50080
50106
  defaults: {
50081
50107
  value: 12,
@@ -50090,10 +50116,6 @@ const FontSize = Extension.create({
50090
50116
  {
50091
50117
  types: this.options.types,
50092
50118
  attributes: {
50093
- /**
50094
- * @category Attribute
50095
- * @param {FontSizeValue} [fontSize] - Font size with unit
50096
- */
50097
50119
  fontSize: {
50098
50120
  default: null,
50099
50121
  parseDOM: (el) => el.style.fontSize,
@@ -50115,16 +50137,10 @@ const FontSize = Extension.create({
50115
50137
  * Set font size
50116
50138
  * @category Command
50117
50139
  * @param {FontSizeValue} fontSize - Size to apply (with optional unit)
50118
- * @returns {Function} Command function
50119
50140
  * @example
50120
- * // Set to 14pt
50121
- * setFontSize('14pt')
50122
- *
50123
- * // Set to 18px
50124
- * setFontSize('18px')
50125
- *
50126
- * // Set without unit (uses default)
50127
- * setFontSize(16)
50141
+ * editor.commands.setFontSize('14pt')
50142
+ * editor.commands.setFontSize('18px')
50143
+ * editor.commands.setFontSize(16)
50128
50144
  * @note Automatically clamps to min/max values
50129
50145
  */
50130
50146
  setFontSize: (fontSize2) => ({ chain }) => {
@@ -50146,9 +50162,8 @@ const FontSize = Extension.create({
50146
50162
  /**
50147
50163
  * Remove font size
50148
50164
  * @category Command
50149
- * @returns {Function} Command function
50150
50165
  * @example
50151
- * unsetFontSize()
50166
+ * editor.commands.unsetFontSize()
50152
50167
  * @note Reverts to default document size
50153
50168
  */
50154
50169
  unsetFontSize: () => ({ chain }) => {
@@ -50198,13 +50213,9 @@ const TextAlign = Extension.create({
50198
50213
  * Set text alignment
50199
50214
  * @category Command
50200
50215
  * @param {string} alignment - Alignment value (left, center, right, justify)
50201
- * @returns {Function} Command function
50202
50216
  * @example
50203
- * // Set to center
50204
- * setTextAlign('center')
50205
- *
50206
- * // Set to justify
50207
- * setTextAlign('justify')
50217
+ * editor.commands.setTextAlign('center')
50218
+ * editor.commands.setTextAlign('justify')
50208
50219
  * @note Applies to all configured node types (heading, paragraph by default)
50209
50220
  */
50210
50221
  setTextAlign: (alignment2) => ({ commands: commands2 }) => {
@@ -50215,9 +50226,8 @@ const TextAlign = Extension.create({
50215
50226
  /**
50216
50227
  * Remove text alignment (reset to default)
50217
50228
  * @category Command
50218
- * @returns {Function} Command function
50219
50229
  * @example
50220
- * unsetTextAlign()
50230
+ * editor.commands.unsetTextAlign()
50221
50231
  * @note Resets alignment to the default value
50222
50232
  */
50223
50233
  unsetTextAlign: () => ({ commands: commands2 }) => {
@@ -50358,13 +50368,6 @@ const LineHeight = Extension.create({
50358
50368
  name: "lineHeight",
50359
50369
  addOptions() {
50360
50370
  return {
50361
- /**
50362
- * @typedef {Object} LineHeightOptions
50363
- * @category Options
50364
- * @property {string[]} [types=['heading', 'paragraph']] - Block types to add line height support to
50365
- * @property {Object} [defaults] - Default configuration
50366
- * @property {string} [defaults.unit=''] - Default unit for line height values
50367
- */
50368
50371
  types: ["heading", "paragraph"],
50369
50372
  defaults: {
50370
50373
  unit: ""
@@ -50376,10 +50379,6 @@ const LineHeight = Extension.create({
50376
50379
  {
50377
50380
  types: this.options.types,
50378
50381
  attributes: {
50379
- /**
50380
- * @category Attribute
50381
- * @param {LineHeightValue} [lineHeight] - Line height value
50382
- */
50383
50382
  lineHeight: {
50384
50383
  default: null,
50385
50384
  parseDOM: (el) => el.style.lineHeight,
@@ -50405,16 +50404,10 @@ const LineHeight = Extension.create({
50405
50404
  * Set line height for blocks
50406
50405
  * @category Command
50407
50406
  * @param {LineHeightValue} lineHeight - Line height to apply
50408
- * @returns {Function} Command function
50409
50407
  * @example
50410
- * // Set to 1.5x spacing
50411
- * setLineHeight(1.5)
50412
- *
50413
- * // Set to 24px spacing
50414
- * setLineHeight('24px')
50415
- *
50416
- * // Set to double spacing
50417
- * setLineHeight(2)
50408
+ * editor.commands.setLineHeight(1.5)
50409
+ * editor.commands.setLineHeight('24px')
50410
+ * editor.commands.setLineHeight(2)
50418
50411
  * @note Applies to paragraphs and headings
50419
50412
  */
50420
50413
  setLineHeight: (lineHeight2) => ({ commands: commands2 }) => {
@@ -50424,9 +50417,8 @@ const LineHeight = Extension.create({
50424
50417
  /**
50425
50418
  * Remove line height
50426
50419
  * @category Command
50427
- * @returns {Function} Command function
50428
50420
  * @example
50429
- * unsetLineHeight()
50421
+ * editor.commands.unsetLineHeight()
50430
50422
  * @note Reverts to default line spacing
50431
50423
  */
50432
50424
  unsetLineHeight: () => ({ commands: commands2 }) => {
@@ -50454,9 +50446,8 @@ const FormatCommands = Extension.create({
50454
50446
  /**
50455
50447
  * Clear all formatting (nodes and marks)
50456
50448
  * @category Command
50457
- * @returns {Function} Command function
50458
50449
  * @example
50459
- * clearFormat()
50450
+ * editor.commands.clearFormat()
50460
50451
  * @note Removes all marks and resets nodes to default paragraph
50461
50452
  */
50462
50453
  clearFormat: () => ({ chain }) => {
@@ -50465,9 +50456,8 @@ const FormatCommands = Extension.create({
50465
50456
  /**
50466
50457
  * Clear only mark formatting
50467
50458
  * @category Command
50468
- * @returns {Function} Command function
50469
50459
  * @example
50470
- * clearMarksFormat()
50460
+ * editor.commands.clearMarksFormat()
50471
50461
  * @note Removes bold, italic, underline, colors, etc. but preserves block structure
50472
50462
  */
50473
50463
  clearMarksFormat: () => ({ chain }) => {
@@ -50476,9 +50466,8 @@ const FormatCommands = Extension.create({
50476
50466
  /**
50477
50467
  * Clear only node formatting
50478
50468
  * @category Command
50479
- * @returns {Function} Command function
50480
50469
  * @example
50481
- * clearNodesFormat()
50470
+ * editor.commands.clearNodesFormat()
50482
50471
  * @note Converts headings, lists, etc. to paragraphs but preserves text marks
50483
50472
  */
50484
50473
  clearNodesFormat: () => ({ chain }) => {
@@ -50487,13 +50476,8 @@ const FormatCommands = Extension.create({
50487
50476
  /**
50488
50477
  * Copy format from selection or apply copied format
50489
50478
  * @category Command
50490
- * @returns {Function} Command function
50491
50479
  * @example
50492
- * // First call: copy format from selection
50493
- * copyFormat()
50494
- *
50495
- * // Second call: apply copied format to new selection
50496
- * copyFormat()
50480
+ * editor.commands.copyFormat()
50497
50481
  * @note Works like format painter - first click copies, second click applies
50498
50482
  */
50499
50483
  copyFormat: () => ({ chain }) => {
@@ -50906,6 +50890,9 @@ function drawGapCursor(state2) {
50906
50890
  }
50907
50891
  const Gapcursor = Extension.create({
50908
50892
  name: "gapCursor",
50893
+ addOptions() {
50894
+ return {};
50895
+ },
50909
50896
  addPmPlugins() {
50910
50897
  return [gapCursor()];
50911
50898
  },
@@ -51246,6 +51233,9 @@ function getCursorPositionRelativeToContainer(view, eventLocation) {
51246
51233
  const SlashMenuPluginKey = new PluginKey("slashMenu");
51247
51234
  const SlashMenu = Extension.create({
51248
51235
  name: "slashMenu",
51236
+ addOptions() {
51237
+ return {};
51238
+ },
51249
51239
  addPmPlugins() {
51250
51240
  if (this.editor.options?.disableContextMenu) {
51251
51241
  return [];
@@ -51383,11 +51373,6 @@ const Document = Node$1.create({
51383
51373
  },
51384
51374
  addAttributes() {
51385
51375
  return {
51386
- /**
51387
- * @private
51388
- * @category Attribute
51389
- * @param {Object} [attributes] - Internal document attributes
51390
- */
51391
51376
  attributes: {
51392
51377
  rendered: false,
51393
51378
  "aria-label": "Document node"
@@ -51399,10 +51384,10 @@ const Document = Node$1.create({
51399
51384
  /**
51400
51385
  * Get document statistics
51401
51386
  * @category Command
51402
- * @returns {Function} Command function
51403
51387
  * @example
51404
51388
  * // Get word and character count
51405
- * getDocumentStats()
51389
+ * const stats = editor.commands.getDocumentStats()
51390
+ * console.log(`${stats.words} words, ${stats.characters} characters`)
51406
51391
  * @note Returns word count, character count, and paragraph count
51407
51392
  */
51408
51393
  getDocumentStats: () => ({ editor }) => {
@@ -51419,9 +51404,8 @@ const Document = Node$1.create({
51419
51404
  /**
51420
51405
  * Clear entire document
51421
51406
  * @category Command
51422
- * @returns {Function} Command function
51423
51407
  * @example
51424
- * clearDocument()
51408
+ * editor.commands.clearDocument()
51425
51409
  * @note Replaces all content with an empty paragraph
51426
51410
  */
51427
51411
  clearDocument: () => ({ commands: commands2 }) => {
@@ -51433,13 +51417,19 @@ const Document = Node$1.create({
51433
51417
  const Text = Node$1.create({
51434
51418
  name: "text",
51435
51419
  group: "inline",
51436
- inline: true
51420
+ inline: true,
51421
+ addOptions() {
51422
+ return {};
51423
+ }
51437
51424
  });
51438
51425
  const RunItem = Node$1.create({
51439
51426
  name: "run",
51440
51427
  group: "inline",
51441
51428
  content: "text*",
51442
51429
  inline: true,
51430
+ addOptions() {
51431
+ return {};
51432
+ },
51443
51433
  parseDOM() {
51444
51434
  return [{ tag: "run" }];
51445
51435
  },
@@ -51465,14 +51455,6 @@ const BulletList = Node$1.create({
51465
51455
  },
51466
51456
  addOptions() {
51467
51457
  return {
51468
- /**
51469
- * @typedef {Object} BulletListOptions
51470
- * @category Options
51471
- * @property {string} [itemTypeName='listItem'] - Name of the list item node type
51472
- * @property {Object} [htmlAttributes] - HTML attributes for the ul element
51473
- * @property {boolean} [keepMarks=true] - Whether to preserve marks when splitting
51474
- * @property {boolean} [keepAttributes=false] - Whether to preserve attributes when splitting
51475
- */
51476
51458
  itemTypeName: "listItem",
51477
51459
  htmlAttributes: {
51478
51460
  "aria-label": "Bullet list node"
@@ -51490,27 +51472,13 @@ const BulletList = Node$1.create({
51490
51472
  },
51491
51473
  addAttributes() {
51492
51474
  return {
51493
- /**
51494
- * @category Attribute
51495
- * @param {string} [list-style-type='bullet'] - List style type for this list
51496
- */
51497
51475
  "list-style-type": {
51498
51476
  default: "bullet",
51499
51477
  rendered: false
51500
51478
  },
51501
- /**
51502
- * @private
51503
- * @category Attribute
51504
- * @param {string} [listId] - Internal list identifier for numbering
51505
- */
51506
51479
  listId: {
51507
51480
  rendered: false
51508
51481
  },
51509
- /**
51510
- * @private
51511
- * @category Attribute
51512
- * @param {string} [sdBlockId] - Internal block tracking ID
51513
- */
51514
51482
  sdBlockId: {
51515
51483
  default: null,
51516
51484
  keepOnSplit: false,
@@ -51519,11 +51487,6 @@ const BulletList = Node$1.create({
51519
51487
  return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
51520
51488
  }
51521
51489
  },
51522
- /**
51523
- * @private
51524
- * @category Attribute
51525
- * @param {Object} [attributes] - Additional attributes for the list
51526
- */
51527
51490
  attributes: {
51528
51491
  rendered: false,
51529
51492
  keepOnSplit: true
@@ -51535,10 +51498,9 @@ const BulletList = Node$1.create({
51535
51498
  /**
51536
51499
  * Toggle a bullet list at the current selection
51537
51500
  * @category Command
51538
- * @returns {Function} Command function
51539
51501
  * @example
51540
51502
  * // Toggle bullet list on selected text
51541
- * toggleBulletList()
51503
+ * editor.commands.toggleBulletList()
51542
51504
  * @note Converts selected paragraphs to list items or removes list formatting
51543
51505
  */
51544
51506
  toggleBulletList: () => (params2) => {
@@ -51657,9 +51619,25 @@ const OrderedList = Node$1.create({
51657
51619
  },
51658
51620
  addCommands() {
51659
51621
  return {
51622
+ /**
51623
+ * Toggle ordered list formatting
51624
+ * @category Command
51625
+ * @example
51626
+ * editor.commands.toggleOrderedList()
51627
+ * @note Converts selection to ordered list or back to paragraphs
51628
+ */
51660
51629
  toggleOrderedList: () => (params2) => {
51661
51630
  return toggleList(this.type)(params2);
51662
51631
  },
51632
+ /**
51633
+ * Restart list node numbering
51634
+ * @category Command
51635
+ * @param {Array} followingNodes - Nodes to restart
51636
+ * @param {number} pos - Starting position
51637
+ * @example
51638
+ * editor.commands.restartListNodes(nodes, position)
51639
+ * @note Resets list numbering for specified nodes
51640
+ */
51663
51641
  restartListNodes: (followingNodes, pos) => ({ tr }) => {
51664
51642
  let currentNodePos = pos;
51665
51643
  const nodes = followingNodes.map((node) => {
@@ -51678,8 +51656,11 @@ const OrderedList = Node$1.create({
51678
51656
  return true;
51679
51657
  },
51680
51658
  /**
51681
- * Updates ordered list style type when sink or lift `listItem`.
51682
- * @example 1,2,3 -> a,b,c -> i,ii,iii -> 1,2,3 -> etc
51659
+ * Update ordered list style type based on nesting level
51660
+ * @category Command
51661
+ * @example
51662
+ * editor.commands.updateOrderedListStyleType()
51663
+ * @note Cycles through decimal -> lowerAlpha -> lowerRoman based on depth
51683
51664
  */
51684
51665
  updateOrderedListStyleType: () => ({ dispatch, tr }) => {
51685
51666
  let list = findParentNode((node) => node.type.name === this.name)(tr.selection);
@@ -51956,7 +51937,7 @@ const CustomSelection = Extension.create({
51956
51937
  * @returns {Function} Command function
51957
51938
  * @example
51958
51939
  * // Restore selection after toolbar interaction
51959
- * restorePreservedSelection()
51940
+ * editor.commands.restorePreservedSelection()
51960
51941
  * @note Used internally to maintain selection when interacting with toolbar
51961
51942
  */
51962
51943
  restorePreservedSelection: () => ({ tr, state: state2 }) => {
@@ -52245,6 +52226,9 @@ const LinkedStyles = Extension.create({
52245
52226
  name: "linkedStyles",
52246
52227
  priority: 1,
52247
52228
  // We need this plugin to run before the list plugins
52229
+ addOptions() {
52230
+ return {};
52231
+ },
52248
52232
  addPmPlugins() {
52249
52233
  return [createLinkedStylesPlugin(this.editor)];
52250
52234
  },
@@ -52253,11 +52237,10 @@ const LinkedStyles = Extension.create({
52253
52237
  /**
52254
52238
  * Apply a linked style to the selected paragraphs
52255
52239
  * @category Command
52256
- * @param {Object} style - The style object to apply
52257
- * @returns {Function} Command function
52240
+ * @param {LinkedStyle} style - The style object to apply
52258
52241
  * @example
52259
52242
  * const style = editor.helpers.linkedStyles.getStyleById('Heading1');
52260
- * setLinkedStyle(style);
52243
+ * editor.commands.setLinkedStyle(style);
52261
52244
  * @note Clears existing formatting when applying a style
52262
52245
  * @note Works with custom selection preservation
52263
52246
  */
@@ -52268,16 +52251,12 @@ const LinkedStyles = Extension.create({
52268
52251
  /**
52269
52252
  * Toggle a linked style on the current selection
52270
52253
  * @category Command
52271
- * @param {Object} style - The linked style to apply (with id property)
52254
+ * @param {LinkedStyle} style - The linked style to apply (with id property)
52272
52255
  * @param {string|null} [nodeType=null] - Node type to restrict toggle to (e.g., 'paragraph')
52273
- * @returns {Function} Command function
52274
52256
  * @example
52275
- * // Toggle a heading style
52276
52257
  * const style = editor.helpers.linkedStyles.getStyleById('Heading1');
52277
- * toggleLinkedStyle(style)
52278
- *
52279
- * // Toggle only on paragraph nodes
52280
- * toggleLinkedStyle(style, 'paragraph')
52258
+ * editor.commands.toggleLinkedStyle(style)
52259
+ * editor.commands.toggleLinkedStyle(style, 'paragraph')
52281
52260
  * @note If selection is empty, returns false
52282
52261
  * @note Removes style if already applied, applies it if not
52283
52262
  */
@@ -52305,13 +52284,9 @@ const LinkedStyles = Extension.create({
52305
52284
  * Apply a linked style by its ID
52306
52285
  * @category Command
52307
52286
  * @param {string} styleId - The style ID to apply (e.g., 'Heading1')
52308
- * @returns {Function} Command function
52309
52287
  * @example
52310
- * // Apply a heading style
52311
- * setStyleById('Heading1')
52312
- *
52313
- * // Apply a normal style
52314
- * setStyleById('Normal')
52288
+ * editor.commands.setStyleById('Heading1')
52289
+ * editor.commands.setStyleById('Normal')
52315
52290
  * @note Looks up the style from loaded Word styles
52316
52291
  */
52317
52292
  setStyleById: (styleId) => (params2) => {
@@ -53019,12 +52994,6 @@ const Paragraph = OxmlNode.create({
53019
52994
  inline: false,
53020
52995
  addOptions() {
53021
52996
  return {
53022
- /**
53023
- * @typedef {Object} HeadingOptions
53024
- * @category Options
53025
- * @property {number[]} [headingLevels=[1,2,3,4,5,6]] - Supported heading levels
53026
- * @property {Object} [htmlAttributes] - HTML attributes for paragraph elements
53027
- */
53028
52997
  headingLevels: [1, 2, 3, 4, 5, 6],
53029
52998
  htmlAttributes: {}
53030
52999
  };
@@ -53256,11 +53225,6 @@ const Heading = Extension.create({
53256
53225
  name: "heading",
53257
53226
  addOptions() {
53258
53227
  return {
53259
- /**
53260
- * @typedef {Object} HeadingOptions
53261
- * @category Options
53262
- * @property {number[]} [levels=[1,2,3,4,5,6]] - Supported heading levels
53263
- */
53264
53228
  levels: [1, 2, 3, 4, 5, 6]
53265
53229
  };
53266
53230
  },
@@ -53270,10 +53234,8 @@ const Heading = Extension.create({
53270
53234
  * Set a heading with specified level
53271
53235
  * @category Command
53272
53236
  * @param {HeadingAttributes} attributes - Heading attributes including level
53273
- * @returns {Function} Command function
53274
53237
  * @example
53275
- * // Set heading level 2
53276
- * setHeading({ level: 2 })
53238
+ * editor.commands.setHeading({ level: 2 })
53277
53239
  * @note Converts current block to heading
53278
53240
  */
53279
53241
  setHeading: (attributes) => ({ commands: commands2 }) => {
@@ -53285,13 +53247,9 @@ const Heading = Extension.create({
53285
53247
  * Toggle between heading and paragraph
53286
53248
  * @category Command
53287
53249
  * @param {HeadingAttributes} attributes - Heading attributes including level
53288
- * @returns {Function} Command function
53289
53250
  * @example
53290
- * // Toggle heading level 1
53291
- * toggleHeading({ level: 1 })
53292
- *
53293
- * // Toggle heading level 3
53294
- * toggleHeading({ level: 3 })
53251
+ * editor.commands.toggleHeading({ level: 1 })
53252
+ * editor.commands.toggleHeading({ level: 3 })
53295
53253
  * @note Switches between heading and paragraph for the same level
53296
53254
  */
53297
53255
  toggleHeading: (attributes) => ({ commands: commands2 }) => {
@@ -53696,6 +53654,9 @@ const LineBreak = Node$1.create({
53696
53654
  selectable: false,
53697
53655
  content: "",
53698
53656
  atom: true,
53657
+ addOptions() {
53658
+ return {};
53659
+ },
53699
53660
  parseDOM() {
53700
53661
  return [{ tag: "br" }];
53701
53662
  },
@@ -53704,17 +53665,7 @@ const LineBreak = Node$1.create({
53704
53665
  },
53705
53666
  addAttributes() {
53706
53667
  return {
53707
- /**
53708
- * @private
53709
- * @category Attribute
53710
- * @param {string} [lineBreakType] - Type of line break - passthrough in this node
53711
- */
53712
53668
  lineBreakType: { rendered: false },
53713
- /**
53714
- * @private
53715
- * @category Attribute
53716
- * @param {string} [clear] - Clear attribute - passthrough in this node
53717
- */
53718
53669
  clear: { rendered: false }
53719
53670
  };
53720
53671
  },
@@ -53723,9 +53674,8 @@ const LineBreak = Node$1.create({
53723
53674
  /**
53724
53675
  * Insert a line break
53725
53676
  * @category Command
53726
- * @returns {Function} Command function
53727
53677
  * @example
53728
- * insertLineBreak()
53678
+ * editor.commands.insertLineBreak()
53729
53679
  * @note Creates a soft break within the same paragraph
53730
53680
  */
53731
53681
  insertLineBreak: () => ({ commands: commands2 }) => {
@@ -53742,11 +53692,6 @@ const HardBreak = Node$1.create({
53742
53692
  atom: true,
53743
53693
  addOptions() {
53744
53694
  return {
53745
- /**
53746
- * @typedef {Object} HardBreakOptions
53747
- * @category Options
53748
- * @property {Object} [htmlAttributes] - HTML attributes for the break element
53749
- */
53750
53695
  htmlAttributes: {
53751
53696
  contentEditable: "false",
53752
53697
  lineBreakType: "page",
@@ -53757,35 +53702,15 @@ const HardBreak = Node$1.create({
53757
53702
  },
53758
53703
  addAttributes() {
53759
53704
  return {
53760
- /**
53761
- * @private
53762
- * @category Attribute
53763
- * @param {string} [pageBreakSource] - Source of the page break
53764
- */
53765
53705
  pageBreakSource: {
53766
53706
  rendered: false,
53767
53707
  default: null
53768
53708
  },
53769
- /**
53770
- * @private
53771
- * @category Attribute
53772
- * @param {string} [pageBreakType] - Type of page break
53773
- */
53774
53709
  pageBreakType: {
53775
53710
  default: null,
53776
53711
  rendered: false
53777
53712
  },
53778
- /**
53779
- * @private
53780
- * @category Attribute
53781
- * @param {string} [lineBreakType] - Type of line break - passthrough in this node
53782
- */
53783
53713
  lineBreakType: { rendered: false },
53784
- /**
53785
- * @private
53786
- * @category Attribute
53787
- * @param {string} [clear] - Clear attribute - passthrough in this node
53788
- */
53789
53714
  clear: { rendered: false }
53790
53715
  };
53791
53716
  },
@@ -53811,9 +53736,8 @@ const HardBreak = Node$1.create({
53811
53736
  /**
53812
53737
  * Insert a page break
53813
53738
  * @category Command
53814
- * @returns {Function} Command function
53815
53739
  * @example
53816
- * insertPageBreak()
53740
+ * editor.commands.insertPageBreak()
53817
53741
  * @note Forces content to start on a new page when printed
53818
53742
  */
53819
53743
  insertPageBreak: () => ({ commands: commands2 }) => {
@@ -56203,17 +56127,6 @@ const Table = Node$1.create({
56203
56127
  group: "block",
56204
56128
  isolating: true,
56205
56129
  tableRole: "table",
56206
- /**
56207
- * Table extension options
56208
- * @category Options
56209
- * @typedef {Object} TableOptions
56210
- * @property {Object} [htmlAttributes={'aria-label': 'Table node'}] - Default HTML attributes for all tables
56211
- * @property {boolean} [resizable=true] - Enable column resizing functionality
56212
- * @property {number} [handleWidth=5] - Width of resize handles in pixels
56213
- * @property {number} [cellMinWidth=10] - Minimum cell width constraint in pixels
56214
- * @property {boolean} [lastColumnResizable=true] - Allow resizing of the last column
56215
- * @property {boolean} [allowTableNodeSelection=false] - Enable selecting the entire table node
56216
- */
56217
56130
  addOptions() {
56218
56131
  return {
56219
56132
  htmlAttributes: {
@@ -56371,14 +56284,9 @@ const Table = Node$1.create({
56371
56284
  * Insert a new table into the document
56372
56285
  * @category Command
56373
56286
  * @param {TableConfig} [config] - Table configuration options
56374
- * @returns {Function} Command
56375
56287
  * @example
56376
- * // Using default values
56377
- * insertTable() // Creates 3x3 table without header
56378
- *
56379
- * // Using custom values
56380
- * insertTable({ rows: 3, cols: 3, withHeaderRow: true })
56381
- *
56288
+ * editor.commands.insertTable()
56289
+ * editor.commands.insertTable({ rows: 3, cols: 3, withHeaderRow: true })
56382
56290
  */
56383
56291
  insertTable: ({ rows = 3, cols = 3, withHeaderRow = false } = {}) => ({ tr, dispatch, editor }) => {
56384
56292
  const node = createTable(editor.schema, rows, cols, withHeaderRow);
@@ -56391,9 +56299,8 @@ const Table = Node$1.create({
56391
56299
  /**
56392
56300
  * Delete the entire table containing the cursor
56393
56301
  * @category Command
56394
- * @returns {Function} Command
56395
56302
  * @example
56396
- * deleteTable()
56303
+ * editor.commands.deleteTable()
56397
56304
  */
56398
56305
  deleteTable: () => ({ state: state2, dispatch }) => {
56399
56306
  return deleteTable(state2, dispatch);
@@ -56401,9 +56308,8 @@ const Table = Node$1.create({
56401
56308
  /**
56402
56309
  * Add a column before the current column
56403
56310
  * @category Command
56404
- * @returns {Function} Command
56405
56311
  * @example
56406
- * addColumnBefore()
56312
+ * editor.commands.addColumnBefore()
56407
56313
  * @note Preserves cell attributes from current column
56408
56314
  */
56409
56315
  addColumnBefore: () => ({ state: state2, dispatch, chain }) => {
@@ -56780,10 +56686,9 @@ const Table = Node$1.create({
56780
56686
  * Set background color for selected cells
56781
56687
  * @category Command
56782
56688
  * @param {string} value - Color value (hex with or without #)
56783
- * @returns {Function} Command
56784
56689
  * @example
56785
- * setCellBackground('#ff0000')
56786
- * setCellBackground('ff0000')
56690
+ * editor.commands.setCellBackground('#ff0000')
56691
+ * editor.commands.setCellBackground('ff0000')
56787
56692
  */
56788
56693
  setCellBackground: (value) => ({ editor, commands: commands2, dispatch }) => {
56789
56694
  const { selection } = editor.state;
@@ -56909,24 +56814,12 @@ const TableHeader = Node$1.create({
56909
56814
  },
56910
56815
  addAttributes() {
56911
56816
  return {
56912
- /**
56913
- * @category Attribute
56914
- * @param {number} [colspan=1] - Number of columns this header spans
56915
- */
56916
56817
  colspan: {
56917
56818
  default: 1
56918
56819
  },
56919
- /**
56920
- * @category Attribute
56921
- * @param {number} [rowspan=1] - Number of rows this header spans
56922
- */
56923
56820
  rowspan: {
56924
56821
  default: 1
56925
56822
  },
56926
- /**
56927
- * @category Attribute
56928
- * @param {number[]} [colwidth] - Column widths array in pixels
56929
- */
56930
56823
  colwidth: {
56931
56824
  default: null,
56932
56825
  parseDOM: (element) => {
@@ -56963,10 +56856,6 @@ const TableRow = Node$1.create({
56963
56856
  },
56964
56857
  addAttributes() {
56965
56858
  return {
56966
- /**
56967
- * @category Attribute
56968
- * @param {number} [rowHeight] - Fixed row height in pixels
56969
- */
56970
56859
  rowHeight: {
56971
56860
  renderDOM({ rowHeight }) {
56972
56861
  if (!rowHeight) return {};
@@ -56974,11 +56863,6 @@ const TableRow = Node$1.create({
56974
56863
  return { style: style2 };
56975
56864
  }
56976
56865
  },
56977
- /**
56978
- * Indicates that this row should not be split across pages when paginating/exporting.
56979
- * @category Attribute
56980
- * @param {boolean} [cantSplit]
56981
- */
56982
56866
  cantSplit: {
56983
56867
  default: false,
56984
56868
  parseDOM() {
@@ -56990,44 +56874,30 @@ const TableRow = Node$1.create({
56990
56874
  }
56991
56875
  },
56992
56876
  /**
56993
- * @category Attribute
56994
- * @param {TableRowProperties} [tableRowProperties] - Properties for the table row.
56995
56877
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 377-482
56996
56878
  */
56997
56879
  tableRowProperties: { rendered: false },
56998
56880
  /**
56999
- * @category Attribute
57000
- * @param {string} [rsidDel] - Unique identifier used to track the editing session when the row was deleted from the main document.
57001
56881
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
57002
56882
  */
57003
56883
  rsidDel: { rendered: false },
57004
56884
  /**
57005
- * @category Attribute
57006
- * @param {string} [rsidR] - Unique identifier used to track the editing session when the table row was added to the main document.
57007
56885
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
57008
56886
  */
57009
56887
  rsidR: { rendered: false },
57010
56888
  /**
57011
- * @category Attribute
57012
- * @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.
57013
56889
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
57014
56890
  */
57015
56891
  rsidRPr: { rendered: false },
57016
56892
  /**
57017
- * @category Attribute
57018
- * @param {string} [rsidTr] - Unique identifier used to track the editing session when the table row's properties were last modified in this document.
57019
56893
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
57020
56894
  */
57021
56895
  rsidTr: { rendered: false },
57022
56896
  /**
57023
- * @category Attribute
57024
- * @param {string} [paraId] - A randomly generated unique identifier for the table row.
57025
56897
  * @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/a0e7d2e2-2246-44c6-96e8-1cf009823615}
57026
56898
  */
57027
56899
  paraId: { rendered: false },
57028
56900
  /**
57029
- * @category Attribute
57030
- * @param {string} [textId] - A randomly generated unique identifier for the text of the table row.
57031
56901
  * @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/b7eeddec-7c50-47fb-88b6-1feec3ed832c}
57032
56902
  */
57033
56903
  textId: { rendered: false }
@@ -57054,24 +56924,12 @@ const TableCell = Node$1.create({
57054
56924
  },
57055
56925
  addAttributes() {
57056
56926
  return {
57057
- /**
57058
- * @category Attribute
57059
- * @param {number} [colspan=1] - Number of columns this cell spans
57060
- */
57061
56927
  colspan: {
57062
56928
  default: 1
57063
56929
  },
57064
- /**
57065
- * @category Attribute
57066
- * @param {number} [rowspan=1] - Number of rows this cell spans
57067
- */
57068
56930
  rowspan: {
57069
56931
  default: 1
57070
56932
  },
57071
- /**
57072
- * @category Attribute
57073
- * @param {number[]} [colwidth=[100]] - Column widths array in pixels
57074
- */
57075
56933
  colwidth: {
57076
56934
  default: [100],
57077
56935
  parseDOM: (elem) => {
@@ -57086,10 +56944,6 @@ const TableCell = Node$1.create({
57086
56944
  };
57087
56945
  }
57088
56946
  },
57089
- /**
57090
- * @category Attribute
57091
- * @param {CellBackground} [background] - Cell background color configuration
57092
- */
57093
56947
  background: {
57094
56948
  renderDOM({ background }) {
57095
56949
  if (!background) return {};
@@ -57098,10 +56952,6 @@ const TableCell = Node$1.create({
57098
56952
  return { style: style2 };
57099
56953
  }
57100
56954
  },
57101
- /**
57102
- * @category Attribute
57103
- * @param {string} [verticalAlign] - Vertical content alignment (top, middle, bottom)
57104
- */
57105
56955
  verticalAlign: {
57106
56956
  renderDOM({ verticalAlign }) {
57107
56957
  if (!verticalAlign) return {};
@@ -57109,10 +56959,6 @@ const TableCell = Node$1.create({
57109
56959
  return { style: style2 };
57110
56960
  }
57111
56961
  },
57112
- /**
57113
- * @category Attribute
57114
- * @param {CellMargins} [cellMargins] - Internal cell padding
57115
- */
57116
56962
  cellMargins: {
57117
56963
  renderDOM({ cellMargins }) {
57118
56964
  if (!cellMargins) return {};
@@ -57125,10 +56971,6 @@ const TableCell = Node$1.create({
57125
56971
  return { style: style2 };
57126
56972
  }
57127
56973
  },
57128
- /**
57129
- * @category Attribute
57130
- * @param {CellBorders} [borders] - Cell border configuration
57131
- */
57132
56974
  borders: {
57133
56975
  default: () => createCellBorders(),
57134
56976
  renderDOM({ borders }) {
@@ -57143,20 +56985,10 @@ const TableCell = Node$1.create({
57143
56985
  return { style: style2 };
57144
56986
  }
57145
56987
  },
57146
- /**
57147
- * @private
57148
- * @category Attribute
57149
- * @param {string} [widthType='auto'] - Internal width type
57150
- */
57151
56988
  widthType: {
57152
56989
  default: "auto",
57153
56990
  rendered: false
57154
56991
  },
57155
- /**
57156
- * @private
57157
- * @category Attribute
57158
- * @param {string} [widthUnit='px'] - Internal width unit
57159
- */
57160
56992
  widthUnit: {
57161
56993
  default: "px",
57162
56994
  rendered: false
@@ -59359,6 +59191,19 @@ const findPreviousDomNodeWithClass = (view, pos, className) => {
59359
59191
  }
59360
59192
  return null;
59361
59193
  };
59194
+ const getRotationMargins = (w2, h2, angleDegrees) => {
59195
+ const rad = angleDegrees * (Math.PI / 180);
59196
+ const cos = Math.abs(Math.cos(rad));
59197
+ const sin = Math.abs(Math.sin(rad));
59198
+ const boundingWidth = w2 * cos + h2 * sin;
59199
+ const boundingHeight = w2 * sin + h2 * cos;
59200
+ const marginLeftRight = Math.round(Math.max(0, (boundingWidth - w2) / 2));
59201
+ const marginTopBottom = Math.round(Math.max(0, (boundingHeight - h2) / 2));
59202
+ return {
59203
+ horizontal: marginLeftRight,
59204
+ vertical: marginTopBottom
59205
+ };
59206
+ };
59362
59207
  const Image = Node$1.create({
59363
59208
  name: "image",
59364
59209
  group: "inline",
@@ -59380,10 +59225,6 @@ const Image = Node$1.create({
59380
59225
  },
59381
59226
  addAttributes() {
59382
59227
  return {
59383
- /**
59384
- * @category Attribute
59385
- * @param {string} [src] - Image source URL or path
59386
- */
59387
59228
  src: {
59388
59229
  default: null,
59389
59230
  renderDOM: ({ src }) => {
@@ -59392,95 +59233,75 @@ const Image = Node$1.create({
59392
59233
  };
59393
59234
  }
59394
59235
  },
59395
- /**
59396
- * @category Attribute
59397
- * @param {string} [alt='Uploaded picture'] - Alternative text for accessibility
59398
- */
59399
59236
  alt: {
59400
59237
  default: "Uploaded picture"
59401
59238
  },
59402
- /**
59403
- * @category Attribute
59404
- * @param {string} [id] - Image element ID
59405
- * @private
59406
- */
59407
59239
  id: { rendered: false },
59408
- /**
59409
- * @category Attribute
59410
- * @param {string} [title] - Image title/tooltip text
59411
- */
59412
59240
  title: {
59413
59241
  default: null
59414
59242
  },
59415
- /**
59416
- * @category Attribute
59417
- * @param {string} [rId] - Relationship ID for Word export
59418
- * @private
59419
- */
59420
59243
  rId: {
59421
59244
  default: null,
59422
59245
  rendered: false
59423
59246
  },
59424
- /**
59425
- * @category Attribute
59426
- * @param {Object} [originalPadding] - Original padding values from Word import
59427
- * @private
59428
- */
59429
59247
  originalPadding: {
59430
59248
  default: null,
59431
59249
  rendered: false
59432
59250
  },
59433
- /**
59434
- * @category Attribute
59435
- * @param {Object} [originalAttributes] - Original attributes from Word import
59436
- * @private
59437
- */
59438
59251
  originalAttributes: { rendered: false },
59439
- /**
59440
- * @category Attribute
59441
- * @param {boolean} [wrapTopAndBottom] - Wrap text above and below image
59442
- * @private
59443
- */
59444
59252
  wrapTopAndBottom: { rendered: false },
59445
- /**
59446
- * @category Attribute
59447
- * @param {Object} [anchorData] - Anchor positioning data for Word
59448
- * @private
59449
- */
59450
59253
  anchorData: {
59451
59254
  default: null,
59452
59255
  rendered: false
59453
59256
  },
59257
+ isAnchor: { rendered: false },
59454
59258
  /**
59455
59259
  * @category Attribute
59456
- * @param {boolean} [isAnchor] - Whether image is anchored
59260
+ * @param {Object} [transformData] - Transform data for image (turn and flip)
59261
+ * @param {number} [transformData.rotation] - Turn angle in degrees
59262
+ * @param {boolean} [transformData.verticalFlip] - Whether to flip vertically
59263
+ * @param {boolean} [transformData.horizontalFlip] - Whether to flip horizontally
59264
+ * @param {Object} [transformData.sizeExtension] - Size extension for image due to transformation
59265
+ * @param {number} [transformData.sizeExtension.left] - Left size extension for image
59266
+ * @param {number} [transformData.sizeExtension.top] - Top size extension for image
59267
+ * @param {number} [transformData.sizeExtension.right] - Right size extension for image
59268
+ * @param {number} [transformData.sizeExtension.bottom] - Bottom size extension for image
59269
+ *
59457
59270
  * @private
59458
59271
  */
59459
- isAnchor: { rendered: false },
59272
+ transformData: {
59273
+ default: {},
59274
+ renderDOM: ({ transformData }) => {
59275
+ let style2 = "";
59276
+ if (transformData?.rotation) {
59277
+ style2 += `rotate(${Math.round(transformData.rotation)}deg) `;
59278
+ }
59279
+ if (transformData?.verticalFlip) {
59280
+ style2 += "scaleY(-1) ";
59281
+ }
59282
+ if (transformData?.horizontalFlip) {
59283
+ style2 += "scaleX(-1) ";
59284
+ }
59285
+ style2 = style2.trim();
59286
+ if (style2.length > 0) {
59287
+ return { style: `transform: ${style2};` };
59288
+ }
59289
+ return;
59290
+ }
59291
+ },
59460
59292
  /**
59461
59293
  * @category Attribute
59462
59294
  * @param {boolean} [simplePos] - Simple positioning flag
59463
59295
  * @private
59464
59296
  */
59465
59297
  simplePos: { rendered: false },
59466
- /**
59467
- * @category Attribute
59468
- * @param {string} [wrapText] - Text wrapping style
59469
- * @private
59470
- */
59471
59298
  wrapText: { rendered: false },
59472
59299
  extension: { rendered: false },
59473
- /**
59474
- * @category Attribute
59475
- * @param {Object} [size] - Image dimensions
59476
- * @param {number} [size.width] - Width in pixels
59477
- * @param {number} [size.height] - Height in pixels
59478
- */
59479
59300
  size: {
59480
59301
  default: {},
59481
59302
  renderDOM: ({ size: size2, extension }) => {
59482
59303
  let style2 = "";
59483
- const { width, height } = size2 ?? {};
59304
+ let { width, height } = size2 ?? {};
59484
59305
  if (width) style2 += `width: ${width}px;`;
59485
59306
  if (height && ["emf", "wmf"].includes(extension))
59486
59307
  style2 += `height: ${height}px; border: 1px solid black; position: absolute;`;
@@ -59488,51 +59309,58 @@ const Image = Node$1.create({
59488
59309
  return { style: style2 };
59489
59310
  }
59490
59311
  },
59491
- /**
59492
- * @category Attribute
59493
- * @param {Object} [padding] - Image padding/margins
59494
- * @param {number} [padding.left] - Left padding in pixels
59495
- * @param {number} [padding.top] - Top padding in pixels
59496
- * @param {number} [padding.bottom] - Bottom padding in pixels
59497
- * @param {number} [padding.right] - Right padding in pixels
59498
- */
59499
59312
  padding: {
59500
59313
  default: {},
59501
- renderDOM: ({ padding, marginOffset }) => {
59502
- const { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
59314
+ renderDOM: ({ size: size2 = {}, padding, marginOffset, transformData }) => {
59315
+ let { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
59316
+ const { rotation } = transformData ?? {};
59317
+ const { height, width } = size2 ?? {};
59318
+ if (rotation && height && width) {
59319
+ const { horizontal, vertical } = getRotationMargins(width, height, rotation);
59320
+ left2 += horizontal;
59321
+ right2 += horizontal;
59322
+ top2 += vertical;
59323
+ bottom2 += vertical;
59324
+ }
59503
59325
  let style2 = "";
59504
- if (left2 && !marginOffset?.left) style2 += `margin-left: ${left2}px;`;
59505
- if (top2 && !marginOffset?.top) style2 += `margin-top: ${top2}px;`;
59326
+ if (left2 && marginOffset?.left == null) style2 += `margin-left: ${left2}px;`;
59327
+ if (top2 && marginOffset?.top == null) style2 += `margin-top: ${top2}px;`;
59506
59328
  if (bottom2) style2 += `margin-bottom: ${bottom2}px;`;
59507
59329
  if (right2) style2 += `margin-right: ${right2}px;`;
59508
59330
  return { style: style2 };
59509
59331
  }
59510
59332
  },
59511
- /**
59512
- * @category Attribute
59513
- * @param {Object} [marginOffset] - Margin offset for anchored images
59514
- * @param {number} [marginOffset.left] - Left margin offset
59515
- * @param {number} [marginOffset.top] - Top margin offset
59516
- */
59517
59333
  marginOffset: {
59518
59334
  default: {},
59519
- renderDOM: ({ marginOffset, anchorData }) => {
59335
+ renderDOM: ({ marginOffset, anchorData, transformData, size: size2 }) => {
59336
+ const hasAnchorData = Boolean(anchorData);
59337
+ const hasMarginOffsets = marginOffset?.left != null || marginOffset?.top != null;
59338
+ if (!hasAnchorData && !hasMarginOffsets) return {};
59520
59339
  const relativeFromPageV = anchorData?.vRelativeFrom === "page";
59521
59340
  const maxMarginV = 500;
59522
- const { left: left2 = 0, top: top2 = 0 } = marginOffset ?? {};
59341
+ const baseLeft = marginOffset?.left ?? 0;
59342
+ const baseTop = marginOffset?.top ?? 0;
59343
+ let rotationLeft = 0;
59344
+ let rotationTop = 0;
59345
+ const { rotation } = transformData ?? {};
59346
+ const { height, width } = size2 ?? {};
59347
+ if (rotation && height && width) {
59348
+ const { horizontal, vertical } = getRotationMargins(width, height, rotation);
59349
+ rotationLeft = horizontal;
59350
+ rotationTop = vertical;
59351
+ }
59352
+ const left2 = baseLeft + rotationLeft;
59353
+ const top2 = baseTop + rotationTop;
59523
59354
  let style2 = "";
59524
59355
  if (left2) style2 += `margin-left: ${left2}px;`;
59525
59356
  if (top2) {
59526
59357
  if (relativeFromPageV && top2 >= maxMarginV) style2 += `margin-top: ${maxMarginV}px;`;
59527
59358
  else style2 += `margin-top: ${top2}px;`;
59528
59359
  }
59360
+ if (!style2) return {};
59529
59361
  return { style: style2 };
59530
59362
  }
59531
59363
  },
59532
- /**
59533
- * @category Attribute
59534
- * @param {string} [style] - Custom inline CSS styles
59535
- */
59536
59364
  style: {
59537
59365
  default: null,
59538
59366
  rendered: true,
@@ -59558,18 +59386,10 @@ const Image = Node$1.create({
59558
59386
  /**
59559
59387
  * Insert an image at the current position
59560
59388
  * @category Command
59561
- * @param {Object} options - Image attributes
59562
- * @param {string} options.src - Image source URL or data URI
59563
- * @param {string} [options.alt] - Alternative text
59564
- * @param {string} [options.title] - Image title
59565
- * @param {Object} [options.size] - Image dimensions
59566
- * @returns {Function} Command function
59389
+ * @param {ImageInsertOptions} options - Image insertion options
59567
59390
  * @example
59568
- * // Insert an image from a URL
59569
- * setImage({ src: 'https://example.com/image.jpg' })
59570
- *
59571
- * // Insert a base64 encoded image
59572
- * setImage({
59391
+ * editor.commands.setImage({ src: 'https://example.com/image.jpg' })
59392
+ * editor.commands.setImage({
59573
59393
  * src: 'data:image/png;base64,...',
59574
59394
  * alt: 'Company logo',
59575
59395
  * size: { width: 200 }
@@ -59786,6 +59606,14 @@ const PageNumber = Node$1.create({
59786
59606
  },
59787
59607
  addCommands() {
59788
59608
  return {
59609
+ /**
59610
+ * Insert an automatic page number
59611
+ * @category Command
59612
+ * @returns {Function} Command function
59613
+ * @example
59614
+ * editor.commands.addAutoPageNumber()
59615
+ * @note Only works in header/footer contexts
59616
+ */
59789
59617
  addAutoPageNumber: () => ({ tr, dispatch, state: state2, editor }) => {
59790
59618
  const { options } = editor;
59791
59619
  if (!options.isHeaderOrFooter) return false;
@@ -59848,6 +59676,14 @@ const TotalPageCount = Node$1.create({
59848
59676
  },
59849
59677
  addCommands() {
59850
59678
  return {
59679
+ /**
59680
+ * Insert total page count
59681
+ * @category Command
59682
+ * @returns {Function} Command function
59683
+ * @example
59684
+ * editor.commands.addTotalPageCount()
59685
+ * @note Only works in header/footer contexts
59686
+ */
59851
59687
  addTotalPageCount: () => ({ tr, dispatch, state: state2, editor }) => {
59852
59688
  const { options } = editor;
59853
59689
  if (!options.isHeaderOrFooter) return false;
@@ -60114,11 +59950,6 @@ const ContentBlock = Node$1.create({
60114
59950
  inline: true,
60115
59951
  addOptions() {
60116
59952
  return {
60117
- /**
60118
- * @typedef {Object} ContentBlockOptions
60119
- * @category Options
60120
- * @property {Object} [htmlAttributes] - HTML attributes for the block element
60121
- */
60122
59953
  htmlAttributes: {
60123
59954
  contenteditable: false
60124
59955
  }
@@ -60126,10 +59957,6 @@ const ContentBlock = Node$1.create({
60126
59957
  },
60127
59958
  addAttributes() {
60128
59959
  return {
60129
- /**
60130
- * @category Attribute
60131
- * @param {boolean} [horizontalRule=false] - Whether this block is a horizontal rule
60132
- */
60133
59960
  horizontalRule: {
60134
59961
  default: false,
60135
59962
  renderDOM: ({ horizontalRule }) => {
@@ -60137,10 +59964,6 @@ const ContentBlock = Node$1.create({
60137
59964
  return { "data-horizontal-rule": "true" };
60138
59965
  }
60139
59966
  },
60140
- /**
60141
- * @category Attribute
60142
- * @param {ContentBlockSize} [size] - Size and position of the content block
60143
- */
60144
59967
  size: {
60145
59968
  default: null,
60146
59969
  renderDOM: ({ size: size2 }) => {
@@ -60154,10 +59977,6 @@ const ContentBlock = Node$1.create({
60154
59977
  return { style: style2 };
60155
59978
  }
60156
59979
  },
60157
- /**
60158
- * @category Attribute
60159
- * @param {string} [background] - Background color for the block
60160
- */
60161
59980
  background: {
60162
59981
  default: null,
60163
59982
  renderDOM: (attrs) => {
@@ -60167,19 +59986,9 @@ const ContentBlock = Node$1.create({
60167
59986
  };
60168
59987
  }
60169
59988
  },
60170
- /**
60171
- * @private
60172
- * @category Attribute
60173
- * @param {Object} [drawingContent] - Internal drawing data
60174
- */
60175
59989
  drawingContent: {
60176
59990
  rendered: false
60177
59991
  },
60178
- /**
60179
- * @private
60180
- * @category Attribute
60181
- * @param {Object} [attributes] - Additional internal attributes
60182
- */
60183
59992
  attributes: {
60184
59993
  rendered: false
60185
59994
  }
@@ -60200,9 +60009,8 @@ const ContentBlock = Node$1.create({
60200
60009
  /**
60201
60010
  * Insert a horizontal rule
60202
60011
  * @category Command
60203
- * @returns {Function} Command function
60204
60012
  * @example
60205
- * insertHorizontalRule()
60013
+ * editor.commands.insertHorizontalRule()
60206
60014
  * @note Creates a visual separator between content sections
60207
60015
  */
60208
60016
  insertHorizontalRule: () => ({ commands: commands2 }) => {
@@ -60219,13 +60027,13 @@ const ContentBlock = Node$1.create({
60219
60027
  * Insert a content block
60220
60028
  * @category Command
60221
60029
  * @param {ContentBlockConfig} config - Block configuration
60222
- * @returns {Function} Command function
60223
60030
  * @example
60224
60031
  * // Insert a spacer block
60225
- * insertContentBlock({ size: { height: 20 } })
60032
+ * editor.commands.insertContentBlock({ size: { height: 20 } })
60226
60033
  *
60034
+ * @example
60227
60035
  * // Insert a colored divider
60228
- * insertContentBlock({
60036
+ * editor.commands.insertContentBlock({
60229
60037
  * size: { width: '50%', height: 3 },
60230
60038
  * background: '#3b82f6'
60231
60039
  * })
@@ -60753,16 +60561,7 @@ const DocumentSection = Node$1.create({
60753
60561
  },
60754
60562
  addAttributes() {
60755
60563
  return {
60756
- /**
60757
- * @category Attribute
60758
- * @param {number} [id] - Unique section identifier
60759
- */
60760
60564
  id: {},
60761
- /**
60762
- * @private
60763
- * @category Attribute
60764
- * @param {string} [sdBlockId] - Internal block tracking
60765
- */
60766
60565
  sdBlockId: {
60767
60566
  default: null,
60768
60567
  keepOnSplit: false,
@@ -60771,25 +60570,9 @@ const DocumentSection = Node$1.create({
60771
60570
  return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
60772
60571
  }
60773
60572
  },
60774
- /**
60775
- * @category Attribute
60776
- * @param {string} [title] - Section display label
60777
- */
60778
60573
  title: {},
60779
- /**
60780
- * @category Attribute
60781
- * @param {string} [description] - Section metadata
60782
- */
60783
60574
  description: {},
60784
- /**
60785
- * @category Attribute
60786
- * @param {string} [sectionType] - Business classification (e.g., 'legal', 'pricing')
60787
- */
60788
60575
  sectionType: {},
60789
- /**
60790
- * @category Attribute
60791
- * @param {boolean} [isLocked=false] - Lock state preventing edits
60792
- */
60793
60576
  isLocked: { default: false }
60794
60577
  };
60795
60578
  },
@@ -60804,10 +60587,9 @@ const DocumentSection = Node$1.create({
60804
60587
  * Create a lockable content section
60805
60588
  * @category Command
60806
60589
  * @param {SectionCreate} [options={}] - Section configuration
60807
- * @returns {Function} Command - true if created, false if position invalid
60808
60590
  * @example
60809
- * createDocumentSection({
60810
- * id: 'legal-1',
60591
+ * editor.commands.createDocumentSection({
60592
+ * id: 1,
60811
60593
  * title: 'Terms & Conditions',
60812
60594
  * isLocked: true,
60813
60595
  * html: '<p>Legal content...</p>'
@@ -60888,9 +60670,8 @@ const DocumentSection = Node$1.create({
60888
60670
  /**
60889
60671
  * Remove section wrapper at cursor, preserving its content
60890
60672
  * @category Command
60891
- * @returns {Function} Command - true if removed, false if no section at position
60892
60673
  * @example
60893
- * removeSectionAtSelection()
60674
+ * editor.commands.removeSectionAtSelection()
60894
60675
  * @note Content stays in document, only section wrapper is removed
60895
60676
  */
60896
60677
  removeSectionAtSelection: () => ({ tr, dispatch }) => {
@@ -60916,9 +60697,8 @@ const DocumentSection = Node$1.create({
60916
60697
  * Delete section and all its content
60917
60698
  * @category Command
60918
60699
  * @param {number} id - Section to delete
60919
- * @returns {Function} Command - true if deleted, false if ID doesn't exist
60920
60700
  * @example
60921
- * removeSectionById(123)
60701
+ * editor.commands.removeSectionById(123)
60922
60702
  */
60923
60703
  removeSectionById: (id) => ({ tr, dispatch }) => {
60924
60704
  const sections = SectionHelpers.getAllSections(this.editor);
@@ -60938,9 +60718,8 @@ const DocumentSection = Node$1.create({
60938
60718
  * Lock section against edits
60939
60719
  * @category Command
60940
60720
  * @param {number} id - Section to lock
60941
- * @returns {Function} Command - true if locked, false if ID doesn't exist
60942
60721
  * @example
60943
- * lockSectionById(123)
60722
+ * editor.commands.lockSectionById(123)
60944
60723
  */
60945
60724
  lockSectionById: (id) => ({ tr, dispatch }) => {
60946
60725
  const sections = SectionHelpers.getAllSections(this.editor);
@@ -60957,16 +60736,10 @@ const DocumentSection = Node$1.create({
60957
60736
  * Modify section attributes or content
60958
60737
  * @category Command
60959
60738
  * @param {SectionUpdate} options - Changes to apply
60960
- * @returns {Function} Command - true if updated, false if ID doesn't exist
60961
60739
  * @example
60962
- * // Toggle lock
60963
- * updateSectionById({ id: 123, attrs: { isLocked: false } })
60964
- *
60965
- * // Replace content
60966
- * updateSectionById({ id: 123, html: '<p>New content</p>' })
60967
- *
60968
- * // Both
60969
- * updateSectionById({
60740
+ * editor.commands.updateSectionById({ id: 123, attrs: { isLocked: false } })
60741
+ * editor.commands.updateSectionById({ id: 123, html: '<p>New content</p>' })
60742
+ * editor.commands.updateSectionById({
60970
60743
  * id: 123,
60971
60744
  * html: '<p>Updated</p>',
60972
60745
  * attrs: { title: 'New Title' }
@@ -61016,11 +60789,10 @@ const BlockNode = Extension.create({
61016
60789
  * Replace a block node by its ID with new content
61017
60790
  * @category Command
61018
60791
  * @param {string} id - The sdBlockId of the node to replace
61019
- * @param {Object} contentNode - The replacement ProseMirror node
61020
- * @returns {Function} Command function
60792
+ * @param {ProseMirrorNode} contentNode - The replacement ProseMirror node
61021
60793
  * @example
61022
60794
  * const newParagraph = editor.schema.nodes.paragraph.create({}, editor.schema.text('New content'))
61023
- * replaceBlockNodeById('block-123', newParagraph)
60795
+ * editor.commands.replaceBlockNodeById('block-123', newParagraph)
61024
60796
  * @note The replacement node should have the same type as the original
61025
60797
  */
61026
60798
  replaceBlockNodeById: (id, contentNode) => ({ dispatch, tr }) => {
@@ -61043,9 +60815,8 @@ const BlockNode = Extension.create({
61043
60815
  * Delete a block node by its ID
61044
60816
  * @category Command
61045
60817
  * @param {string} id - The sdBlockId of the node to delete
61046
- * @returns {Function} Command function
61047
60818
  * @example
61048
- * deleteBlockNodeById('block-123')
60819
+ * editor.commands.deleteBlockNodeById('block-123')
61049
60820
  * @note Completely removes the node from the document
61050
60821
  */
61051
60822
  deleteBlockNodeById: (id) => ({ dispatch, tr }) => {
@@ -61069,11 +60840,10 @@ const BlockNode = Extension.create({
61069
60840
  * @category Command
61070
60841
  * @param {string} id - The sdBlockId of the node to update
61071
60842
  * @param {Object} attrs - Attributes to update
61072
- * @returns {Function} Command function
61073
60843
  * @example
61074
- * updateBlockNodeAttributes('block-123', { textAlign: 'center' })
60844
+ * editor.commands.updateBlockNodeAttributes('block-123', { textAlign: 'center' })
61075
60845
  * @example
61076
- * updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
60846
+ * editor.commands.updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
61077
60847
  * @note Merges new attributes with existing ones
61078
60848
  */
61079
60849
  updateBlockNodeAttributes: (id, attrs = {}) => ({ dispatch, tr }) => {
@@ -61167,7 +60937,7 @@ const BlockNode = Extension.create({
61167
60937
  key: BlockNodePluginKey,
61168
60938
  appendTransaction: (transactions, _oldState, newState) => {
61169
60939
  if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
61170
- if (hasInitialized && !checkForNewBlockNodesInTrs(transactions)) return null;
60940
+ if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) return null;
61171
60941
  const { tr } = newState;
61172
60942
  let changed = false;
61173
60943
  newState.doc.descendants((node, pos) => {
@@ -61246,9 +61016,8 @@ const TextStyle = Mark2.create({
61246
61016
  /**
61247
61017
  * Remove empty text style marks
61248
61018
  * @category Command
61249
- * @returns {Function} Command function - Removes mark if no attributes present
61250
61019
  * @example
61251
- * removeEmptyTextStyle()
61020
+ * editor.commands.removeEmptyTextStyle()
61252
61021
  * @note Cleanup utility to prevent empty span elements
61253
61022
  * @note Automatically checks if any style attributes exist before removal
61254
61023
  */
@@ -61270,10 +61039,6 @@ const Bold = Mark2.create({
61270
61039
  },
61271
61040
  addAttributes() {
61272
61041
  return {
61273
- /**
61274
- * @category Attribute
61275
- * @param {string} [value] - Bold weight value ('0' renders as normal)
61276
- */
61277
61042
  value: {
61278
61043
  default: null,
61279
61044
  renderDOM: (attrs) => {
@@ -61302,26 +61067,23 @@ const Bold = Mark2.create({
61302
61067
  /**
61303
61068
  * Apply bold formatting
61304
61069
  * @category Command
61305
- * @returns {Function} Command
61306
61070
  * @example
61307
- * setBold()
61071
+ * editor.commands.setBold()
61308
61072
  * @note '0' renders as normal weight
61309
61073
  */
61310
61074
  setBold: () => ({ commands: commands2 }) => commands2.setMark(this.name),
61311
61075
  /**
61312
61076
  * Remove bold formatting
61313
61077
  * @category Command
61314
- * @returns {Function} Command
61315
61078
  * @example
61316
- * unsetBold()
61079
+ * editor.commands.unsetBold()
61317
61080
  */
61318
61081
  unsetBold: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
61319
61082
  /**
61320
61083
  * Toggle bold formatting
61321
61084
  * @category Command
61322
- * @returns {Function} Command
61323
61085
  * @example
61324
- * toggleBold()
61086
+ * editor.commands.toggleBold()
61325
61087
  */
61326
61088
  toggleBold: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
61327
61089
  };
@@ -61356,25 +61118,22 @@ const Italic = Mark2.create({
61356
61118
  /**
61357
61119
  * Apply italic formatting
61358
61120
  * @category Command
61359
- * @returns {Function} Command
61360
61121
  * @example
61361
- * setItalic()
61122
+ * editor.commands.setItalic()
61362
61123
  */
61363
61124
  setItalic: () => ({ commands: commands2 }) => commands2.setMark(this.name),
61364
61125
  /**
61365
61126
  * Remove italic formatting
61366
61127
  * @category Command
61367
- * @returns {Function} Command
61368
61128
  * @example
61369
- * unsetItalic()
61129
+ * editor.commands.unsetItalic()
61370
61130
  */
61371
61131
  unsetItalic: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
61372
61132
  /**
61373
61133
  * Toggle italic formatting
61374
61134
  * @category Command
61375
- * @returns {Function} Command
61376
61135
  * @example
61377
- * toggleItalic()
61136
+ * editor.commands.toggleItalic()
61378
61137
  */
61379
61138
  toggleItalic: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
61380
61139
  };
@@ -61458,10 +61217,6 @@ const Highlight = Mark2.create({
61458
61217
  },
61459
61218
  addAttributes() {
61460
61219
  return {
61461
- /**
61462
- * @category Attribute
61463
- * @param {string} [color] - Background color (CSS color value)
61464
- */
61465
61220
  color: {
61466
61221
  default: null,
61467
61222
  parseDOM: (element) => element.getAttribute("data-color") || element.style.backgroundColor,
@@ -61489,26 +61244,23 @@ const Highlight = Mark2.create({
61489
61244
  * Apply highlight with specified color
61490
61245
  * @category Command
61491
61246
  * @param {string} color - CSS color value
61492
- * @returns {Function} Command
61493
61247
  * @example
61494
- * setHighlight('#FFEB3B')
61495
- * setHighlight('rgba(255, 235, 59, 0.5)')
61248
+ * editor.commands.setHighlight('#FFEB3B')
61249
+ * editor.commands.setHighlight('rgba(255, 235, 59, 0.5)')
61496
61250
  */
61497
61251
  setHighlight: (color) => ({ commands: commands2 }) => commands2.setMark(this.name, { color }),
61498
61252
  /**
61499
61253
  * Remove highlight formatting
61500
61254
  * @category Command
61501
- * @returns {Function} Command
61502
61255
  * @example
61503
- * unsetHighlight()
61256
+ * editor.commands.unsetHighlight()
61504
61257
  */
61505
61258
  unsetHighlight: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
61506
61259
  /**
61507
61260
  * Toggle highlight formatting
61508
61261
  * @category Command
61509
- * @returns {Function} Command
61510
61262
  * @example
61511
- * toggleHighlight()
61263
+ * editor.commands.toggleHighlight()
61512
61264
  */
61513
61265
  toggleHighlight: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
61514
61266
  };
@@ -61541,9 +61293,8 @@ const Strike = Mark2.create({
61541
61293
  /**
61542
61294
  * Apply strikethrough formatting
61543
61295
  * @category Command
61544
- * @returns {Function} Command
61545
61296
  * @example
61546
- * setStrike()
61297
+ * editor.commands.setStrike()
61547
61298
  */
61548
61299
  setStrike: () => ({ commands: commands2 }) => {
61549
61300
  return commands2.setMark(this.name);
@@ -61551,9 +61302,8 @@ const Strike = Mark2.create({
61551
61302
  /**
61552
61303
  * Remove strikethrough formatting
61553
61304
  * @category Command
61554
- * @returns {Function} Command
61555
61305
  * @example
61556
- * unsetStrike()
61306
+ * editor.commands.unsetStrike()
61557
61307
  */
61558
61308
  unsetStrike: () => ({ commands: commands2 }) => {
61559
61309
  return commands2.unsetMark(this.name);
@@ -61561,9 +61311,8 @@ const Strike = Mark2.create({
61561
61311
  /**
61562
61312
  * Toggle strikethrough formatting
61563
61313
  * @category Command
61564
- * @returns {Function} Command
61565
61314
  * @example
61566
- * toggleStrike()
61315
+ * editor.commands.toggleStrike()
61567
61316
  */
61568
61317
  toggleStrike: () => ({ commands: commands2 }) => {
61569
61318
  return commands2.toggleMark(this.name);
@@ -61583,11 +61332,6 @@ const Link = Mark2.create({
61583
61332
  inclusive: false,
61584
61333
  addOptions() {
61585
61334
  return {
61586
- /**
61587
- * Allowed URL protocols
61588
- * @type {string[]}
61589
- * @default ['http', 'https']
61590
- */
61591
61335
  protocols: ["http", "https"],
61592
61336
  htmlAttributes: {
61593
61337
  target: null,
@@ -61686,16 +61430,10 @@ const Link = Mark2.create({
61686
61430
  /**
61687
61431
  * Create or update a link
61688
61432
  * @category Command
61689
- * @param {Object} options - Link configuration
61690
- * @param {string} [options.href] - URL for the link
61691
- * @param {string} [options.text] - Display text (uses selection if omitted)
61692
- * @returns {Function} Command - Creates link with underline
61433
+ * @param {SetLinkOptions} [options] - Link configuration
61693
61434
  * @example
61694
- * // Link selected text
61695
- * setLink({ href: 'https://example.com' })
61696
- *
61697
- * // Link with custom text
61698
- * setLink({
61435
+ * editor.commands.setLink({ href: 'https://example.com' })
61436
+ * editor.commands.setLink({
61699
61437
  * href: 'https://example.com',
61700
61438
  * text: 'Visit Example'
61701
61439
  * })
@@ -61747,9 +61485,8 @@ const Link = Mark2.create({
61747
61485
  /**
61748
61486
  * Remove link and associated formatting
61749
61487
  * @category Command
61750
- * @returns {Function} Command - Removes link, underline, and color
61751
61488
  * @example
61752
- * unsetLink()
61489
+ * editor.commands.unsetLink()
61753
61490
  * @note Also removes underline and text color
61754
61491
  */
61755
61492
  unsetLink: () => ({ chain }) => {
@@ -61758,16 +61495,10 @@ const Link = Mark2.create({
61758
61495
  /**
61759
61496
  * Toggle link on selection
61760
61497
  * @category Command
61761
- * @param {Object} [options] - Link configuration
61762
- * @param {string} [options.href] - URL for the link
61763
- * @param {string} [options.text] - Display text
61764
- * @returns {Function} Command - Creates link if href provided, removes otherwise
61498
+ * @param {SetLinkOptions} [options] - Link configuration
61765
61499
  * @example
61766
- * // Add link
61767
- * toggleLink({ href: 'https://example.com' })
61768
- *
61769
- * // Remove link
61770
- * toggleLink()
61500
+ * editor.commands.toggleLink({ href: 'https://example.com' })
61501
+ * editor.commands.toggleLink()
61771
61502
  */
61772
61503
  toggleLink: ({ href, text } = {}) => ({ commands: commands2 }) => {
61773
61504
  if (!href) return commands2.unsetLink();
@@ -65084,6 +64815,9 @@ const Mentions = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v
65084
64815
  const popoverPluginKey = new PluginKey("popoverPlugin");
65085
64816
  const PopoverPlugin = Extension.create({
65086
64817
  name: "popoverPlugin",
64818
+ addOptions() {
64819
+ return {};
64820
+ },
65087
64821
  addPmPlugins() {
65088
64822
  const popover = new Plugin({
65089
64823
  key: popoverPluginKey,
@@ -67311,12 +67045,11 @@ const Search = Extension.create({
67311
67045
  addCommands() {
67312
67046
  return {
67313
67047
  /**
67314
- * Navigates to the first search match
67048
+ * Navigate to the first search match
67315
67049
  * @category Command
67316
- * @returns {Function} - Command function
67317
67050
  * @example
67318
- * goToFirstMatch()
67319
- * @note Scrolls Editor to the first match of called search().
67051
+ * editor.commands.goToFirstMatch()
67052
+ * @note Scrolls editor to the first match from previous search
67320
67053
  */
67321
67054
  goToFirstMatch: () => (
67322
67055
  /** @returns {boolean} */
@@ -67332,13 +67065,13 @@ const Search = Extension.create({
67332
67065
  })
67333
67066
  ),
67334
67067
  /**
67335
- * Searches for the string match in Editor content
67068
+ * Search for string matches in editor content
67336
67069
  * @category Command
67337
67070
  * @param {String|RegExp} patternInput - Search string or pattern
67338
- * @returns {Function} - Command function that returns matches
67339
67071
  * @example
67340
- * search('test string')
67341
- * @note Searches for the test string in the Editor content and returns an array of matches
67072
+ * const matches = editor.commands.search('test string')
67073
+ * const regexMatches = editor.commands.search(/test/i)
67074
+ * @note Returns array of SearchMatch objects with positions and IDs
67342
67075
  */
67343
67076
  search: (patternInput) => (
67344
67077
  /** @returns {SearchMatch[]} */
@@ -67381,14 +67114,13 @@ const Search = Extension.create({
67381
67114
  })
67382
67115
  ),
67383
67116
  /**
67384
- * Navigates to the selected match
67117
+ * Navigate to a specific search match
67385
67118
  * @category Command
67386
- * @param {SearchMatch} match Match at specific index
67387
- * @returns {Function} - Command function
67119
+ * @param {SearchMatch} match - Match object to navigate to
67388
67120
  * @example
67389
- * const searchResult = search('test string')
67390
- * goToSearchResult(searchResult[3])
67391
- * @note Scrolls Editor to the fourth match of called search() and sets selection on it.
67121
+ * const searchResults = editor.commands.search('test string')
67122
+ * editor.commands.goToSearchResult(searchResults[3])
67123
+ * @note Scrolls to match and selects it
67392
67124
  */
67393
67125
  goToSearchResult: (match) => (
67394
67126
  /** @returns {boolean} */
@@ -67650,6 +67382,9 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
67650
67382
  };
67651
67383
  const NodeResizer = Extension.create({
67652
67384
  name: "nodeResizer",
67385
+ addOptions() {
67386
+ return {};
67387
+ },
67653
67388
  addPmPlugins() {
67654
67389
  const isHeadless = this.editor.options.isHeadless;
67655
67390
  const hasDocument = typeof document !== "undefined";