superdoc 0.31.0-next.1 → 0.31.0-next.3

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-DoOKSkNf.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DYfpBL2P.es.js → PdfViewer-UMfEMyPR.es.js} +1 -1
  3. package/dist/chunks/{index-0zP7LFOd-CQ5IRTwG.es.js → index-B74saKaW-CeHVjvs8.es.js} +1 -1
  4. package/dist/chunks/{index-0zP7LFOd-PDPveafF.cjs → index-B74saKaW-nw0M-3t9.cjs} +1 -1
  5. package/dist/chunks/{index-9j37gBmK.cjs → index-CjrYy0l4.cjs} +3 -3
  6. package/dist/chunks/{index-BiYSI2c3.es.js → index-D78pvKjo.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-BzhuUuJx.es.js → super-editor.es-CQFVPho1.es.js} +199 -255
  8. package/dist/chunks/{super-editor.es-D8j9E-4h.cjs → super-editor.es-DTqtLZgT.cjs} +199 -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-BdxQSBuI.js} +10 -7
  15. package/dist/super-editor/chunks/{docx-zipper-FgUekv4g.js → docx-zipper-CeENQy4K.js} +1 -1
  16. package/dist/super-editor/chunks/{editor-B0PiO07g.js → editor-fHPBoGEW.js} +203 -326
  17. package/dist/super-editor/chunks/{index-0zP7LFOd.js → index-B74saKaW.js} +1 -1
  18. package/dist/super-editor/chunks/{toolbar-Bj9E8rmT.js → toolbar-DVn2P_6q.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 +201 -257
  231. package/dist/superdoc.umd.js.map +1 -1
  232. package/package.json +1 -1
@@ -11704,8 +11704,9 @@
11704
11704
  const index$3 = /* @__PURE__ */ getDefaultExportFromCjs$3(bufferCrc32);
11705
11705
  function callOrGet(value, context = null, ...props) {
11706
11706
  if (typeof value === "function") {
11707
- if (context) return value.bind(context)(...props);
11708
- return value(...props);
11707
+ const fn = value;
11708
+ if (context) return fn.bind(context)(...props);
11709
+ return fn(...props);
11709
11710
  }
11710
11711
  return value;
11711
11712
  }
@@ -11716,6 +11717,7 @@
11716
11717
  return typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
11717
11718
  };
11718
11719
  const isIOS = () => {
11720
+ if (typeof navigator === "undefined") return false;
11719
11721
  return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(
11720
11722
  navigator.platform
11721
11723
  );
@@ -25136,11 +25138,12 @@
25136
25138
  return schema.topNodeType.createAndFill();
25137
25139
  }
25138
25140
  function getExtensionConfigField(extension, field, context = {}) {
25139
- if (typeof extension.config[field] === "function") {
25140
- const value = extension.config[field].bind({ ...context });
25141
- return value;
25141
+ const fieldValue = extension.config[field];
25142
+ if (typeof fieldValue === "function") {
25143
+ const boundValue = fieldValue.bind({ ...context });
25144
+ return boundValue;
25142
25145
  }
25143
- return extension.config[field];
25146
+ return fieldValue;
25144
25147
  }
25145
25148
  function getSchemaTypeByName(name, schema) {
25146
25149
  return schema.nodes[name] || schema.marks[name] || null;
@@ -35265,7 +35268,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35265
35268
  static getStoredSuperdocVersion(docx) {
35266
35269
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35267
35270
  }
35268
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.1") {
35271
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.3") {
35269
35272
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35270
35273
  }
35271
35274
  /**
@@ -46205,7 +46208,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
46205
46208
  var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
46206
46209
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
46207
46210
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
46208
- 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;
46211
+ 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, 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;
46209
46212
  var GOOD_LEAF_SIZE = 200;
46210
46213
  var RopeSequence = function RopeSequence2() {
46211
46214
  };
@@ -53837,15 +53840,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53837
53840
  });
53838
53841
  class Extension {
53839
53842
  constructor(config2) {
53840
- __publicField$1(this, "type", "extension");
53841
- __publicField$1(this, "name", "extension");
53842
- __publicField$1(this, "options");
53843
- __publicField$1(this, "storage");
53844
- __publicField$1(this, "config", {
53845
- name: this.name
53846
- });
53843
+ this.type = "extension";
53844
+ this.name = "extension";
53847
53845
  this.config = {
53848
- ...this.config,
53846
+ name: this.name,
53849
53847
  ...config2
53850
53848
  };
53851
53849
  this.name = this.config.name;
@@ -53854,7 +53852,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53854
53852
  getExtensionConfigField(this, "addOptions", {
53855
53853
  name: this.name
53856
53854
  })
53857
- );
53855
+ ) || {};
53856
+ } else {
53857
+ this.options = {};
53858
53858
  }
53859
53859
  this.storage = callOrGet(
53860
53860
  getExtensionConfigField(this, "addStorage", {
@@ -53865,10 +53865,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53865
53865
  }
53866
53866
  /**
53867
53867
  * Static method for creating an extension.
53868
- * @param args Arguments for the constructor.
53868
+ * @param config Configuration for the extension.
53869
53869
  */
53870
- static create(...args) {
53871
- return new Extension(...args);
53870
+ static create(config2) {
53871
+ return new Extension(config2);
53872
53872
  }
53873
53873
  }
53874
53874
  const History = Extension.create({
@@ -53935,22 +53935,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53935
53935
  return yUndoPluginInstance;
53936
53936
  };
53937
53937
  let Node$1 = class Node2 {
53938
- /**
53939
- * @param {import('./types/index.js').EditorNodeConfig} config
53940
- */
53941
53938
  constructor(config2) {
53942
- __publicField$1(this, "type", "node");
53943
- __publicField$1(this, "name", "node");
53944
- __publicField$1(this, "options");
53945
- __publicField$1(this, "group");
53946
- __publicField$1(this, "atom");
53947
- __publicField$1(this, "editor");
53948
- __publicField$1(this, "storage");
53949
- __publicField$1(this, "config", {
53950
- name: this.name
53951
- });
53939
+ this.type = "node";
53940
+ this.name = "node";
53952
53941
  this.config = {
53953
- ...this.config,
53942
+ name: this.name,
53954
53943
  ...config2
53955
53944
  };
53956
53945
  this.name = this.config.name;
@@ -53960,7 +53949,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53960
53949
  getExtensionConfigField(this, "addOptions", {
53961
53950
  name: this.name
53962
53951
  })
53963
- );
53952
+ ) || {};
53953
+ } else {
53954
+ this.options = {};
53964
53955
  }
53965
53956
  this.storage = callOrGet(
53966
53957
  getExtensionConfigField(this, "addStorage", {
@@ -53971,9 +53962,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53971
53962
  }
53972
53963
  /**
53973
53964
  * Factory method to construct a new Node extension.
53974
- *
53975
- * @param {import('./types/index.js').EditorNodeConfig} config - The node configuration.
53976
- * @returns {Node} A new Node instance.
53965
+ * @param config - The node configuration.
53966
+ * @returns A new Node instance.
53977
53967
  */
53978
53968
  static create(config2) {
53979
53969
  return new Node2(config2);
@@ -53981,16 +53971,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53981
53971
  };
53982
53972
  class Mark {
53983
53973
  constructor(config2) {
53984
- __publicField$1(this, "type", "mark");
53985
- __publicField$1(this, "name", "mark");
53986
- __publicField$1(this, "options");
53987
- __publicField$1(this, "storage");
53988
- __publicField$1(this, "isExternal");
53989
- __publicField$1(this, "config", {
53990
- name: this.name
53991
- });
53974
+ this.type = "mark";
53975
+ this.name = "mark";
53992
53976
  this.config = {
53993
- ...this.config,
53977
+ name: this.name,
53994
53978
  ...config2
53995
53979
  };
53996
53980
  this.name = this.config.name;
@@ -54000,7 +53984,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
54000
53984
  getExtensionConfigField(this, "addOptions", {
54001
53985
  name: this.name
54002
53986
  })
54003
- );
53987
+ ) || {};
53988
+ } else {
53989
+ this.options = {};
54004
53990
  }
54005
53991
  this.storage = callOrGet(
54006
53992
  getExtensionConfigField(this, "addStorage", {
@@ -54011,10 +53997,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
54011
53997
  }
54012
53998
  /**
54013
53999
  * Static method for creating Mark extension.
54014
- * @param args Arguments for the constructor.
54000
+ * @param config Configuration for the mark.
54015
54001
  */
54016
- static create(...args) {
54017
- return new Mark(...args);
54002
+ static create(config2) {
54003
+ return new Mark(config2);
54018
54004
  }
54019
54005
  }
54020
54006
  class Attribute {
@@ -54106,8 +54092,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
54106
54092
  continue;
54107
54093
  }
54108
54094
  if (key2 === "class") {
54109
- const valueClasses = value ? value.split(" ") : [];
54110
- const existingClasses = mergedAttributes[key2] ? mergedAttributes[key2].split(" ") : [];
54095
+ const valueStr = typeof value === "string" ? value : String(value);
54096
+ const existingStr = typeof mergedAttributes[key2] === "string" ? mergedAttributes[key2] : String(mergedAttributes[key2] || "");
54097
+ const valueClasses = valueStr ? valueStr.split(" ") : [];
54098
+ const existingClasses = existingStr ? existingStr.split(" ") : [];
54111
54099
  const insertClasses = valueClasses.filter((value2) => !existingClasses.includes(value2));
54112
54100
  mergedAttributes[key2] = [...existingClasses, ...insertClasses].join(" ");
54113
54101
  } else if (key2 === "style") {
@@ -54211,7 +54199,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
54211
54199
  options: extension.options,
54212
54200
  storage: extension.storage
54213
54201
  };
54214
- const addGlobalAttributes = getExtensionConfigField(extension, "addGlobalAttributes", context);
54202
+ const addGlobalAttributes = getExtensionConfigField(
54203
+ extension,
54204
+ "addGlobalAttributes",
54205
+ context
54206
+ );
54215
54207
  if (!addGlobalAttributes) continue;
54216
54208
  const globalAttributes = addGlobalAttributes();
54217
54209
  for (const globalAttr of globalAttributes) {
@@ -54231,7 +54223,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
54231
54223
  options: extension.options,
54232
54224
  storage: extension.storage
54233
54225
  };
54234
- const addAttributes = getExtensionConfigField(extension, "addAttributes", context);
54226
+ const addAttributes = getExtensionConfigField(
54227
+ extension,
54228
+ "addAttributes",
54229
+ context
54230
+ );
54235
54231
  if (!addAttributes) continue;
54236
54232
  const attributes = addAttributes();
54237
54233
  for (const [name, attribute] of Object.entries(attributes)) {
@@ -54376,19 +54372,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
54376
54372
  __privateAdd$1(_Schema, _Schema_static);
54377
54373
  let Schema$1 = _Schema;
54378
54374
  class OxmlNode extends Node$1 {
54379
- /**
54380
- * @param {import('./types/index.js').OxmlNodeConfig} config
54381
- */
54382
54375
  constructor(config2) {
54383
54376
  super(config2);
54384
- __publicField$1(this, "oXmlName");
54385
54377
  this.oXmlName = config2.oXmlName;
54386
54378
  }
54387
54379
  /**
54388
54380
  * Factory method to construct a new OxmlNode instance.
54389
- *
54390
- * @param {import('./types/index.js').OxmlNodeConfig} config
54391
- * @returns {OxmlNode} A new OxmlNode instance.
54381
+ * @param config - The OXML node configuration.
54382
+ * @returns A new OxmlNode instance.
54392
54383
  */
54393
54384
  static create(config2) {
54394
54385
  return new OxmlNode(config2);
@@ -55901,8 +55892,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
55901
55892
  }
55902
55893
  /**
55903
55894
  * Subscribe to the event.
55904
- * @param {string} name Event name.
55905
- * @param {(...args: any[]) => void} fn Callback.
55895
+ * @param name Event name.
55896
+ * @param fn Callback.
55906
55897
  * @returns {void}
55907
55898
  */
55908
55899
  on(name, fn2) {
@@ -55912,8 +55903,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
55912
55903
  }
55913
55904
  /**
55914
55905
  * Emit event.
55915
- * @param {string} name Event name.
55916
- * @param {...any} args Arguments to pass to each listener.
55906
+ * @param name Event name.
55907
+ * @param args Arguments to pass to each listener.
55917
55908
  * @returns {void}
55918
55909
  */
55919
55910
  emit(name, ...args) {
@@ -55926,8 +55917,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
55926
55917
  /**
55927
55918
  * Remove a specific callback from event
55928
55919
  * or all event subscriptions.
55929
- * @param {string} name Event name.
55930
- * @param {(...args: any[]) => void} fn Callback.
55920
+ * @param name Event name.
55921
+ * @param fn Callback.
55931
55922
  * @returns {void}
55932
55923
  */
55933
55924
  off(name, fn2) {
@@ -55944,8 +55935,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
55944
55935
  }
55945
55936
  /**
55946
55937
  * Subscribe to an event that will be called only once.
55947
- * @param {string} name Event name.
55948
- * @param {(...args: any[]) => void} fn Callback.
55938
+ * @param name Event name.
55939
+ * @param fn Callback.
55949
55940
  * @returns {void}
55950
55941
  */
55951
55942
  once(name, fn2) {
@@ -59671,19 +59662,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59671
59662
  const _Editor = class _Editor2 extends EventEmitter$2 {
59672
59663
  /**
59673
59664
  * Create a new Editor instance
59674
- * @param {EditorOptions} options - Editor configuration options
59665
+ * @param options - Editor configuration options
59675
59666
  */
59676
59667
  constructor(options) {
59677
59668
  super();
59678
59669
  __privateAdd$1(this, _Editor_instances);
59679
59670
  __privateAdd$1(this, _commandService);
59680
- __publicField$1(this, "extensionService");
59681
- __publicField$1(this, "extensionStorage", {});
59682
- __publicField$1(this, "schema");
59683
- __publicField$1(this, "view");
59684
- __publicField$1(this, "isFocused", false);
59685
- __publicField$1(this, "fontsImported", []);
59686
- __publicField$1(this, "options", {
59671
+ this.extensionStorage = {};
59672
+ this.isFocused = false;
59673
+ this.fontsImported = [];
59674
+ this.options = {
59687
59675
  element: null,
59688
59676
  selector: null,
59689
59677
  isHeadless: false,
@@ -59716,11 +59704,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59716
59704
  annotations: false,
59717
59705
  isInternal: false,
59718
59706
  externalExtensions: [],
59707
+ isChildEditor: false,
59719
59708
  numbering: {},
59720
59709
  isHeaderOrFooter: false,
59710
+ pagination: null,
59721
59711
  lastSelection: null,
59722
59712
  suppressDefaultDocxStyles: false,
59723
59713
  jsonOverride: null,
59714
+ loadFromSchema: false,
59715
+ fragment: null,
59724
59716
  onBeforeCreate: () => null,
59725
59717
  onCreate: () => null,
59726
59718
  onUpdate: () => null,
@@ -59752,15 +59744,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59752
59744
  customUpdatedFiles: {},
59753
59745
  isHeaderFooterChanged: false,
59754
59746
  isCustomXmlChanged: false,
59747
+ ydoc: null,
59748
+ collaborationProvider: null,
59749
+ collaborationIsReady: false,
59750
+ shouldLoadComments: false,
59751
+ replacedFile: false,
59755
59752
  focusTarget: null,
59756
59753
  permissionResolver: null,
59757
59754
  // header/footer editors may have parent(main) editor set
59758
59755
  parentEditor: null
59759
- });
59756
+ };
59760
59757
  __privateMethod$1(this, _Editor_instances, initContainerElement_fn).call(this, options);
59761
59758
  __privateMethod$1(this, _Editor_instances, checkHeadless_fn).call(this, options);
59762
59759
  this.setOptions(options);
59763
- let modes = {
59760
+ const modes = {
59764
59761
  docx: () => __privateMethod$1(this, _Editor_instances, init_fn).call(this),
59765
59762
  text: () => __privateMethod$1(this, _Editor_instances, initRichText_fn).call(this),
59766
59763
  html: () => __privateMethod$1(this, _Editor_instances, initRichText_fn).call(this),
@@ -59768,14 +59765,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59768
59765
  console.log("Not implemented.");
59769
59766
  }
59770
59767
  };
59771
- let initMode = modes[this.options.mode] ?? modes.default;
59768
+ const initMode = modes[this.options.mode] ?? modes.default;
59772
59769
  const { setHighContrastMode } = useHighContrastMode$1();
59773
59770
  this.setHighContrastMode = setHighContrastMode;
59774
59771
  initMode();
59775
59772
  }
59776
59773
  /**
59777
59774
  * Getter which indicates if any changes happen in Editor
59778
- * @returns {boolean}
59779
59775
  */
59780
59776
  get docChanged() {
59781
59777
  return this.options.isHeaderFooterChanged || this.options.isCustomXmlChanged || !this.options.initialState.doc.eq(this.state.doc);
@@ -59791,97 +59787,84 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59791
59787
  if (this.view) {
59792
59788
  this.view.destroy();
59793
59789
  }
59794
- this.view = null;
59790
+ this.view = void 0;
59795
59791
  }
59796
59792
  /**
59797
59793
  * Set the toolbar for this editor
59798
- * @param {Object} toolbar - The toolbar instance
59799
- * @returns {void}
59800
59794
  */
59801
59795
  setToolbar(toolbar) {
59802
59796
  this.toolbar = toolbar;
59803
59797
  }
59804
59798
  /**
59805
59799
  * Focus the editor.
59806
- * @returns {void}
59807
59800
  */
59808
59801
  focus() {
59809
59802
  this.view?.focus();
59810
59803
  }
59811
59804
  /**
59812
59805
  * Get the editor state
59813
- * @returns {Object} ProseMirror state
59814
59806
  */
59815
59807
  get state() {
59816
59808
  return this.view?.state;
59817
59809
  }
59818
59810
  /**
59819
59811
  * Get the editor storage.
59820
- * @returns {Object} Editor storage object
59821
59812
  */
59822
59813
  get storage() {
59823
59814
  return this.extensionStorage;
59824
59815
  }
59825
59816
  /**
59826
59817
  * Get object of registered commands.
59827
- * @returns {import('./commands/types/index.js').EditorCommands} Commands object
59828
59818
  */
59829
59819
  get commands() {
59830
59820
  return __privateGet$1(this, _commandService)?.commands;
59831
59821
  }
59832
59822
  /**
59833
59823
  * Get extension helpers.
59834
- * @returns {EditorHelpers} Object with helper methods for extensions
59835
59824
  */
59836
59825
  get helpers() {
59837
59826
  return this.extensionService.helpers;
59838
59827
  }
59839
59828
  /**
59840
59829
  * Check if the editor is editable.
59841
- * @returns {boolean}
59842
59830
  */
59843
59831
  get isEditable() {
59844
59832
  return Boolean(this.options.editable && this.view && this.view.editable);
59845
59833
  }
59846
59834
  /**
59847
59835
  * Check if editor is destroyed.
59848
- * @returns {boolean}
59849
59836
  */
59850
59837
  get isDestroyed() {
59851
59838
  return this.view?.isDestroyed ?? true;
59852
59839
  }
59853
59840
  /**
59854
59841
  * Get the editor element
59855
- * @returns {HTMLElement} The editor element
59856
59842
  */
59857
59843
  get element() {
59858
59844
  return this.options.element;
59859
59845
  }
59860
59846
  /**
59861
59847
  * Get possible users of the editor.
59862
- * @returns {Array.<User>} List of users
59863
59848
  */
59864
59849
  get users() {
59865
59850
  return this.options.users;
59866
59851
  }
59867
59852
  /**
59868
59853
  * Create a chain of commands to call multiple commands at once.
59869
- * @returns {Object} Command chain
59870
59854
  */
59871
59855
  chain() {
59872
59856
  return __privateGet$1(this, _commandService).chain();
59873
59857
  }
59874
59858
  /**
59875
59859
  * Check if a command or a chain of commands can be executed. Without executing it.
59876
- * @returns {Object} Object with methods to check command availability
59877
59860
  */
59878
59861
  can() {
59879
59862
  return __privateGet$1(this, _commandService).can();
59880
59863
  }
59881
59864
  /**
59882
59865
  * Set the document mode
59883
- * @param {string} documentMode - The document mode ('editing', 'viewing', 'suggesting')
59884
- * @param {string} caller - Calling context
59866
+ * @param documentMode - The document mode ('editing', 'viewing', 'suggesting')
59867
+ * @param caller - Calling context
59885
59868
  */
59886
59869
  setDocumentMode(documentMode, caller) {
59887
59870
  if (this.options.isHeaderOrFooter || this.options.isChildEditor) return;
@@ -59925,7 +59908,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59925
59908
  }
59926
59909
  /**
59927
59910
  * Export the yjs binary from the current state.
59928
- * @returns {Promise<Uint8Array>} The exported yjs binary
59929
59911
  */
59930
59912
  async generateCollaborationUpdate() {
59931
59913
  return await generateCollaborationData(this);
@@ -59934,11 +59916,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59934
59916
  * Initialize data for collaborative editing
59935
59917
  * If we are replacing data and have a valid provider, listen for synced event
59936
59918
  * so that we can initialize the data
59937
- * @returns {void}
59938
59919
  */
59939
59920
  initializeCollaborationData() {
59940
59921
  if (!this.options.isNewFile || !this.options.collaborationProvider) return;
59941
- const { collaborationProvider: provider2 } = this.options;
59922
+ const provider2 = this.options.collaborationProvider;
59942
59923
  const postSyncInit = () => {
59943
59924
  provider2.off("synced", postSyncInit);
59944
59925
  __privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
@@ -59950,8 +59931,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59950
59931
  * Replace content of editor that was created with loadFromSchema option
59951
59932
  * Used to replace content of other header/footer when one of it was edited
59952
59933
  *
59953
- * @param {object} content - new editor content json (retrieved from editor.getUpdatedJson)
59954
- * @returns {void}
59934
+ * @param content - new editor content json (retrieved from editor.getUpdatedJson)
59955
59935
  */
59956
59936
  replaceContent(content2) {
59957
59937
  this.setOptions({
@@ -59968,8 +59948,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59968
59948
  }
59969
59949
  /**
59970
59950
  * Set editor options and update state.
59971
- * @param {EditorOptions} options - Editor options
59972
- * @returns {void}
59973
59951
  */
59974
59952
  setOptions(options = {}) {
59975
59953
  this.options = {
@@ -59989,9 +59967,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
59989
59967
  }
59990
59968
  /**
59991
59969
  * Set whether the editor is editable
59992
- * @param {boolean} [editable=true] - Whether the editor is editable
59993
- * @param {boolean} [emitUpdate=true] - Whether to emit an update event
59994
- * @returns {void}
59995
59970
  */
59996
59971
  setEditable(editable = true, emitUpdate = true) {
59997
59972
  this.setOptions({ editable });
@@ -60003,7 +59978,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60003
59978
  * Register PM plugin.
60004
59979
  * @param plugin PM plugin.
60005
59980
  * @param handlePlugins Optional function for handling plugin merge.
60006
- * @returns {void}
60007
59981
  */
60008
59982
  registerPlugin(plugin2, handlePlugins) {
60009
59983
  if (!this.state?.plugins) return;
@@ -60013,25 +59987,21 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60013
59987
  }
60014
59988
  /**
60015
59989
  * Unregister a PM plugin
60016
- * @param {string|Object} nameOrPluginKey - Plugin name or plugin instance
60017
- * @returns {void}
60018
59990
  */
60019
59991
  unregisterPlugin(nameOrPluginKey) {
60020
59992
  if (this.isDestroyed) return;
60021
- const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
59993
+ const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey?.key ?? "";
60022
59994
  const state2 = this.state.reconfigure({
60023
- plugins: this.state.plugins.filter((plugin2) => !plugin2.key.startsWith(name))
59995
+ plugins: this.state.plugins.filter((plugin2) => !__privateMethod$1(this, _Editor_instances, getPluginKeyName_fn).call(this, plugin2).startsWith(name))
60024
59996
  });
60025
59997
  this.view.updateState(state2);
60026
59998
  }
60027
59999
  /**
60028
60000
  * Load the data from DOCX to be used in the schema.
60029
60001
  * Expects a DOCX file.
60030
- * @static
60031
- * @async
60032
- * @param {File|Blob|Buffer} fileSource - The DOCX file to load (File/Blob in browser, Buffer in Node.js)
60033
- * @param {boolean} [isNode=false] - Whether the method is being called in a Node.js environment
60034
- * @returns {Promise<Array>} - A promise that resolves to an array containing:
60002
+ * @param fileSource - The DOCX file to load (File/Blob in browser, Buffer in Node.js)
60003
+ * @param isNode - Whether the method is being called in a Node.js environment
60004
+ * @returns A promise that resolves to an array containing:
60035
60005
  * - [0] xmlFiles - Array of XML files extracted from the DOCX
60036
60006
  * - [1] mediaFiles - Object containing media files with URLs (browser only)
60037
60007
  * - [2] mediaFiles - Object containing media files with base64 data
@@ -60046,33 +60016,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60046
60016
  }
60047
60017
  /**
60048
60018
  * Get the document version
60049
- * @static
60050
- * @param {Object} doc - Document object
60051
- * @returns {string} Document version
60052
60019
  */
60053
60020
  static getDocumentVersion(doc2) {
60054
60021
  return SuperConverter.getStoredSuperdocVersion(doc2);
60055
60022
  }
60056
60023
  /**
60057
60024
  * Set the document version
60058
- * @static
60059
- * @param {Object} doc - Document object
60060
- * @param {string} version - New version
60061
- * @returns {string} The set version
60062
60025
  */
60063
60026
  static setDocumentVersion(doc2, version2) {
60064
60027
  return SuperConverter.setStoredSuperdocVersion(doc2, version2);
60065
60028
  }
60066
60029
  /**
60067
60030
  * Get the document GUID
60068
- * @static
60069
- * @param {Object} doc - Document object
60070
- * @returns {string|null} Document GUID
60071
60031
  */
60072
60032
  static getDocumentGuid(doc2) {
60073
60033
  return SuperConverter.extractDocumentGuid(doc2);
60074
60034
  }
60075
- // Deprecated
60076
60035
  /**
60077
60036
  * @deprecated use setDocumentVersion instead
60078
60037
  */
@@ -60082,7 +60041,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60082
60041
  }
60083
60042
  /**
60084
60043
  * Creates all node views.
60085
- * @returns {void}
60086
60044
  */
60087
60045
  createNodeViews() {
60088
60046
  this.view.setProps({
@@ -60091,7 +60049,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60091
60049
  }
60092
60050
  /**
60093
60051
  * Get the maximum content size
60094
- * @returns {Object} Size object with width and height
60095
60052
  */
60096
60053
  getMaxContentSize() {
60097
60054
  if (!this.converter) return {};
@@ -60115,7 +60072,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60115
60072
  return;
60116
60073
  }
60117
60074
  proseMirror.setAttribute("role", "document");
60118
- proseMirror.setAttribute("aria-multiline", true);
60075
+ proseMirror.setAttribute("aria-multiline", "true");
60119
60076
  proseMirror.setAttribute("aria-label", "Main content area, start typing to enter text.");
60120
60077
  proseMirror.setAttribute("aria-description", "");
60121
60078
  proseMirror.classList.remove("view-mode");
@@ -60146,7 +60103,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60146
60103
  element2.style.touchAction = "auto";
60147
60104
  element2.style.webkitOverflowScrolling = "touch";
60148
60105
  const defaultLineHeight = 1.2;
60149
- proseMirror.style.lineHeight = defaultLineHeight;
60106
+ proseMirror.style.lineHeight = String(defaultLineHeight);
60150
60107
  if (!hasPaginationEnabled) {
60151
60108
  proseMirror.style.paddingTop = "1in";
60152
60109
  proseMirror.style.paddingBottom = "1in";
@@ -60160,8 +60117,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60160
60117
  * Get page size and margins from the converter.
60161
60118
  * Set document default font and font size.
60162
60119
  *
60163
- * @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
60164
- * @returns {void}
60120
+ * @param element - The DOM element to apply styles to
60165
60121
  */
60166
60122
  initDefaultStyles(element2 = this.element, isPaginationEnabled = true) {
60167
60123
  if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
@@ -60172,9 +60128,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60172
60128
  /**
60173
60129
  * Initializes responsive styles for mobile devices.
60174
60130
  * Sets up scaling based on viewport width and handles orientation changes.
60175
- *
60176
- * @param {HTMLElement|void} element - The DOM element to apply mobile styles to
60177
- * @returns {void}
60178
60131
  */
60179
60132
  initMobileStyles(element2) {
60180
60133
  if (!element2) {
@@ -60209,30 +60162,28 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60209
60162
  };
60210
60163
  if ("orientation" in screen && "addEventListener" in screen.orientation) {
60211
60164
  screen.orientation.addEventListener("change", handleResize);
60212
- } else if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
60213
- window.matchMedia("(orientation: portrait)").addEventListener("change", handleResize);
60214
- }
60215
- if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
60216
- window.addEventListener("resize", () => handleResize);
60165
+ } else {
60166
+ const mediaQueryList = typeof window.matchMedia === "function" ? window.matchMedia("(orientation: portrait)") : null;
60167
+ if (mediaQueryList?.addEventListener) {
60168
+ mediaQueryList.addEventListener("change", handleResize);
60169
+ }
60217
60170
  }
60171
+ window.addEventListener("resize", () => handleResize);
60218
60172
  }
60219
60173
  /**
60220
60174
  * Get document identifier for telemetry (async - may generate hash)
60221
- * @returns {Promise<string>} GUID for modified docs, hash for unmodified
60222
60175
  */
60223
60176
  async getDocumentIdentifier() {
60224
60177
  return await this.converter?.getDocumentIdentifier() || null;
60225
60178
  }
60226
60179
  /**
60227
60180
  * Get permanent document GUID (sync - only for modified documents)
60228
- * @returns {string|null} GUID or null if document hasn't been modified
60229
60181
  */
60230
60182
  getDocumentGuid() {
60231
60183
  return this.converter?.documentGuid || null;
60232
60184
  }
60233
60185
  /**
60234
60186
  * Check if document has been modified
60235
- * @returns {boolean}
60236
60187
  */
60237
60188
  isDocumentModified() {
60238
60189
  return this.converter?.documentModified || false;
@@ -60248,14 +60199,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60248
60199
  version: this.converter?.getSuperdocVersion()
60249
60200
  };
60250
60201
  }
60251
- // Deprecated for backward compatibility
60202
+ /**
60203
+ * @deprecated use getDocumentGuid instead
60204
+ */
60252
60205
  getDocumentId() {
60253
60206
  console.warn("getDocumentId is deprecated, use getDocumentGuid instead");
60254
60207
  return this.getDocumentGuid();
60255
60208
  }
60256
60209
  /**
60257
60210
  * Get attrs of the currently selected node or mark.
60258
- * @param {String} nameOrType
60259
60211
  * @example
60260
60212
  * editor.getAttributes('textStyle').color
60261
60213
  */
@@ -60264,9 +60216,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60264
60216
  }
60265
60217
  /**
60266
60218
  * Returns if the currently selected node or mark is active.
60267
- * @param {String|Object} nameOrAttributes - The name of the node/mark or an attributes object
60268
- * @param {Object} [attributesOrUndefined] - Optional attributes to check when first parameter is a name
60269
- * @returns {Boolean} Whether the node or mark is active with the specified attributes
60219
+ * @param nameOrAttributes - The name of the node/mark or an attributes object
60220
+ * @param attributesOrUndefined - Optional attributes to check when first parameter is a name
60270
60221
  * @example
60271
60222
  * editor.isActive('bold')
60272
60223
  * editor.isActive('textStyle', { color: 'purple' })
@@ -60279,18 +60230,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60279
60230
  }
60280
60231
  /**
60281
60232
  * Get the editor content as JSON
60282
- * @returns {Object} Editor content as JSON
60283
60233
  */
60284
60234
  getJSON() {
60285
60235
  return this.state.doc.toJSON();
60286
60236
  }
60287
60237
  /**
60288
60238
  * Get document metadata including GUID, modification status, and version
60289
- * @returns {{
60290
- * documentGuid: string | null,
60291
- * isModified: boolean,
60292
- * version: string | null
60293
- * }} Document metadata
60294
60239
  */
60295
60240
  getMetadata() {
60296
60241
  return {
@@ -60301,9 +60246,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60301
60246
  }
60302
60247
  /**
60303
60248
  * Get the editor content as HTML
60304
- * @param {Object} options - Options for the HTML serializer
60305
- * @param {boolean} [options.unflattenLists] - Whether to unflatten lists in the HTML
60306
- * @returns {string} Editor content as HTML
60307
60249
  */
60308
60250
  getHTML({ unflattenLists = false } = {}) {
60309
60251
  const tempDocument = document.implementation.createHTMLDocument();
@@ -60318,7 +60260,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60318
60260
  }
60319
60261
  /**
60320
60262
  * Get the editor content as Markdown
60321
- * @returns {Promise<string>} Editor content as Markdown
60322
60263
  */
60323
60264
  async getMarkdown() {
60324
60265
  const [
@@ -60328,7 +60269,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60328
60269
  { default: remarkStringify2 },
60329
60270
  { default: remarkGfm2 }
60330
60271
  ] = await Promise.all([
60331
- Promise.resolve().then(() => index0zP7LFOd),
60272
+ Promise.resolve().then(() => indexB74saKaW),
60332
60273
  Promise.resolve().then(() => indexDRCvimau),
60333
60274
  Promise.resolve().then(() => indexC_x_N6Uh),
60334
60275
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -60343,7 +60284,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60343
60284
  }
60344
60285
  /**
60345
60286
  * Get the document version from the converter
60346
- * @returns {string|null} The SuperDoc version stored in the document
60347
60287
  */
60348
60288
  getDocumentVersion() {
60349
60289
  return this.converter?.getSuperdocVersion() || null;
@@ -60352,25 +60292,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60352
60292
  * Create a child editor linked to this editor.
60353
60293
  * This is useful for creating header/footer editors that are linked to the main editor.
60354
60294
  * Or paragraph fields that rely on the same underlying document and list defintions
60355
- * @param {EditorOptions} options - Options for the child editor
60356
- * @returns {Editor} A new child editor instance linked to this editor
60357
60295
  */
60358
60296
  createChildEditor(options) {
60359
60297
  return createLinkedChildEditor(this, options);
60360
60298
  }
60361
60299
  /**
60362
60300
  * Get page styles
60363
- * @returns {Object} Page styles
60364
60301
  */
60365
60302
  getPageStyles() {
60366
60303
  return this.converter?.pageStyles || {};
60367
60304
  }
60368
60305
  /**
60369
60306
  * Update page styles
60370
- *
60371
- * @param {Object} param0
60372
- * @param {Object} param0.pageMargins The new page margins
60373
- * @returns {void}
60374
60307
  */
60375
60308
  updatePageStyle({ pageMargins }) {
60376
60309
  if (!this.converter) return;
@@ -60396,13 +60329,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60396
60329
  }
60397
60330
  /**
60398
60331
  * Export the editor document to DOCX.
60399
- * @async
60400
- * @param {Object} options - The export options
60401
- * @param {boolean} [options.isFinalDoc=false] - Whether this is the final document version
60402
- * @param {string} [options.commentsType] - The type of comments to include
60403
- * @param {Array} [options.comments=[]] - Array of comments to include in the document
60404
- * @param {boolean} [options.getUpdatedDocs=false] - When set to true return only updated docx files
60405
- * @returns {Promise<Blob|ArrayBuffer|Object>} The exported DOCX file or updated docx files
60406
60332
  */
60407
60333
  async exportDocx({
60408
60334
  isFinalDoc = false,
@@ -60437,7 +60363,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60437
60363
  const updatedHeadersFooters = {};
60438
60364
  Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
60439
60365
  if (name.includes("header") || name.includes("footer")) {
60440
- const resultXml = this.converter.schemaToXml(json2.elements[0]);
60366
+ const jsonObj = json2;
60367
+ const resultXml = this.converter.schemaToXml(jsonObj.elements?.[0]);
60441
60368
  updatedHeadersFooters[name] = String(resultXml);
60442
60369
  }
60443
60370
  });
@@ -60492,19 +60419,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60492
60419
  fonts: this.options.fonts,
60493
60420
  isHeadless: this.options.isHeadless
60494
60421
  });
60495
- this.options.telemetry?.trackUsage("document_export", {
60422
+ this.options.telemetry?.trackUsage?.("document_export", {
60496
60423
  documentType: "docx",
60497
60424
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
60498
60425
  });
60499
60426
  return result;
60500
60427
  } catch (error) {
60501
- this.emit("exception", { error, editor: this });
60502
- console.error(error);
60428
+ const err = error instanceof Error ? error : new Error(String(error));
60429
+ this.emit("exception", { error: err, editor: this });
60430
+ console.error(err);
60503
60431
  }
60504
60432
  }
60505
60433
  /**
60506
60434
  * Destroy the editor and clean up resources
60507
- * @returns {void}
60508
60435
  */
60509
60436
  destroy() {
60510
60437
  this.emit("destroy");
@@ -60519,34 +60446,31 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60519
60446
  const footerEditors = this.converter?.footerEditors ?? [];
60520
60447
  if (!headerEditors.length && !footerEditors.length) return;
60521
60448
  const editors = [...headerEditors, ...footerEditors].filter(Boolean);
60522
- for (let editorData of editors) {
60449
+ for (const editorData of editors) {
60523
60450
  editorData?.editor?.destroy?.();
60524
60451
  }
60525
60452
  if (headerEditors.length) headerEditors.length = 0;
60526
60453
  if (footerEditors.length) footerEditors.length = 0;
60527
60454
  } catch (error) {
60528
- this.emit("exception", { error, editor: this });
60529
- console.error(error);
60455
+ const err = error instanceof Error ? error : new Error(String(error));
60456
+ this.emit("exception", { error: err, editor: this });
60457
+ console.error(err);
60530
60458
  }
60531
60459
  }
60532
60460
  /**
60533
60461
  * Check if migrations are needed for the data
60534
- * @static
60535
- * @param {Object} data - Document data
60536
- * @returns {boolean} Whether migrations are needed
60537
60462
  */
60538
60463
  static checkIfMigrationsNeeded() {
60539
- const dataVersion = version || "initial";
60464
+ const dataVersion = version ?? "initial";
60540
60465
  const migrations = getNecessaryMigrations(dataVersion) || [];
60541
60466
  console.debug("[checkVersionMigrations] Migrations needed:", dataVersion, migrations.length);
60542
60467
  return migrations.length > 0;
60543
60468
  }
60544
60469
  /**
60545
60470
  * Process collaboration migrations
60546
- * @returns {Object | void} Migration results
60547
60471
  */
60548
60472
  processCollaborationMigrations() {
60549
- console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.1");
60473
+ console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.3");
60550
60474
  if (!this.options.ydoc) return;
60551
60475
  const metaMap = this.options.ydoc.getMap("meta");
60552
60476
  let docVersion = metaMap.get("version");
@@ -60554,10 +60478,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60554
60478
  console.debug("[checkVersionMigrations] Document version", docVersion);
60555
60479
  const migrations = getNecessaryMigrations(docVersion) || [];
60556
60480
  const plugins = this.state.plugins;
60557
- const syncPlugin = plugins.find((p2) => p2.key.startsWith("y-sync"));
60481
+ const syncPlugin = plugins.find((plugin2) => __privateMethod$1(this, _Editor_instances, getPluginKeyName_fn).call(this, plugin2).startsWith("y-sync"));
60558
60482
  if (!syncPlugin) return this.options.ydoc;
60559
60483
  let hasRunMigrations = false;
60560
- for (let migration of migrations) {
60484
+ for (const migration of migrations) {
60561
60485
  console.debug("🏃‍♂️ Running migration", migration.name);
60562
60486
  const result = migration(this);
60563
60487
  if (!result) throw new Error("Migration failed at " + migration.name);
@@ -60569,9 +60493,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60569
60493
  }
60570
60494
  /**
60571
60495
  * Replace the current file
60572
- * @async
60573
- * @param {Object} newFile - New file data
60574
- * @returns {Promise<void>}
60575
60496
  */
60576
60497
  async replaceFile(newFile) {
60577
60498
  this.setOptions({ annotations: true });
@@ -60582,15 +60503,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60582
60503
  media: media2,
60583
60504
  mediaFiles,
60584
60505
  fonts,
60585
- isNewFile: true,
60586
- shouldLoadComments: true,
60587
- replacedFile: true
60506
+ isNewFile: true
60588
60507
  });
60508
+ this.options.shouldLoadComments = true;
60509
+ this.options.replacedFile = true;
60589
60510
  __privateMethod$1(this, _Editor_instances, createConverter_fn).call(this);
60590
60511
  __privateMethod$1(this, _Editor_instances, initMedia_fn).call(this);
60591
60512
  this.initDefaultStyles();
60592
60513
  if (this.options.ydoc && this.options.collaborationProvider) {
60593
- updateYdocDocxData(this);
60514
+ updateYdocDocxData(this, this.options.ydoc);
60594
60515
  this.initializeCollaborationData();
60595
60516
  } else {
60596
60517
  __privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
@@ -60602,9 +60523,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60602
60523
  }
60603
60524
  /**
60604
60525
  * Get internal docx file content
60605
- * @param {string} name - File name
60606
- * @param {string} type - type of result (json, string)
60607
- * @returns {Object|String} - file content
60526
+ * @param name - File name
60527
+ * @param type - type of result (json, string)
60608
60528
  */
60609
60529
  getInternalXmlFile(name, type2 = "json") {
60610
60530
  if (!this.converter.convertedXml[name]) {
@@ -60618,8 +60538,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60618
60538
  }
60619
60539
  /**
60620
60540
  * Update internal docx file content
60621
- * @param {string} name - File name
60622
- * @param {string} updatedContent - new file content
60541
+ * @param name - File name
60542
+ * @param updatedContent - new file content
60623
60543
  */
60624
60544
  updateInternalXmlFile(name, updatedContent) {
60625
60545
  if (typeof updatedContent === "string") {
@@ -60632,8 +60552,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60632
60552
  }
60633
60553
  /**
60634
60554
  * Get all nodes of a specific type
60635
- * @param {string} type - Node type
60636
- * @returns {Array} Array of nodes
60637
60555
  */
60638
60556
  getNodesOfType(type2) {
60639
60557
  const { findChildren: findChildren2 } = helpers;
@@ -60641,9 +60559,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60641
60559
  }
60642
60560
  /**
60643
60561
  * Replace a node with HTML content
60644
- * @param {Object} targetNode - The node to replace
60645
- * @param {string} html - HTML content to replace with
60646
- * @returns {void}
60647
60562
  */
60648
60563
  replaceNodeWithHTML(targetNode, html2) {
60649
60564
  const { tr } = this.state;
@@ -60660,9 +60575,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60660
60575
  * pre-process the document as needed prior to running in the annotator.
60661
60576
  *
60662
60577
  * Currently this is only used for table generation but additional pre-processing can be done here.
60663
- *
60664
- * @param {FieldValue[]} annotationValues
60665
- * @returns {void}
60666
60578
  */
60667
60579
  prepareForAnnotations(annotationValues = []) {
60668
60580
  const { tr } = this.state;
@@ -60671,8 +60583,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60671
60583
  }
60672
60584
  /**
60673
60585
  * Migrate paragraph fields to lists V2 structure if necessary.
60674
- * @param {FieldValue[]} annotationValues - List of field values to migrate.
60675
- * @returns {Promise<FieldValue[]>} - Returns a promise that resolves to the migrated
60586
+ * @param annotationValues - List of field values to migrate.
60587
+ * @returns Returns a promise that resolves to the migrated values
60676
60588
  */
60677
60589
  async migrateParagraphFields(annotationValues = []) {
60678
60590
  if (!Array.isArray(annotationValues) || !annotationValues.length) return annotationValues;
@@ -60681,10 +60593,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60681
60593
  }
60682
60594
  /**
60683
60595
  * Annotate the document with the given annotation values.
60684
- *
60685
- * @param {FieldValue[]} annotationValues List of field values to apply.
60686
- * @param {String[]} hiddenIds List of field ids to remove from the document.
60687
- * @returns {void}
60688
60596
  */
60689
60597
  annotate(annotationValues = [], hiddenIds = [], removeEmptyFields = false) {
60690
60598
  const { state: state2, view, schema } = this;
@@ -60703,10 +60611,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60703
60611
  /**
60704
60612
  * Preview annotations in the editor. It stores a copy of the original state.
60705
60613
  * This can be reverted via closePreview()
60706
- *
60707
- * @param {Object[]} annotationValues
60708
- * @param {string[]} hiddenIds
60709
- * @returns {void}
60710
60614
  */
60711
60615
  previewAnnotations(annotationValues = [], hiddenIds = []) {
60712
60616
  this.originalState = this.view.state;
@@ -60714,8 +60618,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60714
60618
  }
60715
60619
  /**
60716
60620
  * If there is a preview active, this will revert the editor to the original state.
60717
- *
60718
- * @returns {void}
60719
60621
  */
60720
60622
  closePreview() {
60721
60623
  if (!this.originalState) return;
@@ -60761,7 +60663,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60761
60663
  this.on("update", this.options.onUpdate);
60762
60664
  this.on("selectionUpdate", this.options.onSelectionUpdate);
60763
60665
  this.on("transaction", this.options.onTransaction);
60764
- this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn));
60666
+ this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn).bind(this));
60765
60667
  this.on("blur", this.options.onBlur);
60766
60668
  this.on("destroy", this.options.onDestroy);
60767
60669
  this.on("trackedChangesUpdate", this.options.onTrackedChangesUpdate);
@@ -60769,7 +60671,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60769
60671
  this.on("commentClick", this.options.onCommentClicked);
60770
60672
  this.on("commentsUpdate", this.options.onCommentsUpdate);
60771
60673
  this.on("locked", this.options.onDocumentLocked);
60772
- this.on("collaborationReady", __privateMethod$1(this, _Editor_instances, onCollaborationReady_fn));
60674
+ this.on("collaborationReady", __privateMethod$1(this, _Editor_instances, onCollaborationReady_fn).bind(this));
60773
60675
  this.on("paginationUpdate", this.options.onPaginationUpdate);
60774
60676
  this.on("comment-positions", this.options.onCommentLocationsUpdate);
60775
60677
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
@@ -60812,7 +60714,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60812
60714
  this.on("update", this.options.onUpdate);
60813
60715
  this.on("selectionUpdate", this.options.onSelectionUpdate);
60814
60716
  this.on("transaction", this.options.onTransaction);
60815
- this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn));
60717
+ this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn).bind(this));
60816
60718
  this.on("blur", this.options.onBlur);
60817
60719
  this.on("destroy", this.options.onDestroy);
60818
60720
  this.on("commentsLoaded", this.options.onCommentsLoaded);
@@ -60827,7 +60729,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60827
60729
  checkHeadless_fn = function(options) {
60828
60730
  if (!options.isHeadless) return;
60829
60731
  if (typeof navigator === "undefined") {
60830
- global$3.navigator = { isHeadless: true };
60732
+ const minimalNavigator = {
60733
+ platform: "node",
60734
+ userAgent: "Node.js"
60735
+ };
60736
+ global$3.navigator = minimalNavigator;
60831
60737
  }
60832
60738
  if (options.mockDocument) {
60833
60739
  global$3.document = options.mockDocument;
@@ -60860,13 +60766,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60860
60766
  __privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
60861
60767
  }, 50);
60862
60768
  };
60769
+ getPluginKeyName_fn = function(plugin2) {
60770
+ const pluginKey = plugin2.key;
60771
+ return typeof pluginKey?.key === "string" ? pluginKey.key : "";
60772
+ };
60863
60773
  createExtensionService_fn = function() {
60864
60774
  const allowedExtensions = ["extension", "node", "mark"];
60865
60775
  const coreExtensions = [Editable, Commands, EditorFocus, Keymap];
60866
60776
  const externalExtensions = this.options.externalExtensions || [];
60867
- const allExtensions = [...coreExtensions, ...this.options.extensions].filter(
60868
- (e) => allowedExtensions.includes(e?.type)
60869
- );
60777
+ const allExtensions = [...coreExtensions, ...this.options.extensions].filter((extension) => {
60778
+ const extensionType = typeof extension?.type === "string" ? extension.type : void 0;
60779
+ return extensionType ? allowedExtensions.includes(extensionType) : false;
60780
+ });
60870
60781
  this.extensionService = ExtensionService.create(allExtensions, externalExtensions, this);
60871
60782
  };
60872
60783
  createCommandService_fn = function() {
@@ -60891,7 +60802,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60891
60802
  };
60892
60803
  initMedia_fn = function() {
60893
60804
  if (this.options.isChildEditor) return;
60894
- if (!this.options.ydoc) return this.storage.image.media = this.options.mediaFiles;
60805
+ if (!this.options.ydoc) {
60806
+ this.storage.image.media = this.options.mediaFiles;
60807
+ return;
60808
+ }
60895
60809
  const mediaMap = this.options.ydoc.getMap("media");
60896
60810
  if (this.options.isNewFile) {
60897
60811
  Object.entries(this.options.mediaFiles).forEach(([key2, value]) => {
@@ -60921,10 +60835,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60921
60835
  try {
60922
60836
  const fontsUsedInDocument = this.converter.getDocumentFonts();
60923
60837
  const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFonts_fn).call(this, fontsUsedInDocument);
60924
- this.emit("fonts-resolved", {
60838
+ const payload = {
60925
60839
  documentFonts: fontsUsedInDocument,
60926
60840
  unsupportedFonts
60927
- });
60841
+ };
60842
+ this.emit("fonts-resolved", payload);
60928
60843
  } catch {
60929
60844
  console.warn("[SuperDoc] Could not determine document fonts and unsupported fonts");
60930
60845
  }
@@ -60943,9 +60858,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60943
60858
  generatePmData_fn = function() {
60944
60859
  let doc2;
60945
60860
  try {
60946
- const { mode, fragment, content: content2, loadFromSchema } = this.options;
60861
+ const { mode, content: content2, fragment, loadFromSchema } = this.options;
60862
+ const hasJsonContent = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
60947
60863
  if (mode === "docx") {
60948
- if (loadFromSchema) {
60864
+ if (loadFromSchema && hasJsonContent(content2)) {
60949
60865
  doc2 = this.schema.nodeFromJSON(content2);
60950
60866
  doc2 = __privateMethod$1(this, _Editor_instances, prepareDocumentForImport_fn).call(this, doc2);
60951
60867
  } else {
@@ -60958,18 +60874,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60958
60874
  if (fragment) doc2 = yXmlFragmentToProseMirrorRootNode(fragment, this.schema);
60959
60875
  }
60960
60876
  } else if (mode === "text" || mode === "html") {
60961
- if (loadFromSchema) doc2 = this.schema.nodeFromJSON(content2);
60962
- else if (content2) doc2 = createDocFromHTML(content2, this);
60877
+ if (loadFromSchema && hasJsonContent(content2)) doc2 = this.schema.nodeFromJSON(content2);
60878
+ else if (typeof content2 === "string") doc2 = createDocFromHTML(content2, this);
60963
60879
  else doc2 = this.schema.topNodeType.createAndFill();
60964
60880
  }
60965
60881
  } catch (err) {
60966
60882
  console.error(err);
60967
- this.emit("contentError", { editor: this, error: err });
60883
+ const error = err instanceof Error ? err : new Error(String(err));
60884
+ this.emit("contentError", { editor: this, error });
60968
60885
  }
60969
60886
  return doc2;
60970
60887
  };
60971
60888
  createView_fn = function(element2) {
60972
- let doc2 = __privateMethod$1(this, _Editor_instances, generatePmData_fn).call(this);
60889
+ const doc2 = __privateMethod$1(this, _Editor_instances, generatePmData_fn).call(this);
60973
60890
  const state2 = { schema: this.schema };
60974
60891
  if (!this.options.ydoc) state2.doc = doc2;
60975
60892
  this.options.initialState = EditorState.create(state2);
@@ -60978,13 +60895,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60978
60895
  dispatchTransaction: __privateMethod$1(this, _Editor_instances, dispatchTransaction_fn).bind(this),
60979
60896
  state: this.options.initialState,
60980
60897
  handleClick: __privateMethod$1(this, _Editor_instances, handleNodeSelection_fn).bind(this),
60981
- handleDoubleClick: async (view, pos, event) => {
60898
+ handleDoubleClick: (view, pos, event) => {
60982
60899
  if (this.options.documentMode !== "editing") return;
60983
60900
  if (!isHeadless(this)) {
60984
60901
  const isHeader = hasSomeParentWithClass(event.target, "pagination-section-header");
60985
60902
  const isFooter = hasSomeParentWithClass(event.target, "pagination-section-footer");
60986
60903
  if (isHeader || isFooter) {
60987
- const eventClone = new event.constructor(event.type);
60904
+ const EventConstructor = event.constructor;
60905
+ const eventClone = new EventConstructor(event.type);
60988
60906
  event.target.dispatchEvent(eventClone);
60989
60907
  if (this.options.isHeaderOrFooter && this.options.editable) setWordSelection(view, pos);
60990
60908
  return;
@@ -61002,7 +60920,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61002
60920
  const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
61003
60921
  if (pm) {
61004
60922
  pm.classList.remove("header-footer-edit");
61005
- pm.setAttribute("aria-readonly", false);
60923
+ pm.setAttribute("aria-readonly", "false");
61006
60924
  }
61007
60925
  }
61008
60926
  setWordSelection(view, pos);
@@ -61013,7 +60931,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61013
60931
  });
61014
60932
  this.view.updateState(newState);
61015
60933
  this.createNodeViews();
61016
- this.options.telemetry?.sendReport();
60934
+ this.options.telemetry?.trackUsage?.("editor_initialized", {});
61017
60935
  };
61018
60936
  onCollaborationReady_fn = function({ editor, ydoc }) {
61019
60937
  if (this.options.collaborationIsReady) return;
@@ -61031,7 +60949,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61031
60949
  if (!this.options.isNewFile) {
61032
60950
  __privateMethod$1(this, _Editor_instances, initPagination_fn).call(this);
61033
60951
  __privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
61034
- updateYdocDocxData(this);
60952
+ updateYdocDocxData(this, this.options.ydoc);
61035
60953
  }
61036
60954
  };
61037
60955
  initComments_fn = function() {
@@ -61039,7 +60957,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61039
60957
  if (this.options.isHeadless) return;
61040
60958
  if (!this.options.shouldLoadComments) return;
61041
60959
  const replacedFile = this.options.replacedFile;
61042
- this.emit("commentsLoaded", { editor: this, replacedFile, comments: this.converter.comments || [] });
60960
+ this.emit("commentsLoaded", {
60961
+ editor: this,
60962
+ replacedFile,
60963
+ comments: this.converter.comments || []
60964
+ });
61043
60965
  setTimeout(() => {
61044
60966
  this.options.replacedFile = false;
61045
60967
  const { state: state2, dispatch } = this.view;
@@ -61156,11 +61078,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61156
61078
  if (!this.options.ydoc) return;
61157
61079
  try {
61158
61080
  console.debug("🔗 [super-editor] Ending collaboration");
61159
- if (this.options.collaborationProvider) this.options.collaborationProvider.disconnect();
61160
- if (this.options.ydoc) this.options.ydoc.destroy();
61081
+ this.options.collaborationProvider?.disconnect?.();
61082
+ this.options.ydoc.destroy();
61161
61083
  } catch (error) {
61162
- this.emit("exception", { error, editor: this });
61163
- console.error(error);
61084
+ const err = error instanceof Error ? error : new Error(String(error));
61085
+ this.emit("exception", { error: err, editor: this });
61086
+ console.error(err);
61164
61087
  }
61165
61088
  };
61166
61089
  validateDocumentInit_fn = function() {
@@ -63449,6 +63372,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63449
63372
  return new DocumentSectionView(node2, getPos, decorations, editor);
63450
63373
  };
63451
63374
  },
63375
+ // @ts-expect-error - Command signatures will be fixed in TS migration
63452
63376
  addCommands() {
63453
63377
  return {
63454
63378
  /**
@@ -63706,6 +63630,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63706
63630
  }
63707
63631
  };
63708
63632
  },
63633
+ // @ts-expect-error - Command signatures will be fixed in TS migration
63709
63634
  addCommands() {
63710
63635
  return {
63711
63636
  /**
@@ -63843,6 +63768,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63843
63768
  }
63844
63769
  };
63845
63770
  },
63771
+ // @ts-expect-error - Command signatures will be fixed in TS migration
63846
63772
  addCommands() {
63847
63773
  return {
63848
63774
  splitRun
@@ -66377,6 +66303,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66377
66303
  };
66378
66304
  },
66379
66305
  addPmPlugins() {
66306
+ if (isHeadless(this.editor)) {
66307
+ return [];
66308
+ }
66380
66309
  const { view, helpers: helpers2 } = this.editor;
66381
66310
  const mergeRanges2 = (ranges) => {
66382
66311
  if (ranges.length === 0) return [];
@@ -66494,6 +66423,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66494
66423
  clear: { rendered: false }
66495
66424
  };
66496
66425
  },
66426
+ // @ts-expect-error - Command signatures will be fixed in TS migration
66497
66427
  addCommands() {
66498
66428
  return {
66499
66429
  /**
@@ -66556,6 +66486,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66556
66486
  renderDOM({ htmlAttributes }) {
66557
66487
  return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
66558
66488
  },
66489
+ // @ts-expect-error - Command signatures will be fixed in TS migration
66559
66490
  addCommands() {
66560
66491
  return {
66561
66492
  /**
@@ -69302,9 +69233,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69302
69233
  const attrs = Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
69303
69234
  style: tableWidth ? `width: ${tableWidth}` : `min-width: ${tableMinWidth}`
69304
69235
  });
69305
- const table2 = ["table", attrs, colgroup, ["tbody", 0]];
69306
- return table2;
69236
+ return ["table", attrs, colgroup, ["tbody", 0]];
69307
69237
  },
69238
+ // @ts-expect-error - Command signatures will be fixed in TS migration
69308
69239
  addCommands() {
69309
69240
  return {
69310
69241
  /**
@@ -69826,9 +69757,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69826
69757
  return [
69827
69758
  ...resizable ? [
69828
69759
  columnResizing({
69760
+ // @ts-expect-error - Options types will be fixed in TS migration
69829
69761
  handleWidth: this.options.handleWidth,
69762
+ // @ts-expect-error - Options types will be fixed in TS migration
69830
69763
  cellMinWidth: this.options.cellMinWidth,
69764
+ // @ts-expect-error - Options types will be fixed in TS migration
69831
69765
  defaultCellMinWidth: this.options.cellMinWidth,
69766
+ // @ts-expect-error - Options types will be fixed in TS migration
69832
69767
  lastColumnResizable: this.options.lastColumnResizable,
69833
69768
  View: createTableView({
69834
69769
  editor: this.editor
@@ -69836,6 +69771,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69836
69771
  })
69837
69772
  ] : [],
69838
69773
  tableEditing({
69774
+ // @ts-expect-error - Options types will be fixed in TS migration
69839
69775
  allowTableNodeSelection: this.options.allowTableNodeSelection
69840
69776
  })
69841
69777
  ];
@@ -69898,6 +69834,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69898
69834
  renderDOM: (attrs) => {
69899
69835
  if (!attrs.colwidth) return {};
69900
69836
  return {
69837
+ // @ts-expect-error - colwidth is known to be an array at runtime
69901
69838
  "data-colwidth": attrs.colwidth.join(",")
69902
69839
  };
69903
69840
  }
@@ -70021,6 +69958,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70021
69958
  renderDOM: (attrs) => {
70022
69959
  if (!attrs.colwidth) return {};
70023
69960
  return {
69961
+ // @ts-expect-error - colwidth is known to be an array at runtime
70024
69962
  "data-colwidth": attrs.colwidth.join(",")
70025
69963
  };
70026
69964
  }
@@ -73116,6 +73054,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
73116
73054
  renderDOM({ htmlAttributes }) {
73117
73055
  return ["a", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
73118
73056
  },
73057
+ // @ts-expect-error - Command signatures will be fixed in TS migration
73119
73058
  addCommands() {
73120
73059
  return {
73121
73060
  /**
@@ -73219,6 +73158,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
73219
73158
  renderDOM({ htmlAttributes }) {
73220
73159
  return ["span", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
73221
73160
  },
73161
+ // @ts-expect-error - Command signatures will be fixed in TS migration
73222
73162
  addCommands() {
73223
73163
  return {
73224
73164
  /**
@@ -73724,8 +73664,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
73724
73664
  if (size2.top) style2 += `top: ${size2.top}px; `;
73725
73665
  if (size2.left) style2 += `left: ${size2.left}px; `;
73726
73666
  if (size2.width) style2 += `width: ${size2.width.toString().endsWith("%") ? size2.width : `${size2.width}px`}; `;
73727
- if (size2.height)
73728
- style2 += `height: ${size2.height.toString().endsWith("%") ? size2.height : `${size2.height}px`}; `;
73667
+ if (size2.height) {
73668
+ const heightValue = size2.height.toString().endsWith("%") ? size2.height : `${size2.height}px`;
73669
+ style2 += `height: ${heightValue}; `;
73670
+ }
73729
73671
  return { style: style2 };
73730
73672
  }
73731
73673
  },
@@ -73756,6 +73698,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
73756
73698
  renderDOM({ htmlAttributes }) {
73757
73699
  return ["div", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, { "data-type": this.name })];
73758
73700
  },
73701
+ // @ts-expect-error - Command signatures will be fixed in TS migration
73759
73702
  addCommands() {
73760
73703
  return {
73761
73704
  /**
@@ -83080,6 +83023,7 @@ ${l}
83080
83023
  }
83081
83024
  const isRegExp = (value) => Object.prototype.toString.call(value) === "[object RegExp]";
83082
83025
  const Search = Extension.create({
83026
+ // @ts-expect-error - Storage type mismatch will be fixed in TS migration
83083
83027
  addStorage() {
83084
83028
  return {
83085
83029
  /**
@@ -116651,7 +116595,7 @@ ${style2}
116651
116595
  this.config.colors = shuffleArray(this.config.colors);
116652
116596
  this.userColorMap = /* @__PURE__ */ new Map();
116653
116597
  this.colorIndex = 0;
116654
- this.version = "0.31.0-next.1";
116598
+ this.version = "0.31.0-next.3";
116655
116599
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
116656
116600
  this.superdocId = config2.superdocId || v4();
116657
116601
  this.colors = this.config.colors;
@@ -119051,7 +118995,7 @@ ${style2}
119051
118995
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
119052
118996
  );
119053
118997
  }
119054
- const index0zP7LFOd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
118998
+ const indexB74saKaW = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
119055
118999
  __proto__: null,
119056
119000
  unified
119057
119001
  }, Symbol.toStringTag, { value: "Module" }));