@aquera/nile-elements 1.9.6 → 1.9.7

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 (510) hide show
  1. package/README.md +3 -0
  2. package/dist/index-178e1e57.cjs.js +2 -0
  3. package/dist/index-178e1e57.cjs.js.map +1 -0
  4. package/dist/index-1faa963c.esm.js +1 -0
  5. package/dist/index-249de90a.esm.js +1 -0
  6. package/dist/index-353172ed.esm.js +1 -0
  7. package/dist/index-6f3fa4ab.esm.js +1 -0
  8. package/dist/index-89c520e9.cjs.js +5 -0
  9. package/dist/index-89c520e9.cjs.js.map +1 -0
  10. package/dist/index-920675c4.esm.js +1 -0
  11. package/dist/index-b387a9f4.cjs.js +2 -0
  12. package/dist/index-b387a9f4.cjs.js.map +1 -0
  13. package/dist/index-cc1385e0.cjs.js +2 -0
  14. package/dist/index-cc1385e0.cjs.js.map +1 -0
  15. package/dist/index-dedc38a6.esm.js +1 -0
  16. package/dist/index-df196058.cjs.js +2 -0
  17. package/dist/index-df196058.cjs.js.map +1 -0
  18. package/dist/index-f956f56d.cjs.js +7 -0
  19. package/dist/index-f956f56d.cjs.js.map +1 -0
  20. package/dist/index.cjs.js +1 -1
  21. package/dist/index.esm.js +1 -1
  22. package/dist/index.js +3595 -629
  23. package/dist/internal/glyph.cjs.js +2 -0
  24. package/dist/internal/glyph.cjs.js.map +1 -0
  25. package/dist/internal/glyph.esm.js +5 -0
  26. package/dist/nile-auto-complete/index.cjs.js +1 -1
  27. package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
  28. package/dist/nile-auto-complete/portal-manager.cjs.js +1 -1
  29. package/dist/nile-auto-complete/portal-utils.cjs.js +1 -1
  30. package/dist/nile-code-editor/extensionSetup.cjs.js +7 -7
  31. package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
  32. package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
  33. package/dist/nile-code-editor/index.cjs.js +1 -1
  34. package/dist/nile-code-editor/index.esm.js +1 -1
  35. package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
  36. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  37. package/dist/nile-code-editor/nile-code-editor.esm.js +1 -1
  38. package/dist/nile-color-picker/index.cjs.js +1 -1
  39. package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
  40. package/dist/nile-combobox/index.cjs.js +1 -1
  41. package/dist/nile-combobox/index.esm.js +1 -1
  42. package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
  43. package/dist/nile-combobox/nile-combobox.esm.js +1 -1
  44. package/dist/nile-combobox/portal-manager.cjs.js +1 -1
  45. package/dist/nile-context-menu/index.cjs.js +1 -1
  46. package/dist/nile-context-menu/nile-context-menu.cjs.js +1 -1
  47. package/dist/nile-context-submenu/index.cjs.js +1 -1
  48. package/dist/nile-context-submenu/nile-context-submenu.cjs.js +1 -1
  49. package/dist/nile-detail/index.cjs.js +1 -1
  50. package/dist/nile-detail/index.esm.js +1 -1
  51. package/dist/nile-detail/nile-detail.cjs.js +1 -1
  52. package/dist/nile-detail/nile-detail.esm.js +1 -1
  53. package/dist/nile-dropdown/index.cjs.js +1 -1
  54. package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
  55. package/dist/nile-dropdown/portal-manager.cjs.js +1 -1
  56. package/dist/nile-file-upload/index.cjs.js +1 -1
  57. package/dist/nile-file-upload/nile-file-upload.cjs.js +1 -1
  58. package/dist/nile-file-upload/nile-file-upload.template.cjs.js +1 -1
  59. package/dist/nile-floating-panel/index.cjs.js +1 -1
  60. package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
  61. package/dist/nile-lite-tooltip/index.cjs.js +1 -1
  62. package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js +1 -1
  63. package/dist/nile-markdown-editor/index.cjs.js +1 -1
  64. package/dist/nile-markdown-editor/nile-markdown-editor.cjs.js +1 -1
  65. package/dist/nile-popover/index.cjs.js +1 -1
  66. package/dist/nile-popover/nile-popover.cjs.js +1 -1
  67. package/dist/nile-popover/portal-manager.cjs.js +1 -1
  68. package/dist/nile-popup/index.cjs.js +1 -1
  69. package/dist/nile-popup/nile-popup.cjs.js +1 -1
  70. package/dist/nile-select/index.cjs.js +1 -1
  71. package/dist/nile-select/nile-select.cjs.js +1 -1
  72. package/dist/nile-select/portal-manager.cjs.js +1 -1
  73. package/dist/nile-side-bar-action/index.cjs.js +1 -1
  74. package/dist/nile-side-bar-action/nile-side-bar-action.cjs.js +1 -1
  75. package/dist/nile-side-bar-action/portal-manager.cjs.js +1 -1
  76. package/dist/nile-tooltip/index.cjs.js +1 -1
  77. package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
  78. package/dist/nile-virtual-select/index.cjs.js +1 -1
  79. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
  80. package/dist/nile-virtual-select/portal-manager.cjs.js +1 -1
  81. package/dist/nile-virtual-select/renderer.cjs.js +1 -1
  82. package/dist/nile-wysiwyg-editor/emoji.cjs.js +2 -0
  83. package/dist/nile-wysiwyg-editor/emoji.cjs.js.map +1 -0
  84. package/dist/nile-wysiwyg-editor/emoji.esm.js +1 -0
  85. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +2 -0
  86. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -0
  87. package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -0
  88. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +2 -0
  89. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -0
  90. package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -0
  91. package/dist/nile-wysiwyg-editor/engine/export.cjs.js +2 -0
  92. package/dist/nile-wysiwyg-editor/engine/export.cjs.js.map +1 -0
  93. package/dist/nile-wysiwyg-editor/engine/export.esm.js +1 -0
  94. package/dist/nile-wysiwyg-editor/engine/index.cjs.js +2 -0
  95. package/dist/nile-wysiwyg-editor/engine/index.cjs.js.map +1 -0
  96. package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -0
  97. package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +2 -0
  98. package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js.map +1 -0
  99. package/dist/nile-wysiwyg-editor/engine/inputrules.esm.js +1 -0
  100. package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +2 -0
  101. package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js.map +1 -0
  102. package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -0
  103. package/dist/nile-wysiwyg-editor/engine/markdown-parse.cjs.js +2 -0
  104. package/dist/nile-wysiwyg-editor/engine/markdown-parse.cjs.js.map +1 -0
  105. package/dist/nile-wysiwyg-editor/engine/markdown-parse.esm.js +1 -0
  106. package/dist/nile-wysiwyg-editor/engine/markdown.cjs.js +2 -0
  107. package/dist/nile-wysiwyg-editor/engine/markdown.cjs.js.map +1 -0
  108. package/dist/nile-wysiwyg-editor/engine/markdown.esm.js +1 -0
  109. package/dist/nile-wysiwyg-editor/engine/office-paste.cjs.js +2 -0
  110. package/dist/nile-wysiwyg-editor/engine/office-paste.cjs.js.map +1 -0
  111. package/dist/nile-wysiwyg-editor/engine/office-paste.esm.js +1 -0
  112. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +2 -0
  113. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -0
  114. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -0
  115. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +2 -0
  116. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -0
  117. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -0
  118. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +2 -0
  119. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -0
  120. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -0
  121. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js +2 -0
  122. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js.map +1 -0
  123. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.esm.js +1 -0
  124. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js +2 -0
  125. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js.map +1 -0
  126. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.esm.js +1 -0
  127. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js +2 -0
  128. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js.map +1 -0
  129. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.esm.js +1 -0
  130. package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js +2 -0
  131. package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js.map +1 -0
  132. package/dist/nile-wysiwyg-editor/engine/plugins/image.esm.js +1 -0
  133. package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js +2 -0
  134. package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js.map +1 -0
  135. package/dist/nile-wysiwyg-editor/engine/plugins/link.esm.js +1 -0
  136. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js +2 -0
  137. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js.map +1 -0
  138. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.esm.js +1 -0
  139. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js +2 -0
  140. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js.map +1 -0
  141. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.esm.js +1 -0
  142. package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js +2 -0
  143. package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js.map +1 -0
  144. package/dist/nile-wysiwyg-editor/engine/plugins/paste.esm.js +1 -0
  145. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js +2 -0
  146. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js.map +1 -0
  147. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.esm.js +1 -0
  148. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js +2 -0
  149. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js.map +1 -0
  150. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.esm.js +1 -0
  151. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js +2 -0
  152. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js.map +1 -0
  153. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.esm.js +1 -0
  154. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +2 -0
  155. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -0
  156. package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -0
  157. package/dist/nile-wysiwyg-editor/engine/plugins/task-list.cjs.js +2 -0
  158. package/dist/nile-wysiwyg-editor/engine/plugins/task-list.cjs.js.map +1 -0
  159. package/dist/nile-wysiwyg-editor/engine/plugins/task-list.esm.js +1 -0
  160. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +2 -0
  161. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -0
  162. package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -0
  163. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +2 -0
  164. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -0
  165. package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -0
  166. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +2 -0
  167. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -0
  168. package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -0
  169. package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js +2 -0
  170. package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js.map +1 -0
  171. package/dist/nile-wysiwyg-editor/engine/serializer.esm.js +1 -0
  172. package/dist/nile-wysiwyg-editor/index.cjs.js +2 -0
  173. package/dist/nile-wysiwyg-editor/index.cjs.js.map +1 -0
  174. package/dist/nile-wysiwyg-editor/index.esm.js +1 -0
  175. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +2 -0
  176. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -0
  177. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +2 -0
  178. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -0
  179. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +780 -0
  180. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +97 -0
  181. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +2 -0
  182. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js.map +1 -0
  183. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -0
  184. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +2 -0
  185. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js.map +1 -0
  186. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js +2 -0
  187. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js.map +1 -0
  188. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.esm.js +244 -0
  189. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +137 -0
  190. package/dist/nile-wysiwyg-editor/types.cjs.js +2 -0
  191. package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -0
  192. package/dist/nile-wysiwyg-editor/types.esm.js +1 -0
  193. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js +2 -0
  194. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js.map +1 -0
  195. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.esm.js +97 -0
  196. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +2 -0
  197. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -0
  198. package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +67 -0
  199. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +2 -0
  200. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -0
  201. package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +65 -0
  202. package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +2 -0
  203. package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -0
  204. package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +64 -0
  205. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +2 -0
  206. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -0
  207. package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +68 -0
  208. package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js +2 -0
  209. package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js.map +1 -0
  210. package/dist/nile-wysiwyg-editor/ui/emoji-picker.esm.js +96 -0
  211. package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js +2 -0
  212. package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js.map +1 -0
  213. package/dist/nile-wysiwyg-editor/ui/find-replace.esm.js +112 -0
  214. package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +2 -0
  215. package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -0
  216. package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +64 -0
  217. package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js +2 -0
  218. package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js.map +1 -0
  219. package/dist/nile-wysiwyg-editor/ui/image-panel.esm.js +171 -0
  220. package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js +2 -0
  221. package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js.map +1 -0
  222. package/dist/nile-wysiwyg-editor/ui/insert-menu.esm.js +90 -0
  223. package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js +2 -0
  224. package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js.map +1 -0
  225. package/dist/nile-wysiwyg-editor/ui/link-editor.esm.js +114 -0
  226. package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js +2 -0
  227. package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js.map +1 -0
  228. package/dist/nile-wysiwyg-editor/ui/markdown-panel.esm.js +80 -0
  229. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +2 -0
  230. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -0
  231. package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +92 -0
  232. package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js +2 -0
  233. package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js.map +1 -0
  234. package/dist/nile-wysiwyg-editor/ui/shortcut-help.esm.js +147 -0
  235. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +2 -0
  236. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -0
  237. package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +79 -0
  238. package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js +2 -0
  239. package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js.map +1 -0
  240. package/dist/nile-wysiwyg-editor/ui/special-chars.esm.js +96 -0
  241. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +2 -0
  242. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -0
  243. package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +67 -0
  244. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +2 -0
  245. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -0
  246. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +100 -0
  247. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +2 -0
  248. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -0
  249. package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +58 -0
  250. package/dist/src/index.d.ts +24 -0
  251. package/dist/src/index.js +19 -0
  252. package/dist/src/index.js.map +1 -1
  253. package/dist/src/internal/glyph.d.ts +6 -0
  254. package/dist/src/internal/glyph.js +13 -0
  255. package/dist/src/internal/glyph.js.map +1 -0
  256. package/dist/src/nile-wysiwyg-editor/emoji.d.ts +5 -0
  257. package/dist/src/nile-wysiwyg-editor/emoji.js +138 -0
  258. package/dist/src/nile-wysiwyg-editor/emoji.js.map +1 -0
  259. package/dist/src/nile-wysiwyg-editor/engine/commands.d.ts +69 -0
  260. package/dist/src/nile-wysiwyg-editor/engine/commands.js +863 -0
  261. package/dist/src/nile-wysiwyg-editor/engine/commands.js.map +1 -0
  262. package/dist/src/nile-wysiwyg-editor/engine/create-state.d.ts +35 -0
  263. package/dist/src/nile-wysiwyg-editor/engine/create-state.js +67 -0
  264. package/dist/src/nile-wysiwyg-editor/engine/create-state.js.map +1 -0
  265. package/dist/src/nile-wysiwyg-editor/engine/export.d.ts +38 -0
  266. package/dist/src/nile-wysiwyg-editor/engine/export.js +208 -0
  267. package/dist/src/nile-wysiwyg-editor/engine/export.js.map +1 -0
  268. package/dist/src/nile-wysiwyg-editor/engine/export.test.d.ts +1 -0
  269. package/dist/src/nile-wysiwyg-editor/engine/export.test.js +96 -0
  270. package/dist/src/nile-wysiwyg-editor/engine/export.test.js.map +1 -0
  271. package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +37 -0
  272. package/dist/src/nile-wysiwyg-editor/engine/index.js +29 -0
  273. package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -0
  274. package/dist/src/nile-wysiwyg-editor/engine/inputrules.d.ts +12 -0
  275. package/dist/src/nile-wysiwyg-editor/engine/inputrules.js +144 -0
  276. package/dist/src/nile-wysiwyg-editor/engine/inputrules.js.map +1 -0
  277. package/dist/src/nile-wysiwyg-editor/engine/keymap.d.ts +15 -0
  278. package/dist/src/nile-wysiwyg-editor/engine/keymap.js +94 -0
  279. package/dist/src/nile-wysiwyg-editor/engine/keymap.js.map +1 -0
  280. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.d.ts +22 -0
  281. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.js +287 -0
  282. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.js.map +1 -0
  283. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.d.ts +1 -0
  284. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.js +106 -0
  285. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.js.map +1 -0
  286. package/dist/src/nile-wysiwyg-editor/engine/markdown.d.ts +10 -0
  287. package/dist/src/nile-wysiwyg-editor/engine/markdown.js +162 -0
  288. package/dist/src/nile-wysiwyg-editor/engine/markdown.js.map +1 -0
  289. package/dist/src/nile-wysiwyg-editor/engine/office-paste.d.ts +13 -0
  290. package/dist/src/nile-wysiwyg-editor/engine/office-paste.js +182 -0
  291. package/dist/src/nile-wysiwyg-editor/engine/office-paste.js.map +1 -0
  292. package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.d.ts +10 -0
  293. package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.js +165 -0
  294. package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.js.map +1 -0
  295. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.d.ts +17 -0
  296. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js +69 -0
  297. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js.map +1 -0
  298. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.d.ts +17 -0
  299. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js +96 -0
  300. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js.map +1 -0
  301. package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.d.ts +26 -0
  302. package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.js +123 -0
  303. package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.js.map +1 -0
  304. package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.d.ts +28 -0
  305. package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.js +72 -0
  306. package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.js.map +1 -0
  307. package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.d.ts +41 -0
  308. package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js +176 -0
  309. package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js.map +1 -0
  310. package/dist/src/nile-wysiwyg-editor/engine/plugins/image.d.ts +15 -0
  311. package/dist/src/nile-wysiwyg-editor/engine/plugins/image.js +64 -0
  312. package/dist/src/nile-wysiwyg-editor/engine/plugins/image.js.map +1 -0
  313. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.d.ts +11 -0
  314. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js +42 -0
  315. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js.map +1 -0
  316. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.d.ts +18 -0
  317. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js +46 -0
  318. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js.map +1 -0
  319. package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.d.ts +7 -0
  320. package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.js +26 -0
  321. package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.js.map +1 -0
  322. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.d.ts +31 -0
  323. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js +55 -0
  324. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js.map +1 -0
  325. package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.d.ts +7 -0
  326. package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.js +25 -0
  327. package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.js.map +1 -0
  328. package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.d.ts +10 -0
  329. package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.js +48 -0
  330. package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.js.map +1 -0
  331. package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.d.ts +29 -0
  332. package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.js +87 -0
  333. package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.js.map +1 -0
  334. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.d.ts +8 -0
  335. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +11 -0
  336. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -0
  337. package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.d.ts +16 -0
  338. package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.js +49 -0
  339. package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.js.map +1 -0
  340. package/dist/src/nile-wysiwyg-editor/engine/pm.test.d.ts +1 -0
  341. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +883 -0
  342. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -0
  343. package/dist/src/nile-wysiwyg-editor/engine/productivity.test.d.ts +1 -0
  344. package/dist/src/nile-wysiwyg-editor/engine/productivity.test.js +129 -0
  345. package/dist/src/nile-wysiwyg-editor/engine/productivity.test.js.map +1 -0
  346. package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +13 -0
  347. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +155 -0
  348. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -0
  349. package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +20 -0
  350. package/dist/src/nile-wysiwyg-editor/engine/schema.js +823 -0
  351. package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -0
  352. package/dist/src/nile-wysiwyg-editor/engine/selection-state.d.ts +70 -0
  353. package/dist/src/nile-wysiwyg-editor/engine/selection-state.js +138 -0
  354. package/dist/src/nile-wysiwyg-editor/engine/selection-state.js.map +1 -0
  355. package/dist/src/nile-wysiwyg-editor/engine/serializer.d.ts +18 -0
  356. package/dist/src/nile-wysiwyg-editor/engine/serializer.js +63 -0
  357. package/dist/src/nile-wysiwyg-editor/engine/serializer.js.map +1 -0
  358. package/dist/src/nile-wysiwyg-editor/index.d.ts +3 -0
  359. package/dist/src/nile-wysiwyg-editor/index.js +3 -0
  360. package/dist/src/nile-wysiwyg-editor/index.js.map +1 -0
  361. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.d.ts +1 -0
  362. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +782 -0
  363. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -0
  364. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +364 -0
  365. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +2038 -0
  366. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -0
  367. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.d.ts +1 -0
  368. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +636 -0
  369. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -0
  370. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.d.ts +1 -0
  371. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js +2 -0
  372. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js.map +1 -0
  373. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.d.ts +6 -0
  374. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +251 -0
  375. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -0
  376. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.d.ts +41 -0
  377. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js +700 -0
  378. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js.map +1 -0
  379. package/dist/src/nile-wysiwyg-editor/types.d.ts +49 -0
  380. package/dist/src/nile-wysiwyg-editor/types.js +8 -0
  381. package/dist/src/nile-wysiwyg-editor/types.js.map +1 -0
  382. package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.d.ts +20 -0
  383. package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js +159 -0
  384. package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js.map +1 -0
  385. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.d.ts +21 -0
  386. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +125 -0
  387. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -0
  388. package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.d.ts +18 -0
  389. package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js +107 -0
  390. package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js.map +1 -0
  391. package/dist/src/nile-wysiwyg-editor/ui/embed-menu.d.ts +19 -0
  392. package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js +123 -0
  393. package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js.map +1 -0
  394. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.d.ts +27 -0
  395. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +146 -0
  396. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -0
  397. package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.d.ts +21 -0
  398. package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js +154 -0
  399. package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js.map +1 -0
  400. package/dist/src/nile-wysiwyg-editor/ui/find-replace.d.ts +26 -0
  401. package/dist/src/nile-wysiwyg-editor/ui/find-replace.js +178 -0
  402. package/dist/src/nile-wysiwyg-editor/ui/find-replace.js.map +1 -0
  403. package/dist/src/nile-wysiwyg-editor/ui/image-menu.d.ts +18 -0
  404. package/dist/src/nile-wysiwyg-editor/ui/image-menu.js +129 -0
  405. package/dist/src/nile-wysiwyg-editor/ui/image-menu.js.map +1 -0
  406. package/dist/src/nile-wysiwyg-editor/ui/image-panel.d.ts +56 -0
  407. package/dist/src/nile-wysiwyg-editor/ui/image-panel.js +349 -0
  408. package/dist/src/nile-wysiwyg-editor/ui/image-panel.js.map +1 -0
  409. package/dist/src/nile-wysiwyg-editor/ui/insert-menu.d.ts +25 -0
  410. package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js +142 -0
  411. package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js.map +1 -0
  412. package/dist/src/nile-wysiwyg-editor/ui/link-editor.d.ts +30 -0
  413. package/dist/src/nile-wysiwyg-editor/ui/link-editor.js +189 -0
  414. package/dist/src/nile-wysiwyg-editor/ui/link-editor.js.map +1 -0
  415. package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.d.ts +24 -0
  416. package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js +144 -0
  417. package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js.map +1 -0
  418. package/dist/src/nile-wysiwyg-editor/ui/math-panel.d.ts +31 -0
  419. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +172 -0
  420. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -0
  421. package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.d.ts +30 -0
  422. package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js +296 -0
  423. package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js.map +1 -0
  424. package/dist/src/nile-wysiwyg-editor/ui/source-view.d.ts +19 -0
  425. package/dist/src/nile-wysiwyg-editor/ui/source-view.js +120 -0
  426. package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -0
  427. package/dist/src/nile-wysiwyg-editor/ui/special-chars.d.ts +20 -0
  428. package/dist/src/nile-wysiwyg-editor/ui/special-chars.js +199 -0
  429. package/dist/src/nile-wysiwyg-editor/ui/special-chars.js.map +1 -0
  430. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.d.ts +31 -0
  431. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +133 -0
  432. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -0
  433. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.d.ts +23 -0
  434. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +177 -0
  435. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -0
  436. package/dist/src/nile-wysiwyg-editor/ui/table-menu.d.ts +16 -0
  437. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +101 -0
  438. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -0
  439. package/dist/src/version.js +1 -1
  440. package/dist/src/version.js.map +1 -1
  441. package/dist/tsconfig.tsbuildinfo +1 -1
  442. package/package.json +18 -2
  443. package/src/index.ts +57 -1
  444. package/src/internal/glyph.ts +13 -0
  445. package/src/nile-wysiwyg-editor/emoji.ts +137 -0
  446. package/src/nile-wysiwyg-editor/engine/commands.ts +1035 -0
  447. package/src/nile-wysiwyg-editor/engine/create-state.ts +117 -0
  448. package/src/nile-wysiwyg-editor/engine/export.test.ts +113 -0
  449. package/src/nile-wysiwyg-editor/engine/export.ts +242 -0
  450. package/src/nile-wysiwyg-editor/engine/index.ts +69 -0
  451. package/src/nile-wysiwyg-editor/engine/inputrules.ts +169 -0
  452. package/src/nile-wysiwyg-editor/engine/keymap.ts +146 -0
  453. package/src/nile-wysiwyg-editor/engine/markdown-parse.test.ts +148 -0
  454. package/src/nile-wysiwyg-editor/engine/markdown-parse.ts +337 -0
  455. package/src/nile-wysiwyg-editor/engine/markdown.ts +165 -0
  456. package/src/nile-wysiwyg-editor/engine/office-paste.ts +199 -0
  457. package/src/nile-wysiwyg-editor/engine/plugins/code-highlight.ts +173 -0
  458. package/src/nile-wysiwyg-editor/engine/plugins/embed-view.ts +85 -0
  459. package/src/nile-wysiwyg-editor/engine/plugins/embeds.ts +99 -0
  460. package/src/nile-wysiwyg-editor/engine/plugins/find-replace.ts +155 -0
  461. package/src/nile-wysiwyg-editor/engine/plugins/format-painter.ts +80 -0
  462. package/src/nile-wysiwyg-editor/engine/plugins/image-view.ts +220 -0
  463. package/src/nile-wysiwyg-editor/engine/plugins/image.ts +80 -0
  464. package/src/nile-wysiwyg-editor/engine/plugins/link.ts +42 -0
  465. package/src/nile-wysiwyg-editor/engine/plugins/math-view.ts +56 -0
  466. package/src/nile-wysiwyg-editor/engine/plugins/max-length.ts +24 -0
  467. package/src/nile-wysiwyg-editor/engine/plugins/paste.ts +74 -0
  468. package/src/nile-wysiwyg-editor/engine/plugins/placeholder.ts +24 -0
  469. package/src/nile-wysiwyg-editor/engine/plugins/single-line.ts +47 -0
  470. package/src/nile-wysiwyg-editor/engine/plugins/suggestions.ts +110 -0
  471. package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +12 -0
  472. package/src/nile-wysiwyg-editor/engine/plugins/task-list.ts +65 -0
  473. package/src/nile-wysiwyg-editor/engine/pm.test.ts +1088 -0
  474. package/src/nile-wysiwyg-editor/engine/productivity.test.ts +163 -0
  475. package/src/nile-wysiwyg-editor/engine/sanitize.ts +156 -0
  476. package/src/nile-wysiwyg-editor/engine/schema.ts +859 -0
  477. package/src/nile-wysiwyg-editor/engine/selection-state.ts +210 -0
  478. package/src/nile-wysiwyg-editor/engine/serializer.ts +78 -0
  479. package/src/nile-wysiwyg-editor/index.ts +3 -0
  480. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +782 -0
  481. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +750 -0
  482. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +2155 -0
  483. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.ts +1 -0
  484. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +251 -0
  485. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.ts +772 -0
  486. package/src/nile-wysiwyg-editor/types.ts +83 -0
  487. package/src/nile-wysiwyg-editor/ui/bookmark-panel.ts +155 -0
  488. package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +135 -0
  489. package/src/nile-wysiwyg-editor/ui/code-block-menu.ts +105 -0
  490. package/src/nile-wysiwyg-editor/ui/embed-menu.ts +133 -0
  491. package/src/nile-wysiwyg-editor/ui/embed-panel.ts +143 -0
  492. package/src/nile-wysiwyg-editor/ui/emoji-picker.ts +152 -0
  493. package/src/nile-wysiwyg-editor/ui/find-replace.ts +174 -0
  494. package/src/nile-wysiwyg-editor/ui/image-menu.ts +140 -0
  495. package/src/nile-wysiwyg-editor/ui/image-panel.ts +337 -0
  496. package/src/nile-wysiwyg-editor/ui/insert-menu.ts +142 -0
  497. package/src/nile-wysiwyg-editor/ui/link-editor.ts +180 -0
  498. package/src/nile-wysiwyg-editor/ui/markdown-panel.ts +143 -0
  499. package/src/nile-wysiwyg-editor/ui/math-panel.ts +169 -0
  500. package/src/nile-wysiwyg-editor/ui/shortcut-help.ts +311 -0
  501. package/src/nile-wysiwyg-editor/ui/source-view.ts +119 -0
  502. package/src/nile-wysiwyg-editor/ui/special-chars.ts +209 -0
  503. package/src/nile-wysiwyg-editor/ui/suggest-list.ts +138 -0
  504. package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +173 -0
  505. package/src/nile-wysiwyg-editor/ui/table-menu.ts +109 -0
  506. package/vscode-html-custom-data.json +450 -0
  507. package/web-dev-server.config.mjs +6 -2
  508. package/dist/index-5fef1a0d.esm.js +0 -1
  509. package/dist/index-8f38fae3.cjs.js +0 -2
  510. package/dist/index-8f38fae3.cjs.js.map +0 -1
@@ -0,0 +1,15 @@
1
+ import { Plugin, PluginKey, EditorState } from 'prosemirror-state';
2
+ import { DecorationSet } from 'prosemirror-view';
3
+ export declare const imageUploadKey: PluginKey<DecorationSet>;
4
+ export interface ImagePluginOptions {
5
+ /** Called with image files pasted or dropped into the editor. */
6
+ onImageFiles?: (files: File[], pos: number | null) => void;
7
+ }
8
+ /**
9
+ * Image behaviors: routes pasted/dropped image files to the host's upload
10
+ * flow and tracks "uploading…" widget decorations that survive concurrent
11
+ * edits by mapping through transactions.
12
+ */
13
+ export declare function imagePlugin(options?: ImagePluginOptions): Plugin<DecorationSet>;
14
+ /** Position of an upload placeholder, after mapping through edits. */
15
+ export declare function findUploadPos(state: EditorState, id: string): number | null;
@@ -0,0 +1,64 @@
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
+ import { Decoration, DecorationSet } from 'prosemirror-view';
3
+ export const imageUploadKey = new PluginKey('nileImageUpload');
4
+ function imageFilesFrom(data) {
5
+ if (!data)
6
+ return [];
7
+ return Array.from(data.files).filter(file => file.type.startsWith('image/'));
8
+ }
9
+ /**
10
+ * Image behaviors: routes pasted/dropped image files to the host's upload
11
+ * flow and tracks "uploading…" widget decorations that survive concurrent
12
+ * edits by mapping through transactions.
13
+ */
14
+ export function imagePlugin(options = {}) {
15
+ return new Plugin({
16
+ key: imageUploadKey,
17
+ state: {
18
+ init: () => DecorationSet.empty,
19
+ apply(tr, set) {
20
+ let mapped = set.map(tr.mapping, tr.doc);
21
+ const meta = tr.getMeta(imageUploadKey);
22
+ if (meta?.add) {
23
+ const widget = document.createElement('span');
24
+ widget.className = 'nile-wysiwyg__upload-placeholder';
25
+ widget.textContent = 'Uploading image…';
26
+ mapped = mapped.add(tr.doc, [
27
+ Decoration.widget(meta.add.pos, widget, { id: meta.add.id }),
28
+ ]);
29
+ }
30
+ if (meta?.remove) {
31
+ mapped = mapped.remove(mapped.find(undefined, undefined, spec => spec.id === meta.remove.id));
32
+ }
33
+ return mapped;
34
+ },
35
+ },
36
+ props: {
37
+ decorations(state) {
38
+ return imageUploadKey.getState(state);
39
+ },
40
+ handlePaste(_view, event) {
41
+ const files = imageFilesFrom(event.clipboardData);
42
+ if (files.length === 0 || !options.onImageFiles)
43
+ return false;
44
+ options.onImageFiles(files, null);
45
+ return true;
46
+ },
47
+ handleDrop(view, event) {
48
+ const files = imageFilesFrom(event.dataTransfer);
49
+ if (files.length === 0 || !options.onImageFiles)
50
+ return false;
51
+ const drop = view.posAtCoords({ left: event.clientX, top: event.clientY });
52
+ options.onImageFiles(files, drop ? drop.pos : null);
53
+ return true;
54
+ },
55
+ },
56
+ });
57
+ }
58
+ /** Position of an upload placeholder, after mapping through edits. */
59
+ export function findUploadPos(state, id) {
60
+ const set = imageUploadKey.getState(state);
61
+ const found = set?.find(undefined, undefined, spec => spec.id === id);
62
+ return found && found.length ? found[0].from : null;
63
+ }
64
+ //# sourceMappingURL=image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.js","sourceR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IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBACpD,OAAO,IAAI,CAAC;YACd,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,aAAa,CAAC,KAAkB,EAAE,EAAU;IAC1D,MAAM,GAAG,GAAG,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACtE,OAAO,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC","sourcesContent":["import { Plugin, PluginKey, EditorState } from 'prosemirror-state';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\n\nexport const imageUploadKey = new PluginKey<DecorationSet>('nileImageUpload');\n\ninterface UploadMeta {\n add?: { id: string; pos: number };\n remove?: { id: string };\n}\n\nexport interface ImagePluginOptions {\n /** Called with image files pasted or dropped into the editor. */\n onImageFiles?: (files: File[], pos: number | null) => void;\n}\n\nfunction imageFilesFrom(data: DataTransfer | null): File[] {\n if (!data) return [];\n return Array.from(data.files).filter(file => file.type.startsWith('image/'));\n}\n\n/**\n * Image behaviors: routes pasted/dropped image files to the host's upload\n * flow and tracks \"uploading…\" widget decorations that survive concurrent\n * edits by mapping through transactions.\n */\nexport function imagePlugin(options: ImagePluginOptions = {}): Plugin<DecorationSet> {\n return new Plugin<DecorationSet>({\n key: imageUploadKey,\n\n state: {\n init: () => DecorationSet.empty,\n apply(tr, set) {\n let mapped = set.map(tr.mapping, tr.doc);\n const meta = tr.getMeta(imageUploadKey) as UploadMeta | undefined;\n if (meta?.add) {\n const widget = document.createElement('span');\n widget.className = 'nile-wysiwyg__upload-placeholder';\n widget.textContent = 'Uploading image…';\n mapped = mapped.add(tr.doc, [\n Decoration.widget(meta.add.pos, widget, { id: meta.add.id }),\n ]);\n }\n if (meta?.remove) {\n mapped = mapped.remove(\n mapped.find(undefined, undefined, spec => spec.id === meta.remove!.id)\n );\n }\n return mapped;\n },\n },\n\n props: {\n decorations(state) {\n return imageUploadKey.getState(state);\n },\n\n handlePaste(_view, event) {\n const files = imageFilesFrom(event.clipboardData);\n if (files.length === 0 || !options.onImageFiles) return false;\n options.onImageFiles(files, null);\n return true;\n },\n\n handleDrop(view, event) {\n const files = imageFilesFrom(event.dataTransfer);\n if (files.length === 0 || !options.onImageFiles) return false;\n const drop = view.posAtCoords({ left: event.clientX, top: event.clientY });\n options.onImageFiles(files, drop ? drop.pos : null);\n return true;\n },\n },\n });\n}\n\n/** Position of an upload placeholder, after mapping through edits. */\nexport function findUploadPos(state: EditorState, id: string): number | null {\n const set = imageUploadKey.getState(state);\n const found = set?.find(undefined, undefined, spec => spec.id === id);\n return found && found.length ? found[0].from : null;\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ export interface LinkPluginOptions {
3
+ /** Called with the href when a link is Mod/Ctrl-clicked. */
4
+ onOpenLink?: (href: string) => void;
5
+ }
6
+ /**
7
+ * Link behaviors that belong to the document, not the chrome:
8
+ * - Mod/Ctrl-click opens the link.
9
+ * - Pasting a bare URL over a text selection turns the selection into a link.
10
+ */
11
+ export declare function linkPlugin(options?: LinkPluginOptions): Plugin;
@@ -0,0 +1,42 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { isSafeUrl } from '../sanitize';
3
+ const URL_PATTERN = /^https?:\/\/\S+$/i;
4
+ /**
5
+ * Link behaviors that belong to the document, not the chrome:
6
+ * - Mod/Ctrl-click opens the link.
7
+ * - Pasting a bare URL over a text selection turns the selection into a link.
8
+ */
9
+ export function linkPlugin(options = {}) {
10
+ return new Plugin({
11
+ props: {
12
+ handleClick(view, _pos, event) {
13
+ if (!(event.metaKey || event.ctrlKey))
14
+ return false;
15
+ const target = event.target?.closest?.('a[href]');
16
+ if (!target)
17
+ return false;
18
+ const href = target.getAttribute('href');
19
+ if (!isSafeUrl(href))
20
+ return false;
21
+ if (options.onOpenLink)
22
+ options.onOpenLink(href);
23
+ else
24
+ window.open(href, '_blank', 'noopener,noreferrer');
25
+ return true;
26
+ },
27
+ handlePaste(view, event) {
28
+ const { state } = view;
29
+ const { empty, from, to } = state.selection;
30
+ if (empty)
31
+ return false;
32
+ const text = event.clipboardData?.getData('text/plain')?.trim();
33
+ if (!text || !URL_PATTERN.test(text) || !isSafeUrl(text))
34
+ return false;
35
+ const linkMark = state.schema.marks.link.create({ href: text });
36
+ view.dispatch(state.tr.addMark(from, to, linkMark));
37
+ return true;
38
+ },
39
+ },
40
+ });
41
+ }
42
+ //# sourceMappingURL=link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAOxC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,UAA6B,EAAE;IACxD,OAAO,IAAI,MAAM,CAAC;QAChB,KAAK,EAAE;YACL,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK;gBAC3B,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC;oBAAE,OAAO,KAAK,CAAC;gBACpD,MAAM,MAAM,GAAI,KAAK,CAAC,MAA6B,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC;gBAC1E,IAAI,CAAC,MAAM;oBAAE,OAAO,KAAK,CAAC;gBAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAE,CAAC;gBAC1C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;oBAAE,OAAO,KAAK,CAAC;gBACnC,IAAI,OAAO,CAAC,UAAU;oBAAE,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;;oBAC5C,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;gBACxD,OAAO,IAAI,CAAC;YACd,CAAC;YAED,WAAW,CAAC,IAAI,EAAE,KAAK;gBACrB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;gBACvB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;gBAC5C,IAAI,KAAK;oBAAE,OAAO,KAAK,CAAC;gBACxB,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;gBAChE,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;oBAAE,OAAO,KAAK,CAAC;gBACvE,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBAChE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;gBACpD,OAAO,IAAI,CAAC;YACd,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Plugin } from 'prosemirror-state';\nimport { isSafeUrl } from '../sanitize';\n\nconst URL_PATTERN = /^https?:\\/\\/\\S+$/i;\n\nexport interface LinkPluginOptions {\n /** Called with the href when a link is Mod/Ctrl-clicked. */\n onOpenLink?: (href: string) => void;\n}\n\n/**\n * Link behaviors that belong to the document, not the chrome:\n * - Mod/Ctrl-click opens the link.\n * - Pasting a bare URL over a text selection turns the selection into a link.\n */\nexport function linkPlugin(options: LinkPluginOptions = {}): Plugin {\n return new Plugin({\n props: {\n handleClick(view, _pos, event) {\n if (!(event.metaKey || event.ctrlKey)) return false;\n const target = (event.target as HTMLElement | null)?.closest?.('a[href]');\n if (!target) return false;\n const href = target.getAttribute('href')!;\n if (!isSafeUrl(href)) return false;\n if (options.onOpenLink) options.onOpenLink(href);\n else window.open(href, '_blank', 'noopener,noreferrer');\n return true;\n },\n\n handlePaste(view, event) {\n const { state } = view;\n const { empty, from, to } = state.selection;\n if (empty) return false;\n const text = event.clipboardData?.getData('text/plain')?.trim();\n if (!text || !URL_PATTERN.test(text) || !isSafeUrl(text)) return false;\n const linkMark = state.schema.marks.link.create({ href: text });\n view.dispatch(state.tr.addMark(from, to, linkMark));\n return true;\n },\n },\n });\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import { Node as PMNode } from 'prosemirror-model';
2
+ import { NodeView } from 'prosemirror-view';
3
+ /** Turns a LaTeX string into HTML (KaTeX/MathJax/MathML). Host-provided. */
4
+ export type MathRenderer = (latex: string, display: 'inline' | 'block') => string;
5
+ /**
6
+ * Inline atom rendering a math formula. When the host supplies a renderer the
7
+ * formula is drawn with it; otherwise the raw LaTeX is shown in a math chip so
8
+ * the content is still visible and editable without a math engine.
9
+ */
10
+ export declare class MathView implements NodeView {
11
+ dom: HTMLSpanElement;
12
+ private renderer?;
13
+ constructor(node: PMNode, renderer?: MathRenderer);
14
+ private render;
15
+ update(node: PMNode): boolean;
16
+ /** Atom node: ProseMirror owns selection; never read our subtree back. */
17
+ ignoreMutation(): boolean;
18
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Inline atom rendering a math formula. When the host supplies a renderer the
3
+ * formula is drawn with it; otherwise the raw LaTeX is shown in a math chip so
4
+ * the content is still visible and editable without a math engine.
5
+ */
6
+ export class MathView {
7
+ constructor(node, renderer) {
8
+ this.renderer = renderer;
9
+ this.dom = document.createElement('span');
10
+ this.dom.contentEditable = 'false';
11
+ this.render(node);
12
+ }
13
+ render(node) {
14
+ const latex = node.attrs.latex ?? '';
15
+ const display = node.attrs.display ?? 'inline';
16
+ this.dom.className =
17
+ display === 'block'
18
+ ? 'nile-wysiwyg__math nile-wysiwyg__math--block'
19
+ : 'nile-wysiwyg__math';
20
+ this.dom.setAttribute('data-math', latex);
21
+ this.dom.setAttribute('data-math-display', display);
22
+ this.dom.title = latex;
23
+ if (this.renderer) {
24
+ try {
25
+ // Host renderer output is trusted (same trust level as uploadHandler).
26
+ this.dom.innerHTML = this.renderer(latex, display);
27
+ return;
28
+ }
29
+ catch {
30
+ // Fall back to raw LaTeX if the renderer throws.
31
+ }
32
+ }
33
+ this.dom.textContent = latex;
34
+ }
35
+ update(node) {
36
+ if (node.type.name !== 'math')
37
+ return false;
38
+ this.render(node);
39
+ return true;
40
+ }
41
+ /** Atom node: ProseMirror owns selection; never read our subtree back. */
42
+ ignoreMutation() {
43
+ return true;
44
+ }
45
+ }
46
+ //# sourceMappingURL=math-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math-view.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/math-view.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,OAAO,QAAQ;IAKnB,YAAY,IAAY,EAAE,QAAuB;QAC/C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,CAAC,eAAe,GAAG,OAAO,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAEO,MAAM,CAAC,IAAY;QACzB,MAAM,KAAK,GAAI,IAAI,CAAC,KAAK,CAAC,KAAgB,IAAI,EAAE,CAAC;QACjD,MAAM,OAAO,GAAI,IAAI,CAAC,KAAK,CAAC,OAA8B,IAAI,QAAQ,CAAC;QACvE,IAAI,CAAC,GAAG,CAAC,SAAS;YAChB,OAAO,KAAK,OAAO;gBACjB,CAAC,CAAC,8CAA8C;gBAChD,CAAC,CAAC,oBAAoB,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;QACvB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC;gBACH,uEAAuE;gBACvE,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBACnD,OAAO;YACT,CAAC;YAAC,MAAM,CAAC;gBACP,iDAAiD;YACnD,CAAC;QACH,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0EAA0E;IAC1E,cAAc;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { Node as PMNode } from 'prosemirror-model';\nimport { NodeView } from 'prosemirror-view';\n\n/** Turns a LaTeX string into HTML (KaTeX/MathJax/MathML). Host-provided. */\nexport type MathRenderer = (latex: string, display: 'inline' | 'block') => string;\n\n/**\n * Inline atom rendering a math formula. When the host supplies a renderer the\n * formula is drawn with it; otherwise the raw LaTeX is shown in a math chip so\n * the content is still visible and editable without a math engine.\n */\nexport class MathView implements NodeView {\n dom: HTMLSpanElement;\n\n private renderer?: MathRenderer;\n\n constructor(node: PMNode, renderer?: MathRenderer) {\n this.renderer = renderer;\n this.dom = document.createElement('span');\n this.dom.contentEditable = 'false';\n this.render(node);\n }\n\n private render(node: PMNode): void {\n const latex = (node.attrs.latex as string) ?? '';\n const display = (node.attrs.display as 'inline' | 'block') ?? 'inline';\n this.dom.className =\n display === 'block'\n ? 'nile-wysiwyg__math nile-wysiwyg__math--block'\n : 'nile-wysiwyg__math';\n this.dom.setAttribute('data-math', latex);\n this.dom.setAttribute('data-math-display', display);\n this.dom.title = latex;\n if (this.renderer) {\n try {\n // Host renderer output is trusted (same trust level as uploadHandler).\n this.dom.innerHTML = this.renderer(latex, display);\n return;\n } catch {\n // Fall back to raw LaTeX if the renderer throws.\n }\n }\n this.dom.textContent = latex;\n }\n\n update(node: PMNode): boolean {\n if (node.type.name !== 'math') return false;\n this.render(node);\n return true;\n }\n\n /** Atom node: ProseMirror owns selection; never read our subtree back. */\n ignoreMutation(): boolean {\n return true;\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ /**
3
+ * Enforces a character limit by rejecting transactions that grow the
4
+ * document past it. Shrinking edits are always allowed, even while over the
5
+ * limit (e.g. after the limit was lowered), so users can recover.
6
+ */
7
+ export declare function maxLengthPlugin(getMaxLength: () => number): Plugin;
@@ -0,0 +1,26 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { docToText } from '../serializer';
3
+ function charCount(doc) {
4
+ return docToText(doc).replace(/\n/g, '').length;
5
+ }
6
+ /**
7
+ * Enforces a character limit by rejecting transactions that grow the
8
+ * document past it. Shrinking edits are always allowed, even while over the
9
+ * limit (e.g. after the limit was lowered), so users can recover.
10
+ */
11
+ export function maxLengthPlugin(getMaxLength) {
12
+ return new Plugin({
13
+ filterTransaction(tr, state) {
14
+ if (!tr.docChanged)
15
+ return true;
16
+ const max = getMaxLength();
17
+ if (!max || max <= 0)
18
+ return true;
19
+ const after = charCount(tr.doc);
20
+ if (after <= max)
21
+ return true;
22
+ return after < charCount(state.doc);
23
+ },
24
+ });
25
+ }
26
+ //# sourceMappingURL=max-length.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"max-length.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/max-length.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,SAAS,SAAS,CAAC,GAAqC;IACtD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,YAA0B;IACxD,OAAO,IAAI,MAAM,CAAC;QAChB,iBAAiB,CAAC,EAAE,EAAE,KAAK;YACzB,IAAI,CAAC,EAAE,CAAC,UAAU;gBAAE,OAAO,IAAI,CAAC;YAChC,MAAM,GAAG,GAAG,YAAY,EAAE,CAAC;YAC3B,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YAClC,MAAM,KAAK,GAAG,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;YAChC,IAAI,KAAK,IAAI,GAAG;gBAAE,OAAO,IAAI,CAAC;YAC9B,OAAO,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Plugin } from 'prosemirror-state';\nimport { docToText } from '../serializer';\n\nfunction charCount(doc: import('prosemirror-model').Node): number {\n return docToText(doc).replace(/\\n/g, '').length;\n}\n\n/**\n * Enforces a character limit by rejecting transactions that grow the\n * document past it. Shrinking edits are always allowed, even while over the\n * limit (e.g. after the limit was lowered), so users can recover.\n */\nexport function maxLengthPlugin(getMaxLength: () => number): Plugin {\n return new Plugin({\n filterTransaction(tr, state) {\n if (!tr.docChanged) return true;\n const max = getMaxLength();\n if (!max || max <= 0) return true;\n const after = charCount(tr.doc);\n if (after <= max) return true;\n return after < charCount(state.doc);\n },\n });\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { Slice, Schema } from 'prosemirror-model';
3
+ /**
4
+ * Builds a slice of plain paragraphs from text, splitting on newlines. Open
5
+ * depth 1 on both ends lets the first/last block merge into the surrounding
6
+ * paragraph, matching how a normal plain-text paste behaves.
7
+ */
8
+ export declare function plainTextSlice(schema: Schema, text: string): Slice;
9
+ /** Reduces a pasted slice to unstyled text, preserving block breaks. */
10
+ export declare function stripSliceFormatting(schema: Schema, slice: Slice): Slice;
11
+ export interface PasteOptions {
12
+ /**
13
+ * Read live: when it returns true, every paste drops formatting (the
14
+ * persistent "paste as plain text" toggle). The Ctrl+Shift+V shortcut is a
15
+ * separate one-shot handled in the keymap.
16
+ */
17
+ getForcePlainText?: () => boolean;
18
+ /**
19
+ * Read live: when false, plain-text pastes are never parsed as Markdown.
20
+ * Defaults to on.
21
+ */
22
+ getMarkdownPaste?: () => boolean;
23
+ /** Read live: whether pasted HTML is sanitized. Defaults to on. */
24
+ getSanitize?: () => boolean;
25
+ }
26
+ /**
27
+ * Paste behavior: plain-text pastes that look like Markdown are parsed into
28
+ * rich content (headings, lists, code fences, tables, inline marks), and all
29
+ * pastes drop formatting while the host's plain-text toggle is on.
30
+ */
31
+ export declare function pastePlugin(schema: Schema, options?: PasteOptions): Plugin;
@@ -0,0 +1,55 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { Slice, Fragment } from 'prosemirror-model';
3
+ import { markdownToHtml, looksLikeMarkdown } from '../markdown-parse';
4
+ import { htmlToSlice } from '../serializer';
5
+ /**
6
+ * Builds a slice of plain paragraphs from text, splitting on newlines. Open
7
+ * depth 1 on both ends lets the first/last block merge into the surrounding
8
+ * paragraph, matching how a normal plain-text paste behaves.
9
+ */
10
+ export function plainTextSlice(schema, text) {
11
+ const blocks = text.split(/\r\n?|\n/);
12
+ const nodes = blocks.map(line => schema.nodes.paragraph.create(null, line ? schema.text(line) : null));
13
+ return new Slice(Fragment.from(nodes), 1, 1);
14
+ }
15
+ /** Reduces a pasted slice to unstyled text, preserving block breaks. */
16
+ export function stripSliceFormatting(schema, slice) {
17
+ const text = slice.content.textBetween(0, slice.content.size, '\n', '\n');
18
+ return plainTextSlice(schema, text);
19
+ }
20
+ /**
21
+ * Paste behavior: plain-text pastes that look like Markdown are parsed into
22
+ * rich content (headings, lists, code fences, tables, inline marks), and all
23
+ * pastes drop formatting while the host's plain-text toggle is on.
24
+ */
25
+ export function pastePlugin(schema, options = {}) {
26
+ return new Plugin({
27
+ props: {
28
+ handlePaste(view, event) {
29
+ if (options.getForcePlainText?.())
30
+ return false;
31
+ if (options.getMarkdownPaste && !options.getMarkdownPaste())
32
+ return false;
33
+ // Only plain-text pastes qualify: an HTML flavor means the source
34
+ // was already rich, and code blocks take text verbatim.
35
+ const html = event.clipboardData?.getData('text/html') ?? '';
36
+ const text = event.clipboardData?.getData('text/plain') ?? '';
37
+ if (html.trim() || !text.trim())
38
+ return false;
39
+ if (view.state.selection.$from.parent.type.spec.code)
40
+ return false;
41
+ if (!looksLikeMarkdown(text))
42
+ return false;
43
+ const slice = htmlToSlice(schema, markdownToHtml(text), options.getSanitize?.() ?? true);
44
+ view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView());
45
+ return true;
46
+ },
47
+ transformPasted(slice) {
48
+ return options.getForcePlainText?.()
49
+ ? stripSliceFormatting(schema, slice)
50
+ : slice;
51
+ },
52
+ },
53
+ });
54
+ }
55
+ //# sourceMappingURL=paste.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paste.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/paste.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3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AAO,KAAK,CAAC;gBAC1E,kEAAkE;gBAClE,wDAAwD;gBACxD,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;gBAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;gBAC9D,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;oBAAE,OAAO,KAAK,CAAC;gBAC9C,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;oBAAE,OAAO,KAAK,CAAC;gBACnE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;oBAAE,OAAO,KAAK,CAAC;gBAC3C,MAAM,KAAK,GAAG,WAAW,CACvB,MAAM,EACN,cAAc,CAAC,IAAI,CAAC,EACpB,OAAO,CAAC,WAAW,EAAE,EAAE,IAAI,IAAI,CAChC,CAAC;gBACF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC;gBACtE,OAAO,IAAI,CAAC;YACd,CAAC;YACD,eAAe,CAAC,KAAK;gBACnB,OAAO,OAAO,CAAC,iBAAiB,EAAE,EAAE;oBAClC,CAAC,CAAC,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC;oBACrC,CAAC,CAAC,KAAK,CAAC;YACZ,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Plugin } from 'prosemirror-state';\nimport { Slice, Fragment, Node as PMNode, Schema } from 'prosemirror-model';\nimport { markdownToHtml, looksLikeMarkdown } from '../markdown-parse';\nimport { htmlToSlice } from '../serializer';\n\n/**\n * Builds a slice of plain paragraphs from text, splitting on newlines. Open\n * depth 1 on both ends lets the first/last block merge into the surrounding\n * paragraph, matching how a normal plain-text paste behaves.\n */\nexport function plainTextSlice(schema: Schema, text: string): Slice {\n const blocks = text.split(/\\r\\n?|\\n/);\n const nodes: PMNode[] = blocks.map(line =>\n schema.nodes.paragraph.create(null, line ? schema.text(line) : null)\n );\n return new Slice(Fragment.from(nodes), 1, 1);\n}\n\n/** Reduces a pasted slice to unstyled text, preserving block breaks. */\nexport function stripSliceFormatting(schema: Schema, slice: Slice): Slice {\n const text = slice.content.textBetween(0, slice.content.size, '\\n', '\\n');\n return plainTextSlice(schema, text);\n}\n\nexport interface PasteOptions {\n /**\n * Read live: when it returns true, every paste drops formatting (the\n * persistent \"paste as plain text\" toggle). The Ctrl+Shift+V shortcut is a\n * separate one-shot handled in the keymap.\n */\n getForcePlainText?: () => boolean;\n /**\n * Read live: when false, plain-text pastes are never parsed as Markdown.\n * Defaults to on.\n */\n getMarkdownPaste?: () => boolean;\n /** Read live: whether pasted HTML is sanitized. Defaults to on. */\n getSanitize?: () => boolean;\n}\n\n/**\n * Paste behavior: plain-text pastes that look like Markdown are parsed into\n * rich content (headings, lists, code fences, tables, inline marks), and all\n * pastes drop formatting while the host's plain-text toggle is on.\n */\nexport function pastePlugin(schema: Schema, options: PasteOptions = {}): Plugin {\n return new Plugin({\n props: {\n handlePaste(view, event) {\n if (options.getForcePlainText?.()) return false;\n if (options.getMarkdownPaste && !options.getMarkdownPaste()) return false;\n // Only plain-text pastes qualify: an HTML flavor means the source\n // was already rich, and code blocks take text verbatim.\n const html = event.clipboardData?.getData('text/html') ?? '';\n const text = event.clipboardData?.getData('text/plain') ?? '';\n if (html.trim() || !text.trim()) return false;\n if (view.state.selection.$from.parent.type.spec.code) return false;\n if (!looksLikeMarkdown(text)) return false;\n const slice = htmlToSlice(\n schema,\n markdownToHtml(text),\n options.getSanitize?.() ?? true\n );\n view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView());\n return true;\n },\n transformPasted(slice) {\n return options.getForcePlainText?.()\n ? stripSliceFormatting(schema, slice)\n : slice;\n },\n },\n });\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ /**
3
+ * Shows placeholder text on the first paragraph while the document is empty.
4
+ * The text itself is rendered by CSS (`content: attr(data-placeholder)`) so
5
+ * it never enters the document.
6
+ */
7
+ export declare function placeholderPlugin(getText: () => string): Plugin;
@@ -0,0 +1,25 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { Decoration, DecorationSet } from 'prosemirror-view';
3
+ import { isDocEmpty } from '../serializer';
4
+ /**
5
+ * Shows placeholder text on the first paragraph while the document is empty.
6
+ * The text itself is rendered by CSS (`content: attr(data-placeholder)`) so
7
+ * it never enters the document.
8
+ */
9
+ export function placeholderPlugin(getText) {
10
+ return new Plugin({
11
+ props: {
12
+ decorations(state) {
13
+ const text = getText();
14
+ if (!text || !isDocEmpty(state.doc))
15
+ return null;
16
+ const deco = Decoration.node(0, state.doc.firstChild.nodeSize, {
17
+ class: 'nile-wysiwyg__empty',
18
+ 'data-placeholder': text,
19
+ });
20
+ return DecorationSet.create(state.doc, [deco]);
21
+ },
22
+ },
23
+ });
24
+ }
25
+ //# sourceMappingURL=placeholder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/placeholder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAqB;IACrD,OAAO,IAAI,MAAM,CAAC;QAChB,KAAK,EAAE;YACL,WAAW,CAAC,KAAK;gBACf,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;gBACvB,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC;oBAAE,OAAO,IAAI,CAAC;gBACjD,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,UAAW,CAAC,QAAQ,EAAE;oBAC9D,KAAK,EAAE,qBAAqB;oBAC5B,kBAAkB,EAAE,IAAI;iBACzB,CAAC,CAAC;gBACH,OAAO,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YACjD,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Plugin } from 'prosemirror-state';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\nimport { isDocEmpty } from '../serializer';\n\n/**\n * Shows placeholder text on the first paragraph while the document is empty.\n * The text itself is rendered by CSS (`content: attr(data-placeholder)`) so\n * it never enters the document.\n */\nexport function placeholderPlugin(getText: () => string): Plugin {\n return new Plugin({\n props: {\n decorations(state) {\n const text = getText();\n if (!text || !isDocEmpty(state.doc)) return null;\n const deco = Decoration.node(0, state.doc.firstChild!.nodeSize, {\n class: 'nile-wysiwyg__empty',\n 'data-placeholder': text,\n });\n return DecorationSet.create(state.doc, [deco]);\n },\n },\n });\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { Node as PMNode } from 'prosemirror-model';
3
+ /** Flattens a multi-block document into a single paragraph, keeping marks. */
4
+ export declare function flattenToSingleParagraph(doc: PMNode): PMNode;
5
+ /**
6
+ * Constrains the document to a single paragraph: Enter is inert, pasted
7
+ * multi-block content is flattened to one line, and any transaction that
8
+ * would still produce extra blocks is rejected.
9
+ */
10
+ export declare function singleLinePlugin(): Plugin;
@@ -0,0 +1,48 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { Slice, Fragment } from 'prosemirror-model';
3
+ /** Flattens a multi-block document into a single paragraph, keeping marks. */
4
+ export function flattenToSingleParagraph(doc) {
5
+ if (doc.childCount <= 1)
6
+ return doc;
7
+ const schema = doc.type.schema;
8
+ const inline = [];
9
+ doc.descendants(node => {
10
+ if (node.isInline) {
11
+ if (node.type === schema.nodes.hard_break)
12
+ return false;
13
+ inline.push(node);
14
+ return false;
15
+ }
16
+ return true;
17
+ });
18
+ return schema.nodes.doc.create(null, schema.nodes.paragraph.create(null, inline));
19
+ }
20
+ /**
21
+ * Constrains the document to a single paragraph: Enter is inert, pasted
22
+ * multi-block content is flattened to one line, and any transaction that
23
+ * would still produce extra blocks is rejected.
24
+ */
25
+ export function singleLinePlugin() {
26
+ return new Plugin({
27
+ filterTransaction(tr) {
28
+ return !tr.docChanged || tr.doc.childCount <= 1;
29
+ },
30
+ props: {
31
+ handleKeyDown(_view, event) {
32
+ return event.key === 'Enter';
33
+ },
34
+ transformPasted(slice) {
35
+ const inline = [];
36
+ slice.content.descendants(node => {
37
+ if (node.isInline) {
38
+ inline.push(node);
39
+ return false;
40
+ }
41
+ return true;
42
+ });
43
+ return new Slice(Fragment.from(inline), 0, 0);
44
+ },
45
+ },
46
+ });
47
+ }
48
+ //# sourceMappingURL=single-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single-line.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/single-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAkB,MAAM,mBAAmB,CAAC;AAEpE,8EAA8E;AAC9E,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAClD,IAAI,GAAG,CAAC,UAAU,IAAI,CAAC;QAAE,OAAO,GAAG,CAAC;IACpC,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;QACrB,IAAI,IAAI,CAAC,QAAQ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irror-model';\n\n/** Flattens a multi-block document into a single paragraph, keeping marks. */\nexport function flattenToSingleParagraph(doc: PMNode): PMNode {\n if (doc.childCount <= 1) return doc;\n const schema = doc.type.schema;\n const inline: PMNode[] = [];\n doc.descendants(node => {\n if (node.isInline) {\n if (node.type === schema.nodes.hard_break) return false;\n inline.push(node);\n return false;\n }\n return true;\n });\n return schema.nodes.doc.create(null, schema.nodes.paragraph.create(null, inline));\n}\n\n/**\n * Constrains the document to a single paragraph: Enter is inert, pasted\n * multi-block content is flattened to one line, and any transaction that\n * would still produce extra blocks is rejected.\n */\nexport function singleLinePlugin(): Plugin {\n return new Plugin({\n filterTransaction(tr) {\n return !tr.docChanged || tr.doc.childCount <= 1;\n },\n props: {\n handleKeyDown(_view, event) {\n return event.key === 'Enter';\n },\n transformPasted(slice) {\n const inline: PMNode[] = [];\n slice.content.descendants(node => {\n if (node.isInline) {\n inline.push(node);\n return false;\n }\n return true;\n });\n return new Slice(Fragment.from(inline), 0, 0);\n },\n },\n });\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
+ /** Live state of a trigger-character suggestion (mention or slash command). */
3
+ export interface SuggestionMatch {
4
+ active: boolean;
5
+ trigger: string;
6
+ query: string;
7
+ /** Doc range spanning trigger + query, to replace on selection. */
8
+ from: number;
9
+ to: number;
10
+ }
11
+ export declare const INACTIVE_SUGGESTION: SuggestionMatch;
12
+ export interface SuggestionOptions {
13
+ /** Read live so trigger config can change without rebuilding state. */
14
+ getTriggers: () => string[];
15
+ /** Restrict to the start of an empty-ish textblock (slash commands). */
16
+ startOfLine?: boolean;
17
+ /** Stay inactive until the query reaches this length (emoji ":" noise). */
18
+ minQueryLength?: number;
19
+ /** Notified on every state change (including becoming inactive). */
20
+ onChange: (match: SuggestionMatch) => void;
21
+ /** Intercept keys (arrows/Enter/Escape) while a suggestion is active. */
22
+ onKeyDown?: (event: KeyboardEvent, match: SuggestionMatch) => boolean;
23
+ }
24
+ /**
25
+ * Generic trigger-character suggestion tracker. Recomputes the active
26
+ * trigger/query from the selection on every transaction, notifies the host,
27
+ * and softly highlights the query text. Insertion/UI is the host's job.
28
+ */
29
+ export declare function suggestionPlugin(key: PluginKey, options: SuggestionOptions): Plugin;
@@ -0,0 +1,87 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { Decoration, DecorationSet } from 'prosemirror-view';
3
+ export const INACTIVE_SUGGESTION = {
4
+ active: false,
5
+ trigger: '',
6
+ query: '',
7
+ from: 0,
8
+ to: 0,
9
+ };
10
+ const MAX_QUERY_LENGTH = 50;
11
+ function findSuggestion(state, options) {
12
+ const { $from, empty } = state.selection;
13
+ if (!empty || !$from.parent.isTextblock || $from.parent.type.spec.code) {
14
+ return INACTIVE_SUGGESTION;
15
+ }
16
+ const textBefore = $from.parent.textBetween(0, $from.parentOffset, '\0', '\0');
17
+ // Longest triggers first so '{{' wins over '{'.
18
+ const triggers = [...options.getTriggers()].sort((a, b) => b.length - a.length);
19
+ for (const trigger of triggers) {
20
+ if (!trigger)
21
+ continue;
22
+ const index = textBefore.lastIndexOf(trigger);
23
+ if (index === -1)
24
+ continue;
25
+ if (options.startOfLine && index !== 0)
26
+ continue;
27
+ // Trigger must start a word: preceded by nothing or whitespace.
28
+ const before = textBefore[index - 1];
29
+ if (before !== undefined && !/\s/.test(before))
30
+ continue;
31
+ const query = textBefore.slice(index + trigger.length);
32
+ if (query.length > MAX_QUERY_LENGTH || /\s/.test(query))
33
+ continue;
34
+ if (query.length < (options.minQueryLength ?? 0))
35
+ continue;
36
+ return {
37
+ active: true,
38
+ trigger,
39
+ query,
40
+ from: $from.start() + index,
41
+ to: $from.pos,
42
+ };
43
+ }
44
+ return INACTIVE_SUGGESTION;
45
+ }
46
+ /**
47
+ * Generic trigger-character suggestion tracker. Recomputes the active
48
+ * trigger/query from the selection on every transaction, notifies the host,
49
+ * and softly highlights the query text. Insertion/UI is the host's job.
50
+ */
51
+ export function suggestionPlugin(key, options) {
52
+ return new Plugin({
53
+ key,
54
+ state: {
55
+ init: () => INACTIVE_SUGGESTION,
56
+ apply(tr, prev, _old, newState) {
57
+ const next = findSuggestion(newState, options);
58
+ if (next.active !== prev.active ||
59
+ next.query !== prev.query ||
60
+ next.trigger !== prev.trigger ||
61
+ next.from !== prev.from) {
62
+ options.onChange(next);
63
+ }
64
+ return next;
65
+ },
66
+ },
67
+ props: {
68
+ decorations(state) {
69
+ const match = key.getState(state);
70
+ if (!match.active)
71
+ return null;
72
+ return DecorationSet.create(state.doc, [
73
+ Decoration.inline(match.from, match.to, {
74
+ class: 'nile-wysiwyg__suggestion',
75
+ }),
76
+ ]);
77
+ },
78
+ handleKeyDown(view, event) {
79
+ const match = key.getState(view.state);
80
+ if (!match.active || !options.onKeyDown)
81
+ return false;
82
+ return options.onKeyDown(event, match);
83
+ },
84
+ },
85
+ });
86
+ }
87
+ //# sourceMappingURL=suggestions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestions.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/suggestions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA0B,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAY7D,MAAM,CAAC,MAAM,mBAAmB,GAAoB;IAClD,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,CAAC;IACP,EAAE,EAAE,CAAC;CACN,CAAC;AAeF,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,SAAS,cAAc,CAAC,KAAkB,EAAE,OAA0B;IACpE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;IACzC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,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CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS;oBAAE,OAAO,KAAK,CAAC;gBACtD,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACzC,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Plugin, PluginKey, EditorState } from 'prosemirror-state';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\n\n/** Live state of a trigger-character suggestion (mention or slash command). */\nexport interface SuggestionMatch {\n active: boolean;\n trigger: string;\n query: string;\n /** Doc range spanning trigger + query, to replace on selection. */\n from: number;\n to: number;\n}\n\nexport const INACTIVE_SUGGESTION: SuggestionMatch = {\n active: false,\n trigger: '',\n query: '',\n from: 0,\n to: 0,\n};\n\nexport interface SuggestionOptions {\n /** Read live so trigger config can change without rebuilding state. */\n getTriggers: () => string[];\n /** Restrict to the start of an empty-ish textblock (slash commands). */\n startOfLine?: boolean;\n /** Stay inactive until the query reaches this length (emoji \":\" noise). */\n minQueryLength?: number;\n /** Notified on every state change (including becoming inactive). */\n onChange: (match: SuggestionMatch) => void;\n /** Intercept keys (arrows/Enter/Escape) while a suggestion is active. */\n onKeyDown?: (event: KeyboardEvent, match: SuggestionMatch) => boolean;\n}\n\nconst MAX_QUERY_LENGTH = 50;\n\nfunction findSuggestion(state: EditorState, options: SuggestionOptions): SuggestionMatch {\n const { $from, empty } = state.selection;\n if (!empty || !$from.parent.isTextblock || $from.parent.type.spec.code) {\n return INACTIVE_SUGGESTION;\n }\n const textBefore = $from.parent.textBetween(0, $from.parentOffset, '\\0', '\\0');\n // Longest triggers first so '{{' wins over '{'.\n const triggers = [...options.getTriggers()].sort((a, b) => b.length - a.length);\n for (const trigger of triggers) {\n if (!trigger) continue;\n const index = textBefore.lastIndexOf(trigger);\n if (index === -1) continue;\n if (options.startOfLine && index !== 0) continue;\n // Trigger must start a word: preceded by nothing or whitespace.\n const before = textBefore[index - 1];\n if (before !== undefined && !/\\s/.test(before)) continue;\n const query = textBefore.slice(index + trigger.length);\n if (query.length > MAX_QUERY_LENGTH || /\\s/.test(query)) continue;\n if (query.length < (options.minQueryLength ?? 0)) continue;\n return {\n active: true,\n trigger,\n query,\n from: $from.start() + index,\n to: $from.pos,\n };\n }\n return INACTIVE_SUGGESTION;\n}\n\n/**\n * Generic trigger-character suggestion tracker. Recomputes the active\n * trigger/query from the selection on every transaction, notifies the host,\n * and softly highlights the query text. Insertion/UI is the host's job.\n */\nexport function suggestionPlugin(key: PluginKey, options: SuggestionOptions): Plugin {\n return new Plugin<SuggestionMatch>({\n key,\n\n state: {\n init: () => INACTIVE_SUGGESTION,\n apply(tr, prev, _old, newState) {\n const next = findSuggestion(newState, options);\n if (\n next.active !== prev.active ||\n next.query !== prev.query ||\n next.trigger !== prev.trigger ||\n next.from !== prev.from\n ) {\n options.onChange(next);\n }\n return next;\n },\n },\n\n props: {\n decorations(state) {\n const match = key.getState(state) as SuggestionMatch;\n if (!match.active) return null;\n return DecorationSet.create(state.doc, [\n Decoration.inline(match.from, match.to, {\n class: 'nile-wysiwyg__suggestion',\n }),\n ]);\n },\n\n handleKeyDown(view, event) {\n const match = key.getState(view.state) as SuggestionMatch;\n if (!match.active || !options.onKeyDown) return false;\n return options.onKeyDown(event, match);\n },\n },\n });\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ /**
3
+ * prosemirror-tables wiring: cell selections, fix-tables normalization, and
4
+ * draggable column resizing (widths persist as `data-colwidth`). The CSS
5
+ * these plugins rely on (.selectedCell, .column-resize-handle, .resize-cursor)
6
+ * is inlined in nile-wysiwyg-editor.css.ts.
7
+ */
8
+ export declare function tablePlugins(): Plugin[];