@harbour-enterprises/superdoc 0.20.0-next.7 → 0.20.0-next.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/chunks/{PdfViewer-BYyZViQt.es.js → PdfViewer-BZlsmhsJ.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-DXtnxGoU.cjs → PdfViewer-BqGjx7hC.cjs} +1 -1
  3. package/dist/chunks/{index-CqLcgYHG.es.js → index-4GToG3C3.es.js} +2 -2
  4. package/dist/chunks/{index-CMBPzhIR.cjs → index-DPzgGSfg.cjs} +2 -2
  5. package/dist/chunks/{super-editor.es-5O71lyiI.cjs → super-editor.es-BkxUKZfn.cjs} +493 -639
  6. package/dist/chunks/{super-editor.es-BTalhwn-.es.js → super-editor.es-DqX3Ipsk.es.js} +493 -639
  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-kutpjDQU.js → converter-C6YOTAXG.js} +246 -71
  10. package/dist/super-editor/chunks/{docx-zipper-BjcI24VU.js → docx-zipper-CSiwWpmr.js} +1 -1
  11. package/dist/super-editor/chunks/{editor-CQMKOaY4.js → editor-chVid4VD.js} +249 -570
  12. package/dist/super-editor/chunks/{toolbar-Cp6gL4i5.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/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts +1 -1
  20. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblGrid/tblGrid-helpers.d.ts +5 -0
  21. package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +9 -1
  22. package/dist/super-editor/src/extensions/block-node/block-node.d.ts +30 -5
  23. package/dist/super-editor/src/extensions/bold/bold.d.ts +20 -0
  24. package/dist/super-editor/src/extensions/bullet-list/bullet-list.d.ts +12 -0
  25. package/dist/super-editor/src/extensions/color/color.d.ts +26 -0
  26. package/dist/super-editor/src/extensions/content-block/content-block.d.ts +30 -0
  27. package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +16 -0
  28. package/dist/super-editor/src/extensions/document/document.d.ts +26 -0
  29. package/dist/super-editor/src/extensions/dropcursor/dropcursor.d.ts +26 -0
  30. package/dist/super-editor/src/extensions/font-family/font-family.d.ts +29 -0
  31. package/dist/super-editor/src/extensions/font-size/font-size.d.ts +21 -0
  32. package/dist/super-editor/src/extensions/format-commands/format-commands.d.ts +9 -0
  33. package/dist/super-editor/src/extensions/gapcursor/gapcursor.d.ts +9 -0
  34. package/dist/super-editor/src/extensions/heading/heading.d.ts +12 -6
  35. package/dist/super-editor/src/extensions/highlight/highlight.d.ts +20 -0
  36. package/dist/super-editor/src/extensions/history/history.d.ts +7 -15
  37. package/dist/super-editor/src/extensions/image/image.d.ts +78 -0
  38. package/dist/super-editor/src/extensions/image/imageHelpers/index.d.ts +1 -0
  39. package/dist/super-editor/src/extensions/image/imageHelpers/rotation.d.ts +4 -0
  40. package/dist/super-editor/src/extensions/italic/italic.d.ts +10 -0
  41. package/dist/super-editor/src/extensions/line-break/line-break.d.ts +43 -0
  42. package/dist/super-editor/src/extensions/line-height/line-height.d.ts +22 -0
  43. package/dist/super-editor/src/extensions/link/link.d.ts +53 -25
  44. package/dist/super-editor/src/extensions/linked-styles/linked-styles.d.ts +9 -0
  45. package/dist/super-editor/src/extensions/list-item/list-item.d.ts +48 -0
  46. package/dist/super-editor/src/extensions/mention/mention.d.ts +26 -0
  47. package/dist/super-editor/src/extensions/noderesizer/noderesizer.d.ts +14 -0
  48. package/dist/super-editor/src/extensions/ordered-list/ordered-list.d.ts +35 -0
  49. package/dist/super-editor/src/extensions/page-number/page-number.d.ts +52 -0
  50. package/dist/super-editor/src/extensions/paragraph/paragraph.d.ts +49 -0
  51. package/dist/super-editor/src/extensions/placeholder/placeholder.d.ts +15 -0
  52. package/dist/super-editor/src/extensions/popover-plugin/popover-plugin.d.ts +9 -0
  53. package/dist/super-editor/src/extensions/run-item/run-item.d.ts +24 -0
  54. package/dist/super-editor/src/extensions/search/search.d.ts +11 -2
  55. package/dist/super-editor/src/extensions/shape-container/shape-container.d.ts +29 -0
  56. package/dist/super-editor/src/extensions/shape-textbox/shape-textbox.d.ts +26 -0
  57. package/dist/super-editor/src/extensions/slash-menu/slash-menu.d.ts +9 -0
  58. package/dist/super-editor/src/extensions/strike/strike.d.ts +10 -0
  59. package/dist/super-editor/src/extensions/structured-content/StructuredContentBlockView.d.ts +0 -1
  60. package/dist/super-editor/src/extensions/structured-content/StructuredContentInlineView.d.ts +0 -1
  61. package/dist/super-editor/src/extensions/structured-content/StructuredContentViewBase.d.ts +1 -1
  62. package/dist/super-editor/src/extensions/structured-content/document-section.d.ts +46 -27
  63. package/dist/super-editor/src/extensions/structured-content/structured-content-block.d.ts +26 -0
  64. package/dist/super-editor/src/extensions/structured-content/structured-content.d.ts +26 -0
  65. package/dist/super-editor/src/extensions/tab/tab.d.ts +25 -0
  66. package/dist/super-editor/src/extensions/table/table.d.ts +112 -121
  67. package/dist/super-editor/src/extensions/table-cell/table-cell.d.ts +41 -0
  68. package/dist/super-editor/src/extensions/table-header/table-header.d.ts +22 -0
  69. package/dist/super-editor/src/extensions/table-row/table-row.d.ts +28 -0
  70. package/dist/super-editor/src/extensions/text/text.d.ts +14 -0
  71. package/dist/super-editor/src/extensions/text-align/text-align.d.ts +22 -0
  72. package/dist/super-editor/src/extensions/text-indent/text-indent.d.ts +19 -10
  73. package/dist/super-editor/src/extensions/text-style/text-style.d.ts +20 -0
  74. package/dist/super-editor/src/extensions/text-transform/text-transform.d.ts +20 -0
  75. package/dist/super-editor/src/extensions/underline/underline.d.ts +25 -0
  76. package/dist/super-editor/src/tests/helpers/editor-test-utils.d.ts +14 -0
  77. package/dist/super-editor/super-editor.es.js +6 -6
  78. package/dist/super-editor/toolbar.es.js +2 -2
  79. package/dist/super-editor.cjs +1 -1
  80. package/dist/super-editor.es.js +1 -1
  81. package/dist/superdoc.cjs +2 -2
  82. package/dist/superdoc.es.js +2 -2
  83. package/dist/superdoc.umd.js +493 -639
  84. package/dist/superdoc.umd.js.map +1 -1
  85. package/package.json +1 -1
@@ -22523,22 +22523,25 @@
22523
22523
  function inchesToTwips(inches) {
22524
22524
  if (inches == null) return;
22525
22525
  if (typeof inches === "string") inches = parseFloat(inches);
22526
- return Math.round(inches * 1440);
22526
+ return Math.round(Number(inches) * 1440);
22527
22527
  }
22528
22528
  function twipsToInches(twips) {
22529
22529
  if (twips == null) return;
22530
- if (typeof twips === "string") twips = parseInt(twips, 10);
22531
- return Math.round(twips / 1440 * 100) / 100;
22530
+ const value = Number(twips);
22531
+ if (Number.isNaN(value)) return;
22532
+ return value / 1440;
22532
22533
  }
22533
22534
  function twipsToPixels(twips) {
22534
22535
  if (twips == null) return;
22535
- twips = twipsToInches(twips);
22536
- return Math.round(twips * 96);
22536
+ const inches = twipsToInches(twips);
22537
+ if (inches == null) return;
22538
+ const pixels = inches * 96;
22539
+ return Math.round(pixels * 1e3) / 1e3;
22537
22540
  }
22538
22541
  function pixelsToTwips(pixels) {
22539
22542
  if (pixels == null) return;
22540
- pixels = pixels / 96;
22541
- return inchesToTwips(pixels);
22543
+ const inches = Number(pixels) / 96;
22544
+ return inchesToTwips(inches);
22542
22545
  }
22543
22546
  function twipsToLines(twips) {
22544
22547
  if (twips == null) return;
@@ -22581,6 +22584,14 @@
22581
22584
  if (pt == null) return;
22582
22585
  return pt * 20;
22583
22586
  }
22587
+ function rotToDegrees(rot) {
22588
+ if (rot == null) return;
22589
+ return rot / 6e4;
22590
+ }
22591
+ function degreesToRot(degrees) {
22592
+ if (degrees == null) return;
22593
+ return degrees * 6e4;
22594
+ }
22584
22595
  const getTextIndentExportValue = (indent) => {
22585
22596
  const [value, unit] = parseSizeUnit(indent);
22586
22597
  const functionsMap = {
@@ -32426,13 +32437,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32426
32437
  }
32427
32438
  return indent;
32428
32439
  };
32429
- const getParagraphSpacing = (node, docx, styleId = "", marks = []) => {
32440
+ const getParagraphSpacing = (node, docx, styleId = "", marks = [], options = {}) => {
32441
+ const { insideTable = false } = options;
32430
32442
  const spacing = {};
32431
- const { spacing: pDefaultSpacing = {} } = getDefaultParagraphStyle(docx, styleId);
32443
+ const { spacing: pDefaultSpacing = {}, spacingSource } = getDefaultParagraphStyle(docx, styleId);
32432
32444
  let lineSpaceAfter, lineSpaceBefore, line, lineRuleStyle;
32433
32445
  const pPr = node.elements?.find((el) => el.name === "w:pPr");
32434
32446
  const inLineSpacingTag = pPr?.elements?.find((el) => el.name === "w:spacing");
32435
32447
  const inLineSpacing = inLineSpacingTag?.attributes || {};
32448
+ const hasInlineSpacing = !!Object.keys(inLineSpacing).length;
32436
32449
  const textStyleMark = marks.find((el) => el.type === "textStyle");
32437
32450
  const fontSize2 = textStyleMark?.attrs?.fontSize;
32438
32451
  const lineSpacing = inLineSpacing?.["w:line"] || line || pDefaultSpacing?.["w:line"];
@@ -32454,6 +32467,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32454
32467
  if (afterAutospacing === "1" && fontSize2) {
32455
32468
  spacing.lineSpaceAfter += Math.round(parseInt(fontSize2) * 0.5 * 96 / 72);
32456
32469
  }
32470
+ if (insideTable && !hasInlineSpacing && spacingSource === "docDefault") {
32471
+ const hasExplicitSpacing = Object.keys(inLineSpacing).length > 0;
32472
+ if (!hasExplicitSpacing) {
32473
+ return void 0;
32474
+ }
32475
+ }
32457
32476
  return spacing;
32458
32477
  };
32459
32478
  const getDefaultParagraphStyle = (docx, styleId = "") => {
@@ -32494,9 +32513,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32494
32513
  const { attributes: pPrByIdIndentAttr } = pPrStyleIdIndentTag;
32495
32514
  const spacingRest = isNormalAsDefault ? pPrNormalSpacingAttr || pPrDefaultSpacingAttr : pPrDefaultSpacingAttr || pPrNormalSpacingAttr;
32496
32515
  const indentRest = isNormalAsDefault ? pPrNormalIndentAttr || pPrDefaultIndentAttr : pPrDefaultIndentAttr || pPrNormalIndentAttr;
32516
+ let spacingToUse = pPrByIdSpacingAttr || spacingRest;
32517
+ let spacingSource = "docDefault";
32518
+ if (pPrByIdSpacingAttr) {
32519
+ spacingSource = "style";
32520
+ } else if (spacingRest === pPrNormalSpacingAttr && pPrNormalSpacingAttr) {
32521
+ spacingSource = isNormalAsDefault ? "docDefault" : "normal";
32522
+ } else if (spacingRest === pPrDefaultSpacingAttr && pPrDefaultSpacingAttr) {
32523
+ spacingSource = "docDefault";
32524
+ }
32525
+ let indentToUse = pPrByIdIndentAttr || indentRest;
32497
32526
  return {
32498
- spacing: pPrByIdSpacingAttr || spacingRest,
32499
- indent: pPrByIdIndentAttr || indentRest,
32527
+ spacing: spacingToUse,
32528
+ spacingSource,
32529
+ indent: indentToUse,
32500
32530
  justify: pPrByIdJcAttr
32501
32531
  };
32502
32532
  };
@@ -32671,7 +32701,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32671
32701
  }
32672
32702
  if (docx) {
32673
32703
  const defaultStyleId = node.attributes?.["w:rsidRDefault"];
32674
- schemaNode.attrs["spacing"] = getParagraphSpacing(node, docx, styleId, schemaNode.attrs.marksAttrs);
32704
+ const insideTable = (params2.path || []).some((ancestor) => ancestor.name === "w:tc");
32705
+ const spacing = getParagraphSpacing(node, docx, styleId, schemaNode.attrs.marksAttrs, {
32706
+ insideTable
32707
+ });
32708
+ if (spacing) {
32709
+ schemaNode.attrs["spacing"] = spacing;
32710
+ }
32675
32711
  schemaNode.attrs["rsidRDefault"] = defaultStyleId;
32676
32712
  }
32677
32713
  if (docx) {
@@ -32917,10 +32953,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
32917
32953
  createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
32918
32954
  createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
32919
32955
  ],
32920
- encode: (_2, encodedAttrs) => {
32956
+ encode: (params2, encodedAttrs) => {
32921
32957
  return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
32922
32958
  },
32923
- decode: function({ node }, _2) {
32959
+ decode: function({ node }, context) {
32924
32960
  const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
32925
32961
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
32926
32962
  }
@@ -33279,10 +33315,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33279
33315
  "w:themeTint",
33280
33316
  "w:val"
33281
33317
  ].map((attr) => createAttributeHandler(attr)),
33282
- encode: (_2, encodedAttrs) => {
33318
+ encode: (params2, encodedAttrs) => {
33283
33319
  return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
33284
33320
  },
33285
- decode: function({ node }, _2) {
33321
+ decode: function({ node }, context) {
33286
33322
  const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.shading || {} } });
33287
33323
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
33288
33324
  }
@@ -33295,10 +33331,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33295
33331
  xmlName: "w:tblLook",
33296
33332
  sdNodeOrKeyName: "tblLook",
33297
33333
  attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
33298
- encode: (_2, encodedAttrs) => {
33334
+ encode: (params2, encodedAttrs) => {
33299
33335
  return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
33300
33336
  },
33301
- decode: function({ node }, _2) {
33337
+ decode: function({ node }, context) {
33302
33338
  const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.tblLook || {} } });
33303
33339
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
33304
33340
  }
@@ -33316,10 +33352,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33316
33352
  xmlName: "w:tblpPr",
33317
33353
  sdNodeOrKeyName: "floatingTableProperties",
33318
33354
  attributes: ["w:leftFromText", "w:rightFromText", "w:topFromText", "w:bottomFromText", "w:tblpX", "w:tblpY"].map((attr) => createAttributeHandler(attr, null, parseInteger, integerToString)).concat(["w:horzAnchor", "w:vertAnchor", "w:tblpXSpec", "w:tblpYSpec"].map((attr) => createAttributeHandler(attr))),
33319
- encode: (_2, encodedAttrs) => {
33355
+ encode: (params2, encodedAttrs) => {
33320
33356
  return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
33321
33357
  },
33322
- decode: function({ node }, _2) {
33358
+ decode: function({ node }, context) {
33323
33359
  const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.floatingTableProperties || {} } });
33324
33360
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
33325
33361
  }
@@ -33340,13 +33376,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33340
33376
  const translator$c = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
33341
33377
  const XML_NODE_NAME$a = "w:tblBorders";
33342
33378
  const SD_ATTR_KEY$3 = "borders";
33343
- const encode$a = (params2, _2) => {
33379
+ const encode$a = (params2) => {
33344
33380
  const { nodes } = params2;
33345
33381
  const node = nodes[0];
33346
33382
  const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
33347
33383
  return Object.keys(attributes).length > 0 ? attributes : void 0;
33348
33384
  };
33349
- const decode$a = (params2, _2) => {
33385
+ const decode$a = (params2) => {
33350
33386
  const { borders = {} } = params2.node.attrs || {};
33351
33387
  const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
33352
33388
  const newNode = {
@@ -33383,13 +33419,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33383
33419
  });
33384
33420
  const XML_NODE_NAME$9 = "w:tblCellMar";
33385
33421
  const SD_ATTR_KEY$2 = "cellMargins";
33386
- const encode$9 = (params2, _2) => {
33422
+ const encode$9 = (params2) => {
33387
33423
  const { nodes } = params2;
33388
33424
  const node = nodes[0];
33389
33425
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
33390
33426
  return Object.keys(attributes).length > 0 ? attributes : void 0;
33391
33427
  };
33392
- const decode$9 = (params2, _2) => {
33428
+ const decode$9 = (params2) => {
33393
33429
  const { cellMargins = {} } = params2.node.attrs || {};
33394
33430
  const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
33395
33431
  const newNode = {
@@ -33480,6 +33516,53 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33480
33516
  const translator$8 = NodeTranslator.from(
33481
33517
  createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
33482
33518
  );
33519
+ const DEFAULT_COLUMN_WIDTH_PX = 100;
33520
+ const normalizeTwipWidth = (value) => {
33521
+ if (value == null) return null;
33522
+ const numericValue = typeof value === "string" ? parseInt(value, 10) : value;
33523
+ if (!Number.isFinite(numericValue) || Number.isNaN(numericValue) || numericValue <= 0) {
33524
+ return null;
33525
+ }
33526
+ return numericValue;
33527
+ };
33528
+ const getSchemaDefaultColumnWidthPx = (params2) => {
33529
+ const defaultValue = params2?.editor?.schema?.nodes?.tableCell?.spec?.attrs?.colwidth?.default;
33530
+ if (Array.isArray(defaultValue)) {
33531
+ const numericWidth = defaultValue.find((width) => typeof width === "number" && Number.isFinite(width) && width > 0);
33532
+ if (numericWidth != null) return numericWidth;
33533
+ } else if (typeof defaultValue === "number" && Number.isFinite(defaultValue) && defaultValue > 0) {
33534
+ return defaultValue;
33535
+ }
33536
+ return DEFAULT_COLUMN_WIDTH_PX;
33537
+ };
33538
+ const getTableWidthPx = (params2) => {
33539
+ const explicitWidth = params2?.node?.attrs?.tableWidth?.width;
33540
+ if (typeof explicitWidth === "number" && explicitWidth > 0) return explicitWidth;
33541
+ const tableWidth = params2?.node?.attrs?.tableProperties?.tableWidth;
33542
+ if (tableWidth?.value != null && typeof tableWidth.value === "number" && tableWidth.value > 0) {
33543
+ const { value, type: type2 } = tableWidth;
33544
+ if (!type2 || type2 === "auto" || type2 === "dxa") {
33545
+ return twipsToPixels(value);
33546
+ }
33547
+ }
33548
+ return null;
33549
+ };
33550
+ const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwips) => {
33551
+ const columnCount = Math.max(totalColumns, 1);
33552
+ const defaultColumnWidthPx = getSchemaDefaultColumnWidthPx(params2);
33553
+ const tableWidthPx = getTableWidthPx(params2);
33554
+ const safeDefaultPx = Number.isFinite(defaultColumnWidthPx) && defaultColumnWidthPx > 0 ? defaultColumnWidthPx : DEFAULT_COLUMN_WIDTH_PX;
33555
+ let fallbackWidthPx = safeDefaultPx;
33556
+ if (typeof tableWidthPx === "number" && tableWidthPx > 0) {
33557
+ fallbackWidthPx = tableWidthPx / columnCount;
33558
+ }
33559
+ const fallbackWidthTwips = pixelsToTwips(fallbackWidthPx);
33560
+ if (!Number.isFinite(fallbackWidthTwips) || Number.isNaN(fallbackWidthTwips) || fallbackWidthTwips <= 0) {
33561
+ const safeDefault = Math.max(pixelsToTwips(safeDefaultPx), cellMinWidthTwips);
33562
+ return safeDefault;
33563
+ }
33564
+ return Math.max(fallbackWidthTwips, cellMinWidthTwips);
33565
+ };
33483
33566
  const XML_NODE_NAME$7 = "w:tblGrid";
33484
33567
  const SD_ATTR_KEY = "grid";
33485
33568
  const cellMinWidth = pixelsToTwips(10);
@@ -33494,35 +33577,60 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33494
33577
  };
33495
33578
  };
33496
33579
  const decode$7 = (params2) => {
33497
- const { grid = [] } = params2.node.attrs || {};
33580
+ const { grid: rawGrid } = params2.node.attrs || {};
33581
+ const grid = Array.isArray(rawGrid) ? rawGrid : [];
33498
33582
  const { firstRow = {} } = params2.extraParams || {};
33499
33583
  const cellNodes = firstRow.content?.filter((n) => n.type === "tableCell") ?? [];
33500
- const numberOfColumns = cellNodes.length || grid.length;
33584
+ const columnCountFromCells = cellNodes.reduce((count, cell) => {
33585
+ const spanCount = Math.max(1, cell?.attrs?.colspan ?? 1);
33586
+ return count + spanCount;
33587
+ }, 0);
33588
+ const totalColumns = Math.max(columnCountFromCells, grid.length);
33589
+ const fallbackColumnWidthTwips = resolveFallbackColumnWidthTwips(params2, totalColumns, cellMinWidth);
33501
33590
  const elements = [];
33502
- for (let cellIdx = 0; cellIdx < numberOfColumns; cellIdx++) {
33503
- const cell = cellNodes[cellIdx];
33591
+ let columnIndex = 0;
33592
+ const pushColumn = (widthTwips) => {
33593
+ let numericWidth = typeof widthTwips === "string" ? parseInt(widthTwips, 10) : widthTwips;
33594
+ if (numericWidth == null || Number.isNaN(numericWidth) || numericWidth <= 0) {
33595
+ numericWidth = fallbackColumnWidthTwips;
33596
+ }
33597
+ numericWidth = Math.max(numericWidth, cellMinWidth);
33598
+ const decoded = translator$8.decode({
33599
+ node: { type: (
33600
+ /** @type {string} */
33601
+ translator$8.sdNodeOrKeyName
33602
+ ), attrs: { col: numericWidth } }
33603
+ });
33604
+ if (decoded) elements.push(decoded);
33605
+ };
33606
+ cellNodes.forEach((cell) => {
33504
33607
  const { colspan = 1, colwidth } = cell?.attrs || {};
33505
- for (let mergedCellIdx = 0; mergedCellIdx < colspan; mergedCellIdx++) {
33506
- const cellWidthPixels = colwidth && colwidth[mergedCellIdx];
33507
- const colGridAttrs = grid?.[mergedCellIdx] || {};
33508
- const gridWidthTwips = colGridAttrs.col;
33509
- const gridWidthPixels = twipsToPixels(gridWidthTwips);
33608
+ const spanCount = Math.max(1, colspan);
33609
+ for (let span = 0; span < spanCount; span++) {
33610
+ const cellWidthPixels = Array.isArray(colwidth) ? colwidth[span] : void 0;
33611
+ const colGridAttrs = grid?.[columnIndex] || {};
33612
+ const gridWidthTwips = normalizeTwipWidth(colGridAttrs.col);
33613
+ const gridWidthPixels = gridWidthTwips != null ? twipsToPixels(gridWidthTwips) : null;
33510
33614
  let cellWidthTwips;
33511
- if (gridWidthPixels === cellWidthPixels) {
33615
+ if (cellWidthPixels != null) {
33616
+ if (gridWidthTwips != null && gridWidthPixels === cellWidthPixels) {
33617
+ cellWidthTwips = gridWidthTwips;
33618
+ } else {
33619
+ cellWidthTwips = pixelsToTwips(cellWidthPixels);
33620
+ }
33621
+ } else if (gridWidthTwips != null) {
33512
33622
  cellWidthTwips = gridWidthTwips;
33513
- } else if (cellWidthPixels) {
33514
- cellWidthTwips = pixelsToTwips(cellWidthPixels);
33515
- }
33516
- const widthTwips = Math.max(cellWidthTwips, cellMinWidth);
33517
- elements.push(
33518
- translator$8.decode({
33519
- node: { type: (
33520
- /** @type {string} */
33521
- translator$8.sdNodeOrKeyName
33522
- ), attrs: { col: widthTwips } }
33523
- })
33524
- );
33623
+ } else {
33624
+ cellWidthTwips = fallbackColumnWidthTwips;
33625
+ }
33626
+ pushColumn(cellWidthTwips);
33627
+ columnIndex++;
33525
33628
  }
33629
+ });
33630
+ while (columnIndex < grid.length) {
33631
+ const gridWidthTwips = normalizeTwipWidth(grid[columnIndex]?.col);
33632
+ pushColumn(gridWidthTwips);
33633
+ columnIndex++;
33526
33634
  }
33527
33635
  const newNode = {
33528
33636
  name: XML_NODE_NAME$7,
@@ -33545,7 +33653,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33545
33653
  const node = nodes[0];
33546
33654
  const tblPr = node.elements.find((el) => el.name === "w:tblPr");
33547
33655
  if (tblPr) {
33548
- encodedAttrs["tableProperties"] = translator$9.encode({ ...params2, nodes: [tblPr] }).attributes;
33656
+ const encodedProperties = translator$9.encode({ ...params2, nodes: [tblPr] });
33657
+ encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
33549
33658
  }
33550
33659
  const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
33551
33660
  if (tblGrid) {
@@ -33567,7 +33676,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33567
33676
  key2 = prop;
33568
33677
  transform = (v2) => v2;
33569
33678
  }
33570
- if (encodedAttrs.tableProperties?.[key2]) {
33679
+ if (encodedAttrs.tableProperties && encodedAttrs.tableProperties[key2]) {
33571
33680
  encodedAttrs[key2] = transform(encodedAttrs.tableProperties[key2]);
33572
33681
  }
33573
33682
  });
@@ -33576,11 +33685,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33576
33685
  }
33577
33686
  const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
33578
33687
  const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2);
33688
+ if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
33689
+ encodedAttrs.tableProperties = {
33690
+ ...encodedAttrs.tableProperties || {},
33691
+ cellMargins: referencedStyles.cellMargins
33692
+ };
33693
+ }
33579
33694
  const rows = node.elements.filter((el) => el.name === "w:tr");
33580
33695
  const borderData = Object.assign({}, referencedStyles?.borders || {}, borders || {});
33581
33696
  const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
33582
33697
  encodedAttrs["borders"] = borderData;
33583
- const tblStyleTag = tblPr.elements.find((el) => el.name === "w:tblStyle");
33698
+ const tblStyleTag = tblPr?.elements?.find((el) => el.name === "w:tblStyle");
33584
33699
  const columnWidths = (encodedAttrs["grid"] ?? []).map((item) => twipsToPixels(item.col));
33585
33700
  const content = [];
33586
33701
  rows.forEach((row) => {
@@ -33589,6 +33704,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33589
33704
  nodes: [row],
33590
33705
  extraParams: {
33591
33706
  row,
33707
+ table: node,
33592
33708
  rowBorders: borderRowData,
33593
33709
  styleTag: tblStyleTag,
33594
33710
  columnWidths
@@ -33690,7 +33806,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33690
33806
  if (rowBorders) stylesToReturn.rowBorders = rowBorders;
33691
33807
  const cellMargins = {};
33692
33808
  Object.entries(tableProperties.cellMargins || {}).forEach(([key2, attrs]) => {
33693
- if (attrs?.value) cellMargins[key2] = String(attrs.value);
33809
+ if (attrs?.value != null) {
33810
+ cellMargins[key2] = {
33811
+ value: attrs.value,
33812
+ type: attrs.type || "dxa"
33813
+ };
33814
+ }
33694
33815
  });
33695
33816
  if (Object.keys(cellMargins).length) stylesToReturn.cellMargins = cellMargins;
33696
33817
  }
@@ -33943,11 +34064,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33943
34064
  marginTop: marginTopStyle,
33944
34065
  marginBottom: marginBottomStyle
33945
34066
  } = cellMargins;
34067
+ const resolveMargin = (inlineValue, styleValue) => {
34068
+ if (inlineValue != null) return inlineValue;
34069
+ if (styleValue == null) return void 0;
34070
+ if (typeof styleValue === "object") return styleValue.value;
34071
+ return styleValue;
34072
+ };
33946
34073
  const margins = {
33947
- left: twipsToPixels(inlineMarginLeftValue ?? marginLeftStyle),
33948
- right: twipsToPixels(inlineMarginRightValue ?? marginRightStyle),
33949
- top: twipsToPixels(inlineMarginTopValue ?? marginTopStyle),
33950
- bottom: twipsToPixels(inlineMarginBottomValue ?? marginBottomStyle)
34074
+ left: twipsToPixels(resolveMargin(inlineMarginLeftValue, marginLeftStyle)),
34075
+ right: twipsToPixels(resolveMargin(inlineMarginRightValue, marginRightStyle)),
34076
+ top: twipsToPixels(resolveMargin(inlineMarginTopValue, marginTopStyle)),
34077
+ bottom: twipsToPixels(resolveMargin(inlineMarginBottomValue, marginBottomStyle))
33951
34078
  };
33952
34079
  return margins;
33953
34080
  };
@@ -34222,7 +34349,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34222
34349
  }
34223
34350
  try {
34224
34351
  return JSON.parse(trimmed);
34225
- } catch (err) {
34352
+ } catch {
34226
34353
  return {};
34227
34354
  }
34228
34355
  }
@@ -34478,6 +34605,32 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34478
34605
  if (!picture || !picture.elements) return null;
34479
34606
  const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
34480
34607
  const blip = blipFill.elements.find((el) => el.name === "a:blip");
34608
+ const spPr = picture.elements.find((el) => el.name === "pic:spPr");
34609
+ let transformData = {};
34610
+ if (spPr) {
34611
+ const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
34612
+ if (xfrm?.attributes) {
34613
+ transformData = {
34614
+ rotation: rotToDegrees(xfrm.attributes["rot"]),
34615
+ verticalFlip: xfrm.attributes["flipV"] === "1",
34616
+ horizontalFlip: xfrm.attributes["flipH"] === "1"
34617
+ };
34618
+ }
34619
+ }
34620
+ const effectExtent = node.elements.find((el) => el.name === "wp:effectExtent");
34621
+ if (effectExtent) {
34622
+ const sanitizeEmuValue = (value) => {
34623
+ if (value === null || value === void 0) return 0;
34624
+ const numeric = Number(value);
34625
+ return Number.isFinite(numeric) ? numeric : 0;
34626
+ };
34627
+ transformData.sizeExtension = {
34628
+ left: emuToPixels(sanitizeEmuValue(effectExtent.attributes["l"])),
34629
+ top: emuToPixels(sanitizeEmuValue(effectExtent.attributes["t"])),
34630
+ right: emuToPixels(sanitizeEmuValue(effectExtent.attributes["r"])),
34631
+ bottom: emuToPixels(sanitizeEmuValue(effectExtent.attributes["b"]))
34632
+ };
34633
+ }
34481
34634
  const positionHTag = node.elements.find((el) => el.name === "wp:positionH");
34482
34635
  const positionH = positionHTag?.elements.find((el) => el.name === "wp:posOffset");
34483
34636
  const positionHValue = emuToPixels(positionH?.elements[0]?.text);
@@ -34534,6 +34687,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34534
34687
  size: size2,
34535
34688
  anchorData,
34536
34689
  isAnchor,
34690
+ transformData,
34537
34691
  ...simplePos && {
34538
34692
  simplePos: {
34539
34693
  x: simplePos.attributes.x,
@@ -34685,6 +34839,31 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34685
34839
  distL: 0,
34686
34840
  distR: 0
34687
34841
  };
34842
+ const xfrmAttrs = {};
34843
+ const effectExtentAttrs = {
34844
+ l: 0,
34845
+ t: 0,
34846
+ r: 0,
34847
+ b: 0
34848
+ };
34849
+ const transformData = attrs.transformData;
34850
+ if (transformData) {
34851
+ if (transformData.rotation) {
34852
+ xfrmAttrs.rot = degreesToRot(transformData.rotation);
34853
+ }
34854
+ if (transformData.verticalFlip) {
34855
+ xfrmAttrs.flipV = "1";
34856
+ }
34857
+ if (transformData.horizontalFlip) {
34858
+ xfrmAttrs.flipH = "1";
34859
+ }
34860
+ if (transformData.sizeExtension) {
34861
+ effectExtentAttrs.l = pixelsToEmu(transformData.sizeExtension.left);
34862
+ effectExtentAttrs.t = pixelsToEmu(transformData.sizeExtension.top);
34863
+ effectExtentAttrs.r = pixelsToEmu(transformData.sizeExtension.right);
34864
+ effectExtentAttrs.b = pixelsToEmu(transformData.sizeExtension.bottom);
34865
+ }
34866
+ }
34688
34867
  const drawingXmlns = "http://schemas.openxmlformats.org/drawingml/2006/main";
34689
34868
  const pictureXmlns = "http://schemas.openxmlformats.org/drawingml/2006/picture";
34690
34869
  return {
@@ -34699,12 +34878,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34699
34878
  },
34700
34879
  {
34701
34880
  name: "wp:effectExtent",
34702
- attributes: {
34703
- l: 0,
34704
- t: 0,
34705
- r: 0,
34706
- b: 0
34707
- }
34881
+ attributes: effectExtentAttrs
34708
34882
  },
34709
34883
  {
34710
34884
  name: "wp:docPr",
@@ -34784,6 +34958,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34784
34958
  elements: [
34785
34959
  {
34786
34960
  name: "a:xfrm",
34961
+ attributes: xfrmAttrs,
34787
34962
  elements: [
34788
34963
  {
34789
34964
  name: "a:ext",
@@ -34961,14 +35136,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34961
35136
  const XML_NODE_NAME$3 = "wp:anchor";
34962
35137
  const SD_NODE_NAME$3 = ["image"];
34963
35138
  const validXmlAttributes$3 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
34964
- function encode$3(params2, encodedAttrs) {
35139
+ function encode$3(params2) {
34965
35140
  const { node } = params2.extraParams;
34966
35141
  if (!node || !node.type) {
34967
35142
  return null;
34968
35143
  }
34969
35144
  return handleAnchorNode(params2);
34970
35145
  }
34971
- function decode$3(params2, decodedAttrs) {
35146
+ function decode$3(params2) {
34972
35147
  const { node } = params2;
34973
35148
  if (!node || !node.type) {
34974
35149
  return null;
@@ -35002,14 +35177,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35002
35177
  const XML_NODE_NAME$2 = "wp:inline";
35003
35178
  const SD_NODE_NAME$2 = ["image"];
35004
35179
  const validXmlAttributes$2 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
35005
- function encode$2(params2, encodedAttrs) {
35180
+ function encode$2(params2) {
35006
35181
  const { node } = params2.extraParams;
35007
35182
  if (!node || !node.type) {
35008
35183
  return null;
35009
35184
  }
35010
35185
  return handleInlineNode(params2);
35011
35186
  }
35012
- function decode$2(params2, decodedAttrs) {
35187
+ function decode$2(params2) {
35013
35188
  const { node } = params2;
35014
35189
  if (!node || !node.type) {
35015
35190
  return null;
@@ -35035,7 +35210,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35035
35210
  const XML_NODE_NAME$1 = "w:drawing";
35036
35211
  const SD_NODE_NAME$1 = [];
35037
35212
  const validXmlAttributes$1 = [];
35038
- function encode$1(params2, encodedAttrs) {
35213
+ function encode$1(params2) {
35039
35214
  const nodes = params2.nodes;
35040
35215
  const node = nodes[0];
35041
35216
  const validChildTranslators = ["wp:anchor", "wp:inline"];
@@ -35046,7 +35221,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35046
35221
  return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
35047
35222
  }, null);
35048
35223
  }
35049
- function decode$1(params2, decodedAttrs) {
35224
+ function decode$1(params2) {
35050
35225
  const { node } = params2;
35051
35226
  if (!node || !node.type) {
35052
35227
  return null;
@@ -36647,7 +36822,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36647
36822
  const XML_NODE_NAME = "w:sdt";
36648
36823
  const SD_NODE_NAME = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
36649
36824
  const validXmlAttributes = [];
36650
- function encode$s(params2, encodedAttrs) {
36825
+ function encode$s(params2) {
36651
36826
  const nodes = params2.nodes;
36652
36827
  const node = nodes[0];
36653
36828
  const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
@@ -36657,7 +36832,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36657
36832
  const result = handler2(params2);
36658
36833
  return result;
36659
36834
  }
36660
- function decode(params2, decodedAttrs) {
36835
+ function decode(params2) {
36661
36836
  const { node } = params2;
36662
36837
  if (!node || !node.type) {
36663
36838
  return null;
@@ -38959,8 +39134,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38959
39134
  }
38960
39135
  const importHeadersFooters = (docx, converter, mainEditor) => {
38961
39136
  const rels = docx["word/_rels/document.xml.rels"];
38962
- const relationships = rels.elements.find((el) => el.name === "Relationships");
38963
- const { elements } = relationships;
39137
+ const relationships = rels?.elements.find((el) => el.name === "Relationships");
39138
+ const { elements } = relationships || { elements: [] };
38964
39139
  const headerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
38965
39140
  const footerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
38966
39141
  const headers = elements.filter((el) => el.attributes["Type"] === headerType);
@@ -49918,12 +50093,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
49918
50093
  name: "history",
49919
50094
  addOptions() {
49920
50095
  return {
49921
- /**
49922
- * @typedef {Object} HistoryOptions
49923
- * @category Options
49924
- * @property {number} [depth=100] - Maximum undo/redo steps to remember
49925
- * @property {number} [newGroupDelay=500] - Milliseconds to wait before starting a new history group
49926
- */
49927
50096
  depth: 100,
49928
50097
  newGroupDelay: 500
49929
50098
  };
@@ -49942,9 +50111,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
49942
50111
  /**
49943
50112
  * Undo the last action
49944
50113
  * @category Command
49945
- * @returns {Function} Command function
49946
50114
  * @example
49947
- * undo()
50115
+ * editor.commands.undo()
49948
50116
  * @note Groups changes within the newGroupDelay window
49949
50117
  */
49950
50118
  undo: () => ({ state: state2, dispatch, tr }) => {
@@ -49958,9 +50126,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
49958
50126
  /**
49959
50127
  * Redo the last undone action
49960
50128
  * @category Command
49961
- * @returns {Function} Command function
49962
50129
  * @example
49963
- * redo()
50130
+ * editor.commands.redo()
49964
50131
  * @note Only available after an undo action
49965
50132
  */
49966
50133
  redo: () => ({ state: state2, dispatch, tr }) => {
@@ -56879,6 +57046,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
56879
57046
  return result;
56880
57047
  } catch (error) {
56881
57048
  this.emit("exception", { error, editor: this });
57049
+ console.error(error);
56882
57050
  }
56883
57051
  }
56884
57052
  /**
@@ -56902,6 +57070,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
56902
57070
  this.converter.footerEditors.length = 0;
56903
57071
  } catch (error) {
56904
57072
  this.emit("exception", { error, editor: this });
57073
+ console.error(error);
56905
57074
  }
56906
57075
  }
56907
57076
  /**
@@ -57490,6 +57659,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57490
57659
  if (this.options.ydoc) this.options.ydoc.destroy();
57491
57660
  } catch (error) {
57492
57661
  this.emit("exception", { error, editor: this });
57662
+ console.error(error);
57493
57663
  }
57494
57664
  };
57495
57665
  validateDocumentInit_fn = function() {
@@ -57516,11 +57686,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57516
57686
  name: "color",
57517
57687
  addOptions() {
57518
57688
  return {
57519
- /**
57520
- * @typedef {Object} ColorOptions
57521
- * @category Options
57522
- * @property {string[]} [types=['textStyle']] - Mark types to add color support to
57523
- */
57524
57689
  types: ["textStyle"]
57525
57690
  };
57526
57691
  },
@@ -57529,10 +57694,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57529
57694
  {
57530
57695
  types: this.options.types,
57531
57696
  attributes: {
57532
- /**
57533
- * @category Attribute
57534
- * @param {ColorValue} [color] - Text color value
57535
- */
57536
57697
  color: {
57537
57698
  default: null,
57538
57699
  parseDOM: (el) => el.style.color?.replace(/['"]+/g, ""),
@@ -57551,16 +57712,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57551
57712
  * Set text color
57552
57713
  * @category Command
57553
57714
  * @param {ColorValue} color - Color value to apply
57554
- * @returns {Function} Command function
57555
57715
  * @example
57556
57716
  * // Set to red using hex
57557
- * setColor('#ff0000')
57717
+ * editor.commands.setColor('#ff0000')
57558
57718
  *
57719
+ * @example
57559
57720
  * // Set using rgb
57560
- * setColor('rgb(255, 0, 0)')
57721
+ * editor.commands.setColor('rgb(255, 0, 0)')
57561
57722
  *
57723
+ * @example
57562
57724
  * // Set using named color
57563
- * setColor('blue')
57725
+ * editor.commands.setColor('blue')
57564
57726
  * @note Preserves other text styling attributes
57565
57727
  */
57566
57728
  setColor: (color) => ({ chain }) => {
@@ -57569,9 +57731,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57569
57731
  /**
57570
57732
  * Remove text color
57571
57733
  * @category Command
57572
- * @returns {Function} Command function
57573
57734
  * @example
57574
- * unsetColor()
57735
+ * editor.commands.unsetColor()
57575
57736
  * @note Removes color while preserving other text styles
57576
57737
  */
57577
57738
  unsetColor: () => ({ chain }) => {
@@ -57584,11 +57745,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57584
57745
  name: "fontFamily",
57585
57746
  addOptions() {
57586
57747
  return {
57587
- /**
57588
- * @typedef {Object} FontFamilyOptions
57589
- * @category Options
57590
- * @property {string[]} [types=['textStyle']] - Mark types to add font family support to
57591
- */
57592
57748
  types: ["textStyle"]
57593
57749
  };
57594
57750
  },
@@ -57597,10 +57753,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57597
57753
  {
57598
57754
  types: this.options.types,
57599
57755
  attributes: {
57600
- /**
57601
- * @category Attribute
57602
- * @param {FontFamilyValue} [fontFamily] - Font family for text
57603
- */
57604
57756
  fontFamily: {
57605
57757
  default: null,
57606
57758
  parseDOM: (el) => el.style.fontFamily?.replace(/['"]+/g, ""),
@@ -57619,13 +57771,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57619
57771
  * Set font family
57620
57772
  * @category Command
57621
57773
  * @param {FontFamilyValue} fontFamily - Font family to apply
57622
- * @returns {Function} Command function
57623
57774
  * @example
57624
57775
  * // Set to Arial
57625
- * setFontFamily('Arial')
57776
+ * editor.commands.setFontFamily('Arial')
57626
57777
  *
57778
+ * @example
57627
57779
  * // Set to serif font
57628
- * setFontFamily('Georgia, serif')
57780
+ * editor.commands.setFontFamily('Georgia, serif')
57629
57781
  * @note Preserves other text styling attributes
57630
57782
  */
57631
57783
  setFontFamily: (fontFamily2) => ({ chain }) => {
@@ -57634,9 +57786,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57634
57786
  /**
57635
57787
  * Remove font family
57636
57788
  * @category Command
57637
- * @returns {Function} Command function
57638
57789
  * @example
57639
- * unsetFontFamily()
57790
+ * editor.commands.unsetFontFamily()
57640
57791
  * @note Reverts to default document font
57641
57792
  */
57642
57793
  unsetFontFamily: () => ({ chain }) => {
@@ -57649,12 +57800,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57649
57800
  name: "fontSize",
57650
57801
  addOptions() {
57651
57802
  return {
57652
- /**
57653
- * @typedef {Object} FontSizeOptions
57654
- * @category Options
57655
- * @property {string[]} [types=['textStyle', 'tableCell']] - Node/mark types to add font size support to
57656
- * @property {FontSizeDefaults} [defaults] - Default size configuration
57657
- */
57658
57803
  types: ["textStyle", "tableCell"],
57659
57804
  defaults: {
57660
57805
  value: 12,
@@ -57669,10 +57814,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57669
57814
  {
57670
57815
  types: this.options.types,
57671
57816
  attributes: {
57672
- /**
57673
- * @category Attribute
57674
- * @param {FontSizeValue} [fontSize] - Font size with unit
57675
- */
57676
57817
  fontSize: {
57677
57818
  default: null,
57678
57819
  parseDOM: (el) => el.style.fontSize,
@@ -57694,16 +57835,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57694
57835
  * Set font size
57695
57836
  * @category Command
57696
57837
  * @param {FontSizeValue} fontSize - Size to apply (with optional unit)
57697
- * @returns {Function} Command function
57698
57838
  * @example
57699
- * // Set to 14pt
57700
- * setFontSize('14pt')
57701
- *
57702
- * // Set to 18px
57703
- * setFontSize('18px')
57704
- *
57705
- * // Set without unit (uses default)
57706
- * setFontSize(16)
57839
+ * editor.commands.setFontSize('14pt')
57840
+ * editor.commands.setFontSize('18px')
57841
+ * editor.commands.setFontSize(16)
57707
57842
  * @note Automatically clamps to min/max values
57708
57843
  */
57709
57844
  setFontSize: (fontSize2) => ({ chain }) => {
@@ -57725,9 +57860,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57725
57860
  /**
57726
57861
  * Remove font size
57727
57862
  * @category Command
57728
- * @returns {Function} Command function
57729
57863
  * @example
57730
- * unsetFontSize()
57864
+ * editor.commands.unsetFontSize()
57731
57865
  * @note Reverts to default document size
57732
57866
  */
57733
57867
  unsetFontSize: () => ({ chain }) => {
@@ -57777,13 +57911,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57777
57911
  * Set text alignment
57778
57912
  * @category Command
57779
57913
  * @param {string} alignment - Alignment value (left, center, right, justify)
57780
- * @returns {Function} Command function
57781
57914
  * @example
57782
- * // Set to center
57783
- * setTextAlign('center')
57784
- *
57785
- * // Set to justify
57786
- * setTextAlign('justify')
57915
+ * editor.commands.setTextAlign('center')
57916
+ * editor.commands.setTextAlign('justify')
57787
57917
  * @note Applies to all configured node types (heading, paragraph by default)
57788
57918
  */
57789
57919
  setTextAlign: (alignment2) => ({ commands: commands2 }) => {
@@ -57794,9 +57924,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57794
57924
  /**
57795
57925
  * Remove text alignment (reset to default)
57796
57926
  * @category Command
57797
- * @returns {Function} Command function
57798
57927
  * @example
57799
- * unsetTextAlign()
57928
+ * editor.commands.unsetTextAlign()
57800
57929
  * @note Resets alignment to the default value
57801
57930
  */
57802
57931
  unsetTextAlign: () => ({ commands: commands2 }) => {
@@ -57937,13 +58066,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57937
58066
  name: "lineHeight",
57938
58067
  addOptions() {
57939
58068
  return {
57940
- /**
57941
- * @typedef {Object} LineHeightOptions
57942
- * @category Options
57943
- * @property {string[]} [types=['heading', 'paragraph']] - Block types to add line height support to
57944
- * @property {Object} [defaults] - Default configuration
57945
- * @property {string} [defaults.unit=''] - Default unit for line height values
57946
- */
57947
58069
  types: ["heading", "paragraph"],
57948
58070
  defaults: {
57949
58071
  unit: ""
@@ -57955,10 +58077,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57955
58077
  {
57956
58078
  types: this.options.types,
57957
58079
  attributes: {
57958
- /**
57959
- * @category Attribute
57960
- * @param {LineHeightValue} [lineHeight] - Line height value
57961
- */
57962
58080
  lineHeight: {
57963
58081
  default: null,
57964
58082
  parseDOM: (el) => el.style.lineHeight,
@@ -57984,16 +58102,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
57984
58102
  * Set line height for blocks
57985
58103
  * @category Command
57986
58104
  * @param {LineHeightValue} lineHeight - Line height to apply
57987
- * @returns {Function} Command function
57988
58105
  * @example
57989
- * // Set to 1.5x spacing
57990
- * setLineHeight(1.5)
57991
- *
57992
- * // Set to 24px spacing
57993
- * setLineHeight('24px')
57994
- *
57995
- * // Set to double spacing
57996
- * setLineHeight(2)
58106
+ * editor.commands.setLineHeight(1.5)
58107
+ * editor.commands.setLineHeight('24px')
58108
+ * editor.commands.setLineHeight(2)
57997
58109
  * @note Applies to paragraphs and headings
57998
58110
  */
57999
58111
  setLineHeight: (lineHeight2) => ({ commands: commands2 }) => {
@@ -58003,9 +58115,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58003
58115
  /**
58004
58116
  * Remove line height
58005
58117
  * @category Command
58006
- * @returns {Function} Command function
58007
58118
  * @example
58008
- * unsetLineHeight()
58119
+ * editor.commands.unsetLineHeight()
58009
58120
  * @note Reverts to default line spacing
58010
58121
  */
58011
58122
  unsetLineHeight: () => ({ commands: commands2 }) => {
@@ -58033,9 +58144,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58033
58144
  /**
58034
58145
  * Clear all formatting (nodes and marks)
58035
58146
  * @category Command
58036
- * @returns {Function} Command function
58037
58147
  * @example
58038
- * clearFormat()
58148
+ * editor.commands.clearFormat()
58039
58149
  * @note Removes all marks and resets nodes to default paragraph
58040
58150
  */
58041
58151
  clearFormat: () => ({ chain }) => {
@@ -58044,9 +58154,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58044
58154
  /**
58045
58155
  * Clear only mark formatting
58046
58156
  * @category Command
58047
- * @returns {Function} Command function
58048
58157
  * @example
58049
- * clearMarksFormat()
58158
+ * editor.commands.clearMarksFormat()
58050
58159
  * @note Removes bold, italic, underline, colors, etc. but preserves block structure
58051
58160
  */
58052
58161
  clearMarksFormat: () => ({ chain }) => {
@@ -58055,9 +58164,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58055
58164
  /**
58056
58165
  * Clear only node formatting
58057
58166
  * @category Command
58058
- * @returns {Function} Command function
58059
58167
  * @example
58060
- * clearNodesFormat()
58168
+ * editor.commands.clearNodesFormat()
58061
58169
  * @note Converts headings, lists, etc. to paragraphs but preserves text marks
58062
58170
  */
58063
58171
  clearNodesFormat: () => ({ chain }) => {
@@ -58066,13 +58174,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58066
58174
  /**
58067
58175
  * Copy format from selection or apply copied format
58068
58176
  * @category Command
58069
- * @returns {Function} Command function
58070
58177
  * @example
58071
- * // First call: copy format from selection
58072
- * copyFormat()
58073
- *
58074
- * // Second call: apply copied format to new selection
58075
- * copyFormat()
58178
+ * editor.commands.copyFormat()
58076
58179
  * @note Works like format painter - first click copies, second click applies
58077
58180
  */
58078
58181
  copyFormat: () => ({ chain }) => {
@@ -58485,6 +58588,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58485
58588
  }
58486
58589
  const Gapcursor = Extension.create({
58487
58590
  name: "gapCursor",
58591
+ addOptions() {
58592
+ return {};
58593
+ },
58488
58594
  addPmPlugins() {
58489
58595
  return [gapCursor()];
58490
58596
  },
@@ -58825,6 +58931,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58825
58931
  const SlashMenuPluginKey = new PluginKey("slashMenu");
58826
58932
  const SlashMenu = Extension.create({
58827
58933
  name: "slashMenu",
58934
+ addOptions() {
58935
+ return {};
58936
+ },
58828
58937
  addPmPlugins() {
58829
58938
  if (this.editor.options?.disableContextMenu) {
58830
58939
  return [];
@@ -58962,11 +59071,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58962
59071
  },
58963
59072
  addAttributes() {
58964
59073
  return {
58965
- /**
58966
- * @private
58967
- * @category Attribute
58968
- * @param {Object} [attributes] - Internal document attributes
58969
- */
58970
59074
  attributes: {
58971
59075
  rendered: false,
58972
59076
  "aria-label": "Document node"
@@ -58978,10 +59082,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58978
59082
  /**
58979
59083
  * Get document statistics
58980
59084
  * @category Command
58981
- * @returns {Function} Command function
58982
59085
  * @example
58983
59086
  * // Get word and character count
58984
- * getDocumentStats()
59087
+ * const stats = editor.commands.getDocumentStats()
59088
+ * console.log(`${stats.words} words, ${stats.characters} characters`)
58985
59089
  * @note Returns word count, character count, and paragraph count
58986
59090
  */
58987
59091
  getDocumentStats: () => ({ editor }) => {
@@ -58998,9 +59102,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58998
59102
  /**
58999
59103
  * Clear entire document
59000
59104
  * @category Command
59001
- * @returns {Function} Command function
59002
59105
  * @example
59003
- * clearDocument()
59106
+ * editor.commands.clearDocument()
59004
59107
  * @note Replaces all content with an empty paragraph
59005
59108
  */
59006
59109
  clearDocument: () => ({ commands: commands2 }) => {
@@ -59012,13 +59115,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59012
59115
  const Text = Node$1.create({
59013
59116
  name: "text",
59014
59117
  group: "inline",
59015
- inline: true
59118
+ inline: true,
59119
+ addOptions() {
59120
+ return {};
59121
+ }
59016
59122
  });
59017
59123
  const RunItem = Node$1.create({
59018
59124
  name: "run",
59019
59125
  group: "inline",
59020
59126
  content: "text*",
59021
59127
  inline: true,
59128
+ addOptions() {
59129
+ return {};
59130
+ },
59022
59131
  parseDOM() {
59023
59132
  return [{ tag: "run" }];
59024
59133
  },
@@ -59044,14 +59153,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59044
59153
  },
59045
59154
  addOptions() {
59046
59155
  return {
59047
- /**
59048
- * @typedef {Object} BulletListOptions
59049
- * @category Options
59050
- * @property {string} [itemTypeName='listItem'] - Name of the list item node type
59051
- * @property {Object} [htmlAttributes] - HTML attributes for the ul element
59052
- * @property {boolean} [keepMarks=true] - Whether to preserve marks when splitting
59053
- * @property {boolean} [keepAttributes=false] - Whether to preserve attributes when splitting
59054
- */
59055
59156
  itemTypeName: "listItem",
59056
59157
  htmlAttributes: {
59057
59158
  "aria-label": "Bullet list node"
@@ -59069,27 +59170,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59069
59170
  },
59070
59171
  addAttributes() {
59071
59172
  return {
59072
- /**
59073
- * @category Attribute
59074
- * @param {string} [list-style-type='bullet'] - List style type for this list
59075
- */
59076
59173
  "list-style-type": {
59077
59174
  default: "bullet",
59078
59175
  rendered: false
59079
59176
  },
59080
- /**
59081
- * @private
59082
- * @category Attribute
59083
- * @param {string} [listId] - Internal list identifier for numbering
59084
- */
59085
59177
  listId: {
59086
59178
  rendered: false
59087
59179
  },
59088
- /**
59089
- * @private
59090
- * @category Attribute
59091
- * @param {string} [sdBlockId] - Internal block tracking ID
59092
- */
59093
59180
  sdBlockId: {
59094
59181
  default: null,
59095
59182
  keepOnSplit: false,
@@ -59098,11 +59185,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59098
59185
  return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
59099
59186
  }
59100
59187
  },
59101
- /**
59102
- * @private
59103
- * @category Attribute
59104
- * @param {Object} [attributes] - Additional attributes for the list
59105
- */
59106
59188
  attributes: {
59107
59189
  rendered: false,
59108
59190
  keepOnSplit: true
@@ -59114,10 +59196,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59114
59196
  /**
59115
59197
  * Toggle a bullet list at the current selection
59116
59198
  * @category Command
59117
- * @returns {Function} Command function
59118
59199
  * @example
59119
59200
  * // Toggle bullet list on selected text
59120
- * toggleBulletList()
59201
+ * editor.commands.toggleBulletList()
59121
59202
  * @note Converts selected paragraphs to list items or removes list formatting
59122
59203
  */
59123
59204
  toggleBulletList: () => (params2) => {
@@ -59236,9 +59317,25 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59236
59317
  },
59237
59318
  addCommands() {
59238
59319
  return {
59320
+ /**
59321
+ * Toggle ordered list formatting
59322
+ * @category Command
59323
+ * @example
59324
+ * editor.commands.toggleOrderedList()
59325
+ * @note Converts selection to ordered list or back to paragraphs
59326
+ */
59239
59327
  toggleOrderedList: () => (params2) => {
59240
59328
  return toggleList(this.type)(params2);
59241
59329
  },
59330
+ /**
59331
+ * Restart list node numbering
59332
+ * @category Command
59333
+ * @param {Array} followingNodes - Nodes to restart
59334
+ * @param {number} pos - Starting position
59335
+ * @example
59336
+ * editor.commands.restartListNodes(nodes, position)
59337
+ * @note Resets list numbering for specified nodes
59338
+ */
59242
59339
  restartListNodes: (followingNodes, pos) => ({ tr }) => {
59243
59340
  let currentNodePos = pos;
59244
59341
  const nodes = followingNodes.map((node) => {
@@ -59257,8 +59354,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59257
59354
  return true;
59258
59355
  },
59259
59356
  /**
59260
- * Updates ordered list style type when sink or lift `listItem`.
59261
- * @example 1,2,3 -> a,b,c -> i,ii,iii -> 1,2,3 -> etc
59357
+ * Update ordered list style type based on nesting level
59358
+ * @category Command
59359
+ * @example
59360
+ * editor.commands.updateOrderedListStyleType()
59361
+ * @note Cycles through decimal -> lowerAlpha -> lowerRoman based on depth
59262
59362
  */
59263
59363
  updateOrderedListStyleType: () => ({ dispatch, tr }) => {
59264
59364
  let list = findParentNode((node) => node.type.name === this.name)(tr.selection);
@@ -59535,7 +59635,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59535
59635
  * @returns {Function} Command function
59536
59636
  * @example
59537
59637
  * // Restore selection after toolbar interaction
59538
- * restorePreservedSelection()
59638
+ * editor.commands.restorePreservedSelection()
59539
59639
  * @note Used internally to maintain selection when interacting with toolbar
59540
59640
  */
59541
59641
  restorePreservedSelection: () => ({ tr, state: state2 }) => {
@@ -59824,6 +59924,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59824
59924
  name: "linkedStyles",
59825
59925
  priority: 1,
59826
59926
  // We need this plugin to run before the list plugins
59927
+ addOptions() {
59928
+ return {};
59929
+ },
59827
59930
  addPmPlugins() {
59828
59931
  return [createLinkedStylesPlugin(this.editor)];
59829
59932
  },
@@ -59832,11 +59935,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59832
59935
  /**
59833
59936
  * Apply a linked style to the selected paragraphs
59834
59937
  * @category Command
59835
- * @param {Object} style - The style object to apply
59836
- * @returns {Function} Command function
59938
+ * @param {LinkedStyle} style - The style object to apply
59837
59939
  * @example
59838
59940
  * const style = editor.helpers.linkedStyles.getStyleById('Heading1');
59839
- * setLinkedStyle(style);
59941
+ * editor.commands.setLinkedStyle(style);
59840
59942
  * @note Clears existing formatting when applying a style
59841
59943
  * @note Works with custom selection preservation
59842
59944
  */
@@ -59847,16 +59949,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59847
59949
  /**
59848
59950
  * Toggle a linked style on the current selection
59849
59951
  * @category Command
59850
- * @param {Object} style - The linked style to apply (with id property)
59952
+ * @param {LinkedStyle} style - The linked style to apply (with id property)
59851
59953
  * @param {string|null} [nodeType=null] - Node type to restrict toggle to (e.g., 'paragraph')
59852
- * @returns {Function} Command function
59853
59954
  * @example
59854
- * // Toggle a heading style
59855
59955
  * const style = editor.helpers.linkedStyles.getStyleById('Heading1');
59856
- * toggleLinkedStyle(style)
59857
- *
59858
- * // Toggle only on paragraph nodes
59859
- * toggleLinkedStyle(style, 'paragraph')
59956
+ * editor.commands.toggleLinkedStyle(style)
59957
+ * editor.commands.toggleLinkedStyle(style, 'paragraph')
59860
59958
  * @note If selection is empty, returns false
59861
59959
  * @note Removes style if already applied, applies it if not
59862
59960
  */
@@ -59884,13 +59982,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59884
59982
  * Apply a linked style by its ID
59885
59983
  * @category Command
59886
59984
  * @param {string} styleId - The style ID to apply (e.g., 'Heading1')
59887
- * @returns {Function} Command function
59888
59985
  * @example
59889
- * // Apply a heading style
59890
- * setStyleById('Heading1')
59891
- *
59892
- * // Apply a normal style
59893
- * setStyleById('Normal')
59986
+ * editor.commands.setStyleById('Heading1')
59987
+ * editor.commands.setStyleById('Normal')
59894
59988
  * @note Looks up the style from loaded Word styles
59895
59989
  */
59896
59990
  setStyleById: (styleId) => (params2) => {
@@ -60598,12 +60692,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60598
60692
  inline: false,
60599
60693
  addOptions() {
60600
60694
  return {
60601
- /**
60602
- * @typedef {Object} HeadingOptions
60603
- * @category Options
60604
- * @property {number[]} [headingLevels=[1,2,3,4,5,6]] - Supported heading levels
60605
- * @property {Object} [htmlAttributes] - HTML attributes for paragraph elements
60606
- */
60607
60695
  headingLevels: [1, 2, 3, 4, 5, 6],
60608
60696
  htmlAttributes: {}
60609
60697
  };
@@ -60835,11 +60923,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60835
60923
  name: "heading",
60836
60924
  addOptions() {
60837
60925
  return {
60838
- /**
60839
- * @typedef {Object} HeadingOptions
60840
- * @category Options
60841
- * @property {number[]} [levels=[1,2,3,4,5,6]] - Supported heading levels
60842
- */
60843
60926
  levels: [1, 2, 3, 4, 5, 6]
60844
60927
  };
60845
60928
  },
@@ -60849,10 +60932,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60849
60932
  * Set a heading with specified level
60850
60933
  * @category Command
60851
60934
  * @param {HeadingAttributes} attributes - Heading attributes including level
60852
- * @returns {Function} Command function
60853
60935
  * @example
60854
- * // Set heading level 2
60855
- * setHeading({ level: 2 })
60936
+ * editor.commands.setHeading({ level: 2 })
60856
60937
  * @note Converts current block to heading
60857
60938
  */
60858
60939
  setHeading: (attributes) => ({ commands: commands2 }) => {
@@ -60864,13 +60945,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60864
60945
  * Toggle between heading and paragraph
60865
60946
  * @category Command
60866
60947
  * @param {HeadingAttributes} attributes - Heading attributes including level
60867
- * @returns {Function} Command function
60868
60948
  * @example
60869
- * // Toggle heading level 1
60870
- * toggleHeading({ level: 1 })
60871
- *
60872
- * // Toggle heading level 3
60873
- * toggleHeading({ level: 3 })
60949
+ * editor.commands.toggleHeading({ level: 1 })
60950
+ * editor.commands.toggleHeading({ level: 3 })
60874
60951
  * @note Switches between heading and paragraph for the same level
60875
60952
  */
60876
60953
  toggleHeading: (attributes) => ({ commands: commands2 }) => {
@@ -61275,6 +61352,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61275
61352
  selectable: false,
61276
61353
  content: "",
61277
61354
  atom: true,
61355
+ addOptions() {
61356
+ return {};
61357
+ },
61278
61358
  parseDOM() {
61279
61359
  return [{ tag: "br" }];
61280
61360
  },
@@ -61283,17 +61363,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61283
61363
  },
61284
61364
  addAttributes() {
61285
61365
  return {
61286
- /**
61287
- * @private
61288
- * @category Attribute
61289
- * @param {string} [lineBreakType] - Type of line break - passthrough in this node
61290
- */
61291
61366
  lineBreakType: { rendered: false },
61292
- /**
61293
- * @private
61294
- * @category Attribute
61295
- * @param {string} [clear] - Clear attribute - passthrough in this node
61296
- */
61297
61367
  clear: { rendered: false }
61298
61368
  };
61299
61369
  },
@@ -61302,9 +61372,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61302
61372
  /**
61303
61373
  * Insert a line break
61304
61374
  * @category Command
61305
- * @returns {Function} Command function
61306
61375
  * @example
61307
- * insertLineBreak()
61376
+ * editor.commands.insertLineBreak()
61308
61377
  * @note Creates a soft break within the same paragraph
61309
61378
  */
61310
61379
  insertLineBreak: () => ({ commands: commands2 }) => {
@@ -61321,11 +61390,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61321
61390
  atom: true,
61322
61391
  addOptions() {
61323
61392
  return {
61324
- /**
61325
- * @typedef {Object} HardBreakOptions
61326
- * @category Options
61327
- * @property {Object} [htmlAttributes] - HTML attributes for the break element
61328
- */
61329
61393
  htmlAttributes: {
61330
61394
  contentEditable: "false",
61331
61395
  lineBreakType: "page",
@@ -61336,35 +61400,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61336
61400
  },
61337
61401
  addAttributes() {
61338
61402
  return {
61339
- /**
61340
- * @private
61341
- * @category Attribute
61342
- * @param {string} [pageBreakSource] - Source of the page break
61343
- */
61344
61403
  pageBreakSource: {
61345
61404
  rendered: false,
61346
61405
  default: null
61347
61406
  },
61348
- /**
61349
- * @private
61350
- * @category Attribute
61351
- * @param {string} [pageBreakType] - Type of page break
61352
- */
61353
61407
  pageBreakType: {
61354
61408
  default: null,
61355
61409
  rendered: false
61356
61410
  },
61357
- /**
61358
- * @private
61359
- * @category Attribute
61360
- * @param {string} [lineBreakType] - Type of line break - passthrough in this node
61361
- */
61362
61411
  lineBreakType: { rendered: false },
61363
- /**
61364
- * @private
61365
- * @category Attribute
61366
- * @param {string} [clear] - Clear attribute - passthrough in this node
61367
- */
61368
61412
  clear: { rendered: false }
61369
61413
  };
61370
61414
  },
@@ -61390,9 +61434,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61390
61434
  /**
61391
61435
  * Insert a page break
61392
61436
  * @category Command
61393
- * @returns {Function} Command function
61394
61437
  * @example
61395
- * insertPageBreak()
61438
+ * editor.commands.insertPageBreak()
61396
61439
  * @note Forces content to start on a new page when printed
61397
61440
  */
61398
61441
  insertPageBreak: () => ({ commands: commands2 }) => {
@@ -63782,17 +63825,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63782
63825
  group: "block",
63783
63826
  isolating: true,
63784
63827
  tableRole: "table",
63785
- /**
63786
- * Table extension options
63787
- * @category Options
63788
- * @typedef {Object} TableOptions
63789
- * @property {Object} [htmlAttributes={'aria-label': 'Table node'}] - Default HTML attributes for all tables
63790
- * @property {boolean} [resizable=true] - Enable column resizing functionality
63791
- * @property {number} [handleWidth=5] - Width of resize handles in pixels
63792
- * @property {number} [cellMinWidth=10] - Minimum cell width constraint in pixels
63793
- * @property {boolean} [lastColumnResizable=true] - Allow resizing of the last column
63794
- * @property {boolean} [allowTableNodeSelection=false] - Enable selecting the entire table node
63795
- */
63796
63828
  addOptions() {
63797
63829
  return {
63798
63830
  htmlAttributes: {
@@ -63950,14 +63982,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63950
63982
  * Insert a new table into the document
63951
63983
  * @category Command
63952
63984
  * @param {TableConfig} [config] - Table configuration options
63953
- * @returns {Function} Command
63954
63985
  * @example
63955
- * // Using default values
63956
- * insertTable() // Creates 3x3 table without header
63957
- *
63958
- * // Using custom values
63959
- * insertTable({ rows: 3, cols: 3, withHeaderRow: true })
63960
- *
63986
+ * editor.commands.insertTable()
63987
+ * editor.commands.insertTable({ rows: 3, cols: 3, withHeaderRow: true })
63961
63988
  */
63962
63989
  insertTable: ({ rows = 3, cols = 3, withHeaderRow = false } = {}) => ({ tr, dispatch, editor }) => {
63963
63990
  const node = createTable(editor.schema, rows, cols, withHeaderRow);
@@ -63970,9 +63997,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63970
63997
  /**
63971
63998
  * Delete the entire table containing the cursor
63972
63999
  * @category Command
63973
- * @returns {Function} Command
63974
64000
  * @example
63975
- * deleteTable()
64001
+ * editor.commands.deleteTable()
63976
64002
  */
63977
64003
  deleteTable: () => ({ state: state2, dispatch }) => {
63978
64004
  return deleteTable(state2, dispatch);
@@ -63980,9 +64006,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63980
64006
  /**
63981
64007
  * Add a column before the current column
63982
64008
  * @category Command
63983
- * @returns {Function} Command
63984
64009
  * @example
63985
- * addColumnBefore()
64010
+ * editor.commands.addColumnBefore()
63986
64011
  * @note Preserves cell attributes from current column
63987
64012
  */
63988
64013
  addColumnBefore: () => ({ state: state2, dispatch, chain }) => {
@@ -64359,10 +64384,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64359
64384
  * Set background color for selected cells
64360
64385
  * @category Command
64361
64386
  * @param {string} value - Color value (hex with or without #)
64362
- * @returns {Function} Command
64363
64387
  * @example
64364
- * setCellBackground('#ff0000')
64365
- * setCellBackground('ff0000')
64388
+ * editor.commands.setCellBackground('#ff0000')
64389
+ * editor.commands.setCellBackground('ff0000')
64366
64390
  */
64367
64391
  setCellBackground: (value) => ({ editor, commands: commands2, dispatch }) => {
64368
64392
  const { selection } = editor.state;
@@ -64488,24 +64512,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64488
64512
  },
64489
64513
  addAttributes() {
64490
64514
  return {
64491
- /**
64492
- * @category Attribute
64493
- * @param {number} [colspan=1] - Number of columns this header spans
64494
- */
64495
64515
  colspan: {
64496
64516
  default: 1
64497
64517
  },
64498
- /**
64499
- * @category Attribute
64500
- * @param {number} [rowspan=1] - Number of rows this header spans
64501
- */
64502
64518
  rowspan: {
64503
64519
  default: 1
64504
64520
  },
64505
- /**
64506
- * @category Attribute
64507
- * @param {number[]} [colwidth] - Column widths array in pixels
64508
- */
64509
64521
  colwidth: {
64510
64522
  default: null,
64511
64523
  parseDOM: (element) => {
@@ -64542,10 +64554,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64542
64554
  },
64543
64555
  addAttributes() {
64544
64556
  return {
64545
- /**
64546
- * @category Attribute
64547
- * @param {number} [rowHeight] - Fixed row height in pixels
64548
- */
64549
64557
  rowHeight: {
64550
64558
  renderDOM({ rowHeight }) {
64551
64559
  if (!rowHeight) return {};
@@ -64553,11 +64561,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64553
64561
  return { style: style2 };
64554
64562
  }
64555
64563
  },
64556
- /**
64557
- * Indicates that this row should not be split across pages when paginating/exporting.
64558
- * @category Attribute
64559
- * @param {boolean} [cantSplit]
64560
- */
64561
64564
  cantSplit: {
64562
64565
  default: false,
64563
64566
  parseDOM() {
@@ -64569,44 +64572,30 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64569
64572
  }
64570
64573
  },
64571
64574
  /**
64572
- * @category Attribute
64573
- * @param {TableRowProperties} [tableRowProperties] - Properties for the table row.
64574
64575
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 377-482
64575
64576
  */
64576
64577
  tableRowProperties: { rendered: false },
64577
64578
  /**
64578
- * @category Attribute
64579
- * @param {string} [rsidDel] - Unique identifier used to track the editing session when the row was deleted from the main document.
64580
64579
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
64581
64580
  */
64582
64581
  rsidDel: { rendered: false },
64583
64582
  /**
64584
- * @category Attribute
64585
- * @param {string} [rsidR] - Unique identifier used to track the editing session when the table row was added to the main document.
64586
64583
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
64587
64584
  */
64588
64585
  rsidR: { rendered: false },
64589
64586
  /**
64590
- * @category Attribute
64591
- * @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.
64592
64587
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
64593
64588
  */
64594
64589
  rsidRPr: { rendered: false },
64595
64590
  /**
64596
- * @category Attribute
64597
- * @param {string} [rsidTr] - Unique identifier used to track the editing session when the table row's properties were last modified in this document.
64598
64591
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
64599
64592
  */
64600
64593
  rsidTr: { rendered: false },
64601
64594
  /**
64602
- * @category Attribute
64603
- * @param {string} [paraId] - A randomly generated unique identifier for the table row.
64604
64595
  * @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/a0e7d2e2-2246-44c6-96e8-1cf009823615}
64605
64596
  */
64606
64597
  paraId: { rendered: false },
64607
64598
  /**
64608
- * @category Attribute
64609
- * @param {string} [textId] - A randomly generated unique identifier for the text of the table row.
64610
64599
  * @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/b7eeddec-7c50-47fb-88b6-1feec3ed832c}
64611
64600
  */
64612
64601
  textId: { rendered: false }
@@ -64633,24 +64622,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64633
64622
  },
64634
64623
  addAttributes() {
64635
64624
  return {
64636
- /**
64637
- * @category Attribute
64638
- * @param {number} [colspan=1] - Number of columns this cell spans
64639
- */
64640
64625
  colspan: {
64641
64626
  default: 1
64642
64627
  },
64643
- /**
64644
- * @category Attribute
64645
- * @param {number} [rowspan=1] - Number of rows this cell spans
64646
- */
64647
64628
  rowspan: {
64648
64629
  default: 1
64649
64630
  },
64650
- /**
64651
- * @category Attribute
64652
- * @param {number[]} [colwidth=[100]] - Column widths array in pixels
64653
- */
64654
64631
  colwidth: {
64655
64632
  default: [100],
64656
64633
  parseDOM: (elem) => {
@@ -64665,10 +64642,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64665
64642
  };
64666
64643
  }
64667
64644
  },
64668
- /**
64669
- * @category Attribute
64670
- * @param {CellBackground} [background] - Cell background color configuration
64671
- */
64672
64645
  background: {
64673
64646
  renderDOM({ background }) {
64674
64647
  if (!background) return {};
@@ -64677,10 +64650,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64677
64650
  return { style: style2 };
64678
64651
  }
64679
64652
  },
64680
- /**
64681
- * @category Attribute
64682
- * @param {string} [verticalAlign] - Vertical content alignment (top, middle, bottom)
64683
- */
64684
64653
  verticalAlign: {
64685
64654
  renderDOM({ verticalAlign }) {
64686
64655
  if (!verticalAlign) return {};
@@ -64688,10 +64657,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64688
64657
  return { style: style2 };
64689
64658
  }
64690
64659
  },
64691
- /**
64692
- * @category Attribute
64693
- * @param {CellMargins} [cellMargins] - Internal cell padding
64694
- */
64695
64660
  cellMargins: {
64696
64661
  renderDOM({ cellMargins }) {
64697
64662
  if (!cellMargins) return {};
@@ -64704,10 +64669,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64704
64669
  return { style: style2 };
64705
64670
  }
64706
64671
  },
64707
- /**
64708
- * @category Attribute
64709
- * @param {CellBorders} [borders] - Cell border configuration
64710
- */
64711
64672
  borders: {
64712
64673
  default: () => createCellBorders(),
64713
64674
  renderDOM({ borders }) {
@@ -64722,20 +64683,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64722
64683
  return { style: style2 };
64723
64684
  }
64724
64685
  },
64725
- /**
64726
- * @private
64727
- * @category Attribute
64728
- * @param {string} [widthType='auto'] - Internal width type
64729
- */
64730
64686
  widthType: {
64731
64687
  default: "auto",
64732
64688
  rendered: false
64733
64689
  },
64734
- /**
64735
- * @private
64736
- * @category Attribute
64737
- * @param {string} [widthUnit='px'] - Internal width unit
64738
- */
64739
64690
  widthUnit: {
64740
64691
  default: "px",
64741
64692
  rendered: false
@@ -66365,7 +66316,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66365
66316
  credentials: "omit"
66366
66317
  });
66367
66318
  return response.ok;
66368
- } catch (_error) {
66319
+ } catch {
66369
66320
  return false;
66370
66321
  }
66371
66322
  };
@@ -66938,6 +66889,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66938
66889
  }
66939
66890
  return null;
66940
66891
  };
66892
+ const getRotationMargins = (w2, h2, angleDegrees) => {
66893
+ const rad = angleDegrees * (Math.PI / 180);
66894
+ const cos = Math.abs(Math.cos(rad));
66895
+ const sin = Math.abs(Math.sin(rad));
66896
+ const boundingWidth = w2 * cos + h2 * sin;
66897
+ const boundingHeight = w2 * sin + h2 * cos;
66898
+ const marginLeftRight = Math.round(Math.max(0, (boundingWidth - w2) / 2));
66899
+ const marginTopBottom = Math.round(Math.max(0, (boundingHeight - h2) / 2));
66900
+ return {
66901
+ horizontal: marginLeftRight,
66902
+ vertical: marginTopBottom
66903
+ };
66904
+ };
66941
66905
  const Image = Node$1.create({
66942
66906
  name: "image",
66943
66907
  group: "inline",
@@ -66959,10 +66923,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66959
66923
  },
66960
66924
  addAttributes() {
66961
66925
  return {
66962
- /**
66963
- * @category Attribute
66964
- * @param {string} [src] - Image source URL or path
66965
- */
66966
66926
  src: {
66967
66927
  default: null,
66968
66928
  renderDOM: ({ src }) => {
@@ -66971,95 +66931,75 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66971
66931
  };
66972
66932
  }
66973
66933
  },
66974
- /**
66975
- * @category Attribute
66976
- * @param {string} [alt='Uploaded picture'] - Alternative text for accessibility
66977
- */
66978
66934
  alt: {
66979
66935
  default: "Uploaded picture"
66980
66936
  },
66981
- /**
66982
- * @category Attribute
66983
- * @param {string} [id] - Image element ID
66984
- * @private
66985
- */
66986
66937
  id: { rendered: false },
66987
- /**
66988
- * @category Attribute
66989
- * @param {string} [title] - Image title/tooltip text
66990
- */
66991
66938
  title: {
66992
66939
  default: null
66993
66940
  },
66994
- /**
66995
- * @category Attribute
66996
- * @param {string} [rId] - Relationship ID for Word export
66997
- * @private
66998
- */
66999
66941
  rId: {
67000
66942
  default: null,
67001
66943
  rendered: false
67002
66944
  },
67003
- /**
67004
- * @category Attribute
67005
- * @param {Object} [originalPadding] - Original padding values from Word import
67006
- * @private
67007
- */
67008
66945
  originalPadding: {
67009
66946
  default: null,
67010
66947
  rendered: false
67011
66948
  },
67012
- /**
67013
- * @category Attribute
67014
- * @param {Object} [originalAttributes] - Original attributes from Word import
67015
- * @private
67016
- */
67017
66949
  originalAttributes: { rendered: false },
67018
- /**
67019
- * @category Attribute
67020
- * @param {boolean} [wrapTopAndBottom] - Wrap text above and below image
67021
- * @private
67022
- */
67023
66950
  wrapTopAndBottom: { rendered: false },
67024
- /**
67025
- * @category Attribute
67026
- * @param {Object} [anchorData] - Anchor positioning data for Word
67027
- * @private
67028
- */
67029
66951
  anchorData: {
67030
66952
  default: null,
67031
66953
  rendered: false
67032
66954
  },
66955
+ isAnchor: { rendered: false },
67033
66956
  /**
67034
66957
  * @category Attribute
67035
- * @param {boolean} [isAnchor] - Whether image is anchored
66958
+ * @param {Object} [transformData] - Transform data for image (turn and flip)
66959
+ * @param {number} [transformData.rotation] - Turn angle in degrees
66960
+ * @param {boolean} [transformData.verticalFlip] - Whether to flip vertically
66961
+ * @param {boolean} [transformData.horizontalFlip] - Whether to flip horizontally
66962
+ * @param {Object} [transformData.sizeExtension] - Size extension for image due to transformation
66963
+ * @param {number} [transformData.sizeExtension.left] - Left size extension for image
66964
+ * @param {number} [transformData.sizeExtension.top] - Top size extension for image
66965
+ * @param {number} [transformData.sizeExtension.right] - Right size extension for image
66966
+ * @param {number} [transformData.sizeExtension.bottom] - Bottom size extension for image
66967
+ *
67036
66968
  * @private
67037
66969
  */
67038
- isAnchor: { rendered: false },
66970
+ transformData: {
66971
+ default: {},
66972
+ renderDOM: ({ transformData }) => {
66973
+ let style2 = "";
66974
+ if (transformData?.rotation) {
66975
+ style2 += `rotate(${Math.round(transformData.rotation)}deg) `;
66976
+ }
66977
+ if (transformData?.verticalFlip) {
66978
+ style2 += "scaleY(-1) ";
66979
+ }
66980
+ if (transformData?.horizontalFlip) {
66981
+ style2 += "scaleX(-1) ";
66982
+ }
66983
+ style2 = style2.trim();
66984
+ if (style2.length > 0) {
66985
+ return { style: `transform: ${style2};` };
66986
+ }
66987
+ return;
66988
+ }
66989
+ },
67039
66990
  /**
67040
66991
  * @category Attribute
67041
66992
  * @param {boolean} [simplePos] - Simple positioning flag
67042
66993
  * @private
67043
66994
  */
67044
66995
  simplePos: { rendered: false },
67045
- /**
67046
- * @category Attribute
67047
- * @param {string} [wrapText] - Text wrapping style
67048
- * @private
67049
- */
67050
66996
  wrapText: { rendered: false },
67051
66997
  extension: { rendered: false },
67052
- /**
67053
- * @category Attribute
67054
- * @param {Object} [size] - Image dimensions
67055
- * @param {number} [size.width] - Width in pixels
67056
- * @param {number} [size.height] - Height in pixels
67057
- */
67058
66998
  size: {
67059
66999
  default: {},
67060
67000
  renderDOM: ({ size: size2, extension }) => {
67061
67001
  let style2 = "";
67062
- const { width, height } = size2 ?? {};
67002
+ let { width, height } = size2 ?? {};
67063
67003
  if (width) style2 += `width: ${width}px;`;
67064
67004
  if (height && ["emf", "wmf"].includes(extension))
67065
67005
  style2 += `height: ${height}px; border: 1px solid black; position: absolute;`;
@@ -67067,51 +67007,58 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67067
67007
  return { style: style2 };
67068
67008
  }
67069
67009
  },
67070
- /**
67071
- * @category Attribute
67072
- * @param {Object} [padding] - Image padding/margins
67073
- * @param {number} [padding.left] - Left padding in pixels
67074
- * @param {number} [padding.top] - Top padding in pixels
67075
- * @param {number} [padding.bottom] - Bottom padding in pixels
67076
- * @param {number} [padding.right] - Right padding in pixels
67077
- */
67078
67010
  padding: {
67079
67011
  default: {},
67080
- renderDOM: ({ padding, marginOffset }) => {
67081
- const { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
67012
+ renderDOM: ({ size: size2 = {}, padding, marginOffset, transformData }) => {
67013
+ let { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
67014
+ const { rotation } = transformData ?? {};
67015
+ const { height, width } = size2 ?? {};
67016
+ if (rotation && height && width) {
67017
+ const { horizontal, vertical } = getRotationMargins(width, height, rotation);
67018
+ left2 += horizontal;
67019
+ right2 += horizontal;
67020
+ top2 += vertical;
67021
+ bottom2 += vertical;
67022
+ }
67082
67023
  let style2 = "";
67083
- if (left2 && !marginOffset?.left) style2 += `margin-left: ${left2}px;`;
67084
- if (top2 && !marginOffset?.top) style2 += `margin-top: ${top2}px;`;
67024
+ if (left2 && marginOffset?.left == null) style2 += `margin-left: ${left2}px;`;
67025
+ if (top2 && marginOffset?.top == null) style2 += `margin-top: ${top2}px;`;
67085
67026
  if (bottom2) style2 += `margin-bottom: ${bottom2}px;`;
67086
67027
  if (right2) style2 += `margin-right: ${right2}px;`;
67087
67028
  return { style: style2 };
67088
67029
  }
67089
67030
  },
67090
- /**
67091
- * @category Attribute
67092
- * @param {Object} [marginOffset] - Margin offset for anchored images
67093
- * @param {number} [marginOffset.left] - Left margin offset
67094
- * @param {number} [marginOffset.top] - Top margin offset
67095
- */
67096
67031
  marginOffset: {
67097
67032
  default: {},
67098
- renderDOM: ({ marginOffset, anchorData }) => {
67033
+ renderDOM: ({ marginOffset, anchorData, transformData, size: size2 }) => {
67034
+ const hasAnchorData = Boolean(anchorData);
67035
+ const hasMarginOffsets = marginOffset?.left != null || marginOffset?.top != null;
67036
+ if (!hasAnchorData && !hasMarginOffsets) return {};
67099
67037
  const relativeFromPageV = anchorData?.vRelativeFrom === "page";
67100
67038
  const maxMarginV = 500;
67101
- const { left: left2 = 0, top: top2 = 0 } = marginOffset ?? {};
67039
+ const baseLeft = marginOffset?.left ?? 0;
67040
+ const baseTop = marginOffset?.top ?? 0;
67041
+ let rotationLeft = 0;
67042
+ let rotationTop = 0;
67043
+ const { rotation } = transformData ?? {};
67044
+ const { height, width } = size2 ?? {};
67045
+ if (rotation && height && width) {
67046
+ const { horizontal, vertical } = getRotationMargins(width, height, rotation);
67047
+ rotationLeft = horizontal;
67048
+ rotationTop = vertical;
67049
+ }
67050
+ const left2 = baseLeft + rotationLeft;
67051
+ const top2 = baseTop + rotationTop;
67102
67052
  let style2 = "";
67103
67053
  if (left2) style2 += `margin-left: ${left2}px;`;
67104
67054
  if (top2) {
67105
67055
  if (relativeFromPageV && top2 >= maxMarginV) style2 += `margin-top: ${maxMarginV}px;`;
67106
67056
  else style2 += `margin-top: ${top2}px;`;
67107
67057
  }
67058
+ if (!style2) return {};
67108
67059
  return { style: style2 };
67109
67060
  }
67110
67061
  },
67111
- /**
67112
- * @category Attribute
67113
- * @param {string} [style] - Custom inline CSS styles
67114
- */
67115
67062
  style: {
67116
67063
  default: null,
67117
67064
  rendered: true,
@@ -67137,18 +67084,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67137
67084
  /**
67138
67085
  * Insert an image at the current position
67139
67086
  * @category Command
67140
- * @param {Object} options - Image attributes
67141
- * @param {string} options.src - Image source URL or data URI
67142
- * @param {string} [options.alt] - Alternative text
67143
- * @param {string} [options.title] - Image title
67144
- * @param {Object} [options.size] - Image dimensions
67145
- * @returns {Function} Command function
67087
+ * @param {ImageInsertOptions} options - Image insertion options
67146
67088
  * @example
67147
- * // Insert an image from a URL
67148
- * setImage({ src: 'https://example.com/image.jpg' })
67149
- *
67150
- * // Insert a base64 encoded image
67151
- * setImage({
67089
+ * editor.commands.setImage({ src: 'https://example.com/image.jpg' })
67090
+ * editor.commands.setImage({
67152
67091
  * src: 'data:image/png;base64,...',
67153
67092
  * alt: 'Company logo',
67154
67093
  * size: { width: 200 }
@@ -67365,6 +67304,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67365
67304
  },
67366
67305
  addCommands() {
67367
67306
  return {
67307
+ /**
67308
+ * Insert an automatic page number
67309
+ * @category Command
67310
+ * @returns {Function} Command function
67311
+ * @example
67312
+ * editor.commands.addAutoPageNumber()
67313
+ * @note Only works in header/footer contexts
67314
+ */
67368
67315
  addAutoPageNumber: () => ({ tr, dispatch, state: state2, editor }) => {
67369
67316
  const { options } = editor;
67370
67317
  if (!options.isHeaderOrFooter) return false;
@@ -67427,6 +67374,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67427
67374
  },
67428
67375
  addCommands() {
67429
67376
  return {
67377
+ /**
67378
+ * Insert total page count
67379
+ * @category Command
67380
+ * @returns {Function} Command function
67381
+ * @example
67382
+ * editor.commands.addTotalPageCount()
67383
+ * @note Only works in header/footer contexts
67384
+ */
67430
67385
  addTotalPageCount: () => ({ tr, dispatch, state: state2, editor }) => {
67431
67386
  const { options } = editor;
67432
67387
  if (!options.isHeaderOrFooter) return false;
@@ -67693,11 +67648,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67693
67648
  inline: true,
67694
67649
  addOptions() {
67695
67650
  return {
67696
- /**
67697
- * @typedef {Object} ContentBlockOptions
67698
- * @category Options
67699
- * @property {Object} [htmlAttributes] - HTML attributes for the block element
67700
- */
67701
67651
  htmlAttributes: {
67702
67652
  contenteditable: false
67703
67653
  }
@@ -67705,10 +67655,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67705
67655
  },
67706
67656
  addAttributes() {
67707
67657
  return {
67708
- /**
67709
- * @category Attribute
67710
- * @param {boolean} [horizontalRule=false] - Whether this block is a horizontal rule
67711
- */
67712
67658
  horizontalRule: {
67713
67659
  default: false,
67714
67660
  renderDOM: ({ horizontalRule }) => {
@@ -67716,10 +67662,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67716
67662
  return { "data-horizontal-rule": "true" };
67717
67663
  }
67718
67664
  },
67719
- /**
67720
- * @category Attribute
67721
- * @param {ContentBlockSize} [size] - Size and position of the content block
67722
- */
67723
67665
  size: {
67724
67666
  default: null,
67725
67667
  renderDOM: ({ size: size2 }) => {
@@ -67733,10 +67675,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67733
67675
  return { style: style2 };
67734
67676
  }
67735
67677
  },
67736
- /**
67737
- * @category Attribute
67738
- * @param {string} [background] - Background color for the block
67739
- */
67740
67678
  background: {
67741
67679
  default: null,
67742
67680
  renderDOM: (attrs) => {
@@ -67746,19 +67684,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67746
67684
  };
67747
67685
  }
67748
67686
  },
67749
- /**
67750
- * @private
67751
- * @category Attribute
67752
- * @param {Object} [drawingContent] - Internal drawing data
67753
- */
67754
67687
  drawingContent: {
67755
67688
  rendered: false
67756
67689
  },
67757
- /**
67758
- * @private
67759
- * @category Attribute
67760
- * @param {Object} [attributes] - Additional internal attributes
67761
- */
67762
67690
  attributes: {
67763
67691
  rendered: false
67764
67692
  }
@@ -67779,9 +67707,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67779
67707
  /**
67780
67708
  * Insert a horizontal rule
67781
67709
  * @category Command
67782
- * @returns {Function} Command function
67783
67710
  * @example
67784
- * insertHorizontalRule()
67711
+ * editor.commands.insertHorizontalRule()
67785
67712
  * @note Creates a visual separator between content sections
67786
67713
  */
67787
67714
  insertHorizontalRule: () => ({ commands: commands2 }) => {
@@ -67798,13 +67725,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67798
67725
  * Insert a content block
67799
67726
  * @category Command
67800
67727
  * @param {ContentBlockConfig} config - Block configuration
67801
- * @returns {Function} Command function
67802
67728
  * @example
67803
67729
  * // Insert a spacer block
67804
- * insertContentBlock({ size: { height: 20 } })
67730
+ * editor.commands.insertContentBlock({ size: { height: 20 } })
67805
67731
  *
67732
+ * @example
67806
67733
  * // Insert a colored divider
67807
- * insertContentBlock({
67734
+ * editor.commands.insertContentBlock({
67808
67735
  * size: { width: '50%', height: 3 },
67809
67736
  * background: '#3b82f6'
67810
67737
  * })
@@ -67841,7 +67768,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67841
67768
  this.htmlAttributes = props.htmlAttributes;
67842
67769
  this.mount(props);
67843
67770
  }
67844
- mount(props) {
67771
+ mount() {
67845
67772
  return;
67846
67773
  }
67847
67774
  get dom() {
@@ -68332,16 +68259,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68332
68259
  },
68333
68260
  addAttributes() {
68334
68261
  return {
68335
- /**
68336
- * @category Attribute
68337
- * @param {number} [id] - Unique section identifier
68338
- */
68339
68262
  id: {},
68340
- /**
68341
- * @private
68342
- * @category Attribute
68343
- * @param {string} [sdBlockId] - Internal block tracking
68344
- */
68345
68263
  sdBlockId: {
68346
68264
  default: null,
68347
68265
  keepOnSplit: false,
@@ -68350,25 +68268,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68350
68268
  return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
68351
68269
  }
68352
68270
  },
68353
- /**
68354
- * @category Attribute
68355
- * @param {string} [title] - Section display label
68356
- */
68357
68271
  title: {},
68358
- /**
68359
- * @category Attribute
68360
- * @param {string} [description] - Section metadata
68361
- */
68362
68272
  description: {},
68363
- /**
68364
- * @category Attribute
68365
- * @param {string} [sectionType] - Business classification (e.g., 'legal', 'pricing')
68366
- */
68367
68273
  sectionType: {},
68368
- /**
68369
- * @category Attribute
68370
- * @param {boolean} [isLocked=false] - Lock state preventing edits
68371
- */
68372
68274
  isLocked: { default: false }
68373
68275
  };
68374
68276
  },
@@ -68383,10 +68285,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68383
68285
  * Create a lockable content section
68384
68286
  * @category Command
68385
68287
  * @param {SectionCreate} [options={}] - Section configuration
68386
- * @returns {Function} Command - true if created, false if position invalid
68387
68288
  * @example
68388
- * createDocumentSection({
68389
- * id: 'legal-1',
68289
+ * editor.commands.createDocumentSection({
68290
+ * id: 1,
68390
68291
  * title: 'Terms & Conditions',
68391
68292
  * isLocked: true,
68392
68293
  * html: '<p>Legal content...</p>'
@@ -68467,9 +68368,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68467
68368
  /**
68468
68369
  * Remove section wrapper at cursor, preserving its content
68469
68370
  * @category Command
68470
- * @returns {Function} Command - true if removed, false if no section at position
68471
68371
  * @example
68472
- * removeSectionAtSelection()
68372
+ * editor.commands.removeSectionAtSelection()
68473
68373
  * @note Content stays in document, only section wrapper is removed
68474
68374
  */
68475
68375
  removeSectionAtSelection: () => ({ tr, dispatch }) => {
@@ -68495,9 +68395,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68495
68395
  * Delete section and all its content
68496
68396
  * @category Command
68497
68397
  * @param {number} id - Section to delete
68498
- * @returns {Function} Command - true if deleted, false if ID doesn't exist
68499
68398
  * @example
68500
- * removeSectionById(123)
68399
+ * editor.commands.removeSectionById(123)
68501
68400
  */
68502
68401
  removeSectionById: (id) => ({ tr, dispatch }) => {
68503
68402
  const sections = SectionHelpers.getAllSections(this.editor);
@@ -68517,9 +68416,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68517
68416
  * Lock section against edits
68518
68417
  * @category Command
68519
68418
  * @param {number} id - Section to lock
68520
- * @returns {Function} Command - true if locked, false if ID doesn't exist
68521
68419
  * @example
68522
- * lockSectionById(123)
68420
+ * editor.commands.lockSectionById(123)
68523
68421
  */
68524
68422
  lockSectionById: (id) => ({ tr, dispatch }) => {
68525
68423
  const sections = SectionHelpers.getAllSections(this.editor);
@@ -68536,16 +68434,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68536
68434
  * Modify section attributes or content
68537
68435
  * @category Command
68538
68436
  * @param {SectionUpdate} options - Changes to apply
68539
- * @returns {Function} Command - true if updated, false if ID doesn't exist
68540
68437
  * @example
68541
- * // Toggle lock
68542
- * updateSectionById({ id: 123, attrs: { isLocked: false } })
68543
- *
68544
- * // Replace content
68545
- * updateSectionById({ id: 123, html: '<p>New content</p>' })
68546
- *
68547
- * // Both
68548
- * updateSectionById({
68438
+ * editor.commands.updateSectionById({ id: 123, attrs: { isLocked: false } })
68439
+ * editor.commands.updateSectionById({ id: 123, html: '<p>New content</p>' })
68440
+ * editor.commands.updateSectionById({
68549
68441
  * id: 123,
68550
68442
  * html: '<p>Updated</p>',
68551
68443
  * attrs: { title: 'New Title' }
@@ -68595,11 +68487,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68595
68487
  * Replace a block node by its ID with new content
68596
68488
  * @category Command
68597
68489
  * @param {string} id - The sdBlockId of the node to replace
68598
- * @param {Object} contentNode - The replacement ProseMirror node
68599
- * @returns {Function} Command function
68490
+ * @param {ProseMirrorNode} contentNode - The replacement ProseMirror node
68600
68491
  * @example
68601
68492
  * const newParagraph = editor.schema.nodes.paragraph.create({}, editor.schema.text('New content'))
68602
- * replaceBlockNodeById('block-123', newParagraph)
68493
+ * editor.commands.replaceBlockNodeById('block-123', newParagraph)
68603
68494
  * @note The replacement node should have the same type as the original
68604
68495
  */
68605
68496
  replaceBlockNodeById: (id, contentNode) => ({ dispatch, tr }) => {
@@ -68622,9 +68513,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68622
68513
  * Delete a block node by its ID
68623
68514
  * @category Command
68624
68515
  * @param {string} id - The sdBlockId of the node to delete
68625
- * @returns {Function} Command function
68626
68516
  * @example
68627
- * deleteBlockNodeById('block-123')
68517
+ * editor.commands.deleteBlockNodeById('block-123')
68628
68518
  * @note Completely removes the node from the document
68629
68519
  */
68630
68520
  deleteBlockNodeById: (id) => ({ dispatch, tr }) => {
@@ -68648,11 +68538,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68648
68538
  * @category Command
68649
68539
  * @param {string} id - The sdBlockId of the node to update
68650
68540
  * @param {Object} attrs - Attributes to update
68651
- * @returns {Function} Command function
68652
68541
  * @example
68653
- * updateBlockNodeAttributes('block-123', { textAlign: 'center' })
68542
+ * editor.commands.updateBlockNodeAttributes('block-123', { textAlign: 'center' })
68654
68543
  * @example
68655
- * updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
68544
+ * editor.commands.updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
68656
68545
  * @note Merges new attributes with existing ones
68657
68546
  */
68658
68547
  updateBlockNodeAttributes: (id, attrs = {}) => ({ dispatch, tr }) => {
@@ -68746,7 +68635,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68746
68635
  key: BlockNodePluginKey,
68747
68636
  appendTransaction: (transactions, _oldState, newState) => {
68748
68637
  if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
68749
- if (hasInitialized && !checkForNewBlockNodesInTrs(transactions)) return null;
68638
+ if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) return null;
68750
68639
  const { tr } = newState;
68751
68640
  let changed = false;
68752
68641
  newState.doc.descendants((node, pos) => {
@@ -68825,9 +68714,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68825
68714
  /**
68826
68715
  * Remove empty text style marks
68827
68716
  * @category Command
68828
- * @returns {Function} Command function - Removes mark if no attributes present
68829
68717
  * @example
68830
- * removeEmptyTextStyle()
68718
+ * editor.commands.removeEmptyTextStyle()
68831
68719
  * @note Cleanup utility to prevent empty span elements
68832
68720
  * @note Automatically checks if any style attributes exist before removal
68833
68721
  */
@@ -68849,10 +68737,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68849
68737
  },
68850
68738
  addAttributes() {
68851
68739
  return {
68852
- /**
68853
- * @category Attribute
68854
- * @param {string} [value] - Bold weight value ('0' renders as normal)
68855
- */
68856
68740
  value: {
68857
68741
  default: null,
68858
68742
  renderDOM: (attrs) => {
@@ -68881,26 +68765,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68881
68765
  /**
68882
68766
  * Apply bold formatting
68883
68767
  * @category Command
68884
- * @returns {Function} Command
68885
68768
  * @example
68886
- * setBold()
68769
+ * editor.commands.setBold()
68887
68770
  * @note '0' renders as normal weight
68888
68771
  */
68889
68772
  setBold: () => ({ commands: commands2 }) => commands2.setMark(this.name),
68890
68773
  /**
68891
68774
  * Remove bold formatting
68892
68775
  * @category Command
68893
- * @returns {Function} Command
68894
68776
  * @example
68895
- * unsetBold()
68777
+ * editor.commands.unsetBold()
68896
68778
  */
68897
68779
  unsetBold: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
68898
68780
  /**
68899
68781
  * Toggle bold formatting
68900
68782
  * @category Command
68901
- * @returns {Function} Command
68902
68783
  * @example
68903
- * toggleBold()
68784
+ * editor.commands.toggleBold()
68904
68785
  */
68905
68786
  toggleBold: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
68906
68787
  };
@@ -68935,25 +68816,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68935
68816
  /**
68936
68817
  * Apply italic formatting
68937
68818
  * @category Command
68938
- * @returns {Function} Command
68939
68819
  * @example
68940
- * setItalic()
68820
+ * editor.commands.setItalic()
68941
68821
  */
68942
68822
  setItalic: () => ({ commands: commands2 }) => commands2.setMark(this.name),
68943
68823
  /**
68944
68824
  * Remove italic formatting
68945
68825
  * @category Command
68946
- * @returns {Function} Command
68947
68826
  * @example
68948
- * unsetItalic()
68827
+ * editor.commands.unsetItalic()
68949
68828
  */
68950
68829
  unsetItalic: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
68951
68830
  /**
68952
68831
  * Toggle italic formatting
68953
68832
  * @category Command
68954
- * @returns {Function} Command
68955
68833
  * @example
68956
- * toggleItalic()
68834
+ * editor.commands.toggleItalic()
68957
68835
  */
68958
68836
  toggleItalic: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
68959
68837
  };
@@ -69037,10 +68915,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69037
68915
  },
69038
68916
  addAttributes() {
69039
68917
  return {
69040
- /**
69041
- * @category Attribute
69042
- * @param {string} [color] - Background color (CSS color value)
69043
- */
69044
68918
  color: {
69045
68919
  default: null,
69046
68920
  parseDOM: (element) => element.getAttribute("data-color") || element.style.backgroundColor,
@@ -69068,26 +68942,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69068
68942
  * Apply highlight with specified color
69069
68943
  * @category Command
69070
68944
  * @param {string} color - CSS color value
69071
- * @returns {Function} Command
69072
68945
  * @example
69073
- * setHighlight('#FFEB3B')
69074
- * setHighlight('rgba(255, 235, 59, 0.5)')
68946
+ * editor.commands.setHighlight('#FFEB3B')
68947
+ * editor.commands.setHighlight('rgba(255, 235, 59, 0.5)')
69075
68948
  */
69076
68949
  setHighlight: (color) => ({ commands: commands2 }) => commands2.setMark(this.name, { color }),
69077
68950
  /**
69078
68951
  * Remove highlight formatting
69079
68952
  * @category Command
69080
- * @returns {Function} Command
69081
68953
  * @example
69082
- * unsetHighlight()
68954
+ * editor.commands.unsetHighlight()
69083
68955
  */
69084
68956
  unsetHighlight: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
69085
68957
  /**
69086
68958
  * Toggle highlight formatting
69087
68959
  * @category Command
69088
- * @returns {Function} Command
69089
68960
  * @example
69090
- * toggleHighlight()
68961
+ * editor.commands.toggleHighlight()
69091
68962
  */
69092
68963
  toggleHighlight: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
69093
68964
  };
@@ -69120,9 +68991,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69120
68991
  /**
69121
68992
  * Apply strikethrough formatting
69122
68993
  * @category Command
69123
- * @returns {Function} Command
69124
68994
  * @example
69125
- * setStrike()
68995
+ * editor.commands.setStrike()
69126
68996
  */
69127
68997
  setStrike: () => ({ commands: commands2 }) => {
69128
68998
  return commands2.setMark(this.name);
@@ -69130,9 +69000,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69130
69000
  /**
69131
69001
  * Remove strikethrough formatting
69132
69002
  * @category Command
69133
- * @returns {Function} Command
69134
69003
  * @example
69135
- * unsetStrike()
69004
+ * editor.commands.unsetStrike()
69136
69005
  */
69137
69006
  unsetStrike: () => ({ commands: commands2 }) => {
69138
69007
  return commands2.unsetMark(this.name);
@@ -69140,9 +69009,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69140
69009
  /**
69141
69010
  * Toggle strikethrough formatting
69142
69011
  * @category Command
69143
- * @returns {Function} Command
69144
69012
  * @example
69145
- * toggleStrike()
69013
+ * editor.commands.toggleStrike()
69146
69014
  */
69147
69015
  toggleStrike: () => ({ commands: commands2 }) => {
69148
69016
  return commands2.toggleMark(this.name);
@@ -69162,11 +69030,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69162
69030
  inclusive: false,
69163
69031
  addOptions() {
69164
69032
  return {
69165
- /**
69166
- * Allowed URL protocols
69167
- * @type {string[]}
69168
- * @default ['http', 'https']
69169
- */
69170
69033
  protocols: ["http", "https"],
69171
69034
  htmlAttributes: {
69172
69035
  target: null,
@@ -69265,16 +69128,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69265
69128
  /**
69266
69129
  * Create or update a link
69267
69130
  * @category Command
69268
- * @param {Object} options - Link configuration
69269
- * @param {string} [options.href] - URL for the link
69270
- * @param {string} [options.text] - Display text (uses selection if omitted)
69271
- * @returns {Function} Command - Creates link with underline
69131
+ * @param {SetLinkOptions} [options] - Link configuration
69272
69132
  * @example
69273
- * // Link selected text
69274
- * setLink({ href: 'https://example.com' })
69275
- *
69276
- * // Link with custom text
69277
- * setLink({
69133
+ * editor.commands.setLink({ href: 'https://example.com' })
69134
+ * editor.commands.setLink({
69278
69135
  * href: 'https://example.com',
69279
69136
  * text: 'Visit Example'
69280
69137
  * })
@@ -69326,9 +69183,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69326
69183
  /**
69327
69184
  * Remove link and associated formatting
69328
69185
  * @category Command
69329
- * @returns {Function} Command - Removes link, underline, and color
69330
69186
  * @example
69331
- * unsetLink()
69187
+ * editor.commands.unsetLink()
69332
69188
  * @note Also removes underline and text color
69333
69189
  */
69334
69190
  unsetLink: () => ({ chain }) => {
@@ -69337,16 +69193,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69337
69193
  /**
69338
69194
  * Toggle link on selection
69339
69195
  * @category Command
69340
- * @param {Object} [options] - Link configuration
69341
- * @param {string} [options.href] - URL for the link
69342
- * @param {string} [options.text] - Display text
69343
- * @returns {Function} Command - Creates link if href provided, removes otherwise
69196
+ * @param {SetLinkOptions} [options] - Link configuration
69344
69197
  * @example
69345
- * // Add link
69346
- * toggleLink({ href: 'https://example.com' })
69347
- *
69348
- * // Remove link
69349
- * toggleLink()
69198
+ * editor.commands.toggleLink({ href: 'https://example.com' })
69199
+ * editor.commands.toggleLink()
69350
69200
  */
69351
69201
  toggleLink: ({ href, text } = {}) => ({ commands: commands2 }) => {
69352
69202
  if (!href) return commands2.unsetLink();
@@ -72663,6 +72513,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
72663
72513
  const popoverPluginKey = new PluginKey("popoverPlugin");
72664
72514
  const PopoverPlugin = Extension.create({
72665
72515
  name: "popoverPlugin",
72516
+ addOptions() {
72517
+ return {};
72518
+ },
72666
72519
  addPmPlugins() {
72667
72520
  const popover = new Plugin({
72668
72521
  key: popoverPluginKey,
@@ -74890,12 +74743,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74890
74743
  addCommands() {
74891
74744
  return {
74892
74745
  /**
74893
- * Navigates to the first search match
74746
+ * Navigate to the first search match
74894
74747
  * @category Command
74895
- * @returns {Function} - Command function
74896
74748
  * @example
74897
- * goToFirstMatch()
74898
- * @note Scrolls Editor to the first match of called search().
74749
+ * editor.commands.goToFirstMatch()
74750
+ * @note Scrolls editor to the first match from previous search
74899
74751
  */
74900
74752
  goToFirstMatch: () => (
74901
74753
  /** @returns {boolean} */
@@ -74911,13 +74763,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74911
74763
  })
74912
74764
  ),
74913
74765
  /**
74914
- * Searches for the string match in Editor content
74766
+ * Search for string matches in editor content
74915
74767
  * @category Command
74916
74768
  * @param {String|RegExp} patternInput - Search string or pattern
74917
- * @returns {Function} - Command function that returns matches
74918
74769
  * @example
74919
- * search('test string')
74920
- * @note Searches for the test string in the Editor content and returns an array of matches
74770
+ * const matches = editor.commands.search('test string')
74771
+ * const regexMatches = editor.commands.search(/test/i)
74772
+ * @note Returns array of SearchMatch objects with positions and IDs
74921
74773
  */
74922
74774
  search: (patternInput) => (
74923
74775
  /** @returns {SearchMatch[]} */
@@ -74960,14 +74812,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74960
74812
  })
74961
74813
  ),
74962
74814
  /**
74963
- * Navigates to the selected match
74815
+ * Navigate to a specific search match
74964
74816
  * @category Command
74965
- * @param {SearchMatch} match Match at specific index
74966
- * @returns {Function} - Command function
74817
+ * @param {SearchMatch} match - Match object to navigate to
74967
74818
  * @example
74968
- * const searchResult = search('test string')
74969
- * goToSearchResult(searchResult[3])
74970
- * @note Scrolls Editor to the fourth match of called search() and sets selection on it.
74819
+ * const searchResults = editor.commands.search('test string')
74820
+ * editor.commands.goToSearchResult(searchResults[3])
74821
+ * @note Scrolls to match and selects it
74971
74822
  */
74972
74823
  goToSearchResult: (match) => (
74973
74824
  /** @returns {boolean} */
@@ -75229,6 +75080,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75229
75080
  };
75230
75081
  const NodeResizer = Extension.create({
75231
75082
  name: "nodeResizer",
75083
+ addOptions() {
75084
+ return {};
75085
+ },
75232
75086
  addPmPlugins() {
75233
75087
  const isHeadless = this.editor.options.isHeadless;
75234
75088
  const hasDocument = typeof document !== "undefined";