@aquera/nile-elements 1.9.5 → 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 (565) hide show
  1. package/README.md +9 -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 +3802 -664
  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-chip/nile-chip.css.cjs.js +1 -1
  31. package/dist/nile-chip/nile-chip.css.cjs.js.map +1 -1
  32. package/dist/nile-chip/nile-chip.css.esm.js +8 -1
  33. package/dist/nile-code-editor/extensionSetup.cjs.js +7 -7
  34. package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
  35. package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
  36. package/dist/nile-code-editor/index.cjs.js +1 -1
  37. package/dist/nile-code-editor/index.esm.js +1 -1
  38. package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
  39. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  40. package/dist/nile-code-editor/nile-code-editor.esm.js +4 -4
  41. package/dist/nile-color-picker/index.cjs.js +1 -1
  42. package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
  43. package/dist/nile-combobox/index.cjs.js +1 -1
  44. package/dist/nile-combobox/index.esm.js +1 -1
  45. package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
  46. package/dist/nile-combobox/nile-combobox.esm.js +1 -1
  47. package/dist/nile-combobox/portal-manager.cjs.js +1 -1
  48. package/dist/nile-context-menu/index.cjs.js +1 -1
  49. package/dist/nile-context-menu/nile-context-menu.cjs.js +1 -1
  50. package/dist/nile-context-submenu/index.cjs.js +1 -1
  51. package/dist/nile-context-submenu/nile-context-submenu.cjs.js +1 -1
  52. package/dist/nile-detail/index.cjs.js +1 -1
  53. package/dist/nile-detail/index.esm.js +1 -1
  54. package/dist/nile-detail/nile-detail.cjs.js +1 -1
  55. package/dist/nile-detail/nile-detail.esm.js +1 -1
  56. package/dist/nile-dropdown/index.cjs.js +1 -1
  57. package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
  58. package/dist/nile-dropdown/portal-manager.cjs.js +1 -1
  59. package/dist/nile-file-upload/index.cjs.js +1 -1
  60. package/dist/nile-file-upload/nile-file-upload.cjs.js +1 -1
  61. package/dist/nile-file-upload/nile-file-upload.template.cjs.js +1 -1
  62. package/dist/nile-floating-panel/index.cjs.js +1 -1
  63. package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
  64. package/dist/nile-hero/nile-hero.cjs.js +1 -1
  65. package/dist/nile-hero/nile-hero.cjs.js.map +1 -1
  66. package/dist/nile-hero/nile-hero.css.cjs.js +1 -1
  67. package/dist/nile-hero/nile-hero.css.cjs.js.map +1 -1
  68. package/dist/nile-hero/nile-hero.css.esm.js +14 -14
  69. package/dist/nile-hero/nile-hero.esm.js +1 -1
  70. package/dist/nile-hero-header/nile-hero-header.cjs.js +1 -1
  71. package/dist/nile-hero-header/nile-hero-header.cjs.js.map +1 -1
  72. package/dist/nile-hero-header/nile-hero-header.css.cjs.js +1 -1
  73. package/dist/nile-hero-header/nile-hero-header.css.cjs.js.map +1 -1
  74. package/dist/nile-hero-header/nile-hero-header.css.esm.js +11 -11
  75. package/dist/nile-hero-header/nile-hero-header.esm.js +3 -3
  76. package/dist/nile-lite-tooltip/index.cjs.js +1 -1
  77. package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js +1 -1
  78. package/dist/nile-markdown-editor/index.cjs.js +1 -1
  79. package/dist/nile-markdown-editor/nile-markdown-editor.cjs.js +1 -1
  80. package/dist/nile-popover/index.cjs.js +1 -1
  81. package/dist/nile-popover/nile-popover.cjs.js +1 -1
  82. package/dist/nile-popover/portal-manager.cjs.js +1 -1
  83. package/dist/nile-popup/index.cjs.js +1 -1
  84. package/dist/nile-popup/nile-popup.cjs.js +1 -1
  85. package/dist/nile-rich-text-editor/index.cjs.js +1 -1
  86. package/dist/nile-rich-text-editor/index.esm.js +1 -1
  87. package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js +1 -1
  88. package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js.map +1 -1
  89. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js +1 -1
  90. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js.map +1 -1
  91. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.esm.js +70 -0
  92. package/dist/nile-rich-text-editor/nile-rich-text-editor.esm.js +1 -1
  93. package/dist/nile-rich-text-editor/nile-rte-image.cjs.js +3 -0
  94. package/dist/nile-rich-text-editor/nile-rte-image.cjs.js.map +1 -0
  95. package/dist/nile-rich-text-editor/nile-rte-image.esm.js +96 -0
  96. package/dist/nile-select/index.cjs.js +1 -1
  97. package/dist/nile-select/nile-select.cjs.js +1 -1
  98. package/dist/nile-select/portal-manager.cjs.js +1 -1
  99. package/dist/nile-side-bar-action/index.cjs.js +1 -1
  100. package/dist/nile-side-bar-action/nile-side-bar-action.cjs.js +1 -1
  101. package/dist/nile-side-bar-action/portal-manager.cjs.js +1 -1
  102. package/dist/nile-tooltip/index.cjs.js +1 -1
  103. package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
  104. package/dist/nile-virtual-select/index.cjs.js +1 -1
  105. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
  106. package/dist/nile-virtual-select/portal-manager.cjs.js +1 -1
  107. package/dist/nile-virtual-select/renderer.cjs.js +1 -1
  108. package/dist/nile-wysiwyg-editor/emoji.cjs.js +2 -0
  109. package/dist/nile-wysiwyg-editor/emoji.cjs.js.map +1 -0
  110. package/dist/nile-wysiwyg-editor/emoji.esm.js +1 -0
  111. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +2 -0
  112. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -0
  113. package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -0
  114. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +2 -0
  115. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -0
  116. package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -0
  117. package/dist/nile-wysiwyg-editor/engine/export.cjs.js +2 -0
  118. package/dist/nile-wysiwyg-editor/engine/export.cjs.js.map +1 -0
  119. package/dist/nile-wysiwyg-editor/engine/export.esm.js +1 -0
  120. package/dist/nile-wysiwyg-editor/engine/index.cjs.js +2 -0
  121. package/dist/nile-wysiwyg-editor/engine/index.cjs.js.map +1 -0
  122. package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -0
  123. package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +2 -0
  124. package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js.map +1 -0
  125. package/dist/nile-wysiwyg-editor/engine/inputrules.esm.js +1 -0
  126. package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +2 -0
  127. package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js.map +1 -0
  128. package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -0
  129. package/dist/nile-wysiwyg-editor/engine/markdown-parse.cjs.js +2 -0
  130. package/dist/nile-wysiwyg-editor/engine/markdown-parse.cjs.js.map +1 -0
  131. package/dist/nile-wysiwyg-editor/engine/markdown-parse.esm.js +1 -0
  132. package/dist/nile-wysiwyg-editor/engine/markdown.cjs.js +2 -0
  133. package/dist/nile-wysiwyg-editor/engine/markdown.cjs.js.map +1 -0
  134. package/dist/nile-wysiwyg-editor/engine/markdown.esm.js +1 -0
  135. package/dist/nile-wysiwyg-editor/engine/office-paste.cjs.js +2 -0
  136. package/dist/nile-wysiwyg-editor/engine/office-paste.cjs.js.map +1 -0
  137. package/dist/nile-wysiwyg-editor/engine/office-paste.esm.js +1 -0
  138. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +2 -0
  139. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -0
  140. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -0
  141. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +2 -0
  142. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -0
  143. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -0
  144. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +2 -0
  145. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -0
  146. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -0
  147. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js +2 -0
  148. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js.map +1 -0
  149. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.esm.js +1 -0
  150. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js +2 -0
  151. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js.map +1 -0
  152. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.esm.js +1 -0
  153. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js +2 -0
  154. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js.map +1 -0
  155. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.esm.js +1 -0
  156. package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js +2 -0
  157. package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js.map +1 -0
  158. package/dist/nile-wysiwyg-editor/engine/plugins/image.esm.js +1 -0
  159. package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js +2 -0
  160. package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js.map +1 -0
  161. package/dist/nile-wysiwyg-editor/engine/plugins/link.esm.js +1 -0
  162. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js +2 -0
  163. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js.map +1 -0
  164. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.esm.js +1 -0
  165. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js +2 -0
  166. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js.map +1 -0
  167. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.esm.js +1 -0
  168. package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js +2 -0
  169. package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js.map +1 -0
  170. package/dist/nile-wysiwyg-editor/engine/plugins/paste.esm.js +1 -0
  171. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js +2 -0
  172. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js.map +1 -0
  173. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.esm.js +1 -0
  174. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js +2 -0
  175. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js.map +1 -0
  176. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.esm.js +1 -0
  177. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js +2 -0
  178. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js.map +1 -0
  179. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.esm.js +1 -0
  180. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +2 -0
  181. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -0
  182. package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -0
  183. package/dist/nile-wysiwyg-editor/engine/plugins/task-list.cjs.js +2 -0
  184. package/dist/nile-wysiwyg-editor/engine/plugins/task-list.cjs.js.map +1 -0
  185. package/dist/nile-wysiwyg-editor/engine/plugins/task-list.esm.js +1 -0
  186. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +2 -0
  187. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -0
  188. package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -0
  189. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +2 -0
  190. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -0
  191. package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -0
  192. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +2 -0
  193. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -0
  194. package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -0
  195. package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js +2 -0
  196. package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js.map +1 -0
  197. package/dist/nile-wysiwyg-editor/engine/serializer.esm.js +1 -0
  198. package/dist/nile-wysiwyg-editor/index.cjs.js +2 -0
  199. package/dist/nile-wysiwyg-editor/index.cjs.js.map +1 -0
  200. package/dist/nile-wysiwyg-editor/index.esm.js +1 -0
  201. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +2 -0
  202. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -0
  203. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +2 -0
  204. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -0
  205. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +780 -0
  206. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +97 -0
  207. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +2 -0
  208. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js.map +1 -0
  209. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -0
  210. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +2 -0
  211. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js.map +1 -0
  212. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js +2 -0
  213. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js.map +1 -0
  214. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.esm.js +244 -0
  215. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +137 -0
  216. package/dist/nile-wysiwyg-editor/types.cjs.js +2 -0
  217. package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -0
  218. package/dist/nile-wysiwyg-editor/types.esm.js +1 -0
  219. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js +2 -0
  220. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js.map +1 -0
  221. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.esm.js +97 -0
  222. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +2 -0
  223. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -0
  224. package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +67 -0
  225. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +2 -0
  226. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -0
  227. package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +65 -0
  228. package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +2 -0
  229. package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -0
  230. package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +64 -0
  231. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +2 -0
  232. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -0
  233. package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +68 -0
  234. package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js +2 -0
  235. package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js.map +1 -0
  236. package/dist/nile-wysiwyg-editor/ui/emoji-picker.esm.js +96 -0
  237. package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js +2 -0
  238. package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js.map +1 -0
  239. package/dist/nile-wysiwyg-editor/ui/find-replace.esm.js +112 -0
  240. package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +2 -0
  241. package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -0
  242. package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +64 -0
  243. package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js +2 -0
  244. package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js.map +1 -0
  245. package/dist/nile-wysiwyg-editor/ui/image-panel.esm.js +171 -0
  246. package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js +2 -0
  247. package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js.map +1 -0
  248. package/dist/nile-wysiwyg-editor/ui/insert-menu.esm.js +90 -0
  249. package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js +2 -0
  250. package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js.map +1 -0
  251. package/dist/nile-wysiwyg-editor/ui/link-editor.esm.js +114 -0
  252. package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js +2 -0
  253. package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js.map +1 -0
  254. package/dist/nile-wysiwyg-editor/ui/markdown-panel.esm.js +80 -0
  255. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +2 -0
  256. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -0
  257. package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +92 -0
  258. package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js +2 -0
  259. package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js.map +1 -0
  260. package/dist/nile-wysiwyg-editor/ui/shortcut-help.esm.js +147 -0
  261. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +2 -0
  262. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -0
  263. package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +79 -0
  264. package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js +2 -0
  265. package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js.map +1 -0
  266. package/dist/nile-wysiwyg-editor/ui/special-chars.esm.js +96 -0
  267. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +2 -0
  268. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -0
  269. package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +67 -0
  270. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +2 -0
  271. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -0
  272. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +100 -0
  273. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +2 -0
  274. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -0
  275. package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +58 -0
  276. package/dist/src/index.d.ts +24 -0
  277. package/dist/src/index.js +19 -0
  278. package/dist/src/index.js.map +1 -1
  279. package/dist/src/internal/glyph.d.ts +6 -0
  280. package/dist/src/internal/glyph.js +13 -0
  281. package/dist/src/internal/glyph.js.map +1 -0
  282. package/dist/src/nile-chip/nile-chip.css.js +8 -1
  283. package/dist/src/nile-chip/nile-chip.css.js.map +1 -1
  284. package/dist/src/nile-code-editor/nile-code-editor.js +3 -3
  285. package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
  286. package/dist/src/nile-hero/nile-hero.css.js +12 -12
  287. package/dist/src/nile-hero/nile-hero.css.js.map +1 -1
  288. package/dist/src/nile-hero/nile-hero.js +1 -1
  289. package/dist/src/nile-hero/nile-hero.js.map +1 -1
  290. package/dist/src/nile-hero-header/nile-hero-header.css.js +9 -9
  291. package/dist/src/nile-hero-header/nile-hero-header.css.js.map +1 -1
  292. package/dist/src/nile-hero-header/nile-hero-header.js +1 -1
  293. package/dist/src/nile-hero-header/nile-hero-header.js.map +1 -1
  294. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js +70 -0
  295. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js.map +1 -1
  296. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.d.ts +3 -0
  297. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js +81 -3
  298. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js.map +1 -1
  299. package/dist/src/nile-rich-text-editor/nile-rte-image.d.ts +87 -0
  300. package/dist/src/nile-rich-text-editor/nile-rte-image.js +1073 -0
  301. package/dist/src/nile-rich-text-editor/nile-rte-image.js.map +1 -0
  302. package/dist/src/nile-wysiwyg-editor/emoji.d.ts +5 -0
  303. package/dist/src/nile-wysiwyg-editor/emoji.js +138 -0
  304. package/dist/src/nile-wysiwyg-editor/emoji.js.map +1 -0
  305. package/dist/src/nile-wysiwyg-editor/engine/commands.d.ts +69 -0
  306. package/dist/src/nile-wysiwyg-editor/engine/commands.js +863 -0
  307. package/dist/src/nile-wysiwyg-editor/engine/commands.js.map +1 -0
  308. package/dist/src/nile-wysiwyg-editor/engine/create-state.d.ts +35 -0
  309. package/dist/src/nile-wysiwyg-editor/engine/create-state.js +67 -0
  310. package/dist/src/nile-wysiwyg-editor/engine/create-state.js.map +1 -0
  311. package/dist/src/nile-wysiwyg-editor/engine/export.d.ts +38 -0
  312. package/dist/src/nile-wysiwyg-editor/engine/export.js +208 -0
  313. package/dist/src/nile-wysiwyg-editor/engine/export.js.map +1 -0
  314. package/dist/src/nile-wysiwyg-editor/engine/export.test.d.ts +1 -0
  315. package/dist/src/nile-wysiwyg-editor/engine/export.test.js +96 -0
  316. package/dist/src/nile-wysiwyg-editor/engine/export.test.js.map +1 -0
  317. package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +37 -0
  318. package/dist/src/nile-wysiwyg-editor/engine/index.js +29 -0
  319. package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -0
  320. package/dist/src/nile-wysiwyg-editor/engine/inputrules.d.ts +12 -0
  321. package/dist/src/nile-wysiwyg-editor/engine/inputrules.js +144 -0
  322. package/dist/src/nile-wysiwyg-editor/engine/inputrules.js.map +1 -0
  323. package/dist/src/nile-wysiwyg-editor/engine/keymap.d.ts +15 -0
  324. package/dist/src/nile-wysiwyg-editor/engine/keymap.js +94 -0
  325. package/dist/src/nile-wysiwyg-editor/engine/keymap.js.map +1 -0
  326. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.d.ts +22 -0
  327. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.js +287 -0
  328. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.js.map +1 -0
  329. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.d.ts +1 -0
  330. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.js +106 -0
  331. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.js.map +1 -0
  332. package/dist/src/nile-wysiwyg-editor/engine/markdown.d.ts +10 -0
  333. package/dist/src/nile-wysiwyg-editor/engine/markdown.js +162 -0
  334. package/dist/src/nile-wysiwyg-editor/engine/markdown.js.map +1 -0
  335. package/dist/src/nile-wysiwyg-editor/engine/office-paste.d.ts +13 -0
  336. package/dist/src/nile-wysiwyg-editor/engine/office-paste.js +182 -0
  337. package/dist/src/nile-wysiwyg-editor/engine/office-paste.js.map +1 -0
  338. package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.d.ts +10 -0
  339. package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.js +165 -0
  340. package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.js.map +1 -0
  341. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.d.ts +17 -0
  342. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js +69 -0
  343. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js.map +1 -0
  344. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.d.ts +17 -0
  345. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js +96 -0
  346. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js.map +1 -0
  347. package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.d.ts +26 -0
  348. package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.js +123 -0
  349. package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.js.map +1 -0
  350. package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.d.ts +28 -0
  351. package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.js +72 -0
  352. package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.js.map +1 -0
  353. package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.d.ts +41 -0
  354. package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js +176 -0
  355. package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js.map +1 -0
  356. package/dist/src/nile-wysiwyg-editor/engine/plugins/image.d.ts +15 -0
  357. package/dist/src/nile-wysiwyg-editor/engine/plugins/image.js +64 -0
  358. package/dist/src/nile-wysiwyg-editor/engine/plugins/image.js.map +1 -0
  359. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.d.ts +11 -0
  360. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js +42 -0
  361. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js.map +1 -0
  362. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.d.ts +18 -0
  363. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js +46 -0
  364. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js.map +1 -0
  365. package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.d.ts +7 -0
  366. package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.js +26 -0
  367. package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.js.map +1 -0
  368. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.d.ts +31 -0
  369. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js +55 -0
  370. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js.map +1 -0
  371. package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.d.ts +7 -0
  372. package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.js +25 -0
  373. package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.js.map +1 -0
  374. package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.d.ts +10 -0
  375. package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.js +48 -0
  376. package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.js.map +1 -0
  377. package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.d.ts +29 -0
  378. package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.js +87 -0
  379. package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.js.map +1 -0
  380. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.d.ts +8 -0
  381. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +11 -0
  382. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -0
  383. package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.d.ts +16 -0
  384. package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.js +49 -0
  385. package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.js.map +1 -0
  386. package/dist/src/nile-wysiwyg-editor/engine/pm.test.d.ts +1 -0
  387. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +883 -0
  388. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -0
  389. package/dist/src/nile-wysiwyg-editor/engine/productivity.test.d.ts +1 -0
  390. package/dist/src/nile-wysiwyg-editor/engine/productivity.test.js +129 -0
  391. package/dist/src/nile-wysiwyg-editor/engine/productivity.test.js.map +1 -0
  392. package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +13 -0
  393. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +155 -0
  394. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -0
  395. package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +20 -0
  396. package/dist/src/nile-wysiwyg-editor/engine/schema.js +823 -0
  397. package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -0
  398. package/dist/src/nile-wysiwyg-editor/engine/selection-state.d.ts +70 -0
  399. package/dist/src/nile-wysiwyg-editor/engine/selection-state.js +138 -0
  400. package/dist/src/nile-wysiwyg-editor/engine/selection-state.js.map +1 -0
  401. package/dist/src/nile-wysiwyg-editor/engine/serializer.d.ts +18 -0
  402. package/dist/src/nile-wysiwyg-editor/engine/serializer.js +63 -0
  403. package/dist/src/nile-wysiwyg-editor/engine/serializer.js.map +1 -0
  404. package/dist/src/nile-wysiwyg-editor/index.d.ts +3 -0
  405. package/dist/src/nile-wysiwyg-editor/index.js +3 -0
  406. package/dist/src/nile-wysiwyg-editor/index.js.map +1 -0
  407. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.d.ts +1 -0
  408. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +782 -0
  409. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -0
  410. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +364 -0
  411. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +2038 -0
  412. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -0
  413. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.d.ts +1 -0
  414. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +636 -0
  415. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -0
  416. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.d.ts +1 -0
  417. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js +2 -0
  418. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js.map +1 -0
  419. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.d.ts +6 -0
  420. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +251 -0
  421. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -0
  422. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.d.ts +41 -0
  423. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js +700 -0
  424. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js.map +1 -0
  425. package/dist/src/nile-wysiwyg-editor/types.d.ts +49 -0
  426. package/dist/src/nile-wysiwyg-editor/types.js +8 -0
  427. package/dist/src/nile-wysiwyg-editor/types.js.map +1 -0
  428. package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.d.ts +20 -0
  429. package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js +159 -0
  430. package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js.map +1 -0
  431. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.d.ts +21 -0
  432. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +125 -0
  433. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -0
  434. package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.d.ts +18 -0
  435. package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js +107 -0
  436. package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js.map +1 -0
  437. package/dist/src/nile-wysiwyg-editor/ui/embed-menu.d.ts +19 -0
  438. package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js +123 -0
  439. package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js.map +1 -0
  440. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.d.ts +27 -0
  441. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +146 -0
  442. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -0
  443. package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.d.ts +21 -0
  444. package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js +154 -0
  445. package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js.map +1 -0
  446. package/dist/src/nile-wysiwyg-editor/ui/find-replace.d.ts +26 -0
  447. package/dist/src/nile-wysiwyg-editor/ui/find-replace.js +178 -0
  448. package/dist/src/nile-wysiwyg-editor/ui/find-replace.js.map +1 -0
  449. package/dist/src/nile-wysiwyg-editor/ui/image-menu.d.ts +18 -0
  450. package/dist/src/nile-wysiwyg-editor/ui/image-menu.js +129 -0
  451. package/dist/src/nile-wysiwyg-editor/ui/image-menu.js.map +1 -0
  452. package/dist/src/nile-wysiwyg-editor/ui/image-panel.d.ts +56 -0
  453. package/dist/src/nile-wysiwyg-editor/ui/image-panel.js +349 -0
  454. package/dist/src/nile-wysiwyg-editor/ui/image-panel.js.map +1 -0
  455. package/dist/src/nile-wysiwyg-editor/ui/insert-menu.d.ts +25 -0
  456. package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js +142 -0
  457. package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js.map +1 -0
  458. package/dist/src/nile-wysiwyg-editor/ui/link-editor.d.ts +30 -0
  459. package/dist/src/nile-wysiwyg-editor/ui/link-editor.js +189 -0
  460. package/dist/src/nile-wysiwyg-editor/ui/link-editor.js.map +1 -0
  461. package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.d.ts +24 -0
  462. package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js +144 -0
  463. package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js.map +1 -0
  464. package/dist/src/nile-wysiwyg-editor/ui/math-panel.d.ts +31 -0
  465. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +172 -0
  466. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -0
  467. package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.d.ts +30 -0
  468. package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js +296 -0
  469. package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js.map +1 -0
  470. package/dist/src/nile-wysiwyg-editor/ui/source-view.d.ts +19 -0
  471. package/dist/src/nile-wysiwyg-editor/ui/source-view.js +120 -0
  472. package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -0
  473. package/dist/src/nile-wysiwyg-editor/ui/special-chars.d.ts +20 -0
  474. package/dist/src/nile-wysiwyg-editor/ui/special-chars.js +199 -0
  475. package/dist/src/nile-wysiwyg-editor/ui/special-chars.js.map +1 -0
  476. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.d.ts +31 -0
  477. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +133 -0
  478. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -0
  479. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.d.ts +23 -0
  480. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +177 -0
  481. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -0
  482. package/dist/src/nile-wysiwyg-editor/ui/table-menu.d.ts +16 -0
  483. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +101 -0
  484. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -0
  485. package/dist/src/version.js +1 -1
  486. package/dist/src/version.js.map +1 -1
  487. package/dist/tsconfig.tsbuildinfo +1 -1
  488. package/package.json +18 -2
  489. package/src/index.ts +57 -1
  490. package/src/internal/glyph.ts +13 -0
  491. package/src/nile-chip/nile-chip.css.ts +8 -1
  492. package/src/nile-code-editor/nile-code-editor.ts +3 -3
  493. package/src/nile-hero/nile-hero.css.ts +12 -12
  494. package/src/nile-hero/nile-hero.ts +1 -1
  495. package/src/nile-hero-header/nile-hero-header.css.ts +9 -9
  496. package/src/nile-hero-header/nile-hero-header.ts +1 -1
  497. package/src/nile-rich-text-editor/nile-rich-text-editor.css.ts +70 -0
  498. package/src/nile-rich-text-editor/nile-rich-text-editor.ts +89 -3
  499. package/src/nile-rich-text-editor/nile-rte-image.ts +1132 -0
  500. package/src/nile-wysiwyg-editor/emoji.ts +137 -0
  501. package/src/nile-wysiwyg-editor/engine/commands.ts +1035 -0
  502. package/src/nile-wysiwyg-editor/engine/create-state.ts +117 -0
  503. package/src/nile-wysiwyg-editor/engine/export.test.ts +113 -0
  504. package/src/nile-wysiwyg-editor/engine/export.ts +242 -0
  505. package/src/nile-wysiwyg-editor/engine/index.ts +69 -0
  506. package/src/nile-wysiwyg-editor/engine/inputrules.ts +169 -0
  507. package/src/nile-wysiwyg-editor/engine/keymap.ts +146 -0
  508. package/src/nile-wysiwyg-editor/engine/markdown-parse.test.ts +148 -0
  509. package/src/nile-wysiwyg-editor/engine/markdown-parse.ts +337 -0
  510. package/src/nile-wysiwyg-editor/engine/markdown.ts +165 -0
  511. package/src/nile-wysiwyg-editor/engine/office-paste.ts +199 -0
  512. package/src/nile-wysiwyg-editor/engine/plugins/code-highlight.ts +173 -0
  513. package/src/nile-wysiwyg-editor/engine/plugins/embed-view.ts +85 -0
  514. package/src/nile-wysiwyg-editor/engine/plugins/embeds.ts +99 -0
  515. package/src/nile-wysiwyg-editor/engine/plugins/find-replace.ts +155 -0
  516. package/src/nile-wysiwyg-editor/engine/plugins/format-painter.ts +80 -0
  517. package/src/nile-wysiwyg-editor/engine/plugins/image-view.ts +220 -0
  518. package/src/nile-wysiwyg-editor/engine/plugins/image.ts +80 -0
  519. package/src/nile-wysiwyg-editor/engine/plugins/link.ts +42 -0
  520. package/src/nile-wysiwyg-editor/engine/plugins/math-view.ts +56 -0
  521. package/src/nile-wysiwyg-editor/engine/plugins/max-length.ts +24 -0
  522. package/src/nile-wysiwyg-editor/engine/plugins/paste.ts +74 -0
  523. package/src/nile-wysiwyg-editor/engine/plugins/placeholder.ts +24 -0
  524. package/src/nile-wysiwyg-editor/engine/plugins/single-line.ts +47 -0
  525. package/src/nile-wysiwyg-editor/engine/plugins/suggestions.ts +110 -0
  526. package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +12 -0
  527. package/src/nile-wysiwyg-editor/engine/plugins/task-list.ts +65 -0
  528. package/src/nile-wysiwyg-editor/engine/pm.test.ts +1088 -0
  529. package/src/nile-wysiwyg-editor/engine/productivity.test.ts +163 -0
  530. package/src/nile-wysiwyg-editor/engine/sanitize.ts +156 -0
  531. package/src/nile-wysiwyg-editor/engine/schema.ts +859 -0
  532. package/src/nile-wysiwyg-editor/engine/selection-state.ts +210 -0
  533. package/src/nile-wysiwyg-editor/engine/serializer.ts +78 -0
  534. package/src/nile-wysiwyg-editor/index.ts +3 -0
  535. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +782 -0
  536. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +750 -0
  537. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +2155 -0
  538. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.ts +1 -0
  539. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +251 -0
  540. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.ts +772 -0
  541. package/src/nile-wysiwyg-editor/types.ts +83 -0
  542. package/src/nile-wysiwyg-editor/ui/bookmark-panel.ts +155 -0
  543. package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +135 -0
  544. package/src/nile-wysiwyg-editor/ui/code-block-menu.ts +105 -0
  545. package/src/nile-wysiwyg-editor/ui/embed-menu.ts +133 -0
  546. package/src/nile-wysiwyg-editor/ui/embed-panel.ts +143 -0
  547. package/src/nile-wysiwyg-editor/ui/emoji-picker.ts +152 -0
  548. package/src/nile-wysiwyg-editor/ui/find-replace.ts +174 -0
  549. package/src/nile-wysiwyg-editor/ui/image-menu.ts +140 -0
  550. package/src/nile-wysiwyg-editor/ui/image-panel.ts +337 -0
  551. package/src/nile-wysiwyg-editor/ui/insert-menu.ts +142 -0
  552. package/src/nile-wysiwyg-editor/ui/link-editor.ts +180 -0
  553. package/src/nile-wysiwyg-editor/ui/markdown-panel.ts +143 -0
  554. package/src/nile-wysiwyg-editor/ui/math-panel.ts +169 -0
  555. package/src/nile-wysiwyg-editor/ui/shortcut-help.ts +311 -0
  556. package/src/nile-wysiwyg-editor/ui/source-view.ts +119 -0
  557. package/src/nile-wysiwyg-editor/ui/special-chars.ts +209 -0
  558. package/src/nile-wysiwyg-editor/ui/suggest-list.ts +138 -0
  559. package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +173 -0
  560. package/src/nile-wysiwyg-editor/ui/table-menu.ts +109 -0
  561. package/vscode-html-custom-data.json +491 -1
  562. package/web-dev-server.config.mjs +6 -2
  563. package/dist/index-5fef1a0d.esm.js +0 -1
  564. package/dist/index-8f38fae3.cjs.js +0 -2
  565. package/dist/index-8f38fae3.cjs.js.map +0 -1
@@ -0,0 +1,96 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ /**
3
+ * Converts share/watch URLs from supported providers into their embed URLs.
4
+ * Returns null for anything unrecognized — only these providers are allowed.
5
+ */
6
+ export function toEmbedUrl(url) {
7
+ let parsed;
8
+ try {
9
+ parsed = new URL(url.trim());
10
+ }
11
+ catch {
12
+ return null;
13
+ }
14
+ if (parsed.protocol !== 'https:')
15
+ return null;
16
+ const host = parsed.hostname.replace(/^www\./, '');
17
+ // YouTube: watch?v=ID, youtu.be/ID, shorts/ID, embed/ID
18
+ if (host === 'youtube.com' || host === 'youtube-nocookie.com' || host === 'youtu.be') {
19
+ let id = '';
20
+ if (host === 'youtu.be')
21
+ id = parsed.pathname.slice(1).split('/')[0];
22
+ else if (parsed.pathname === '/watch')
23
+ id = parsed.searchParams.get('v') ?? '';
24
+ else {
25
+ const match = /^\/(embed|shorts)\/([\w-]+)/.exec(parsed.pathname);
26
+ if (match)
27
+ id = match[2];
28
+ }
29
+ if (/^[\w-]{6,20}$/.test(id)) {
30
+ return { src: `https://www.youtube-nocookie.com/embed/${id}`, provider: 'youtube' };
31
+ }
32
+ return null;
33
+ }
34
+ // Vimeo: vimeo.com/123456789, player.vimeo.com/video/123456789
35
+ if (host === 'vimeo.com' || host === 'player.vimeo.com') {
36
+ const match = /\/(?:video\/)?(\d{6,12})(?:$|[/?])/.exec(parsed.pathname);
37
+ if (match) {
38
+ return { src: `https://player.vimeo.com/video/${match[1]}`, provider: 'vimeo' };
39
+ }
40
+ return null;
41
+ }
42
+ // Loom: loom.com/share/ID or loom.com/embed/ID
43
+ if (host === 'loom.com') {
44
+ const match = /^\/(share|embed)\/([0-9a-f]{16,40})/.exec(parsed.pathname);
45
+ if (match) {
46
+ return { src: `https://www.loom.com/embed/${match[2]}`, provider: 'loom' };
47
+ }
48
+ return null;
49
+ }
50
+ return null;
51
+ }
52
+ /** True when a URL is already a permitted embed src (sanitizer check). */
53
+ export function isAllowedEmbedSrc(src) {
54
+ let parsed;
55
+ try {
56
+ parsed = new URL(src.trim());
57
+ }
58
+ catch {
59
+ return false;
60
+ }
61
+ if (parsed.protocol !== 'https:')
62
+ return false;
63
+ const host = parsed.hostname.replace(/^www\./, '');
64
+ return (((host === 'youtube.com' || host === 'youtube-nocookie.com') &&
65
+ parsed.pathname.startsWith('/embed/')) ||
66
+ (host === 'player.vimeo.com' && parsed.pathname.startsWith('/video/')) ||
67
+ (host === 'loom.com' && parsed.pathname.startsWith('/embed/')));
68
+ }
69
+ /**
70
+ * Pasting a bare provider URL onto an empty selection inserts an embed
71
+ * instead of plain text. (Pasting over selected text still creates a link.)
72
+ */
73
+ export function embedPastePlugin() {
74
+ return new Plugin({
75
+ props: {
76
+ handlePaste(view, event) {
77
+ const { state } = view;
78
+ if (!state.selection.empty)
79
+ return false;
80
+ const text = event.clipboardData?.getData('text/plain')?.trim();
81
+ if (!text || /\s/.test(text))
82
+ return false;
83
+ const target = toEmbedUrl(text);
84
+ if (!target)
85
+ return false;
86
+ const embed = state.schema.nodes.embed.create({
87
+ src: target.src,
88
+ provider: target.provider,
89
+ });
90
+ view.dispatch(state.tr.replaceSelectionWith(embed).scrollIntoView());
91
+ return true;
92
+ },
93
+ },
94
+ });
95
+ }
96
+ //# sourceMappingURL=embeds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeds.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/embeds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAO3C;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEnD,wDAAwD;IACxD,IAAI,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,sBAAsB,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACrF,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,IAAI,IAAI,KAAK,UAAU;YAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;aAChE,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ;YAAE,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aAC1E,CAAC;YACJ,MAAM,KAAK,GAAG,6BAA6B,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAClE,IAAI,KAAK;gBAAE,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QACD,IAAI,eAA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;gBACrE,OAAO,IAAI,CAAC;YACd,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Plugin } from 'prosemirror-state';\n\nexport interface EmbedTarget {\n src: string;\n provider: 'youtube' | 'vimeo' | 'loom';\n}\n\n/**\n * Converts share/watch URLs from supported providers into their embed URLs.\n * Returns null for anything unrecognized — only these providers are allowed.\n */\nexport function toEmbedUrl(url: string): EmbedTarget | null {\n let parsed: URL;\n try {\n parsed = new URL(url.trim());\n } catch {\n return null;\n }\n if (parsed.protocol !== 'https:') return null;\n const host = parsed.hostname.replace(/^www\\./, '');\n\n // YouTube: watch?v=ID, youtu.be/ID, shorts/ID, embed/ID\n if (host === 'youtube.com' || host === 'youtube-nocookie.com' || host === 'youtu.be') {\n let id = '';\n if (host === 'youtu.be') id = parsed.pathname.slice(1).split('/')[0];\n else if (parsed.pathname === '/watch') id = parsed.searchParams.get('v') ?? '';\n else {\n const match = /^\\/(embed|shorts)\\/([\\w-]+)/.exec(parsed.pathname);\n if (match) id = match[2];\n }\n if (/^[\\w-]{6,20}$/.test(id)) {\n return { src: `https://www.youtube-nocookie.com/embed/${id}`, provider: 'youtube' };\n }\n return null;\n }\n\n // Vimeo: vimeo.com/123456789, player.vimeo.com/video/123456789\n if (host === 'vimeo.com' || host === 'player.vimeo.com') {\n const match = /\\/(?:video\\/)?(\\d{6,12})(?:$|[/?])/.exec(parsed.pathname);\n if (match) {\n return { src: `https://player.vimeo.com/video/${match[1]}`, provider: 'vimeo' };\n }\n return null;\n }\n\n // Loom: loom.com/share/ID or loom.com/embed/ID\n if (host === 'loom.com') {\n const match = /^\\/(share|embed)\\/([0-9a-f]{16,40})/.exec(parsed.pathname);\n if (match) {\n return { src: `https://www.loom.com/embed/${match[2]}`, provider: 'loom' };\n }\n return null;\n }\n\n return null;\n}\n\n/** True when a URL is already a permitted embed src (sanitizer check). */\nexport function isAllowedEmbedSrc(src: string): boolean {\n let parsed: URL;\n try {\n parsed = new URL(src.trim());\n } catch {\n return false;\n }\n if (parsed.protocol !== 'https:') return false;\n const host = parsed.hostname.replace(/^www\\./, '');\n return (\n ((host === 'youtube.com' || host === 'youtube-nocookie.com') &&\n parsed.pathname.startsWith('/embed/')) ||\n (host === 'player.vimeo.com' && parsed.pathname.startsWith('/video/')) ||\n (host === 'loom.com' && parsed.pathname.startsWith('/embed/'))\n );\n}\n\n/**\n * Pasting a bare provider URL onto an empty selection inserts an embed\n * instead of plain text. (Pasting over selected text still creates a link.)\n */\nexport function embedPastePlugin(): Plugin {\n return new Plugin({\n props: {\n handlePaste(view, event) {\n const { state } = view;\n if (!state.selection.empty) return false;\n const text = event.clipboardData?.getData('text/plain')?.trim();\n if (!text || /\\s/.test(text)) return false;\n const target = toEmbedUrl(text);\n if (!target) return false;\n const embed = state.schema.nodes.embed.create({\n src: target.src,\n provider: target.provider,\n });\n view.dispatch(state.tr.replaceSelectionWith(embed).scrollIntoView());\n return true;\n },\n },\n });\n}\n"]}
@@ -0,0 +1,26 @@
1
+ import { Plugin, PluginKey, EditorState, Transaction } from 'prosemirror-state';
2
+ export declare const findReplaceKey: PluginKey<FindState>;
3
+ export interface FindMatch {
4
+ from: number;
5
+ to: number;
6
+ }
7
+ export interface FindState {
8
+ query: string;
9
+ caseSensitive: boolean;
10
+ matches: FindMatch[];
11
+ activeIndex: number;
12
+ }
13
+ /**
14
+ * Find & replace: match highlighting with an active match, controlled via
15
+ * transaction meta. Replacement itself is a normal text transaction issued
16
+ * by the host (see findReplaceCommands).
17
+ */
18
+ export declare function findReplacePlugin(): Plugin<FindState>;
19
+ export declare function getFindState(state: EditorState): FindState;
20
+ export declare function searchTr(state: EditorState, query: string, caseSensitive?: boolean): Transaction;
21
+ export declare function findStepTr(state: EditorState, direction: 'next' | 'prev'): Transaction;
22
+ export declare function clearFindTr(state: EditorState): Transaction;
23
+ /** Replaces the active match. Returns the transaction, or null when idle. */
24
+ export declare function replaceActiveTr(state: EditorState, replacement: string): Transaction | null;
25
+ /** Replaces every match in one transaction. Returns null when idle. */
26
+ export declare function replaceAllTr(state: EditorState, replacement: string): Transaction | null;
@@ -0,0 +1,123 @@
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
+ import { Decoration, DecorationSet } from 'prosemirror-view';
3
+ export const findReplaceKey = new PluginKey('nileFindReplace');
4
+ const EMPTY = { query: '', caseSensitive: false, matches: [], activeIndex: 0 };
5
+ function findMatches(doc, query, caseSensitive) {
6
+ if (!query)
7
+ return [];
8
+ const matches = [];
9
+ const needle = caseSensitive ? query : query.toLowerCase();
10
+ doc.descendants((node, pos) => {
11
+ if (!node.isTextblock)
12
+ return true;
13
+ const text = node.textBetween(0, node.content.size, '\0', '\0');
14
+ const haystack = caseSensitive ? text : text.toLowerCase();
15
+ let index = 0;
16
+ // eslint-disable-next-line no-cond-assign
17
+ while ((index = haystack.indexOf(needle, index)) !== -1) {
18
+ matches.push({ from: pos + 1 + index, to: pos + 1 + index + needle.length });
19
+ index += needle.length;
20
+ }
21
+ return false;
22
+ });
23
+ return matches;
24
+ }
25
+ function applyMeta(state, meta, doc) {
26
+ switch (meta.type) {
27
+ case 'search': {
28
+ const caseSensitive = meta.caseSensitive ?? state.caseSensitive;
29
+ return {
30
+ query: meta.query,
31
+ caseSensitive,
32
+ matches: findMatches(doc, meta.query, caseSensitive),
33
+ activeIndex: 0,
34
+ };
35
+ }
36
+ case 'next':
37
+ return state.matches.length
38
+ ? { ...state, activeIndex: (state.activeIndex + 1) % state.matches.length }
39
+ : state;
40
+ case 'prev':
41
+ return state.matches.length
42
+ ? {
43
+ ...state,
44
+ activeIndex: (state.activeIndex - 1 + state.matches.length) % state.matches.length,
45
+ }
46
+ : state;
47
+ case 'clear':
48
+ default:
49
+ return EMPTY;
50
+ }
51
+ }
52
+ /**
53
+ * Find & replace: match highlighting with an active match, controlled via
54
+ * transaction meta. Replacement itself is a normal text transaction issued
55
+ * by the host (see findReplaceCommands).
56
+ */
57
+ export function findReplacePlugin() {
58
+ return new Plugin({
59
+ key: findReplaceKey,
60
+ state: {
61
+ init: () => EMPTY,
62
+ apply(tr, prev) {
63
+ const meta = tr.getMeta(findReplaceKey);
64
+ if (meta)
65
+ return applyMeta(prev, meta, tr.doc);
66
+ if (tr.docChanged && prev.query) {
67
+ const matches = findMatches(tr.doc, prev.query, prev.caseSensitive);
68
+ return {
69
+ ...prev,
70
+ matches,
71
+ activeIndex: Math.min(prev.activeIndex, Math.max(0, matches.length - 1)),
72
+ };
73
+ }
74
+ return prev;
75
+ },
76
+ },
77
+ props: {
78
+ decorations(state) {
79
+ const find = findReplaceKey.getState(state);
80
+ if (!find || !find.matches.length)
81
+ return null;
82
+ return DecorationSet.create(state.doc, find.matches.map((match, index) => Decoration.inline(match.from, match.to, {
83
+ class: index === find.activeIndex
84
+ ? 'nile-wysiwyg__find-match nile-wysiwyg__find-active'
85
+ : 'nile-wysiwyg__find-match',
86
+ })));
87
+ },
88
+ },
89
+ });
90
+ }
91
+ export function getFindState(state) {
92
+ return findReplaceKey.getState(state) ?? EMPTY;
93
+ }
94
+ export function searchTr(state, query, caseSensitive) {
95
+ return state.tr.setMeta(findReplaceKey, { type: 'search', query, caseSensitive });
96
+ }
97
+ export function findStepTr(state, direction) {
98
+ return state.tr.setMeta(findReplaceKey, { type: direction });
99
+ }
100
+ export function clearFindTr(state) {
101
+ return state.tr.setMeta(findReplaceKey, { type: 'clear' });
102
+ }
103
+ /** Replaces the active match. Returns the transaction, or null when idle. */
104
+ export function replaceActiveTr(state, replacement) {
105
+ const find = getFindState(state);
106
+ const match = find.matches[find.activeIndex];
107
+ if (!match)
108
+ return null;
109
+ return state.tr.insertText(replacement, match.from, match.to);
110
+ }
111
+ /** Replaces every match in one transaction. Returns null when idle. */
112
+ export function replaceAllTr(state, replacement) {
113
+ const find = getFindState(state);
114
+ if (!find.matches.length)
115
+ return null;
116
+ const tr = state.tr;
117
+ // Back to front so earlier positions stay valid.
118
+ for (const match of [...find.matches].reverse()) {
119
+ tr.insertText(replacement, match.from, match.to);
120
+ }
121
+ return tr;
122
+ }
123
+ //# sourceMappingURL=find-replace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-replace.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/find-replace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAA4B,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAG7D,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,SAAS,CAAY,iBAAiB,CAAC,CAAC;AAc1E,MAAM,KAAK,GAAc,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;AAQ1F,SAAS,WAAW,CAAC,GAAW,EAAE,KAAa,EAAE,aAAsB;IACrE,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,MAAM,OAAO,GAAgB,EAAE,CAAC;IAChC,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IAC3D,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QAC3D,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,0CAA0C;QAC1C,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,C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AC;AAED,uEAAuE;AACvE,MAAM,UAAU,YAAY,CAAC,KAAkB,EAAE,WAAmB;IAClE,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACpB,iDAAiD;IACjD,KAAK,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QAChD,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import { Plugin, PluginKey, EditorState, Transaction } from 'prosemirror-state';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\nimport { Node as PMNode } from 'prosemirror-model';\n\nexport const findReplaceKey = new PluginKey<FindState>('nileFindReplace');\n\nexport interface FindMatch {\n from: number;\n to: number;\n}\n\nexport interface FindState {\n query: string;\n caseSensitive: boolean;\n matches: FindMatch[];\n activeIndex: number;\n}\n\nconst EMPTY: FindState = { query: '', caseSensitive: false, matches: [], activeIndex: 0 };\n\ntype FindMeta =\n | { type: 'search'; query: string; caseSensitive?: boolean }\n | { type: 'next' }\n | { type: 'prev' }\n | { type: 'clear' };\n\nfunction findMatches(doc: PMNode, query: string, caseSensitive: boolean): FindMatch[] {\n if (!query) return [];\n const matches: FindMatch[] = [];\n const needle = caseSensitive ? query : query.toLowerCase();\n doc.descendants((node, pos) => {\n if (!node.isTextblock) return true;\n const text = node.textBetween(0, node.content.size, '\\0', '\\0');\n const haystack = caseSensitive ? text : text.toLowerCase();\n let index = 0;\n // eslint-disable-next-line no-cond-assign\n while ((index = haystack.indexOf(needle, index)) !== -1) {\n matches.push({ from: pos + 1 + index, to: pos + 1 + index + needle.length });\n index += needle.length;\n }\n return false;\n });\n return matches;\n}\n\nfunction applyMeta(state: FindState, meta: FindMeta, doc: PMNode): FindState {\n switch (meta.type) {\n case 'search': {\n const caseSensitive = meta.caseSensitive ?? state.caseSensitive;\n return {\n query: meta.query,\n caseSensitive,\n matches: findMatches(doc, meta.query, caseSensitive),\n activeIndex: 0,\n };\n }\n case 'next':\n return state.matches.length\n ? { ...state, activeIndex: (state.activeIndex + 1) % state.matches.length }\n : state;\n case 'prev':\n return state.matches.length\n ? {\n ...state,\n activeIndex:\n (state.activeIndex - 1 + state.matches.length) % state.matches.length,\n }\n : state;\n case 'clear':\n default:\n return EMPTY;\n }\n}\n\n/**\n * Find & replace: match highlighting with an active match, controlled via\n * transaction meta. Replacement itself is a normal text transaction issued\n * by the host (see findReplaceCommands).\n */\nexport function findReplacePlugin(): Plugin<FindState> {\n return new Plugin<FindState>({\n key: findReplaceKey,\n\n state: {\n init: () => EMPTY,\n apply(tr, prev) {\n const meta = tr.getMeta(findReplaceKey) as FindMeta | undefined;\n if (meta) return applyMeta(prev, meta, tr.doc);\n if (tr.docChanged && prev.query) {\n const matches = findMatches(tr.doc, prev.query, prev.caseSensitive);\n return {\n ...prev,\n matches,\n activeIndex: Math.min(prev.activeIndex, Math.max(0, matches.length - 1)),\n };\n }\n return prev;\n },\n },\n\n props: {\n decorations(state) {\n const find = findReplaceKey.getState(state);\n if (!find || !find.matches.length) return null;\n return DecorationSet.create(\n state.doc,\n find.matches.map((match, index) =>\n Decoration.inline(match.from, match.to, {\n class:\n index === find.activeIndex\n ? 'nile-wysiwyg__find-match nile-wysiwyg__find-active'\n : 'nile-wysiwyg__find-match',\n })\n )\n );\n },\n },\n });\n}\n\nexport function getFindState(state: EditorState): FindState {\n return findReplaceKey.getState(state) ?? EMPTY;\n}\n\nexport function searchTr(state: EditorState, query: string, caseSensitive?: boolean): Transaction {\n return state.tr.setMeta(findReplaceKey, { type: 'search', query, caseSensitive });\n}\n\nexport function findStepTr(state: EditorState, direction: 'next' | 'prev'): Transaction {\n return state.tr.setMeta(findReplaceKey, { type: direction });\n}\n\nexport function clearFindTr(state: EditorState): Transaction {\n return state.tr.setMeta(findReplaceKey, { type: 'clear' });\n}\n\n/** Replaces the active match. Returns the transaction, or null when idle. */\nexport function replaceActiveTr(state: EditorState, replacement: string): Transaction | null {\n const find = getFindState(state);\n const match = find.matches[find.activeIndex];\n if (!match) return null;\n return state.tr.insertText(replacement, match.from, match.to);\n}\n\n/** Replaces every match in one transaction. Returns null when idle. */\nexport function replaceAllTr(state: EditorState, replacement: string): Transaction | null {\n const find = getFindState(state);\n if (!find.matches.length) return null;\n const tr = state.tr;\n // Back to front so earlier positions stay valid.\n for (const match of [...find.matches].reverse()) {\n tr.insertText(replacement, match.from, match.to);\n }\n return tr;\n}\n"]}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Format painter: copy the inline formatting (marks) at the current selection,
3
+ * then apply it to the next selection the user makes — like the paint-roller
4
+ * tool in word processors. The plugin only holds the copied marks and an
5
+ * "armed" flag; the host drives arm/apply through the exported helpers.
6
+ */
7
+ import { EditorState, Plugin, PluginKey, Transaction } from 'prosemirror-state';
8
+ import { Mark } from 'prosemirror-model';
9
+ interface FormatPainterState {
10
+ marks: readonly Mark[] | null;
11
+ }
12
+ export declare const formatPainterKey: PluginKey<FormatPainterState>;
13
+ export declare function formatPainterPlugin(): Plugin<FormatPainterState>;
14
+ /** True while the painter is armed (marks captured, waiting to apply). */
15
+ export declare function isFormatPainterArmed(state: EditorState): boolean;
16
+ /**
17
+ * Arms the painter, capturing the current formatting. Returns a transaction to
18
+ * dispatch, or null when there is nothing to copy.
19
+ */
20
+ export declare function armFormatPainter(state: EditorState): Transaction | null;
21
+ /** Disarms the painter without applying. */
22
+ export declare function disarmFormatPainter(state: EditorState): Transaction;
23
+ /**
24
+ * Applies the copied formatting to the current (non-empty) selection and
25
+ * disarms. Returns null when not armed or the selection is empty.
26
+ */
27
+ export declare function applyFormatPainter(state: EditorState): Transaction | null;
28
+ export {};
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Format painter: copy the inline formatting (marks) at the current selection,
3
+ * then apply it to the next selection the user makes — like the paint-roller
4
+ * tool in word processors. The plugin only holds the copied marks and an
5
+ * "armed" flag; the host drives arm/apply through the exported helpers.
6
+ */
7
+ import { Plugin, PluginKey } from 'prosemirror-state';
8
+ export const formatPainterKey = new PluginKey('nileFormatPainter');
9
+ export function formatPainterPlugin() {
10
+ return new Plugin({
11
+ key: formatPainterKey,
12
+ state: {
13
+ init: () => ({ marks: null }),
14
+ apply(tr, value) {
15
+ const meta = tr.getMeta(formatPainterKey);
16
+ if (meta?.type === 'arm')
17
+ return { marks: meta.marks };
18
+ if (meta?.type === 'disarm')
19
+ return { marks: null };
20
+ return value;
21
+ },
22
+ },
23
+ props: {
24
+ attributes: state => (formatPainterKey.getState(state)?.marks
25
+ ? { class: 'nile-wysiwyg--painting' }
26
+ : {}),
27
+ },
28
+ });
29
+ }
30
+ /** True while the painter is armed (marks captured, waiting to apply). */
31
+ export function isFormatPainterArmed(state) {
32
+ return !!formatPainterKey.getState(state)?.marks;
33
+ }
34
+ /** The inline marks to copy from the current selection/caret. */
35
+ function capturedMarks(state) {
36
+ const { $from, empty } = state.selection;
37
+ if (empty)
38
+ return state.storedMarks ?? $from.marks();
39
+ // Marks that hold across the selection start — the visible formatting.
40
+ return $from.marksAcross(state.selection.$to) ?? $from.marks();
41
+ }
42
+ /**
43
+ * Arms the painter, capturing the current formatting. Returns a transaction to
44
+ * dispatch, or null when there is nothing to copy.
45
+ */
46
+ export function armFormatPainter(state) {
47
+ const marks = capturedMarks(state);
48
+ return state.tr.setMeta(formatPainterKey, { type: 'arm', marks });
49
+ }
50
+ /** Disarms the painter without applying. */
51
+ export function disarmFormatPainter(state) {
52
+ return state.tr.setMeta(formatPainterKey, { type: 'disarm' });
53
+ }
54
+ /**
55
+ * Applies the copied formatting to the current (non-empty) selection and
56
+ * disarms. Returns null when not armed or the selection is empty.
57
+ */
58
+ export function applyFormatPainter(state) {
59
+ const painter = formatPainterKey.getState(state);
60
+ if (!painter?.marks)
61
+ return null;
62
+ const { from, to, empty } = state.selection;
63
+ if (empty)
64
+ return null;
65
+ const tr = state.tr;
66
+ tr.removeMark(from, to, null);
67
+ for (const mark of painter.marks)
68
+ tr.addMark(from, to, mark);
69
+ tr.setMeta(formatPainterKey, { type: 'disarm' });
70
+ return tr;
71
+ }
72
+ //# sourceMappingURL=format-painter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-painter.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/format-painter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAe,MAAM,EAAE,SAAS,EAAe,MAAM,mBAAmB,CAAC;AAOhF,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,SAAS,CAAqB,mBAAmB,CAAC,CAAC;AAIvF,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,MAAM,CAAqB;QACpC,GAAG,EAAE,gBAAgB;QACrB,KAAK,EAAE;YACL,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YAC7B,KAAK,CAAC,EAAE,EAAE,KAAK;gBACb,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAA4B,CAAC;gBACrE,IAAI,IAAI,EAAE,IAAI,KAAK,KAAK;oBAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;gBACvD,IAAI,IAAI,EAAE,IAAI,KAAK,QAAQ;oBAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;gBACpD,OAAO,KAAK,CAAC;YACf,CAAC;SACF;QACD,KAAK,EAAE;YACL,UAAU,EAAE,KAAK,CAAC,EAAE,CAClB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK;gBACtC,CAAC,CAAC,EAAE,KAAK,EAAE,wB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CAAC;IAC5C,IAAI,KAAK;QAAE,OAAO,IAAI,CAAC;IACvB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACpB,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK;QAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC7D,EAAE,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC,CAAC;IAChE,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["/**\n * Format painter: copy the inline formatting (marks) at the current selection,\n * then apply it to the next selection the user makes — like the paint-roller\n * tool in word processors. The plugin only holds the copied marks and an\n * \"armed\" flag; the host drives arm/apply through the exported helpers.\n */\nimport { EditorState, Plugin, PluginKey, Transaction } from 'prosemirror-state';\nimport { Mark } from 'prosemirror-model';\n\ninterface FormatPainterState {\n marks: readonly Mark[] | null;\n}\n\nexport const formatPainterKey = new PluginKey<FormatPainterState>('nileFormatPainter');\n\ntype PainterMeta = { type: 'arm'; marks: readonly Mark[] } | { type: 'disarm' };\n\nexport function formatPainterPlugin(): Plugin<FormatPainterState> {\n return new Plugin<FormatPainterState>({\n key: formatPainterKey,\n state: {\n init: () => ({ marks: null }),\n apply(tr, value) {\n const meta = tr.getMeta(formatPainterKey) as PainterMeta | undefined;\n if (meta?.type === 'arm') return { marks: meta.marks };\n if (meta?.type === 'disarm') return { marks: null };\n return value;\n },\n },\n props: {\n attributes: state =>\n (formatPainterKey.getState(state)?.marks\n ? { class: 'nile-wysiwyg--painting' }\n : {}) as Record<string, string>,\n },\n });\n}\n\n/** True while the painter is armed (marks captured, waiting to apply). */\nexport function isFormatPainterArmed(state: EditorState): boolean {\n return !!formatPainterKey.getState(state)?.marks;\n}\n\n/** The inline marks to copy from the current selection/caret. */\nfunction capturedMarks(state: EditorState): readonly Mark[] {\n const { $from, empty } = state.selection;\n if (empty) return state.storedMarks ?? $from.marks();\n // Marks that hold across the selection start — the visible formatting.\n return $from.marksAcross(state.selection.$to) ?? $from.marks();\n}\n\n/**\n * Arms the painter, capturing the current formatting. Returns a transaction to\n * dispatch, or null when there is nothing to copy.\n */\nexport function armFormatPainter(state: EditorState): Transaction | null {\n const marks = capturedMarks(state);\n return state.tr.setMeta(formatPainterKey, { type: 'arm', marks } as PainterMeta);\n}\n\n/** Disarms the painter without applying. */\nexport function disarmFormatPainter(state: EditorState): Transaction {\n return state.tr.setMeta(formatPainterKey, { type: 'disarm' } as PainterMeta);\n}\n\n/**\n * Applies the copied formatting to the current (non-empty) selection and\n * disarms. Returns null when not armed or the selection is empty.\n */\nexport function applyFormatPainter(state: EditorState): Transaction | null {\n const painter = formatPainterKey.getState(state);\n if (!painter?.marks) return null;\n const { from, to, empty } = state.selection;\n if (empty) return null;\n const tr = state.tr;\n tr.removeMark(from, to, null);\n for (const mark of painter.marks) tr.addMark(from, to, mark);\n tr.setMeta(formatPainterKey, { type: 'disarm' } as PainterMeta);\n return tr;\n}\n"]}
@@ -0,0 +1,41 @@
1
+ import { Node as PMNode } from 'prosemirror-model';
2
+ import { EditorView, NodeView } from 'prosemirror-view';
3
+ /**
4
+ * Attaches four corner drag-handles to a wrapper and returns a cleanup
5
+ * function. Dragging previews by mutating the target's style; on release the
6
+ * final width is committed through onCommit (one transaction).
7
+ */
8
+ export declare function attachResizeHandles(wrapper: HTMLElement, img: HTMLElement, onCommit: (width: number) => void, minWidth?: number): void;
9
+ export declare function isResizeEvent(event: Event): boolean;
10
+ /** Inline image with drag-resize handles shown while selected. */
11
+ export declare class ImageView implements NodeView {
12
+ private node;
13
+ dom: HTMLSpanElement;
14
+ private img;
15
+ constructor(node: PMNode, view: EditorView, getPos: () => number | undefined);
16
+ private applyAttrs;
17
+ update(node: PMNode): boolean;
18
+ selectNode(): void;
19
+ deselectNode(): void;
20
+ stopEvent(event: Event): boolean;
21
+ ignoreMutation(): boolean;
22
+ }
23
+ /**
24
+ * Captioned figure: non-editable image (with resize handles) above an
25
+ * editable figcaption (the node's content). Clicking the image selects the
26
+ * whole figure.
27
+ */
28
+ export declare class FigureView implements NodeView {
29
+ private node;
30
+ dom: HTMLElement;
31
+ contentDOM: HTMLElement;
32
+ private img;
33
+ private wrapper;
34
+ constructor(node: PMNode, view: EditorView, getPos: () => number | undefined);
35
+ private applyAttrs;
36
+ update(node: PMNode): boolean;
37
+ selectNode(): void;
38
+ deselectNode(): void;
39
+ stopEvent(event: Event): boolean;
40
+ ignoreMutation(mutation: MutationRecord): boolean;
41
+ }
@@ -0,0 +1,176 @@
1
+ import { NodeSelection } from 'prosemirror-state';
2
+ const MIN_WIDTH = 40;
3
+ /**
4
+ * Attaches four corner drag-handles to a wrapper and returns a cleanup
5
+ * function. Dragging previews by mutating the target's style; on release the
6
+ * final width is committed through onCommit (one transaction).
7
+ */
8
+ export function attachResizeHandles(wrapper, img, onCommit, minWidth = MIN_WIDTH) {
9
+ for (const corner of ['nw', 'ne', 'sw', 'se']) {
10
+ const handle = document.createElement('span');
11
+ handle.className = `nile-wysiwyg__resize-handle nile-wysiwyg__resize-handle--${corner}`;
12
+ handle.dataset.resizeHandle = corner;
13
+ handle.contentEditable = 'false';
14
+ handle.addEventListener('mousedown', event => {
15
+ event.preventDefault();
16
+ event.stopPropagation();
17
+ const startX = event.clientX;
18
+ const startWidth = img.getBoundingClientRect().width;
19
+ const sign = corner.includes('w') ? -1 : 1;
20
+ const maxWidth = wrapper.closest('.ProseMirror')?.getBoundingClientRect().width ?? 2000;
21
+ let width = startWidth;
22
+ const onMove = (move) => {
23
+ width = Math.max(minWidth, Math.min(maxWidth, startWidth + sign * (move.clientX - startX)));
24
+ img.style.width = `${Math.round(width)}px`;
25
+ };
26
+ const onUp = () => {
27
+ window.removeEventListener('mousemove', onMove);
28
+ window.removeEventListener('mouseup', onUp);
29
+ wrapper.classList.remove('nile-wysiwyg__resizing');
30
+ onCommit(Math.round(width));
31
+ };
32
+ // While dragging, iframes inside the wrapper must not swallow mouse
33
+ // events (they are separate documents); CSS keys off this class.
34
+ wrapper.classList.add('nile-wysiwyg__resizing');
35
+ window.addEventListener('mousemove', onMove);
36
+ window.addEventListener('mouseup', onUp);
37
+ });
38
+ wrapper.appendChild(handle);
39
+ }
40
+ }
41
+ export function isResizeEvent(event) {
42
+ return (event.target instanceof HTMLElement && !!event.target.dataset.resizeHandle);
43
+ }
44
+ /** Inline image with drag-resize handles shown while selected. */
45
+ export class ImageView {
46
+ constructor(node, view, getPos) {
47
+ this.node = node;
48
+ this.dom = document.createElement('span');
49
+ this.dom.className = 'nile-wysiwyg__image-resizer';
50
+ this.img = document.createElement('img');
51
+ this.applyAttrs(node);
52
+ this.dom.appendChild(this.img);
53
+ attachResizeHandles(this.dom, this.img, width => {
54
+ const pos = getPos();
55
+ if (pos === undefined || !view.editable)
56
+ return;
57
+ const current = view.state.doc.nodeAt(pos);
58
+ if (!current)
59
+ return;
60
+ view.dispatch(view.state.tr.setNodeMarkup(pos, undefined, { ...current.attrs, width }));
61
+ });
62
+ }
63
+ applyAttrs(node) {
64
+ const { src, alt, title, width } = node.attrs;
65
+ this.img.src = src;
66
+ if (alt)
67
+ this.img.alt = alt;
68
+ else
69
+ this.img.removeAttribute('alt');
70
+ if (title)
71
+ this.img.title = title;
72
+ else
73
+ this.img.removeAttribute('title');
74
+ this.img.style.width = width ? `${width}px` : '';
75
+ }
76
+ update(node) {
77
+ if (node.type !== this.node.type)
78
+ return false;
79
+ this.node = node;
80
+ this.applyAttrs(node);
81
+ return true;
82
+ }
83
+ selectNode() {
84
+ this.dom.classList.add('nile-wysiwyg__image-resizer--selected');
85
+ }
86
+ deselectNode() {
87
+ this.dom.classList.remove('nile-wysiwyg__image-resizer--selected');
88
+ }
89
+ stopEvent(event) {
90
+ return isResizeEvent(event);
91
+ }
92
+ ignoreMutation() {
93
+ return true;
94
+ }
95
+ }
96
+ /**
97
+ * Captioned figure: non-editable image (with resize handles) above an
98
+ * editable figcaption (the node's content). Clicking the image selects the
99
+ * whole figure.
100
+ */
101
+ export class FigureView {
102
+ constructor(node, view, getPos) {
103
+ this.node = node;
104
+ this.dom = document.createElement('figure');
105
+ this.dom.className = 'nile-wysiwyg__figure';
106
+ this.wrapper = document.createElement('span');
107
+ this.wrapper.className = 'nile-wysiwyg__image-resizer';
108
+ this.wrapper.contentEditable = 'false';
109
+ this.img = document.createElement('img');
110
+ this.wrapper.appendChild(this.img);
111
+ this.contentDOM = document.createElement('figcaption');
112
+ this.contentDOM.className = 'nile-wysiwyg__figcaption';
113
+ this.dom.append(this.wrapper, this.contentDOM);
114
+ this.applyAttrs(node);
115
+ // Clicking the image selects the figure node (instead of dropping the
116
+ // cursor into the caption).
117
+ this.img.addEventListener('mousedown', event => {
118
+ event.preventDefault();
119
+ const pos = getPos();
120
+ if (pos === undefined)
121
+ return;
122
+ view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos)));
123
+ view.focus();
124
+ });
125
+ attachResizeHandles(this.wrapper, this.img, width => {
126
+ const pos = getPos();
127
+ if (pos === undefined || !view.editable)
128
+ return;
129
+ const current = view.state.doc.nodeAt(pos);
130
+ if (!current)
131
+ return;
132
+ view.dispatch(view.state.tr.setNodeMarkup(pos, undefined, { ...current.attrs, width }));
133
+ });
134
+ }
135
+ applyAttrs(node) {
136
+ const { src, alt, title, width, align } = node.attrs;
137
+ this.img.src = src;
138
+ if (alt)
139
+ this.img.alt = alt;
140
+ else
141
+ this.img.removeAttribute('alt');
142
+ if (title)
143
+ this.img.title = title;
144
+ else
145
+ this.img.removeAttribute('title');
146
+ this.dom.style.width = width ? `${width}px` : '';
147
+ if (align)
148
+ this.dom.setAttribute('data-align', align);
149
+ else
150
+ this.dom.removeAttribute('data-align');
151
+ this.dom.classList.toggle('nile-wysiwyg__figure--empty-caption', node.content.size === 0);
152
+ }
153
+ update(node) {
154
+ if (node.type !== this.node.type)
155
+ return false;
156
+ this.node = node;
157
+ this.applyAttrs(node);
158
+ return true;
159
+ }
160
+ selectNode() {
161
+ this.dom.classList.add('nile-wysiwyg__figure--selected');
162
+ this.wrapper.classList.add('nile-wysiwyg__image-resizer--selected');
163
+ }
164
+ deselectNode() {
165
+ this.dom.classList.remove('nile-wysiwyg__figure--selected');
166
+ this.wrapper.classList.remove('nile-wysiwyg__image-resizer--selected');
167
+ }
168
+ stopEvent(event) {
169
+ return isResizeEvent(event);
170
+ }
171
+ ignoreMutation(mutation) {
172
+ // Caption edits must flow through; image/handle mutations must not.
173
+ return !this.contentDOM.contains(mutation.target);
174
+ }
175
+ }
176
+ //# sourceMappingURL=image-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-view.js","sourceRoot":"","sources":["../../../../../src/nile-wysiwyg-editor/engine/plugins/image-view.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAoB,EACpB,GAAgB,EAChB,QAAiC,EACjC,WAAmB,SAAS;IAE5B,KAAK,MAAM,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,CAAC,SAAS,GAAG,4DAA4D,MAAM,EAAE,CAAC;QACxF,MAAM,CAAC,OAAO,CAAC,YAAY,GAAG,MAAM,CAAC;QACrC,MAAM,CAAC,eAAe,GAAG,OAAO,CAAC;QACjC,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE;YAC3C,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,eAAe,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC;YAC7B,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AAY,CAAC,CAAC;QAC5C,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CACvB,qCAAqC,EACrC,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,CACxB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU;QACR,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACtE,CAAC;IAED,YAAY;QACV,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,gCAAgC,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,uCAAuC,CAAC,CAAC;IACzE,CAAC;IAED,SAAS,CAAC,KAAY;QACpB,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,cAAc,CAAC,QAAwB;QACrC,oEAAoE;QACpE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;CACF","sourcesContent":["import { Node as PMNode } from 'prosemirror-model';\nimport { EditorView, NodeView } from 'prosemirror-view';\nimport { NodeSelection } from 'prosemirror-state';\n\nconst MIN_WIDTH = 40;\n\n/**\n * Attaches four corner drag-handles to a wrapper and returns a cleanup\n * function. Dragging previews by mutating the target's style; on release the\n * final width is committed through onCommit (one transaction).\n */\nexport function attachResizeHandles(\n wrapper: HTMLElement,\n img: HTMLElement,\n onCommit: (width: number) => void,\n minWidth: number = MIN_WIDTH\n): void {\n for (const corner of ['nw', 'ne', 'sw', 'se']) {\n const handle = document.createElement('span');\n handle.className = `nile-wysiwyg__resize-handle nile-wysiwyg__resize-handle--${corner}`;\n handle.dataset.resizeHandle = corner;\n handle.contentEditable = 'false';\n handle.addEventListener('mousedown', event => {\n event.preventDefault();\n event.stopPropagation();\n const startX = event.clientX;\n const startWidth = img.getBoundingClientRect().width;\n const sign = corner.includes('w') ? -1 : 1;\n const maxWidth =\n wrapper.closest('.ProseMirror')?.getBoundingClientRect().width ?? 2000;\n let width = startWidth;\n const onMove = (move: MouseEvent): void => {\n width = Math.max(\n minWidth,\n Math.min(maxWidth, startWidth + sign * (move.clientX - startX))\n );\n img.style.width = `${Math.round(width)}px`;\n };\n const onUp = (): void => {\n window.removeEventListener('mousemove', onMove);\n window.removeEventListener('mouseup', onUp);\n wrapper.classList.remove('nile-wysiwyg__resizing');\n onCommit(Math.round(width));\n };\n // While dragging, iframes inside the wrapper must not swallow mouse\n // events (they are separate documents); CSS keys off this class.\n wrapper.classList.add('nile-wysiwyg__resizing');\n window.addEventListener('mousemove', onMove);\n window.addEventListener('mouseup', onUp);\n });\n wrapper.appendChild(handle);\n }\n}\n\nexport function isResizeEvent(event: Event): boolean {\n return (\n event.target instanceof HTMLElement && !!event.target.dataset.resizeHandle\n );\n}\n\n/** Inline image with drag-resize handles shown while selected. */\nexport class ImageView implements NodeView {\n dom: HTMLSpanElement;\n\n private img: HTMLImageElement;\n\n constructor(\n private node: PMNode,\n view: EditorView,\n getPos: () => number | undefined\n ) {\n this.dom = document.createElement('span');\n this.dom.className = 'nile-wysiwyg__image-resizer';\n this.img = document.createElement('img');\n this.applyAttrs(node);\n this.dom.appendChild(this.img);\n attachResizeHandles(this.dom, this.img, width => {\n const pos = getPos();\n if (pos === undefined || !view.editable) return;\n const current = view.state.doc.nodeAt(pos);\n if (!current) return;\n view.dispatch(\n view.state.tr.setNodeMarkup(pos, undefined, { ...current.attrs, width })\n );\n });\n }\n\n private applyAttrs(node: PMNode): void {\n const { src, alt, title, width } = node.attrs;\n this.img.src = src;\n if (alt) this.img.alt = alt;\n else this.img.removeAttribute('alt');\n if (title) this.img.title = title;\n else this.img.removeAttribute('title');\n this.img.style.width = width ? `${width}px` : '';\n }\n\n update(node: PMNode): boolean {\n if (node.type !== this.node.type) return false;\n this.node = node;\n this.applyAttrs(node);\n return true;\n }\n\n selectNode(): void {\n this.dom.classList.add('nile-wysiwyg__image-resizer--selected');\n }\n\n deselectNode(): void {\n this.dom.classList.remove('nile-wysiwyg__image-resizer--selected');\n }\n\n stopEvent(event: Event): boolean {\n return isResizeEvent(event);\n }\n\n ignoreMutation(): boolean {\n return true;\n }\n}\n\n/**\n * Captioned figure: non-editable image (with resize handles) above an\n * editable figcaption (the node's content). Clicking the image selects the\n * whole figure.\n */\nexport class FigureView implements NodeView {\n dom: HTMLElement;\n\n contentDOM: HTMLElement;\n\n private img: HTMLImageElement;\n\n private wrapper: HTMLSpanElement;\n\n constructor(\n private node: PMNode,\n view: EditorView,\n getPos: () => number | undefined\n ) {\n this.dom = document.createElement('figure');\n this.dom.className = 'nile-wysiwyg__figure';\n\n this.wrapper = document.createElement('span');\n this.wrapper.className = 'nile-wysiwyg__image-resizer';\n this.wrapper.contentEditable = 'false';\n this.img = document.createElement('img');\n this.wrapper.appendChild(this.img);\n\n this.contentDOM = document.createElement('figcaption');\n this.contentDOM.className = 'nile-wysiwyg__figcaption';\n\n this.dom.append(this.wrapper, this.contentDOM);\n this.applyAttrs(node);\n\n // Clicking the image selects the figure node (instead of dropping the\n // cursor into the caption).\n this.img.addEventListener('mousedown', event => {\n event.preventDefault();\n const pos = getPos();\n if (pos === undefined) return;\n view.dispatch(\n view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos))\n );\n view.focus();\n });\n\n attachResizeHandles(this.wrapper, this.img, width => {\n const pos = getPos();\n if (pos === undefined || !view.editable) return;\n const current = view.state.doc.nodeAt(pos);\n if (!current) return;\n view.dispatch(\n view.state.tr.setNodeMarkup(pos, undefined, { ...current.attrs, width })\n );\n });\n }\n\n private applyAttrs(node: PMNode): void {\n const { src, alt, title, width, align } = node.attrs;\n this.img.src = src;\n if (alt) this.img.alt = alt;\n else this.img.removeAttribute('alt');\n if (title) this.img.title = title;\n else this.img.removeAttribute('title');\n this.dom.style.width = width ? `${width}px` : '';\n if (align) this.dom.setAttribute('data-align', align);\n else this.dom.removeAttribute('data-align');\n this.dom.classList.toggle(\n 'nile-wysiwyg__figure--empty-caption',\n node.content.size === 0\n );\n }\n\n update(node: PMNode): boolean {\n if (node.type !== this.node.type) return false;\n this.node = node;\n this.applyAttrs(node);\n return true;\n }\n\n selectNode(): void {\n this.dom.classList.add('nile-wysiwyg__figure--selected');\n this.wrapper.classList.add('nile-wysiwyg__image-resizer--selected');\n }\n\n deselectNode(): void {\n this.dom.classList.remove('nile-wysiwyg__figure--selected');\n this.wrapper.classList.remove('nile-wysiwyg__image-resizer--selected');\n }\n\n stopEvent(event: Event): boolean {\n return isResizeEvent(event);\n }\n\n ignoreMutation(mutation: MutationRecord): boolean {\n // Caption edits must flow through; image/handle mutations must not.\n return !this.contentDOM.contains(mutation.target);\n }\n}\n"]}