superdoc 0.31.0-next.1 → 0.31.0-next.2

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 (232) hide show
  1. package/dist/chunks/{PdfViewer-CSZtzevK.cjs → PdfViewer-K3AvhcPe.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DYfpBL2P.es.js → PdfViewer-SNmZ-cFQ.es.js} +1 -1
  3. package/dist/chunks/{index-0zP7LFOd-CQ5IRTwG.es.js → index-BYoh4bTC-CvwLNvhw.es.js} +1 -1
  4. package/dist/chunks/{index-0zP7LFOd-PDPveafF.cjs → index-BYoh4bTC-D3KgbMGN.cjs} +1 -1
  5. package/dist/chunks/{index-BiYSI2c3.es.js → index-B_y8k48i.es.js} +3 -3
  6. package/dist/chunks/{index-9j37gBmK.cjs → index-BhTmqYMI.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-BzhuUuJx.es.js → super-editor.es-2s47mdgM.es.js} +196 -255
  8. package/dist/chunks/{super-editor.es-D8j9E-4h.cjs → super-editor.es-qzNK-dCq.cjs} +196 -255
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts +132 -52
  10. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  11. package/dist/packages/superdoc/src/core/types/index.d.ts +132 -52
  12. package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
  13. package/dist/super-editor/ai-writer.es.js +2 -2
  14. package/dist/super-editor/chunks/{converter-B3mE6WPB.js → converter-B9P9VS_X.js} +10 -7
  15. package/dist/super-editor/chunks/{docx-zipper-FgUekv4g.js → docx-zipper-CrHein3w.js} +1 -1
  16. package/dist/super-editor/chunks/{editor-B0PiO07g.js → editor-uhFrEJtT.js} +200 -326
  17. package/dist/super-editor/chunks/{index-0zP7LFOd.js → index-BYoh4bTC.js} +1 -1
  18. package/dist/super-editor/chunks/{toolbar-Bj9E8rmT.js → toolbar-BnD2JDA6.js} +2 -2
  19. package/dist/super-editor/converter.es.js +1 -1
  20. package/dist/super-editor/docx-zipper.es.js +2 -2
  21. package/dist/super-editor/editor.es.js +3 -3
  22. package/dist/super-editor/file-zipper.es.js +1 -1
  23. package/dist/super-editor/super-editor/src/core/Attribute.d.ts +75 -29
  24. package/dist/super-editor/super-editor/src/core/Attribute.d.ts.map +1 -1
  25. package/dist/super-editor/super-editor/src/core/CommandService.d.ts +1 -1
  26. package/dist/super-editor/super-editor/src/core/CommandService.d.ts.map +1 -1
  27. package/dist/super-editor/super-editor/src/core/Editor.d.ts +136 -673
  28. package/dist/super-editor/super-editor/src/core/Editor.d.ts.map +1 -1
  29. package/dist/super-editor/super-editor/src/core/EventEmitter.d.ts +23 -14
  30. package/dist/super-editor/super-editor/src/core/EventEmitter.d.ts.map +1 -1
  31. package/dist/super-editor/super-editor/src/core/Extension.d.ts +25 -11
  32. package/dist/super-editor/super-editor/src/core/Extension.d.ts.map +1 -1
  33. package/dist/super-editor/super-editor/src/core/ExtensionService.d.ts +1 -1
  34. package/dist/super-editor/super-editor/src/core/ExtensionService.d.ts.map +1 -1
  35. package/dist/super-editor/super-editor/src/core/Mark.d.ts +28 -12
  36. package/dist/super-editor/super-editor/src/core/Mark.d.ts.map +1 -1
  37. package/dist/super-editor/super-editor/src/core/Node.d.ts +87 -25
  38. package/dist/super-editor/super-editor/src/core/Node.d.ts.map +1 -1
  39. package/dist/super-editor/super-editor/src/core/OxmlNode.d.ts +20 -13
  40. package/dist/super-editor/super-editor/src/core/OxmlNode.d.ts.map +1 -1
  41. package/dist/super-editor/super-editor/src/core/commands/types/index.d.ts +11 -89
  42. package/dist/super-editor/super-editor/src/core/commands/types/index.d.ts.map +1 -1
  43. package/dist/super-editor/super-editor/src/core/extensions/commands.d.ts +1 -1
  44. package/dist/super-editor/super-editor/src/core/extensions/commands.d.ts.map +1 -1
  45. package/dist/super-editor/super-editor/src/core/extensions/editable.d.ts +1 -1
  46. package/dist/super-editor/super-editor/src/core/extensions/editable.d.ts.map +1 -1
  47. package/dist/super-editor/super-editor/src/core/extensions/editorFocus.d.ts +1 -1
  48. package/dist/super-editor/super-editor/src/core/extensions/editorFocus.d.ts.map +1 -1
  49. package/dist/super-editor/super-editor/src/core/extensions/keymap.d.ts +1 -1
  50. package/dist/super-editor/super-editor/src/core/extensions/keymap.d.ts.map +1 -1
  51. package/dist/super-editor/super-editor/src/core/helpers/annotator.d.ts +3 -2
  52. package/dist/super-editor/super-editor/src/core/helpers/annotator.d.ts.map +1 -1
  53. package/dist/super-editor/super-editor/src/core/helpers/getExtensionConfigField.d.ts +12 -5
  54. package/dist/super-editor/super-editor/src/core/helpers/getExtensionConfigField.d.ts.map +1 -1
  55. package/dist/super-editor/super-editor/src/core/helpers/isList.d.ts +1 -1
  56. package/dist/super-editor/super-editor/src/core/helpers/isList.d.ts.map +1 -1
  57. package/dist/super-editor/super-editor/src/core/helpers/list-numbering-helpers.d.ts.map +1 -1
  58. package/dist/super-editor/super-editor/src/core/index.d.ts +18 -13
  59. package/dist/super-editor/super-editor/src/core/index.d.ts.map +1 -1
  60. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/markImporter.d.ts +1 -1
  61. package/dist/super-editor/super-editor/src/core/types/ChainedCommands.d.ts +118 -0
  62. package/dist/super-editor/super-editor/src/core/types/ChainedCommands.d.ts.map +1 -0
  63. package/dist/super-editor/super-editor/src/core/types/EditorConfig.d.ts +265 -0
  64. package/dist/super-editor/super-editor/src/core/types/EditorConfig.d.ts.map +1 -0
  65. package/dist/super-editor/super-editor/src/core/types/EditorEvents.d.ts +144 -0
  66. package/dist/super-editor/super-editor/src/core/types/EditorEvents.d.ts.map +1 -0
  67. package/dist/super-editor/super-editor/src/core/types/EditorTypes.d.ts +73 -0
  68. package/dist/super-editor/super-editor/src/core/types/EditorTypes.d.ts.map +1 -0
  69. package/dist/super-editor/super-editor/src/core/types/__tests__/command-types.d.ts +2 -0
  70. package/dist/super-editor/super-editor/src/core/types/__tests__/command-types.d.ts.map +1 -0
  71. package/dist/super-editor/super-editor/src/core/utilities/callOrGet.d.ts +6 -2
  72. package/dist/super-editor/super-editor/src/core/utilities/callOrGet.d.ts.map +1 -1
  73. package/dist/super-editor/super-editor/src/core/utilities/isIOS.d.ts.map +1 -1
  74. package/dist/super-editor/super-editor/src/extensions/ai/ai-marks.d.ts +8 -2
  75. package/dist/super-editor/super-editor/src/extensions/ai/ai-marks.d.ts.map +1 -1
  76. package/dist/super-editor/super-editor/src/extensions/ai/ai-nodes.d.ts +7 -1
  77. package/dist/super-editor/super-editor/src/extensions/ai/ai-nodes.d.ts.map +1 -1
  78. package/dist/super-editor/super-editor/src/extensions/ai/ai-plugin.d.ts +1 -1
  79. package/dist/super-editor/super-editor/src/extensions/ai/ai-plugin.d.ts.map +1 -1
  80. package/dist/super-editor/super-editor/src/extensions/block-node/block-node.d.ts +1 -1
  81. package/dist/super-editor/super-editor/src/extensions/block-node/block-node.d.ts.map +1 -1
  82. package/dist/super-editor/super-editor/src/extensions/bold/bold.d.ts +3 -1
  83. package/dist/super-editor/super-editor/src/extensions/bold/bold.d.ts.map +1 -1
  84. package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-end.d.ts +1 -1
  85. package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-end.d.ts.map +1 -1
  86. package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-start.d.ts +1 -1
  87. package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-start.d.ts.map +1 -1
  88. package/dist/super-editor/super-editor/src/extensions/collaboration/collaboration.d.ts +6 -1
  89. package/dist/super-editor/super-editor/src/extensions/collaboration/collaboration.d.ts.map +1 -1
  90. package/dist/super-editor/super-editor/src/extensions/collaboration-cursor/collaboration-cursor.d.ts +9 -1
  91. package/dist/super-editor/super-editor/src/extensions/collaboration-cursor/collaboration-cursor.d.ts.map +1 -1
  92. package/dist/super-editor/super-editor/src/extensions/color/color.d.ts +3 -1
  93. package/dist/super-editor/super-editor/src/extensions/color/color.d.ts.map +1 -1
  94. package/dist/super-editor/super-editor/src/extensions/comment/comment.d.ts +18 -3
  95. package/dist/super-editor/super-editor/src/extensions/comment/comment.d.ts.map +1 -1
  96. package/dist/super-editor/super-editor/src/extensions/comment/comments-marks.d.ts +5 -1
  97. package/dist/super-editor/super-editor/src/extensions/comment/comments-marks.d.ts.map +1 -1
  98. package/dist/super-editor/super-editor/src/extensions/comment/comments-plugin.d.ts +1 -1
  99. package/dist/super-editor/super-editor/src/extensions/comment/comments-plugin.d.ts.map +1 -1
  100. package/dist/super-editor/super-editor/src/extensions/content-block/content-block.d.ts +1 -1
  101. package/dist/super-editor/super-editor/src/extensions/content-block/content-block.d.ts.map +1 -1
  102. package/dist/super-editor/super-editor/src/extensions/custom-selection/custom-selection.d.ts +1 -1
  103. package/dist/super-editor/super-editor/src/extensions/custom-selection/custom-selection.d.ts.map +1 -1
  104. package/dist/super-editor/super-editor/src/extensions/document/document.d.ts +1 -1
  105. package/dist/super-editor/super-editor/src/extensions/document/document.d.ts.map +1 -1
  106. package/dist/super-editor/super-editor/src/extensions/dropcursor/dropcursor.d.ts +5 -1
  107. package/dist/super-editor/super-editor/src/extensions/dropcursor/dropcursor.d.ts.map +1 -1
  108. package/dist/super-editor/super-editor/src/extensions/field-annotation/field-annotation.d.ts +1 -1
  109. package/dist/super-editor/super-editor/src/extensions/field-annotation/field-annotation.d.ts.map +1 -1
  110. package/dist/super-editor/super-editor/src/extensions/font-family/font-family.d.ts +3 -1
  111. package/dist/super-editor/super-editor/src/extensions/font-family/font-family.d.ts.map +1 -1
  112. package/dist/super-editor/super-editor/src/extensions/font-size/font-size.d.ts +9 -1
  113. package/dist/super-editor/super-editor/src/extensions/font-size/font-size.d.ts.map +1 -1
  114. package/dist/super-editor/super-editor/src/extensions/format-commands/format-commands.d.ts +7 -1
  115. package/dist/super-editor/super-editor/src/extensions/format-commands/format-commands.d.ts.map +1 -1
  116. package/dist/super-editor/super-editor/src/extensions/gapcursor/gapcursor.d.ts +1 -1
  117. package/dist/super-editor/super-editor/src/extensions/gapcursor/gapcursor.d.ts.map +1 -1
  118. package/dist/super-editor/super-editor/src/extensions/heading/heading.d.ts +3 -1
  119. package/dist/super-editor/super-editor/src/extensions/heading/heading.d.ts.map +1 -1
  120. package/dist/super-editor/super-editor/src/extensions/highlight/highlight.d.ts +3 -1
  121. package/dist/super-editor/super-editor/src/extensions/highlight/highlight.d.ts.map +1 -1
  122. package/dist/super-editor/super-editor/src/extensions/history/history.d.ts +4 -1
  123. package/dist/super-editor/super-editor/src/extensions/history/history.d.ts.map +1 -1
  124. package/dist/super-editor/super-editor/src/extensions/image/image.d.ts +1 -1
  125. package/dist/super-editor/super-editor/src/extensions/image/image.d.ts.map +1 -1
  126. package/dist/super-editor/super-editor/src/extensions/index.d.ts +22 -2
  127. package/dist/super-editor/super-editor/src/extensions/index.d.ts.map +1 -1
  128. package/dist/super-editor/super-editor/src/extensions/italic/italic.d.ts +3 -1
  129. package/dist/super-editor/super-editor/src/extensions/italic/italic.d.ts.map +1 -1
  130. package/dist/super-editor/super-editor/src/extensions/line-break/line-break.d.ts +2 -2
  131. package/dist/super-editor/super-editor/src/extensions/line-break/line-break.d.ts.map +1 -1
  132. package/dist/super-editor/super-editor/src/extensions/line-height/line-height.d.ts +6 -1
  133. package/dist/super-editor/super-editor/src/extensions/line-height/line-height.d.ts.map +1 -1
  134. package/dist/super-editor/super-editor/src/extensions/link/link.d.ts +9 -1
  135. package/dist/super-editor/super-editor/src/extensions/link/link.d.ts.map +1 -1
  136. package/dist/super-editor/super-editor/src/extensions/linked-styles/linked-styles.d.ts +1 -1
  137. package/dist/super-editor/super-editor/src/extensions/linked-styles/linked-styles.d.ts.map +1 -1
  138. package/dist/super-editor/super-editor/src/extensions/mention/mention.d.ts +6 -1
  139. package/dist/super-editor/super-editor/src/extensions/mention/mention.d.ts.map +1 -1
  140. package/dist/super-editor/super-editor/src/extensions/noderesizer/noderesizer.d.ts +1 -1
  141. package/dist/super-editor/super-editor/src/extensions/noderesizer/noderesizer.d.ts.map +1 -1
  142. package/dist/super-editor/super-editor/src/extensions/page-number/page-number.d.ts +2 -2
  143. package/dist/super-editor/super-editor/src/extensions/page-number/page-number.d.ts.map +1 -1
  144. package/dist/super-editor/super-editor/src/extensions/page-reference/page-reference.d.ts +8 -1
  145. package/dist/super-editor/super-editor/src/extensions/page-reference/page-reference.d.ts.map +1 -1
  146. package/dist/super-editor/super-editor/src/extensions/pagination/pagination.d.ts +5 -1
  147. package/dist/super-editor/super-editor/src/extensions/pagination/pagination.d.ts.map +1 -1
  148. package/dist/super-editor/super-editor/src/extensions/paragraph/paragraph.d.ts +1 -1
  149. package/dist/super-editor/super-editor/src/extensions/paragraph/paragraph.d.ts.map +1 -1
  150. package/dist/super-editor/super-editor/src/extensions/placeholder/placeholder.d.ts +3 -1
  151. package/dist/super-editor/super-editor/src/extensions/placeholder/placeholder.d.ts.map +1 -1
  152. package/dist/super-editor/super-editor/src/extensions/popover-plugin/popover-plugin.d.ts +1 -1
  153. package/dist/super-editor/super-editor/src/extensions/popover-plugin/popover-plugin.d.ts.map +1 -1
  154. package/dist/super-editor/super-editor/src/extensions/run/run.d.ts +1 -1
  155. package/dist/super-editor/super-editor/src/extensions/run/run.d.ts.map +1 -1
  156. package/dist/super-editor/super-editor/src/extensions/search/search.d.ts +1 -1
  157. package/dist/super-editor/super-editor/src/extensions/search/search.d.ts.map +1 -1
  158. package/dist/super-editor/super-editor/src/extensions/shape-container/shape-container.d.ts +6 -1
  159. package/dist/super-editor/super-editor/src/extensions/shape-container/shape-container.d.ts.map +1 -1
  160. package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts +1 -1
  161. package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts.map +1 -1
  162. package/dist/super-editor/super-editor/src/extensions/shape-textbox/shape-textbox.d.ts +6 -1
  163. package/dist/super-editor/super-editor/src/extensions/shape-textbox/shape-textbox.d.ts.map +1 -1
  164. package/dist/super-editor/super-editor/src/extensions/slash-menu/slash-menu.d.ts +1 -1
  165. package/dist/super-editor/super-editor/src/extensions/slash-menu/slash-menu.d.ts.map +1 -1
  166. package/dist/super-editor/super-editor/src/extensions/strike/strike.d.ts +3 -1
  167. package/dist/super-editor/super-editor/src/extensions/strike/strike.d.ts.map +1 -1
  168. package/dist/super-editor/super-editor/src/extensions/structured-content/document-part-object.d.ts +6 -1
  169. package/dist/super-editor/super-editor/src/extensions/structured-content/document-part-object.d.ts.map +1 -1
  170. package/dist/super-editor/super-editor/src/extensions/structured-content/document-section.d.ts +1 -1
  171. package/dist/super-editor/super-editor/src/extensions/structured-content/document-section.d.ts.map +1 -1
  172. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-block.d.ts +6 -1
  173. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-block.d.ts.map +1 -1
  174. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +1 -1
  175. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts.map +1 -1
  176. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content.d.ts +6 -1
  177. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content.d.ts.map +1 -1
  178. package/dist/super-editor/super-editor/src/extensions/tab/tab.d.ts +6 -1
  179. package/dist/super-editor/super-editor/src/extensions/tab/tab.d.ts.map +1 -1
  180. package/dist/super-editor/super-editor/src/extensions/table/table.d.ts +1 -1
  181. package/dist/super-editor/super-editor/src/extensions/table/table.d.ts.map +1 -1
  182. package/dist/super-editor/super-editor/src/extensions/table-cell/table-cell.d.ts +5 -1
  183. package/dist/super-editor/super-editor/src/extensions/table-cell/table-cell.d.ts.map +1 -1
  184. package/dist/super-editor/super-editor/src/extensions/table-header/table-header.d.ts +5 -1
  185. package/dist/super-editor/super-editor/src/extensions/table-header/table-header.d.ts.map +1 -1
  186. package/dist/super-editor/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts +6 -1
  187. package/dist/super-editor/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts.map +1 -1
  188. package/dist/super-editor/super-editor/src/extensions/table-row/table-row.d.ts +5 -1
  189. package/dist/super-editor/super-editor/src/extensions/table-row/table-row.d.ts.map +1 -1
  190. package/dist/super-editor/super-editor/src/extensions/text/text.d.ts +1 -1
  191. package/dist/super-editor/super-editor/src/extensions/text/text.d.ts.map +1 -1
  192. package/dist/super-editor/super-editor/src/extensions/text-align/text-align.d.ts +4 -1
  193. package/dist/super-editor/super-editor/src/extensions/text-align/text-align.d.ts.map +1 -1
  194. package/dist/super-editor/super-editor/src/extensions/text-indent/text-indent.d.ts +7 -1
  195. package/dist/super-editor/super-editor/src/extensions/text-indent/text-indent.d.ts.map +1 -1
  196. package/dist/super-editor/super-editor/src/extensions/text-style/text-style.d.ts +3 -1
  197. package/dist/super-editor/super-editor/src/extensions/text-style/text-style.d.ts.map +1 -1
  198. package/dist/super-editor/super-editor/src/extensions/text-transform/text-transform.d.ts +3 -1
  199. package/dist/super-editor/super-editor/src/extensions/text-transform/text-transform.d.ts.map +1 -1
  200. package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts +132 -52
  201. package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts.map +1 -1
  202. package/dist/super-editor/super-editor/src/extensions/track-changes/track-changes.d.ts +1 -1
  203. package/dist/super-editor/super-editor/src/extensions/track-changes/track-changes.d.ts.map +1 -1
  204. package/dist/super-editor/super-editor/src/extensions/track-changes/track-delete.d.ts +5 -1
  205. package/dist/super-editor/super-editor/src/extensions/track-changes/track-delete.d.ts.map +1 -1
  206. package/dist/super-editor/super-editor/src/extensions/track-changes/track-format.d.ts +5 -1
  207. package/dist/super-editor/super-editor/src/extensions/track-changes/track-format.d.ts.map +1 -1
  208. package/dist/super-editor/super-editor/src/extensions/track-changes/track-insert.d.ts +5 -1
  209. package/dist/super-editor/super-editor/src/extensions/track-changes/track-insert.d.ts.map +1 -1
  210. package/dist/super-editor/super-editor/src/extensions/track-changes/trackChangesHelpers/trackedTransaction.d.ts +5 -1
  211. package/dist/super-editor/super-editor/src/extensions/track-changes/trackChangesHelpers/trackedTransaction.d.ts.map +1 -1
  212. package/dist/super-editor/super-editor/src/extensions/types/formatting-commands.d.ts +40 -0
  213. package/dist/super-editor/super-editor/src/extensions/types/formatting-commands.d.ts.map +1 -0
  214. package/dist/super-editor/super-editor/src/extensions/types/history-link-table-commands.d.ts +57 -0
  215. package/dist/super-editor/super-editor/src/extensions/types/history-link-table-commands.d.ts.map +1 -0
  216. package/dist/super-editor/super-editor/src/extensions/types/specialized-commands.d.ts +83 -0
  217. package/dist/super-editor/super-editor/src/extensions/types/specialized-commands.d.ts.map +1 -0
  218. package/dist/super-editor/super-editor/src/extensions/underline/underline.d.ts +3 -1
  219. package/dist/super-editor/super-editor/src/extensions/underline/underline.d.ts.map +1 -1
  220. package/dist/super-editor/super-editor/src/extensions/vector-shape/vector-shape.d.ts +1 -1
  221. package/dist/super-editor/super-editor/src/extensions/vector-shape/vector-shape.d.ts.map +1 -1
  222. package/dist/super-editor/super-editor/src/tests/export/export-helpers/export-helpers.d.ts +1 -1
  223. package/dist/super-editor/super-editor/src/tests/export/export-helpers/export-helpers.d.ts.map +1 -1
  224. package/dist/super-editor/super-editor.es.js +6 -6
  225. package/dist/super-editor/toolbar.es.js +2 -2
  226. package/dist/super-editor.cjs +1 -1
  227. package/dist/super-editor.es.js +1 -1
  228. package/dist/superdoc.cjs +2 -2
  229. package/dist/superdoc.es.js +2 -2
  230. package/dist/superdoc.umd.js +198 -257
  231. package/dist/superdoc.umd.js.map +1 -1
  232. package/package.json +1 -1
@@ -9,11 +9,11 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, updateHTMLAttributes_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
12
+ var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, isElementNode_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, updateHTMLAttributes_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, L as ListHelpers, G as updateNumberingProperties, H as changeListLevel, I as findParentNode, J as isList, K as isMacOS, O as isIOS, Q as getSchemaTypeByName, U as inputRulesPlugin, V as TrackDeleteMarkName, W as TrackInsertMarkName, X as v4, Y as TrackFormatMarkName, Z as comments_module_events, _ as findMark, $ as objectIncludes, a0 as AddMarkStep, a1 as RemoveMarkStep, a2 as twipsToLines, a3 as pixelsToTwips, a4 as helpers, a5 as posToDOMRect, a6 as CommandService, a7 as SuperConverter, a8 as createDocument, a9 as createDocFromMarkdown, aa as createDocFromHTML, ab as EditorState, ac as hasSomeParentWithClass, ad as isActive, ae as unflattenListsInHtml, af as parseSizeUnit, ag as minMax, ah as getLineHeightValueString, ai as updateDOMAttributes, aj as findChildren$5, ak as generateRandomSigned32BitIntStrId, al as kebabCase, am as twipsToPixels, an as halfPointToPixels, ao as getUnderlineCssString, ap as findParentNodeClosestToPos, aq as resolveRunProperties, ar as encodeCSSFromRPr, as as docxNumberingHelpers, at as InputRule, au as resolveParagraphProperties, av as eighthPointsToPixels, aw as linesToTwips, ax as PIXELS_PER_INCH, ay as SelectionRange, az as Transform, aA as isInTable$1, aB as generateDocxRandomId, aC as insertNewRelationship, aD as inchesToPixels } from "./converter-B3mE6WPB.js";
16
- import { D as DocxZipper } from "./docx-zipper-FgUekv4g.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, L as ListHelpers, G as updateNumberingProperties, H as changeListLevel, I as findParentNode, J as isList, K as isMacOS, O as isIOS, Q as getSchemaTypeByName, U as inputRulesPlugin, V as TrackDeleteMarkName, W as TrackInsertMarkName, X as v4, Y as TrackFormatMarkName, Z as comments_module_events, _ as findMark, $ as objectIncludes, a0 as AddMarkStep, a1 as RemoveMarkStep, a2 as twipsToLines, a3 as pixelsToTwips, a4 as helpers, a5 as posToDOMRect, a6 as CommandService, a7 as SuperConverter, a8 as createDocument, a9 as createDocFromMarkdown, aa as createDocFromHTML, ab as EditorState, ac as hasSomeParentWithClass, ad as isActive, ae as unflattenListsInHtml, af as parseSizeUnit, ag as minMax, ah as getLineHeightValueString, ai as updateDOMAttributes, aj as findChildren$5, ak as generateRandomSigned32BitIntStrId, al as kebabCase, am as twipsToPixels, an as halfPointToPixels, ao as getUnderlineCssString, ap as findParentNodeClosestToPos, aq as resolveRunProperties, ar as encodeCSSFromRPr, as as docxNumberingHelpers, at as InputRule, au as resolveParagraphProperties, av as eighthPointsToPixels, aw as linesToTwips, ax as PIXELS_PER_INCH, ay as SelectionRange, az as Transform, aA as isInTable$1, aB as generateDocxRandomId, aC as insertNewRelationship, aD as inchesToPixels } from "./converter-B9P9VS_X.js";
16
+ import { D as DocxZipper } from "./docx-zipper-CrHein3w.js";
17
17
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
@@ -7646,15 +7646,10 @@ const yUndoPlugin = ({ protectedNodes = defaultProtectedNodes, trackedOrigins =
7646
7646
  });
7647
7647
  class Extension {
7648
7648
  constructor(config) {
7649
- __publicField(this, "type", "extension");
7650
- __publicField(this, "name", "extension");
7651
- __publicField(this, "options");
7652
- __publicField(this, "storage");
7653
- __publicField(this, "config", {
7654
- name: this.name
7655
- });
7649
+ this.type = "extension";
7650
+ this.name = "extension";
7656
7651
  this.config = {
7657
- ...this.config,
7652
+ name: this.name,
7658
7653
  ...config
7659
7654
  };
7660
7655
  this.name = this.config.name;
@@ -7663,7 +7658,9 @@ class Extension {
7663
7658
  getExtensionConfigField(this, "addOptions", {
7664
7659
  name: this.name
7665
7660
  })
7666
- );
7661
+ ) || {};
7662
+ } else {
7663
+ this.options = {};
7667
7664
  }
7668
7665
  this.storage = callOrGet(
7669
7666
  getExtensionConfigField(this, "addStorage", {
@@ -7674,10 +7671,10 @@ class Extension {
7674
7671
  }
7675
7672
  /**
7676
7673
  * Static method for creating an extension.
7677
- * @param args Arguments for the constructor.
7674
+ * @param config Configuration for the extension.
7678
7675
  */
7679
- static create(...args) {
7680
- return new Extension(...args);
7676
+ static create(config) {
7677
+ return new Extension(config);
7681
7678
  }
7682
7679
  }
7683
7680
  const History = Extension.create({
@@ -7744,30 +7741,11 @@ const createUndoPlugin = () => {
7744
7741
  return yUndoPluginInstance;
7745
7742
  };
7746
7743
  let Node$1 = class Node2 {
7747
- /**
7748
- * @param {import('./types/index.js').EditorNodeConfig} config
7749
- */
7750
7744
  constructor(config) {
7751
- /** @type {import('prosemirror-model').NodeType | String} */
7752
- __publicField(this, "type", "node");
7753
- /** @type {string} */
7754
- __publicField(this, "name", "node");
7755
- /** @type {import('./types/index.js').EditorNodeOptions} */
7756
- __publicField(this, "options");
7757
- /** @type {string} */
7758
- __publicField(this, "group");
7759
- /** @type {boolean} */
7760
- __publicField(this, "atom");
7761
- /** @type {import('./Editor.js').Editor} */
7762
- __publicField(this, "editor");
7763
- /** @type {import('./types/index.js').EditorNodeStorage} */
7764
- __publicField(this, "storage");
7765
- /** @type {import('./types/index.js').EditorNodeConfig} */
7766
- __publicField(this, "config", {
7767
- name: this.name
7768
- });
7745
+ this.type = "node";
7746
+ this.name = "node";
7769
7747
  this.config = {
7770
- ...this.config,
7748
+ name: this.name,
7771
7749
  ...config
7772
7750
  };
7773
7751
  this.name = this.config.name;
@@ -7777,7 +7755,9 @@ let Node$1 = class Node2 {
7777
7755
  getExtensionConfigField(this, "addOptions", {
7778
7756
  name: this.name
7779
7757
  })
7780
- );
7758
+ ) || {};
7759
+ } else {
7760
+ this.options = {};
7781
7761
  }
7782
7762
  this.storage = callOrGet(
7783
7763
  getExtensionConfigField(this, "addStorage", {
@@ -7788,9 +7768,8 @@ let Node$1 = class Node2 {
7788
7768
  }
7789
7769
  /**
7790
7770
  * Factory method to construct a new Node extension.
7791
- *
7792
- * @param {import('./types/index.js').EditorNodeConfig} config - The node configuration.
7793
- * @returns {Node} A new Node instance.
7771
+ * @param config - The node configuration.
7772
+ * @returns A new Node instance.
7794
7773
  */
7795
7774
  static create(config) {
7796
7775
  return new Node2(config);
@@ -7798,16 +7777,10 @@ let Node$1 = class Node2 {
7798
7777
  };
7799
7778
  class Mark {
7800
7779
  constructor(config) {
7801
- __publicField(this, "type", "mark");
7802
- __publicField(this, "name", "mark");
7803
- __publicField(this, "options");
7804
- __publicField(this, "storage");
7805
- __publicField(this, "isExternal");
7806
- __publicField(this, "config", {
7807
- name: this.name
7808
- });
7780
+ this.type = "mark";
7781
+ this.name = "mark";
7809
7782
  this.config = {
7810
- ...this.config,
7783
+ name: this.name,
7811
7784
  ...config
7812
7785
  };
7813
7786
  this.name = this.config.name;
@@ -7817,7 +7790,9 @@ class Mark {
7817
7790
  getExtensionConfigField(this, "addOptions", {
7818
7791
  name: this.name
7819
7792
  })
7820
- );
7793
+ ) || {};
7794
+ } else {
7795
+ this.options = {};
7821
7796
  }
7822
7797
  this.storage = callOrGet(
7823
7798
  getExtensionConfigField(this, "addStorage", {
@@ -7828,10 +7803,10 @@ class Mark {
7828
7803
  }
7829
7804
  /**
7830
7805
  * Static method for creating Mark extension.
7831
- * @param args Arguments for the constructor.
7806
+ * @param config Configuration for the mark.
7832
7807
  */
7833
- static create(...args) {
7834
- return new Mark(...args);
7808
+ static create(config) {
7809
+ return new Mark(config);
7835
7810
  }
7836
7811
  }
7837
7812
  class Attribute {
@@ -7923,8 +7898,10 @@ class Attribute {
7923
7898
  continue;
7924
7899
  }
7925
7900
  if (key2 === "class") {
7926
- const valueClasses = value ? value.split(" ") : [];
7927
- const existingClasses = mergedAttributes[key2] ? mergedAttributes[key2].split(" ") : [];
7901
+ const valueStr = typeof value === "string" ? value : String(value);
7902
+ const existingStr = typeof mergedAttributes[key2] === "string" ? mergedAttributes[key2] : String(mergedAttributes[key2] || "");
7903
+ const valueClasses = valueStr ? valueStr.split(" ") : [];
7904
+ const existingClasses = existingStr ? existingStr.split(" ") : [];
7928
7905
  const insertClasses = valueClasses.filter((value2) => !existingClasses.includes(value2));
7929
7906
  mergedAttributes[key2] = [...existingClasses, ...insertClasses].join(" ");
7930
7907
  } else if (key2 === "style") {
@@ -8028,7 +8005,11 @@ getGlobalAttributes_fn = function(extensions, defaultAttribute) {
8028
8005
  options: extension.options,
8029
8006
  storage: extension.storage
8030
8007
  };
8031
- const addGlobalAttributes = getExtensionConfigField(extension, "addGlobalAttributes", context);
8008
+ const addGlobalAttributes = getExtensionConfigField(
8009
+ extension,
8010
+ "addGlobalAttributes",
8011
+ context
8012
+ );
8032
8013
  if (!addGlobalAttributes) continue;
8033
8014
  const globalAttributes = addGlobalAttributes();
8034
8015
  for (const globalAttr of globalAttributes) {
@@ -8048,7 +8029,11 @@ getNodeAndMarksAttributes_fn = function(extensions, defaultAttribute) {
8048
8029
  options: extension.options,
8049
8030
  storage: extension.storage
8050
8031
  };
8051
- const addAttributes = getExtensionConfigField(extension, "addAttributes", context);
8032
+ const addAttributes = getExtensionConfigField(
8033
+ extension,
8034
+ "addAttributes",
8035
+ context
8036
+ );
8052
8037
  if (!addAttributes) continue;
8053
8038
  const attributes = addAttributes();
8054
8039
  for (const [name, attribute] of Object.entries(attributes)) {
@@ -8068,6 +8053,9 @@ getNodeAndMarksAttributes_fn = function(extensions, defaultAttribute) {
8068
8053
  }
8069
8054
  return extensionAttributes;
8070
8055
  };
8056
+ isElementNode_fn = function(node) {
8057
+ return Boolean(node) && typeof node.getAttribute === "function";
8058
+ };
8071
8059
  __privateAdd(Attribute, _Attribute_static);
8072
8060
  const _Schema = class _Schema {
8073
8061
  /**
@@ -8193,20 +8181,14 @@ createMarksSchema_fn = function(markExtensions, attributes, editor) {
8193
8181
  __privateAdd(_Schema, _Schema_static);
8194
8182
  let Schema = _Schema;
8195
8183
  class OxmlNode extends Node$1 {
8196
- /**
8197
- * @param {import('./types/index.js').OxmlNodeConfig} config
8198
- */
8199
8184
  constructor(config) {
8200
8185
  super(config);
8201
- /** @type {string} */
8202
- __publicField(this, "oXmlName");
8203
8186
  this.oXmlName = config.oXmlName;
8204
8187
  }
8205
8188
  /**
8206
8189
  * Factory method to construct a new OxmlNode instance.
8207
- *
8208
- * @param {import('./types/index.js').OxmlNodeConfig} config
8209
- * @returns {OxmlNode} A new OxmlNode instance.
8190
+ * @param config - The OXML node configuration.
8191
+ * @returns A new OxmlNode instance.
8210
8192
  */
8211
8193
  static create(config) {
8212
8194
  return new OxmlNode(config);
@@ -9719,8 +9701,8 @@ class EventEmitter {
9719
9701
  }
9720
9702
  /**
9721
9703
  * Subscribe to the event.
9722
- * @param {string} name Event name.
9723
- * @param {(...args: any[]) => void} fn Callback.
9704
+ * @param name Event name.
9705
+ * @param fn Callback.
9724
9706
  * @returns {void}
9725
9707
  */
9726
9708
  on(name, fn2) {
@@ -9730,8 +9712,8 @@ class EventEmitter {
9730
9712
  }
9731
9713
  /**
9732
9714
  * Emit event.
9733
- * @param {string} name Event name.
9734
- * @param {...any} args Arguments to pass to each listener.
9715
+ * @param name Event name.
9716
+ * @param args Arguments to pass to each listener.
9735
9717
  * @returns {void}
9736
9718
  */
9737
9719
  emit(name, ...args) {
@@ -9744,8 +9726,8 @@ class EventEmitter {
9744
9726
  /**
9745
9727
  * Remove a specific callback from event
9746
9728
  * or all event subscriptions.
9747
- * @param {string} name Event name.
9748
- * @param {(...args: any[]) => void} fn Callback.
9729
+ * @param name Event name.
9730
+ * @param fn Callback.
9749
9731
  * @returns {void}
9750
9732
  */
9751
9733
  off(name, fn2) {
@@ -9762,8 +9744,8 @@ class EventEmitter {
9762
9744
  }
9763
9745
  /**
9764
9746
  * Subscribe to an event that will be called only once.
9765
- * @param {string} name Event name.
9766
- * @param {(...args: any[]) => void} fn Callback.
9747
+ * @param name Event name.
9748
+ * @param fn Callback.
9767
9749
  * @returns {void}
9768
9750
  */
9769
9751
  once(name, fn2) {
@@ -13517,47 +13499,19 @@ const getLevel = (node) => {
13517
13499
  const _Editor = class _Editor extends EventEmitter {
13518
13500
  /**
13519
13501
  * Create a new Editor instance
13520
- * @param {EditorOptions} options - Editor configuration options
13502
+ * @param options - Editor configuration options
13521
13503
  */
13522
13504
  constructor(options) {
13523
13505
  super();
13524
13506
  __privateAdd(this, _Editor_instances);
13525
13507
  /**
13526
13508
  * Command service for handling editor commands
13527
- * @type {CommandService}
13528
13509
  */
13529
13510
  __privateAdd(this, _commandService);
13530
- /**
13531
- * Service for managing extensions
13532
- * @type {Object}
13533
- */
13534
- __publicField(this, "extensionService");
13535
- /**
13536
- * Storage for extension data
13537
- * @type {Object}
13538
- */
13539
- __publicField(this, "extensionStorage", {});
13540
- /**
13541
- * ProseMirror schema for the editor
13542
- * @type {Object}
13543
- */
13544
- __publicField(this, "schema");
13545
- /**
13546
- * ProseMirror view instance
13547
- * @type {Object}
13548
- */
13549
- __publicField(this, "view");
13550
- /**
13551
- * Whether the editor currently has focus
13552
- * @type {boolean}
13553
- */
13554
- __publicField(this, "isFocused", false);
13555
- /**
13556
- * All the embedded fonts that were imported by the Editor
13557
- * @type {string[]}
13558
- */
13559
- __publicField(this, "fontsImported", []);
13560
- __publicField(this, "options", {
13511
+ this.extensionStorage = {};
13512
+ this.isFocused = false;
13513
+ this.fontsImported = [];
13514
+ this.options = {
13561
13515
  element: null,
13562
13516
  selector: null,
13563
13517
  isHeadless: false,
@@ -13590,11 +13544,15 @@ const _Editor = class _Editor extends EventEmitter {
13590
13544
  annotations: false,
13591
13545
  isInternal: false,
13592
13546
  externalExtensions: [],
13547
+ isChildEditor: false,
13593
13548
  numbering: {},
13594
13549
  isHeaderOrFooter: false,
13550
+ pagination: null,
13595
13551
  lastSelection: null,
13596
13552
  suppressDefaultDocxStyles: false,
13597
13553
  jsonOverride: null,
13554
+ loadFromSchema: false,
13555
+ fragment: null,
13598
13556
  onBeforeCreate: () => null,
13599
13557
  onCreate: () => null,
13600
13558
  onUpdate: () => null,
@@ -13626,15 +13584,20 @@ const _Editor = class _Editor extends EventEmitter {
13626
13584
  customUpdatedFiles: {},
13627
13585
  isHeaderFooterChanged: false,
13628
13586
  isCustomXmlChanged: false,
13587
+ ydoc: null,
13588
+ collaborationProvider: null,
13589
+ collaborationIsReady: false,
13590
+ shouldLoadComments: false,
13591
+ replacedFile: false,
13629
13592
  focusTarget: null,
13630
13593
  permissionResolver: null,
13631
13594
  // header/footer editors may have parent(main) editor set
13632
13595
  parentEditor: null
13633
- });
13596
+ };
13634
13597
  __privateMethod(this, _Editor_instances, initContainerElement_fn).call(this, options);
13635
13598
  __privateMethod(this, _Editor_instances, checkHeadless_fn).call(this, options);
13636
13599
  this.setOptions(options);
13637
- let modes = {
13600
+ const modes = {
13638
13601
  docx: () => __privateMethod(this, _Editor_instances, init_fn).call(this),
13639
13602
  text: () => __privateMethod(this, _Editor_instances, initRichText_fn).call(this),
13640
13603
  html: () => __privateMethod(this, _Editor_instances, initRichText_fn).call(this),
@@ -13642,14 +13605,13 @@ const _Editor = class _Editor extends EventEmitter {
13642
13605
  console.log("Not implemented.");
13643
13606
  }
13644
13607
  };
13645
- let initMode = modes[this.options.mode] ?? modes.default;
13608
+ const initMode = modes[this.options.mode] ?? modes.default;
13646
13609
  const { setHighContrastMode } = useHighContrastMode();
13647
13610
  this.setHighContrastMode = setHighContrastMode;
13648
13611
  initMode();
13649
13612
  }
13650
13613
  /**
13651
13614
  * Getter which indicates if any changes happen in Editor
13652
- * @returns {boolean}
13653
13615
  */
13654
13616
  get docChanged() {
13655
13617
  return this.options.isHeaderFooterChanged || this.options.isCustomXmlChanged || !this.options.initialState.doc.eq(this.state.doc);
@@ -13665,97 +13627,84 @@ const _Editor = class _Editor extends EventEmitter {
13665
13627
  if (this.view) {
13666
13628
  this.view.destroy();
13667
13629
  }
13668
- this.view = null;
13630
+ this.view = void 0;
13669
13631
  }
13670
13632
  /**
13671
13633
  * Set the toolbar for this editor
13672
- * @param {Object} toolbar - The toolbar instance
13673
- * @returns {void}
13674
13634
  */
13675
13635
  setToolbar(toolbar) {
13676
13636
  this.toolbar = toolbar;
13677
13637
  }
13678
13638
  /**
13679
13639
  * Focus the editor.
13680
- * @returns {void}
13681
13640
  */
13682
13641
  focus() {
13683
13642
  this.view?.focus();
13684
13643
  }
13685
13644
  /**
13686
13645
  * Get the editor state
13687
- * @returns {Object} ProseMirror state
13688
13646
  */
13689
13647
  get state() {
13690
13648
  return this.view?.state;
13691
13649
  }
13692
13650
  /**
13693
13651
  * Get the editor storage.
13694
- * @returns {Object} Editor storage object
13695
13652
  */
13696
13653
  get storage() {
13697
13654
  return this.extensionStorage;
13698
13655
  }
13699
13656
  /**
13700
13657
  * Get object of registered commands.
13701
- * @returns {import('./commands/types/index.js').EditorCommands} Commands object
13702
13658
  */
13703
13659
  get commands() {
13704
13660
  return __privateGet(this, _commandService)?.commands;
13705
13661
  }
13706
13662
  /**
13707
13663
  * Get extension helpers.
13708
- * @returns {EditorHelpers} Object with helper methods for extensions
13709
13664
  */
13710
13665
  get helpers() {
13711
13666
  return this.extensionService.helpers;
13712
13667
  }
13713
13668
  /**
13714
13669
  * Check if the editor is editable.
13715
- * @returns {boolean}
13716
13670
  */
13717
13671
  get isEditable() {
13718
13672
  return Boolean(this.options.editable && this.view && this.view.editable);
13719
13673
  }
13720
13674
  /**
13721
13675
  * Check if editor is destroyed.
13722
- * @returns {boolean}
13723
13676
  */
13724
13677
  get isDestroyed() {
13725
13678
  return this.view?.isDestroyed ?? true;
13726
13679
  }
13727
13680
  /**
13728
13681
  * Get the editor element
13729
- * @returns {HTMLElement} The editor element
13730
13682
  */
13731
13683
  get element() {
13732
13684
  return this.options.element;
13733
13685
  }
13734
13686
  /**
13735
13687
  * Get possible users of the editor.
13736
- * @returns {Array.<User>} List of users
13737
13688
  */
13738
13689
  get users() {
13739
13690
  return this.options.users;
13740
13691
  }
13741
13692
  /**
13742
13693
  * Create a chain of commands to call multiple commands at once.
13743
- * @returns {Object} Command chain
13744
13694
  */
13745
13695
  chain() {
13746
13696
  return __privateGet(this, _commandService).chain();
13747
13697
  }
13748
13698
  /**
13749
13699
  * Check if a command or a chain of commands can be executed. Without executing it.
13750
- * @returns {Object} Object with methods to check command availability
13751
13700
  */
13752
13701
  can() {
13753
13702
  return __privateGet(this, _commandService).can();
13754
13703
  }
13755
13704
  /**
13756
13705
  * Set the document mode
13757
- * @param {string} documentMode - The document mode ('editing', 'viewing', 'suggesting')
13758
- * @param {string} caller - Calling context
13706
+ * @param documentMode - The document mode ('editing', 'viewing', 'suggesting')
13707
+ * @param caller - Calling context
13759
13708
  */
13760
13709
  setDocumentMode(documentMode, caller) {
13761
13710
  if (this.options.isHeaderOrFooter || this.options.isChildEditor) return;
@@ -13799,7 +13748,6 @@ const _Editor = class _Editor extends EventEmitter {
13799
13748
  }
13800
13749
  /**
13801
13750
  * Export the yjs binary from the current state.
13802
- * @returns {Promise<Uint8Array>} The exported yjs binary
13803
13751
  */
13804
13752
  async generateCollaborationUpdate() {
13805
13753
  return await generateCollaborationData(this);
@@ -13808,11 +13756,10 @@ const _Editor = class _Editor extends EventEmitter {
13808
13756
  * Initialize data for collaborative editing
13809
13757
  * If we are replacing data and have a valid provider, listen for synced event
13810
13758
  * so that we can initialize the data
13811
- * @returns {void}
13812
13759
  */
13813
13760
  initializeCollaborationData() {
13814
13761
  if (!this.options.isNewFile || !this.options.collaborationProvider) return;
13815
- const { collaborationProvider: provider } = this.options;
13762
+ const provider = this.options.collaborationProvider;
13816
13763
  const postSyncInit = () => {
13817
13764
  provider.off("synced", postSyncInit);
13818
13765
  __privateMethod(this, _Editor_instances, insertNewFileData_fn).call(this);
@@ -13824,8 +13771,7 @@ const _Editor = class _Editor extends EventEmitter {
13824
13771
  * Replace content of editor that was created with loadFromSchema option
13825
13772
  * Used to replace content of other header/footer when one of it was edited
13826
13773
  *
13827
- * @param {object} content - new editor content json (retrieved from editor.getUpdatedJson)
13828
- * @returns {void}
13774
+ * @param content - new editor content json (retrieved from editor.getUpdatedJson)
13829
13775
  */
13830
13776
  replaceContent(content) {
13831
13777
  this.setOptions({
@@ -13842,8 +13788,6 @@ const _Editor = class _Editor extends EventEmitter {
13842
13788
  }
13843
13789
  /**
13844
13790
  * Set editor options and update state.
13845
- * @param {EditorOptions} options - Editor options
13846
- * @returns {void}
13847
13791
  */
13848
13792
  setOptions(options = {}) {
13849
13793
  this.options = {
@@ -13863,9 +13807,6 @@ const _Editor = class _Editor extends EventEmitter {
13863
13807
  }
13864
13808
  /**
13865
13809
  * Set whether the editor is editable
13866
- * @param {boolean} [editable=true] - Whether the editor is editable
13867
- * @param {boolean} [emitUpdate=true] - Whether to emit an update event
13868
- * @returns {void}
13869
13810
  */
13870
13811
  setEditable(editable = true, emitUpdate = true) {
13871
13812
  this.setOptions({ editable });
@@ -13877,7 +13818,6 @@ const _Editor = class _Editor extends EventEmitter {
13877
13818
  * Register PM plugin.
13878
13819
  * @param plugin PM plugin.
13879
13820
  * @param handlePlugins Optional function for handling plugin merge.
13880
- * @returns {void}
13881
13821
  */
13882
13822
  registerPlugin(plugin, handlePlugins) {
13883
13823
  if (!this.state?.plugins) return;
@@ -13887,25 +13827,21 @@ const _Editor = class _Editor extends EventEmitter {
13887
13827
  }
13888
13828
  /**
13889
13829
  * Unregister a PM plugin
13890
- * @param {string|Object} nameOrPluginKey - Plugin name or plugin instance
13891
- * @returns {void}
13892
13830
  */
13893
13831
  unregisterPlugin(nameOrPluginKey) {
13894
13832
  if (this.isDestroyed) return;
13895
- const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
13833
+ const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey?.key ?? "";
13896
13834
  const state = this.state.reconfigure({
13897
- plugins: this.state.plugins.filter((plugin) => !plugin.key.startsWith(name))
13835
+ plugins: this.state.plugins.filter((plugin) => !__privateMethod(this, _Editor_instances, getPluginKeyName_fn).call(this, plugin).startsWith(name))
13898
13836
  });
13899
13837
  this.view.updateState(state);
13900
13838
  }
13901
13839
  /**
13902
13840
  * Load the data from DOCX to be used in the schema.
13903
13841
  * Expects a DOCX file.
13904
- * @static
13905
- * @async
13906
- * @param {File|Blob|Buffer} fileSource - The DOCX file to load (File/Blob in browser, Buffer in Node.js)
13907
- * @param {boolean} [isNode=false] - Whether the method is being called in a Node.js environment
13908
- * @returns {Promise<Array>} - A promise that resolves to an array containing:
13842
+ * @param fileSource - The DOCX file to load (File/Blob in browser, Buffer in Node.js)
13843
+ * @param isNode - Whether the method is being called in a Node.js environment
13844
+ * @returns A promise that resolves to an array containing:
13909
13845
  * - [0] xmlFiles - Array of XML files extracted from the DOCX
13910
13846
  * - [1] mediaFiles - Object containing media files with URLs (browser only)
13911
13847
  * - [2] mediaFiles - Object containing media files with base64 data
@@ -13920,33 +13856,22 @@ const _Editor = class _Editor extends EventEmitter {
13920
13856
  }
13921
13857
  /**
13922
13858
  * Get the document version
13923
- * @static
13924
- * @param {Object} doc - Document object
13925
- * @returns {string} Document version
13926
13859
  */
13927
13860
  static getDocumentVersion(doc2) {
13928
13861
  return SuperConverter.getStoredSuperdocVersion(doc2);
13929
13862
  }
13930
13863
  /**
13931
13864
  * Set the document version
13932
- * @static
13933
- * @param {Object} doc - Document object
13934
- * @param {string} version - New version
13935
- * @returns {string} The set version
13936
13865
  */
13937
13866
  static setDocumentVersion(doc2, version2) {
13938
13867
  return SuperConverter.setStoredSuperdocVersion(doc2, version2);
13939
13868
  }
13940
13869
  /**
13941
13870
  * Get the document GUID
13942
- * @static
13943
- * @param {Object} doc - Document object
13944
- * @returns {string|null} Document GUID
13945
13871
  */
13946
13872
  static getDocumentGuid(doc2) {
13947
13873
  return SuperConverter.extractDocumentGuid(doc2);
13948
13874
  }
13949
- // Deprecated
13950
13875
  /**
13951
13876
  * @deprecated use setDocumentVersion instead
13952
13877
  */
@@ -13956,7 +13881,6 @@ const _Editor = class _Editor extends EventEmitter {
13956
13881
  }
13957
13882
  /**
13958
13883
  * Creates all node views.
13959
- * @returns {void}
13960
13884
  */
13961
13885
  createNodeViews() {
13962
13886
  this.view.setProps({
@@ -13965,7 +13889,6 @@ const _Editor = class _Editor extends EventEmitter {
13965
13889
  }
13966
13890
  /**
13967
13891
  * Get the maximum content size
13968
- * @returns {Object} Size object with width and height
13969
13892
  */
13970
13893
  getMaxContentSize() {
13971
13894
  if (!this.converter) return {};
@@ -13989,7 +13912,7 @@ const _Editor = class _Editor extends EventEmitter {
13989
13912
  return;
13990
13913
  }
13991
13914
  proseMirror.setAttribute("role", "document");
13992
- proseMirror.setAttribute("aria-multiline", true);
13915
+ proseMirror.setAttribute("aria-multiline", "true");
13993
13916
  proseMirror.setAttribute("aria-label", "Main content area, start typing to enter text.");
13994
13917
  proseMirror.setAttribute("aria-description", "");
13995
13918
  proseMirror.classList.remove("view-mode");
@@ -14020,7 +13943,7 @@ const _Editor = class _Editor extends EventEmitter {
14020
13943
  element.style.touchAction = "auto";
14021
13944
  element.style.webkitOverflowScrolling = "touch";
14022
13945
  const defaultLineHeight = 1.2;
14023
- proseMirror.style.lineHeight = defaultLineHeight;
13946
+ proseMirror.style.lineHeight = String(defaultLineHeight);
14024
13947
  if (!hasPaginationEnabled) {
14025
13948
  proseMirror.style.paddingTop = "1in";
14026
13949
  proseMirror.style.paddingBottom = "1in";
@@ -14034,8 +13957,7 @@ const _Editor = class _Editor extends EventEmitter {
14034
13957
  * Get page size and margins from the converter.
14035
13958
  * Set document default font and font size.
14036
13959
  *
14037
- * @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
14038
- * @returns {void}
13960
+ * @param element - The DOM element to apply styles to
14039
13961
  */
14040
13962
  initDefaultStyles(element = this.element, isPaginationEnabled = true) {
14041
13963
  if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
@@ -14046,9 +13968,6 @@ const _Editor = class _Editor extends EventEmitter {
14046
13968
  /**
14047
13969
  * Initializes responsive styles for mobile devices.
14048
13970
  * Sets up scaling based on viewport width and handles orientation changes.
14049
- *
14050
- * @param {HTMLElement|void} element - The DOM element to apply mobile styles to
14051
- * @returns {void}
14052
13971
  */
14053
13972
  initMobileStyles(element) {
14054
13973
  if (!element) {
@@ -14083,30 +14002,28 @@ const _Editor = class _Editor extends EventEmitter {
14083
14002
  };
14084
14003
  if ("orientation" in screen && "addEventListener" in screen.orientation) {
14085
14004
  screen.orientation.addEventListener("change", handleResize);
14086
- } else if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
14087
- window.matchMedia("(orientation: portrait)").addEventListener("change", handleResize);
14088
- }
14089
- if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
14090
- window.addEventListener("resize", () => handleResize);
14005
+ } else {
14006
+ const mediaQueryList = typeof window.matchMedia === "function" ? window.matchMedia("(orientation: portrait)") : null;
14007
+ if (mediaQueryList?.addEventListener) {
14008
+ mediaQueryList.addEventListener("change", handleResize);
14009
+ }
14091
14010
  }
14011
+ window.addEventListener("resize", () => handleResize);
14092
14012
  }
14093
14013
  /**
14094
14014
  * Get document identifier for telemetry (async - may generate hash)
14095
- * @returns {Promise<string>} GUID for modified docs, hash for unmodified
14096
14015
  */
14097
14016
  async getDocumentIdentifier() {
14098
14017
  return await this.converter?.getDocumentIdentifier() || null;
14099
14018
  }
14100
14019
  /**
14101
14020
  * Get permanent document GUID (sync - only for modified documents)
14102
- * @returns {string|null} GUID or null if document hasn't been modified
14103
14021
  */
14104
14022
  getDocumentGuid() {
14105
14023
  return this.converter?.documentGuid || null;
14106
14024
  }
14107
14025
  /**
14108
14026
  * Check if document has been modified
14109
- * @returns {boolean}
14110
14027
  */
14111
14028
  isDocumentModified() {
14112
14029
  return this.converter?.documentModified || false;
@@ -14122,14 +14039,15 @@ const _Editor = class _Editor extends EventEmitter {
14122
14039
  version: this.converter?.getSuperdocVersion()
14123
14040
  };
14124
14041
  }
14125
- // Deprecated for backward compatibility
14042
+ /**
14043
+ * @deprecated use getDocumentGuid instead
14044
+ */
14126
14045
  getDocumentId() {
14127
14046
  console.warn("getDocumentId is deprecated, use getDocumentGuid instead");
14128
14047
  return this.getDocumentGuid();
14129
14048
  }
14130
14049
  /**
14131
14050
  * Get attrs of the currently selected node or mark.
14132
- * @param {String} nameOrType
14133
14051
  * @example
14134
14052
  * editor.getAttributes('textStyle').color
14135
14053
  */
@@ -14138,9 +14056,8 @@ const _Editor = class _Editor extends EventEmitter {
14138
14056
  }
14139
14057
  /**
14140
14058
  * Returns if the currently selected node or mark is active.
14141
- * @param {String|Object} nameOrAttributes - The name of the node/mark or an attributes object
14142
- * @param {Object} [attributesOrUndefined] - Optional attributes to check when first parameter is a name
14143
- * @returns {Boolean} Whether the node or mark is active with the specified attributes
14059
+ * @param nameOrAttributes - The name of the node/mark or an attributes object
14060
+ * @param attributesOrUndefined - Optional attributes to check when first parameter is a name
14144
14061
  * @example
14145
14062
  * editor.isActive('bold')
14146
14063
  * editor.isActive('textStyle', { color: 'purple' })
@@ -14153,18 +14070,12 @@ const _Editor = class _Editor extends EventEmitter {
14153
14070
  }
14154
14071
  /**
14155
14072
  * Get the editor content as JSON
14156
- * @returns {Object} Editor content as JSON
14157
14073
  */
14158
14074
  getJSON() {
14159
14075
  return this.state.doc.toJSON();
14160
14076
  }
14161
14077
  /**
14162
14078
  * Get document metadata including GUID, modification status, and version
14163
- * @returns {{
14164
- * documentGuid: string | null,
14165
- * isModified: boolean,
14166
- * version: string | null
14167
- * }} Document metadata
14168
14079
  */
14169
14080
  getMetadata() {
14170
14081
  return {
@@ -14175,9 +14086,6 @@ const _Editor = class _Editor extends EventEmitter {
14175
14086
  }
14176
14087
  /**
14177
14088
  * Get the editor content as HTML
14178
- * @param {Object} options - Options for the HTML serializer
14179
- * @param {boolean} [options.unflattenLists] - Whether to unflatten lists in the HTML
14180
- * @returns {string} Editor content as HTML
14181
14089
  */
14182
14090
  getHTML({ unflattenLists = false } = {}) {
14183
14091
  const tempDocument = document.implementation.createHTMLDocument();
@@ -14192,7 +14100,6 @@ const _Editor = class _Editor extends EventEmitter {
14192
14100
  }
14193
14101
  /**
14194
14102
  * Get the editor content as Markdown
14195
- * @returns {Promise<string>} Editor content as Markdown
14196
14103
  */
14197
14104
  async getMarkdown() {
14198
14105
  const [
@@ -14202,7 +14109,7 @@ const _Editor = class _Editor extends EventEmitter {
14202
14109
  { default: remarkStringify },
14203
14110
  { default: remarkGfm }
14204
14111
  ] = await Promise.all([
14205
- import("./index-0zP7LFOd.js"),
14112
+ import("./index-BYoh4bTC.js"),
14206
14113
  import("./index-DRCvimau.js"),
14207
14114
  import("./index-C_x_N6Uh.js"),
14208
14115
  import("./index-D_sWOSiG.js"),
@@ -14217,7 +14124,6 @@ const _Editor = class _Editor extends EventEmitter {
14217
14124
  }
14218
14125
  /**
14219
14126
  * Get the document version from the converter
14220
- * @returns {string|null} The SuperDoc version stored in the document
14221
14127
  */
14222
14128
  getDocumentVersion() {
14223
14129
  return this.converter?.getSuperdocVersion() || null;
@@ -14226,25 +14132,18 @@ const _Editor = class _Editor extends EventEmitter {
14226
14132
  * Create a child editor linked to this editor.
14227
14133
  * This is useful for creating header/footer editors that are linked to the main editor.
14228
14134
  * Or paragraph fields that rely on the same underlying document and list defintions
14229
- * @param {EditorOptions} options - Options for the child editor
14230
- * @returns {Editor} A new child editor instance linked to this editor
14231
14135
  */
14232
14136
  createChildEditor(options) {
14233
14137
  return createLinkedChildEditor(this, options);
14234
14138
  }
14235
14139
  /**
14236
14140
  * Get page styles
14237
- * @returns {Object} Page styles
14238
14141
  */
14239
14142
  getPageStyles() {
14240
14143
  return this.converter?.pageStyles || {};
14241
14144
  }
14242
14145
  /**
14243
14146
  * Update page styles
14244
- *
14245
- * @param {Object} param0
14246
- * @param {Object} param0.pageMargins The new page margins
14247
- * @returns {void}
14248
14147
  */
14249
14148
  updatePageStyle({ pageMargins }) {
14250
14149
  if (!this.converter) return;
@@ -14270,13 +14169,6 @@ const _Editor = class _Editor extends EventEmitter {
14270
14169
  }
14271
14170
  /**
14272
14171
  * Export the editor document to DOCX.
14273
- * @async
14274
- * @param {Object} options - The export options
14275
- * @param {boolean} [options.isFinalDoc=false] - Whether this is the final document version
14276
- * @param {string} [options.commentsType] - The type of comments to include
14277
- * @param {Array} [options.comments=[]] - Array of comments to include in the document
14278
- * @param {boolean} [options.getUpdatedDocs=false] - When set to true return only updated docx files
14279
- * @returns {Promise<Blob|ArrayBuffer|Object>} The exported DOCX file or updated docx files
14280
14172
  */
14281
14173
  async exportDocx({
14282
14174
  isFinalDoc = false,
@@ -14311,7 +14203,8 @@ const _Editor = class _Editor extends EventEmitter {
14311
14203
  const updatedHeadersFooters = {};
14312
14204
  Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
14313
14205
  if (name.includes("header") || name.includes("footer")) {
14314
- const resultXml = this.converter.schemaToXml(json2.elements[0]);
14206
+ const jsonObj = json2;
14207
+ const resultXml = this.converter.schemaToXml(jsonObj.elements?.[0]);
14315
14208
  updatedHeadersFooters[name] = String(resultXml);
14316
14209
  }
14317
14210
  });
@@ -14366,19 +14259,19 @@ const _Editor = class _Editor extends EventEmitter {
14366
14259
  fonts: this.options.fonts,
14367
14260
  isHeadless: this.options.isHeadless
14368
14261
  });
14369
- this.options.telemetry?.trackUsage("document_export", {
14262
+ this.options.telemetry?.trackUsage?.("document_export", {
14370
14263
  documentType: "docx",
14371
14264
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
14372
14265
  });
14373
14266
  return result;
14374
14267
  } catch (error) {
14375
- this.emit("exception", { error, editor: this });
14376
- console.error(error);
14268
+ const err = error instanceof Error ? error : new Error(String(error));
14269
+ this.emit("exception", { error: err, editor: this });
14270
+ console.error(err);
14377
14271
  }
14378
14272
  }
14379
14273
  /**
14380
14274
  * Destroy the editor and clean up resources
14381
- * @returns {void}
14382
14275
  */
14383
14276
  destroy() {
14384
14277
  this.emit("destroy");
@@ -14393,34 +14286,31 @@ const _Editor = class _Editor extends EventEmitter {
14393
14286
  const footerEditors = this.converter?.footerEditors ?? [];
14394
14287
  if (!headerEditors.length && !footerEditors.length) return;
14395
14288
  const editors = [...headerEditors, ...footerEditors].filter(Boolean);
14396
- for (let editorData of editors) {
14289
+ for (const editorData of editors) {
14397
14290
  editorData?.editor?.destroy?.();
14398
14291
  }
14399
14292
  if (headerEditors.length) headerEditors.length = 0;
14400
14293
  if (footerEditors.length) footerEditors.length = 0;
14401
14294
  } catch (error) {
14402
- this.emit("exception", { error, editor: this });
14403
- console.error(error);
14295
+ const err = error instanceof Error ? error : new Error(String(error));
14296
+ this.emit("exception", { error: err, editor: this });
14297
+ console.error(err);
14404
14298
  }
14405
14299
  }
14406
14300
  /**
14407
14301
  * Check if migrations are needed for the data
14408
- * @static
14409
- * @param {Object} data - Document data
14410
- * @returns {boolean} Whether migrations are needed
14411
14302
  */
14412
14303
  static checkIfMigrationsNeeded() {
14413
- const dataVersion = version || "initial";
14304
+ const dataVersion = version ?? "initial";
14414
14305
  const migrations = getNecessaryMigrations(dataVersion) || [];
14415
14306
  console.debug("[checkVersionMigrations] Migrations needed:", dataVersion, migrations.length);
14416
14307
  return migrations.length > 0;
14417
14308
  }
14418
14309
  /**
14419
14310
  * Process collaboration migrations
14420
- * @returns {Object | void} Migration results
14421
14311
  */
14422
14312
  processCollaborationMigrations() {
14423
- console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.1");
14313
+ console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.2");
14424
14314
  if (!this.options.ydoc) return;
14425
14315
  const metaMap = this.options.ydoc.getMap("meta");
14426
14316
  let docVersion = metaMap.get("version");
@@ -14428,10 +14318,10 @@ const _Editor = class _Editor extends EventEmitter {
14428
14318
  console.debug("[checkVersionMigrations] Document version", docVersion);
14429
14319
  const migrations = getNecessaryMigrations(docVersion) || [];
14430
14320
  const plugins = this.state.plugins;
14431
- const syncPlugin = plugins.find((p) => p.key.startsWith("y-sync"));
14321
+ const syncPlugin = plugins.find((plugin) => __privateMethod(this, _Editor_instances, getPluginKeyName_fn).call(this, plugin).startsWith("y-sync"));
14432
14322
  if (!syncPlugin) return this.options.ydoc;
14433
14323
  let hasRunMigrations = false;
14434
- for (let migration of migrations) {
14324
+ for (const migration of migrations) {
14435
14325
  console.debug("🏃‍♂️ Running migration", migration.name);
14436
14326
  const result = migration(this);
14437
14327
  if (!result) throw new Error("Migration failed at " + migration.name);
@@ -14443,9 +14333,6 @@ const _Editor = class _Editor extends EventEmitter {
14443
14333
  }
14444
14334
  /**
14445
14335
  * Replace the current file
14446
- * @async
14447
- * @param {Object} newFile - New file data
14448
- * @returns {Promise<void>}
14449
14336
  */
14450
14337
  async replaceFile(newFile) {
14451
14338
  this.setOptions({ annotations: true });
@@ -14456,15 +14343,15 @@ const _Editor = class _Editor extends EventEmitter {
14456
14343
  media,
14457
14344
  mediaFiles,
14458
14345
  fonts,
14459
- isNewFile: true,
14460
- shouldLoadComments: true,
14461
- replacedFile: true
14346
+ isNewFile: true
14462
14347
  });
14348
+ this.options.shouldLoadComments = true;
14349
+ this.options.replacedFile = true;
14463
14350
  __privateMethod(this, _Editor_instances, createConverter_fn).call(this);
14464
14351
  __privateMethod(this, _Editor_instances, initMedia_fn).call(this);
14465
14352
  this.initDefaultStyles();
14466
14353
  if (this.options.ydoc && this.options.collaborationProvider) {
14467
- updateYdocDocxData(this);
14354
+ updateYdocDocxData(this, this.options.ydoc);
14468
14355
  this.initializeCollaborationData();
14469
14356
  } else {
14470
14357
  __privateMethod(this, _Editor_instances, insertNewFileData_fn).call(this);
@@ -14476,9 +14363,8 @@ const _Editor = class _Editor extends EventEmitter {
14476
14363
  }
14477
14364
  /**
14478
14365
  * Get internal docx file content
14479
- * @param {string} name - File name
14480
- * @param {string} type - type of result (json, string)
14481
- * @returns {Object|String} - file content
14366
+ * @param name - File name
14367
+ * @param type - type of result (json, string)
14482
14368
  */
14483
14369
  getInternalXmlFile(name, type = "json") {
14484
14370
  if (!this.converter.convertedXml[name]) {
@@ -14492,8 +14378,8 @@ const _Editor = class _Editor extends EventEmitter {
14492
14378
  }
14493
14379
  /**
14494
14380
  * Update internal docx file content
14495
- * @param {string} name - File name
14496
- * @param {string} updatedContent - new file content
14381
+ * @param name - File name
14382
+ * @param updatedContent - new file content
14497
14383
  */
14498
14384
  updateInternalXmlFile(name, updatedContent) {
14499
14385
  if (typeof updatedContent === "string") {
@@ -14506,8 +14392,6 @@ const _Editor = class _Editor extends EventEmitter {
14506
14392
  }
14507
14393
  /**
14508
14394
  * Get all nodes of a specific type
14509
- * @param {string} type - Node type
14510
- * @returns {Array} Array of nodes
14511
14395
  */
14512
14396
  getNodesOfType(type) {
14513
14397
  const { findChildren: findChildren2 } = helpers;
@@ -14515,9 +14399,6 @@ const _Editor = class _Editor extends EventEmitter {
14515
14399
  }
14516
14400
  /**
14517
14401
  * Replace a node with HTML content
14518
- * @param {Object} targetNode - The node to replace
14519
- * @param {string} html - HTML content to replace with
14520
- * @returns {void}
14521
14402
  */
14522
14403
  replaceNodeWithHTML(targetNode, html) {
14523
14404
  const { tr } = this.state;
@@ -14534,9 +14415,6 @@ const _Editor = class _Editor extends EventEmitter {
14534
14415
  * pre-process the document as needed prior to running in the annotator.
14535
14416
  *
14536
14417
  * Currently this is only used for table generation but additional pre-processing can be done here.
14537
- *
14538
- * @param {FieldValue[]} annotationValues
14539
- * @returns {void}
14540
14418
  */
14541
14419
  prepareForAnnotations(annotationValues = []) {
14542
14420
  const { tr } = this.state;
@@ -14545,8 +14423,8 @@ const _Editor = class _Editor extends EventEmitter {
14545
14423
  }
14546
14424
  /**
14547
14425
  * Migrate paragraph fields to lists V2 structure if necessary.
14548
- * @param {FieldValue[]} annotationValues - List of field values to migrate.
14549
- * @returns {Promise<FieldValue[]>} - Returns a promise that resolves to the migrated
14426
+ * @param annotationValues - List of field values to migrate.
14427
+ * @returns Returns a promise that resolves to the migrated values
14550
14428
  */
14551
14429
  async migrateParagraphFields(annotationValues = []) {
14552
14430
  if (!Array.isArray(annotationValues) || !annotationValues.length) return annotationValues;
@@ -14555,10 +14433,6 @@ const _Editor = class _Editor extends EventEmitter {
14555
14433
  }
14556
14434
  /**
14557
14435
  * Annotate the document with the given annotation values.
14558
- *
14559
- * @param {FieldValue[]} annotationValues List of field values to apply.
14560
- * @param {String[]} hiddenIds List of field ids to remove from the document.
14561
- * @returns {void}
14562
14436
  */
14563
14437
  annotate(annotationValues = [], hiddenIds = [], removeEmptyFields = false) {
14564
14438
  const { state, view, schema } = this;
@@ -14577,10 +14451,6 @@ const _Editor = class _Editor extends EventEmitter {
14577
14451
  /**
14578
14452
  * Preview annotations in the editor. It stores a copy of the original state.
14579
14453
  * This can be reverted via closePreview()
14580
- *
14581
- * @param {Object[]} annotationValues
14582
- * @param {string[]} hiddenIds
14583
- * @returns {void}
14584
14454
  */
14585
14455
  previewAnnotations(annotationValues = [], hiddenIds = []) {
14586
14456
  this.originalState = this.view.state;
@@ -14588,8 +14458,6 @@ const _Editor = class _Editor extends EventEmitter {
14588
14458
  }
14589
14459
  /**
14590
14460
  * If there is a preview active, this will revert the editor to the original state.
14591
- *
14592
- * @returns {void}
14593
14461
  */
14594
14462
  closePreview() {
14595
14463
  if (!this.originalState) return;
@@ -14600,8 +14468,6 @@ _commandService = new WeakMap();
14600
14468
  _Editor_instances = new WeakSet();
14601
14469
  /**
14602
14470
  * Initialize the container element for the editor
14603
- * @param {EditorOptions} options - Editor options
14604
- * @returns {void}
14605
14471
  */
14606
14472
  initContainerElement_fn = function(options) {
14607
14473
  if (!options.element && options.selector) {
@@ -14625,7 +14491,6 @@ initContainerElement_fn = function(options) {
14625
14491
  };
14626
14492
  /**
14627
14493
  * Initialize the editor with the given options
14628
- * @returns {void}
14629
14494
  */
14630
14495
  init_fn = function() {
14631
14496
  __privateMethod(this, _Editor_instances, createExtensionService_fn).call(this);
@@ -14644,7 +14509,7 @@ init_fn = function() {
14644
14509
  this.on("update", this.options.onUpdate);
14645
14510
  this.on("selectionUpdate", this.options.onSelectionUpdate);
14646
14511
  this.on("transaction", this.options.onTransaction);
14647
- this.on("focus", __privateMethod(this, _Editor_instances, onFocus_fn));
14512
+ this.on("focus", __privateMethod(this, _Editor_instances, onFocus_fn).bind(this));
14648
14513
  this.on("blur", this.options.onBlur);
14649
14514
  this.on("destroy", this.options.onDestroy);
14650
14515
  this.on("trackedChangesUpdate", this.options.onTrackedChangesUpdate);
@@ -14652,7 +14517,7 @@ init_fn = function() {
14652
14517
  this.on("commentClick", this.options.onCommentClicked);
14653
14518
  this.on("commentsUpdate", this.options.onCommentsUpdate);
14654
14519
  this.on("locked", this.options.onDocumentLocked);
14655
- this.on("collaborationReady", __privateMethod(this, _Editor_instances, onCollaborationReady_fn));
14520
+ this.on("collaborationReady", __privateMethod(this, _Editor_instances, onCollaborationReady_fn).bind(this));
14656
14521
  this.on("paginationUpdate", this.options.onPaginationUpdate);
14657
14522
  this.on("comment-positions", this.options.onCommentLocationsUpdate);
14658
14523
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
@@ -14682,8 +14547,6 @@ init_fn = function() {
14682
14547
  };
14683
14548
  /**
14684
14549
  * Initialize the editor in rich text mode
14685
- * @param {EditorOptions} options - Editor options
14686
- * @returns {void}
14687
14550
  */
14688
14551
  initRichText_fn = function() {
14689
14552
  if (!this.options.extensions || !this.options.extensions.length) {
@@ -14700,7 +14563,7 @@ initRichText_fn = function() {
14700
14563
  this.on("update", this.options.onUpdate);
14701
14564
  this.on("selectionUpdate", this.options.onSelectionUpdate);
14702
14565
  this.on("transaction", this.options.onTransaction);
14703
- this.on("focus", __privateMethod(this, _Editor_instances, onFocus_fn));
14566
+ this.on("focus", __privateMethod(this, _Editor_instances, onFocus_fn).bind(this));
14704
14567
  this.on("blur", this.options.onBlur);
14705
14568
  this.on("destroy", this.options.onDestroy);
14706
14569
  this.on("commentsLoaded", this.options.onCommentsLoaded);
@@ -14709,11 +14572,7 @@ initRichText_fn = function() {
14709
14572
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
14710
14573
  };
14711
14574
  /**
14712
- *
14713
- * @param {Object} param0
14714
- * @param {Object} param0.editor
14715
- * @param {Object} param0.event
14716
- * @returns {void}
14575
+ * Handle focus event
14717
14576
  */
14718
14577
  onFocus_fn = function({ editor, event }) {
14719
14578
  this.toolbar?.setActiveEditor(editor);
@@ -14721,13 +14580,15 @@ onFocus_fn = function({ editor, event }) {
14721
14580
  };
14722
14581
  /**
14723
14582
  * Check if the editor should run in headless mode
14724
- * @param {EditorOptions} options - Editor options
14725
- * @returns {void}
14726
14583
  */
14727
14584
  checkHeadless_fn = function(options) {
14728
14585
  if (!options.isHeadless) return;
14729
14586
  if (typeof navigator === "undefined") {
14730
- global.navigator = { isHeadless: true };
14587
+ const minimalNavigator = {
14588
+ platform: "node",
14589
+ userAgent: "Node.js"
14590
+ };
14591
+ global.navigator = minimalNavigator;
14731
14592
  }
14732
14593
  if (options.mockDocument) {
14733
14594
  global.document = options.mockDocument;
@@ -14753,10 +14614,6 @@ registerCopyHandler_fn = function() {
14753
14614
  * Replace the current document with new data. Necessary for initializing a new collaboration file,
14754
14615
  * since we need to insert the data only after the provider has synced.
14755
14616
  */
14756
- /**
14757
- * Insert data for a new file
14758
- * @returns {void}
14759
- */
14760
14617
  insertNewFileData_fn = function() {
14761
14618
  if (!this.options.isNewFile) return;
14762
14619
  this.options.isNewFile = false;
@@ -14768,34 +14625,36 @@ insertNewFileData_fn = function() {
14768
14625
  __privateMethod(this, _Editor_instances, initComments_fn).call(this);
14769
14626
  }, 50);
14770
14627
  };
14628
+ /**
14629
+ * Safely resolve the plugin key string for a plugin instance.
14630
+ */
14631
+ getPluginKeyName_fn = function(plugin) {
14632
+ const pluginKey = plugin.key;
14633
+ return typeof pluginKey?.key === "string" ? pluginKey.key : "";
14634
+ };
14771
14635
  /**
14772
14636
  * Creates extension service.
14773
- * @returns {void}
14774
14637
  */
14775
14638
  createExtensionService_fn = function() {
14776
14639
  const allowedExtensions = ["extension", "node", "mark"];
14777
14640
  const coreExtensions = [Editable, Commands, EditorFocus, Keymap];
14778
14641
  const externalExtensions = this.options.externalExtensions || [];
14779
- const allExtensions = [...coreExtensions, ...this.options.extensions].filter(
14780
- (e) => allowedExtensions.includes(e?.type)
14781
- );
14642
+ const allExtensions = [...coreExtensions, ...this.options.extensions].filter((extension) => {
14643
+ const extensionType = typeof extension?.type === "string" ? extension.type : void 0;
14644
+ return extensionType ? allowedExtensions.includes(extensionType) : false;
14645
+ });
14782
14646
  this.extensionService = ExtensionService.create(allExtensions, externalExtensions, this);
14783
14647
  };
14784
14648
  /**
14785
14649
  * Creates a command service.
14786
- * @returns {void}
14787
14650
  */
14788
14651
  createCommandService_fn = function() {
14789
14652
  __privateSet(this, _commandService, CommandService.create({
14790
14653
  editor: this
14791
14654
  }));
14792
14655
  };
14793
- /**
14794
- * Creates a SuperConverter.
14795
- */
14796
14656
  /**
14797
14657
  * Create the document converter as this.converter.
14798
- * @returns {void}
14799
14658
  */
14800
14659
  createConverter_fn = function() {
14801
14660
  if (this.options.converter) {
@@ -14814,11 +14673,13 @@ createConverter_fn = function() {
14814
14673
  };
14815
14674
  /**
14816
14675
  * Initialize media.
14817
- * @returns {void}
14818
14676
  */
14819
14677
  initMedia_fn = function() {
14820
14678
  if (this.options.isChildEditor) return;
14821
- if (!this.options.ydoc) return this.storage.image.media = this.options.mediaFiles;
14679
+ if (!this.options.ydoc) {
14680
+ this.storage.image.media = this.options.mediaFiles;
14681
+ return;
14682
+ }
14822
14683
  const mediaMap = this.options.ydoc.getMap("media");
14823
14684
  if (this.options.isNewFile) {
14824
14685
  Object.entries(this.options.mediaFiles).forEach(([key2, value]) => {
@@ -14831,7 +14692,6 @@ initMedia_fn = function() {
14831
14692
  };
14832
14693
  /**
14833
14694
  * Initialize fonts
14834
- * @returns {void}
14835
14695
  */
14836
14696
  initFonts_fn = function() {
14837
14697
  const results = this.converter.getFontFaceImportString();
@@ -14852,10 +14712,11 @@ checkFonts_fn = async function() {
14852
14712
  try {
14853
14713
  const fontsUsedInDocument = this.converter.getDocumentFonts();
14854
14714
  const unsupportedFonts = __privateMethod(this, _Editor_instances, determineUnsupportedFonts_fn).call(this, fontsUsedInDocument);
14855
- this.emit("fonts-resolved", {
14715
+ const payload = {
14856
14716
  documentFonts: fontsUsedInDocument,
14857
14717
  unsupportedFonts
14858
- });
14718
+ };
14719
+ this.emit("fonts-resolved", payload);
14859
14720
  } catch {
14860
14721
  console.warn("[SuperDoc] Could not determine document fonts and unsupported fonts");
14861
14722
  }
@@ -14866,8 +14727,8 @@ checkFonts_fn = async function() {
14866
14727
  * Fonts are considered unsupported if they cannot be rendered
14867
14728
  * and are not already imported in the document via @font-face.
14868
14729
  *
14869
- * @param {string[]} fonts - Array of font family names used in the document.
14870
- * @returns {string[]} Array of unsupported font family names.
14730
+ * @param fonts - Array of font family names used in the document.
14731
+ * @returns Array of unsupported font family names.
14871
14732
  */
14872
14733
  determineUnsupportedFonts_fn = function(fonts) {
14873
14734
  const unsupportedFonts = fonts.filter((font) => {
@@ -14879,21 +14740,20 @@ determineUnsupportedFonts_fn = function(fonts) {
14879
14740
  };
14880
14741
  /**
14881
14742
  * Creates document PM schema.
14882
- * @returns {void}
14883
14743
  */
14884
14744
  createSchema_fn = function() {
14885
14745
  this.schema = this.extensionService.schema;
14886
14746
  };
14887
14747
  /**
14888
14748
  * Generate ProseMirror data from file
14889
- * @returns {Object} ProseMirror data
14890
14749
  */
14891
14750
  generatePmData_fn = function() {
14892
14751
  let doc2;
14893
14752
  try {
14894
- const { mode, fragment, content, loadFromSchema } = this.options;
14753
+ const { mode, content, fragment, loadFromSchema } = this.options;
14754
+ const hasJsonContent = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
14895
14755
  if (mode === "docx") {
14896
- if (loadFromSchema) {
14756
+ if (loadFromSchema && hasJsonContent(content)) {
14897
14757
  doc2 = this.schema.nodeFromJSON(content);
14898
14758
  doc2 = __privateMethod(this, _Editor_instances, prepareDocumentForImport_fn).call(this, doc2);
14899
14759
  } else {
@@ -14906,22 +14766,22 @@ generatePmData_fn = function() {
14906
14766
  if (fragment) doc2 = yXmlFragmentToProseMirrorRootNode(fragment, this.schema);
14907
14767
  }
14908
14768
  } else if (mode === "text" || mode === "html") {
14909
- if (loadFromSchema) doc2 = this.schema.nodeFromJSON(content);
14910
- else if (content) doc2 = createDocFromHTML(content, this);
14769
+ if (loadFromSchema && hasJsonContent(content)) doc2 = this.schema.nodeFromJSON(content);
14770
+ else if (typeof content === "string") doc2 = createDocFromHTML(content, this);
14911
14771
  else doc2 = this.schema.topNodeType.createAndFill();
14912
14772
  }
14913
14773
  } catch (err) {
14914
14774
  console.error(err);
14915
- this.emit("contentError", { editor: this, error: err });
14775
+ const error = err instanceof Error ? err : new Error(String(err));
14776
+ this.emit("contentError", { editor: this, error });
14916
14777
  }
14917
14778
  return doc2;
14918
14779
  };
14919
14780
  /**
14920
14781
  * Create the PM editor view
14921
- * @returns {void}
14922
14782
  */
14923
14783
  createView_fn = function(element) {
14924
- let doc2 = __privateMethod(this, _Editor_instances, generatePmData_fn).call(this);
14784
+ const doc2 = __privateMethod(this, _Editor_instances, generatePmData_fn).call(this);
14925
14785
  const state = { schema: this.schema };
14926
14786
  if (!this.options.ydoc) state.doc = doc2;
14927
14787
  this.options.initialState = EditorState.create(state);
@@ -14930,13 +14790,14 @@ createView_fn = function(element) {
14930
14790
  dispatchTransaction: __privateMethod(this, _Editor_instances, dispatchTransaction_fn).bind(this),
14931
14791
  state: this.options.initialState,
14932
14792
  handleClick: __privateMethod(this, _Editor_instances, handleNodeSelection_fn).bind(this),
14933
- handleDoubleClick: async (view, pos, event) => {
14793
+ handleDoubleClick: (view, pos, event) => {
14934
14794
  if (this.options.documentMode !== "editing") return;
14935
14795
  if (!isHeadless(this)) {
14936
14796
  const isHeader = hasSomeParentWithClass(event.target, "pagination-section-header");
14937
14797
  const isFooter = hasSomeParentWithClass(event.target, "pagination-section-footer");
14938
14798
  if (isHeader || isFooter) {
14939
- const eventClone = new event.constructor(event.type);
14799
+ const EventConstructor = event.constructor;
14800
+ const eventClone = new EventConstructor(event.type);
14940
14801
  event.target.dispatchEvent(eventClone);
14941
14802
  if (this.options.isHeaderOrFooter && this.options.editable) setWordSelection(view, pos);
14942
14803
  return;
@@ -14954,7 +14815,7 @@ createView_fn = function(element) {
14954
14815
  const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
14955
14816
  if (pm) {
14956
14817
  pm.classList.remove("header-footer-edit");
14957
- pm.setAttribute("aria-readonly", false);
14818
+ pm.setAttribute("aria-readonly", "false");
14958
14819
  }
14959
14820
  }
14960
14821
  setWordSelection(view, pos);
@@ -14965,16 +14826,11 @@ createView_fn = function(element) {
14965
14826
  });
14966
14827
  this.view.updateState(newState);
14967
14828
  this.createNodeViews();
14968
- this.options.telemetry?.sendReport();
14829
+ this.options.telemetry?.trackUsage?.("editor_initialized", {});
14969
14830
  };
14970
14831
  /**
14971
14832
  * Handler called when collaboration is ready.
14972
14833
  * Initializes pagination and comments if not a new file.
14973
- *
14974
- * @param {Object} params - Collaboration parameters
14975
- * @param {Editor} params.editor - The editor instance
14976
- * @param {Object} params.ydoc - The Yjs document
14977
- * @returns {void}
14978
14834
  */
14979
14835
  onCollaborationReady_fn = function({ editor, ydoc }) {
14980
14836
  if (this.options.collaborationIsReady) return;
@@ -14992,19 +14848,22 @@ onCollaborationReady_fn = function({ editor, ydoc }) {
14992
14848
  if (!this.options.isNewFile) {
14993
14849
  __privateMethod(this, _Editor_instances, initPagination_fn).call(this);
14994
14850
  __privateMethod(this, _Editor_instances, initComments_fn).call(this);
14995
- updateYdocDocxData(this);
14851
+ updateYdocDocxData(this, this.options.ydoc);
14996
14852
  }
14997
14853
  };
14998
14854
  /**
14999
14855
  * Initialize comments plugin
15000
- * @returns {void}
15001
14856
  */
15002
14857
  initComments_fn = function() {
15003
14858
  if (!this.options.isCommentsEnabled) return;
15004
14859
  if (this.options.isHeadless) return;
15005
14860
  if (!this.options.shouldLoadComments) return;
15006
14861
  const replacedFile = this.options.replacedFile;
15007
- this.emit("commentsLoaded", { editor: this, replacedFile, comments: this.converter.comments || [] });
14862
+ this.emit("commentsLoaded", {
14863
+ editor: this,
14864
+ replacedFile,
14865
+ comments: this.converter.comments || []
14866
+ });
15008
14867
  setTimeout(() => {
15009
14868
  this.options.replacedFile = false;
15010
14869
  const { state, dispatch } = this.view;
@@ -15027,7 +14886,6 @@ initPagination_fn = async function() {
15027
14886
  };
15028
14887
  /**
15029
14888
  * Dispatch a transaction to update the editor state
15030
- * @param {Object} transaction - ProseMirror transaction
15031
14889
  */
15032
14890
  dispatchTransaction_fn = function(transaction) {
15033
14891
  if (this.isDestroyed) return;
@@ -15106,8 +14964,8 @@ handleNodeSelection_fn = function(view, pos) {
15106
14964
  /**
15107
14965
  * Perform any post conversion pre prosemirror import processing.
15108
14966
  * Comments are processed here.
15109
- * @param {Object} doc The prosemirror document
15110
- * @returns {Object} The updated prosemirror document
14967
+ * @param doc The prosemirror document
14968
+ * @returns The updated prosemirror document
15111
14969
  */
15112
14970
  prepareDocumentForImport_fn = function(doc2) {
15113
14971
  const newState = EditorState.create({
@@ -15122,7 +14980,7 @@ prepareDocumentForImport_fn = function(doc2) {
15122
14980
  /**
15123
14981
  * Prepare the document for export. Any necessary pre-export processing to the state
15124
14982
  * can happen here.
15125
- * @returns {Object} The updated document in JSON
14983
+ * @returns The updated document in JSON
15126
14984
  */
15127
14985
  prepareDocumentForExport_fn = function(comments = []) {
15128
14986
  const newState = EditorState.create({
@@ -15137,22 +14995,21 @@ prepareDocumentForExport_fn = function(comments = []) {
15137
14995
  };
15138
14996
  /**
15139
14997
  * Destroy collaboration provider and ydoc
15140
- * @returns {void}
15141
14998
  */
15142
14999
  endCollaboration_fn = function() {
15143
15000
  if (!this.options.ydoc) return;
15144
15001
  try {
15145
15002
  console.debug("🔗 [super-editor] Ending collaboration");
15146
- if (this.options.collaborationProvider) this.options.collaborationProvider.disconnect();
15147
- if (this.options.ydoc) this.options.ydoc.destroy();
15003
+ this.options.collaborationProvider?.disconnect?.();
15004
+ this.options.ydoc.destroy();
15148
15005
  } catch (error) {
15149
- this.emit("exception", { error, editor: this });
15150
- console.error(error);
15006
+ const err = error instanceof Error ? error : new Error(String(error));
15007
+ this.emit("exception", { error: err, editor: this });
15008
+ console.error(err);
15151
15009
  }
15152
15010
  };
15153
15011
  /**
15154
15012
  * Run the SuperValidator's active document validation to check and fix potential known issues.
15155
- * @returns {void}
15156
15013
  */
15157
15014
  validateDocumentInit_fn = function() {
15158
15015
  if (this.options.isHeaderOrFooter || this.options.isChildEditor) return;
@@ -15161,7 +15018,6 @@ validateDocumentInit_fn = function() {
15161
15018
  };
15162
15019
  /**
15163
15020
  * Run the SuperValidator's on document upon export to check and fix potential known issues.
15164
- * @returns {void}
15165
15021
  */
15166
15022
  validateDocumentExport_fn = function() {
15167
15023
  if (this.options.isHeaderOrFooter || this.options.isChildEditor) return;
@@ -17444,6 +17300,7 @@ const DocumentSection = Node$1.create({
17444
17300
  return new DocumentSectionView(node, getPos, decorations, editor);
17445
17301
  };
17446
17302
  },
17303
+ // @ts-expect-error - Command signatures will be fixed in TS migration
17447
17304
  addCommands() {
17448
17305
  return {
17449
17306
  /**
@@ -17701,6 +17558,7 @@ const Document = Node$1.create({
17701
17558
  }
17702
17559
  };
17703
17560
  },
17561
+ // @ts-expect-error - Command signatures will be fixed in TS migration
17704
17562
  addCommands() {
17705
17563
  return {
17706
17564
  /**
@@ -17838,6 +17696,7 @@ const Run = OxmlNode.create({
17838
17696
  }
17839
17697
  };
17840
17698
  },
17699
+ // @ts-expect-error - Command signatures will be fixed in TS migration
17841
17700
  addCommands() {
17842
17701
  return {
17843
17702
  splitRun
@@ -20537,6 +20396,7 @@ const LineBreak = Node$1.create({
20537
20396
  clear: { rendered: false }
20538
20397
  };
20539
20398
  },
20399
+ // @ts-expect-error - Command signatures will be fixed in TS migration
20540
20400
  addCommands() {
20541
20401
  return {
20542
20402
  /**
@@ -20599,6 +20459,7 @@ const HardBreak = Node$1.create({
20599
20459
  renderDOM({ htmlAttributes }) {
20600
20460
  return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
20601
20461
  },
20462
+ // @ts-expect-error - Command signatures will be fixed in TS migration
20602
20463
  addCommands() {
20603
20464
  return {
20604
20465
  /**
@@ -23345,9 +23206,9 @@ const Table = Node$1.create({
23345
23206
  const attrs = Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
23346
23207
  style: tableWidth ? `width: ${tableWidth}` : `min-width: ${tableMinWidth}`
23347
23208
  });
23348
- const table = ["table", attrs, colgroup, ["tbody", 0]];
23349
- return table;
23209
+ return ["table", attrs, colgroup, ["tbody", 0]];
23350
23210
  },
23211
+ // @ts-expect-error - Command signatures will be fixed in TS migration
23351
23212
  addCommands() {
23352
23213
  return {
23353
23214
  /**
@@ -23869,9 +23730,13 @@ const Table = Node$1.create({
23869
23730
  return [
23870
23731
  ...resizable ? [
23871
23732
  columnResizing({
23733
+ // @ts-expect-error - Options types will be fixed in TS migration
23872
23734
  handleWidth: this.options.handleWidth,
23735
+ // @ts-expect-error - Options types will be fixed in TS migration
23873
23736
  cellMinWidth: this.options.cellMinWidth,
23737
+ // @ts-expect-error - Options types will be fixed in TS migration
23874
23738
  defaultCellMinWidth: this.options.cellMinWidth,
23739
+ // @ts-expect-error - Options types will be fixed in TS migration
23875
23740
  lastColumnResizable: this.options.lastColumnResizable,
23876
23741
  View: createTableView({
23877
23742
  editor: this.editor
@@ -23879,6 +23744,7 @@ const Table = Node$1.create({
23879
23744
  })
23880
23745
  ] : [],
23881
23746
  tableEditing({
23747
+ // @ts-expect-error - Options types will be fixed in TS migration
23882
23748
  allowTableNodeSelection: this.options.allowTableNodeSelection
23883
23749
  })
23884
23750
  ];
@@ -23941,6 +23807,7 @@ const TableHeader = Node$1.create({
23941
23807
  renderDOM: (attrs) => {
23942
23808
  if (!attrs.colwidth) return {};
23943
23809
  return {
23810
+ // @ts-expect-error - colwidth is known to be an array at runtime
23944
23811
  "data-colwidth": attrs.colwidth.join(",")
23945
23812
  };
23946
23813
  }
@@ -24064,6 +23931,7 @@ const TableCell = Node$1.create({
24064
23931
  renderDOM: (attrs) => {
24065
23932
  if (!attrs.colwidth) return {};
24066
23933
  return {
23934
+ // @ts-expect-error - colwidth is known to be an array at runtime
24067
23935
  "data-colwidth": attrs.colwidth.join(",")
24068
23936
  };
24069
23937
  }
@@ -27159,6 +27027,7 @@ const BookmarkStart = Node$1.create({
27159
27027
  renderDOM({ htmlAttributes }) {
27160
27028
  return ["a", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
27161
27029
  },
27030
+ // @ts-expect-error - Command signatures will be fixed in TS migration
27162
27031
  addCommands() {
27163
27032
  return {
27164
27033
  /**
@@ -27262,6 +27131,7 @@ const BookmarkEnd = Node$1.create({
27262
27131
  renderDOM({ htmlAttributes }) {
27263
27132
  return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
27264
27133
  },
27134
+ // @ts-expect-error - Command signatures will be fixed in TS migration
27265
27135
  addCommands() {
27266
27136
  return {
27267
27137
  /**
@@ -27767,8 +27637,10 @@ const ContentBlock = Node$1.create({
27767
27637
  if (size.top) style += `top: ${size.top}px; `;
27768
27638
  if (size.left) style += `left: ${size.left}px; `;
27769
27639
  if (size.width) style += `width: ${size.width.toString().endsWith("%") ? size.width : `${size.width}px`}; `;
27770
- if (size.height)
27771
- style += `height: ${size.height.toString().endsWith("%") ? size.height : `${size.height}px`}; `;
27640
+ if (size.height) {
27641
+ const heightValue = size.height.toString().endsWith("%") ? size.height : `${size.height}px`;
27642
+ style += `height: ${heightValue}; `;
27643
+ }
27772
27644
  return { style };
27773
27645
  }
27774
27646
  },
@@ -27799,6 +27671,7 @@ const ContentBlock = Node$1.create({
27799
27671
  renderDOM({ htmlAttributes }) {
27800
27672
  return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, { "data-type": this.name })];
27801
27673
  },
27674
+ // @ts-expect-error - Command signatures will be fixed in TS migration
27802
27675
  addCommands() {
27803
27676
  return {
27804
27677
  /**
@@ -37123,6 +36996,7 @@ function setSearchState(tr, query, range = null) {
37123
36996
  }
37124
36997
  const isRegExp = (value) => Object.prototype.toString.call(value) === "[object RegExp]";
37125
36998
  const Search = Extension.create({
36999
+ // @ts-expect-error - Storage type mismatch will be fixed in TS migration
37126
37000
  addStorage() {
37127
37001
  return {
37128
37002
  /**