@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,1088 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { TextSelection, NodeSelection, AllSelection } from 'prosemirror-state';
3
+ import {
4
+ defaultSchema,
5
+ htmlToDoc,
6
+ htmlToSlice,
7
+ docToHtml,
8
+ isOfficeHtml,
9
+ cleanOfficeHtml,
10
+ docToMarkdown,
11
+ sanitizeHtml,
12
+ createEditorState,
13
+ getCommand,
14
+ computeToolbarState,
15
+ isDocEmpty,
16
+ countWords,
17
+ getFindState,
18
+ searchTr,
19
+ findStepTr,
20
+ replaceActiveTr,
21
+ replaceAllTr,
22
+ plainTextSlice,
23
+ stripSliceFormatting,
24
+ } from './index';
25
+ import type { SuggestionMatch } from './plugins/suggestions';
26
+ import { toEmbedUrl, isAllowedEmbedSrc } from './plugins/embeds';
27
+ import { codeHighlightKey } from './plugins/code-highlight';
28
+
29
+ /** Builds an editor state with the whole document selected. */
30
+ function stateWithAllSelected(html: string) {
31
+ const doc = htmlToDoc(defaultSchema, html);
32
+ const state = createEditorState({ doc });
33
+ const selection = TextSelection.create(state.doc, 1, state.doc.content.size - 1);
34
+ return state.apply(state.tr.setSelection(selection));
35
+ }
36
+
37
+ describe('sanitizeHtml', () => {
38
+ it('removes script elements entirely', () => {
39
+ expect(sanitizeHtml('<p>hi</p><script>alert(1)</script>')).to.equal('<p>hi</p>');
40
+ });
41
+
42
+ it('removes inline event handlers', () => {
43
+ const out = sanitizeHtml('<p onclick="alert(1)" onmouseover="x()">hi</p>');
44
+ expect(out).to.not.include('onclick').and.to.not.include('onmouseover');
45
+ });
46
+
47
+ it('drops javascript: URLs', () => {
48
+ const out = sanitizeHtml('<a href="javascript:alert(1)">x</a>');
49
+ expect(out).to.not.include('javascript:');
50
+ });
51
+
52
+ it('keeps safe links and forces noopener on _blank', () => {
53
+ const out = sanitizeHtml('<a href="https://example.com" target="_blank">x</a>');
54
+ expect(out).to.include('https://example.com');
55
+ expect(out).to.include('noopener');
56
+ });
57
+
58
+ it('filters style declarations to the allowed set', () => {
59
+ const out = sanitizeHtml(
60
+ '<span style="color: red; position: fixed; background-image: url(x)">x</span>'
61
+ );
62
+ expect(out).to.include('color: red');
63
+ expect(out).to.not.include('position');
64
+ expect(out).to.not.include('url(');
65
+ });
66
+
67
+ it('unwraps unknown elements but keeps their content', () => {
68
+ expect(sanitizeHtml('<article><p>kept</p></article>')).to.equal('<p>kept</p>');
69
+ });
70
+
71
+ it('drops iframes, styles and forms with content', () => {
72
+ const out = sanitizeHtml(
73
+ '<iframe src="x"></iframe><style>p{}</style><form><input></form><p>ok</p>'
74
+ );
75
+ expect(out).to.equal('<p>ok</p>');
76
+ });
77
+ });
78
+
79
+ describe('serializer round-trip', () => {
80
+ const cases = [
81
+ '<p>plain text</p>',
82
+ '<h2>heading</h2><p>body</p>',
83
+ '<p><strong>bold</strong> and <em>italic</em> and <u>underlined</u></p>',
84
+ '<ul><li><p>one</p></li><li><p>two</p></li></ul>',
85
+ '<ol><li><p>first</p></li></ol>',
86
+ '<blockquote><p>quoted</p></blockquote>',
87
+ '<p><a href="https://example.com">link</a></p>',
88
+ '<p style="text-align: center">centered</p>',
89
+ '<p><span style="color: rgb(255, 0, 0)">red</span></p>',
90
+ '<p>line<br>break</p>',
91
+ '<hr>',
92
+ ];
93
+
94
+ for (const html of cases) {
95
+ it(`round-trips ${html.slice(0, 40)}`, () => {
96
+ const doc = htmlToDoc(defaultSchema, html);
97
+ const out = docToHtml(doc);
98
+ const reparsed = htmlToDoc(defaultSchema, out);
99
+ expect(reparsed.eq(doc), `stable parse for ${html}`).to.equal(true);
100
+ });
101
+ }
102
+
103
+ it('parses Word-style font-weight styles as bold', () => {
104
+ const doc = htmlToDoc(defaultSchema, '<p><span style="font-weight: 700">x</span></p>');
105
+ expect(docToHtml(doc)).to.include('<strong>');
106
+ });
107
+
108
+ it('detects empty documents', () => {
109
+ expect(isDocEmpty(htmlToDoc(defaultSchema, ''))).to.equal(true);
110
+ expect(isDocEmpty(htmlToDoc(defaultSchema, '<p></p>'))).to.equal(true);
111
+ expect(isDocEmpty(htmlToDoc(defaultSchema, '<p>x</p>'))).to.equal(false);
112
+ });
113
+ });
114
+
115
+ describe('commands', () => {
116
+ it('toggles bold over a selection', () => {
117
+ let state = stateWithAllSelected('<p>hello</p>');
118
+ const bold = getCommand(state, 'bold')!;
119
+ bold(state, tr => {
120
+ state = state.apply(tr);
121
+ });
122
+ expect(docToHtml(state.doc)).to.equal('<p><strong>hello</strong></p>');
123
+ });
124
+
125
+ it('sets and clears headings', () => {
126
+ let state = stateWithAllSelected('<p>title</p>');
127
+ getCommand(state, 'heading', { level: 2 })!(state, tr => {
128
+ state = state.apply(tr);
129
+ });
130
+ expect(docToHtml(state.doc)).to.equal('<h2>title</h2>');
131
+ getCommand(state, 'paragraph')!(state, tr => {
132
+ state = state.apply(tr);
133
+ });
134
+ expect(docToHtml(state.doc)).to.equal('<p>title</p>');
135
+ });
136
+
137
+ it('wraps and lifts bullet lists', () => {
138
+ let state = stateWithAllSelected('<p>item</p>');
139
+ getCommand(state, 'bulletList')!(state, tr => {
140
+ state = state.apply(tr);
141
+ });
142
+ expect(docToHtml(state.doc)).to.include('<ul>');
143
+ getCommand(state, 'bulletList')!(state, tr => {
144
+ state = state.apply(tr);
145
+ });
146
+ expect(docToHtml(state.doc)).to.equal('<p>item</p>');
147
+ });
148
+
149
+ it('converts between list types in place', () => {
150
+ let state = stateWithAllSelected('<ul><li><p>item</p></li></ul>');
151
+ getCommand(state, 'orderedList')!(state, tr => {
152
+ state = state.apply(tr);
153
+ });
154
+ expect(docToHtml(state.doc)).to.include('<ol>');
155
+ expect(docToHtml(state.doc)).to.not.include('<ul>');
156
+ });
157
+
158
+ it('sets alignment on textblocks', () => {
159
+ let state = stateWithAllSelected('<p>text</p>');
160
+ getCommand(state, 'align', { align: 'right' })!(state, tr => {
161
+ state = state.apply(tr);
162
+ });
163
+ expect(docToHtml(state.doc)).to.include('text-align: right');
164
+ });
165
+
166
+ it('applies and removes links', () => {
167
+ let state = stateWithAllSelected('<p>click</p>');
168
+ getCommand(state, 'link', { href: 'https://example.com' })!(state, tr => {
169
+ state = state.apply(tr);
170
+ });
171
+ expect(docToHtml(state.doc)).to.include('href="https://example.com"');
172
+ getCommand(state, 'unlink')!(state, tr => {
173
+ state = state.apply(tr);
174
+ });
175
+ expect(docToHtml(state.doc)).to.equal('<p>click</p>');
176
+ });
177
+
178
+ it('applies text color and clears formatting', () => {
179
+ let state = stateWithAllSelected('<p>color</p>');
180
+ getCommand(state, 'textColor', { color: '#ff0000' })!(state, tr => {
181
+ state = state.apply(tr);
182
+ });
183
+ // Browsers normalize hex colors to rgb() in style attributes.
184
+ expect(docToHtml(state.doc)).to.match(/color: (#ff0000|rgb\(255, 0, 0\))/);
185
+ getCommand(state, 'clearFormatting')!(state, tr => {
186
+ state = state.apply(tr);
187
+ });
188
+ expect(docToHtml(state.doc)).to.equal('<p>color</p>');
189
+ });
190
+ });
191
+
192
+ describe('phase 2: rich content', () => {
193
+ it('round-trips tables', () => {
194
+ const html =
195
+ '<table><tbody><tr><th><p>h1</p></th><th><p>h2</p></th></tr>' +
196
+ '<tr><td><p>a</p></td><td><p>b</p></td></tr></tbody></table>';
197
+ const doc = htmlToDoc(defaultSchema, html);
198
+ const out = docToHtml(doc);
199
+ expect(out).to.include('<table');
200
+ expect(out).to.include('<th');
201
+ expect(htmlToDoc(defaultSchema, out).eq(doc)).to.equal(true);
202
+ });
203
+
204
+ it('keeps colspan/rowspan through sanitization', () => {
205
+ const out = sanitizeHtml('<table><tr><td colspan="2" rowspan="3">x</td></tr></table>');
206
+ expect(out).to.include('colspan="2"');
207
+ expect(out).to.include('rowspan="3"');
208
+ });
209
+
210
+ it('round-trips inline images', () => {
211
+ const html = '<p>look: <img src="https://x.dev/a.png" alt="A"></p>';
212
+ const doc = htmlToDoc(defaultSchema, html);
213
+ const out = docToHtml(doc);
214
+ expect(out).to.include('src="https://x.dev/a.png"');
215
+ expect(out).to.include('alt="A"');
216
+ expect(htmlToDoc(defaultSchema, out).eq(doc)).to.equal(true);
217
+ });
218
+
219
+ it('parses bare pasted images', () => {
220
+ const doc = htmlToDoc(defaultSchema, '<p>before</p><img src="https://x.dev/a.png">');
221
+ expect(docToHtml(doc)).to.include('<img src="https://x.dev/a.png"');
222
+ });
223
+
224
+ it('drops images with unsafe URLs but allows raster data URLs', () => {
225
+ expect(sanitizeHtml('<img src="javascript:alert(1)">')).to.not.include('src');
226
+ expect(
227
+ sanitizeHtml('<img src="data:image/png;base64,iVBORw0KGgo=">')
228
+ ).to.include('data:image/png');
229
+ expect(
230
+ sanitizeHtml('<img src="data:image/svg+xml,<svg onload=alert(1)>">')
231
+ ).to.not.include('svg');
232
+ });
233
+
234
+ it('round-trips code blocks preserving whitespace', () => {
235
+ const doc = htmlToDoc(
236
+ defaultSchema,
237
+ '<pre data-language="js"><code>const a = 1;\n indent();</code></pre>'
238
+ );
239
+ const out = docToHtml(doc);
240
+ expect(out).to.include('data-language="js"');
241
+ expect(out).to.include('const a = 1;\n indent();');
242
+ });
243
+
244
+ it('toggles code blocks via the codeBlock command', () => {
245
+ let state = stateWithAllSelected('<p>snippet</p>');
246
+ getCommand(state, 'codeBlock')!(state, tr => {
247
+ state = state.apply(tr);
248
+ });
249
+ expect(docToHtml(state.doc)).to.include('<pre');
250
+ getCommand(state, 'codeBlock')!(state, tr => {
251
+ state = state.apply(tr);
252
+ });
253
+ expect(docToHtml(state.doc)).to.equal('<p>snippet</p>');
254
+ });
255
+
256
+ it('inserts tables and edits rows/columns', () => {
257
+ let state = stateWithAllSelected('<p></p>');
258
+ getCommand(state, 'insertTable', { rows: 2, cols: 2 })!(state, tr => {
259
+ state = state.apply(tr);
260
+ });
261
+ let table = state.doc.firstChild!;
262
+ expect(table.type.name).to.equal('table');
263
+ expect(table.childCount).to.equal(2);
264
+
265
+ // Put the cursor inside the first cell, then add a row.
266
+ const inside = TextSelection.near(state.doc.resolve(4));
267
+ state = state.apply(state.tr.setSelection(inside));
268
+ getCommand(state, 'addRowAfter')!(state, tr => {
269
+ state = state.apply(tr);
270
+ });
271
+ table = state.doc.firstChild!;
272
+ expect(table.childCount).to.equal(3);
273
+
274
+ getCommand(state, 'deleteTable')!(state, tr => {
275
+ state = state.apply(tr);
276
+ });
277
+ expect(docToHtml(state.doc)).to.not.include('<table');
278
+ });
279
+
280
+ it('inserts inline images via the insertImage command', () => {
281
+ let state = stateWithAllSelected('<p></p>');
282
+ getCommand(state, 'insertImage', { src: 'https://x.dev/i.png', alt: 'pic' })!(
283
+ state,
284
+ tr => {
285
+ state = state.apply(tr);
286
+ }
287
+ );
288
+ const out = docToHtml(state.doc);
289
+ expect(out).to.include('<img');
290
+ expect(out).to.include('alt="pic"');
291
+ });
292
+
293
+ it('reports inTable and inCodeBlock in toolbar state', () => {
294
+ let state = stateWithAllSelected('<p></p>');
295
+ getCommand(state, 'insertTable', { rows: 2, cols: 2 })!(state, tr => {
296
+ state = state.apply(tr);
297
+ });
298
+ state = state.apply(state.tr.setSelection(TextSelection.near(state.doc.resolve(4))));
299
+ expect(computeToolbarState(state).inTable).to.equal(true);
300
+
301
+ const codeState = stateWithAllSelected('<pre><code>x</code></pre>');
302
+ expect(computeToolbarState(codeState).inCodeBlock).to.equal(true);
303
+ });
304
+ });
305
+
306
+ describe('phase 3: productivity', () => {
307
+ it('round-trips mention nodes', () => {
308
+ const html =
309
+ '<p>ping <span data-mention-trigger="@" data-mention-key="u1" data-mention-label="Ada">@Ada</span> now</p>';
310
+ const doc = htmlToDoc(defaultSchema, html);
311
+ const out = docToHtml(doc);
312
+ expect(out).to.include('data-mention-key="u1"');
313
+ expect(out).to.include('data-mention-label="Ada"');
314
+ expect(out).to.include('@Ada');
315
+ expect(htmlToDoc(defaultSchema, out).eq(doc)).to.equal(true);
316
+ });
317
+
318
+ it('keeps mention data attributes through sanitization', () => {
319
+ const out = sanitizeHtml(
320
+ '<span data-mention-key="u1" data-mention-trigger="@" data-mention-label="Ada" onclick="x()">@Ada</span>'
321
+ );
322
+ expect(out).to.include('data-mention-key="u1"');
323
+ expect(out).to.not.include('onclick');
324
+ });
325
+
326
+ it('tracks trigger queries through the suggestion plugin', () => {
327
+ const seen: SuggestionMatch[] = [];
328
+ let state = createEditorState({
329
+ doc: htmlToDoc(defaultSchema, '<p></p>'),
330
+ mentions: {
331
+ getTriggers: () => ['@'],
332
+ onChange: match => seen.push(match),
333
+ },
334
+ });
335
+ state = state.apply(state.tr.insertText('hello @ad', 1));
336
+ const last = seen[seen.length - 1];
337
+ expect(last.active).to.equal(true);
338
+ expect(last.trigger).to.equal('@');
339
+ expect(last.query).to.equal('ad');
340
+
341
+ // A space ends the suggestion.
342
+ state = state.apply(state.tr.insertText(' '));
343
+ expect(seen[seen.length - 1].active).to.equal(false);
344
+ });
345
+
346
+ it('does not trigger suggestions mid-word', () => {
347
+ const seen: SuggestionMatch[] = [];
348
+ const state = createEditorState({
349
+ doc: htmlToDoc(defaultSchema, '<p></p>'),
350
+ mentions: { getTriggers: () => ['@'], onChange: m => seen.push(m) },
351
+ });
352
+ state.apply(state.tr.insertText('email@example', 1));
353
+ expect(seen.every(m => !m.active)).to.equal(true);
354
+ });
355
+
356
+ it('finds, steps through, and replaces matches', () => {
357
+ let state = createEditorState({
358
+ doc: htmlToDoc(defaultSchema, '<p>cat dog cat</p><p>Cat nap</p>'),
359
+ });
360
+ state = state.apply(searchTr(state, 'cat'));
361
+ expect(getFindState(state).matches.length).to.equal(3);
362
+ expect(getFindState(state).activeIndex).to.equal(0);
363
+
364
+ state = state.apply(findStepTr(state, 'next'));
365
+ expect(getFindState(state).activeIndex).to.equal(1);
366
+ state = state.apply(findStepTr(state, 'prev'));
367
+ expect(getFindState(state).activeIndex).to.equal(0);
368
+
369
+ state = state.apply(replaceActiveTr(state, 'ferret')!);
370
+ expect(docToHtml(state.doc)).to.include('ferret dog cat');
371
+ // Matches recompute after the doc change.
372
+ expect(getFindState(state).matches.length).to.equal(2);
373
+
374
+ state = state.apply(replaceAllTr(state, 'newt')!);
375
+ expect(getFindState(state).matches.length).to.equal(0);
376
+ expect(docToHtml(state.doc)).to.equal('<p>ferret dog newt</p><p>newt nap</p>');
377
+ });
378
+
379
+ it('respects case sensitivity in find', () => {
380
+ let state = createEditorState({
381
+ doc: htmlToDoc(defaultSchema, '<p>Cat cat CAT</p>'),
382
+ });
383
+ state = state.apply(searchTr(state, 'cat', true));
384
+ expect(getFindState(state).matches.length).to.equal(1);
385
+ });
386
+
387
+ it('counts words and characters', () => {
388
+ const doc = htmlToDoc(defaultSchema, '<p>one two</p><p>three</p>');
389
+ expect(countWords(doc)).to.deep.equal({ words: 3, characters: 12 });
390
+ expect(countWords(htmlToDoc(defaultSchema, ''))).to.deep.equal({
391
+ words: 0,
392
+ characters: 0,
393
+ });
394
+ });
395
+ });
396
+
397
+ describe('small features', () => {
398
+ it('round-trips checklists', () => {
399
+ const html =
400
+ '<ul data-task-list="true"><li data-task-item="true" data-checked="true"><p>done</p></li>' +
401
+ '<li data-task-item="true" data-checked="false"><p>todo</p></li></ul>';
402
+ const doc = htmlToDoc(defaultSchema, html);
403
+ expect(doc.firstChild!.type.name).to.equal('task_list');
404
+ expect(doc.firstChild!.firstChild!.attrs.checked).to.equal(true);
405
+ const out = docToHtml(doc);
406
+ expect(out).to.include('data-checked="true"');
407
+ expect(htmlToDoc(defaultSchema, out).eq(doc)).to.equal(true);
408
+ });
409
+
410
+ it('plain lists still parse as bullet lists', () => {
411
+ const doc = htmlToDoc(defaultSchema, '<ul><li><p>plain</p></li></ul>');
412
+ expect(doc.firstChild!.type.name).to.equal('bullet_list');
413
+ });
414
+
415
+ it('toggles checklists and converts bullet lists in place', () => {
416
+ let state = stateWithAllSelected('<p>task</p>');
417
+ getCommand(state, 'taskList')!(state, tr => {
418
+ state = state.apply(tr);
419
+ });
420
+ expect(state.doc.firstChild!.type.name).to.equal('task_list');
421
+
422
+ // Convert to bullet list: items must be remapped too.
423
+ getCommand(state, 'bulletList')!(state, tr => {
424
+ state = state.apply(tr);
425
+ });
426
+ expect(state.doc.firstChild!.type.name).to.equal('bullet_list');
427
+ expect(state.doc.firstChild!.firstChild!.type.name).to.equal('list_item');
428
+
429
+ // And back to a checklist.
430
+ getCommand(state, 'taskList')!(state, tr => {
431
+ state = state.apply(tr);
432
+ });
433
+ expect(state.doc.firstChild!.firstChild!.type.name).to.equal('task_item');
434
+ });
435
+
436
+ it('enforces maxLength but always allows shrinking', () => {
437
+ let state = createEditorState({
438
+ doc: htmlToDoc(defaultSchema, '<p>12345678</p>'),
439
+ getMaxLength: () => 10,
440
+ });
441
+ state = state.apply(state.tr.insertText('90', 9));
442
+ expect(state.doc.textContent).to.equal('1234567890');
443
+
444
+ // Growing past the limit is rejected: the state stays unchanged.
445
+ const attempted = state.apply(state.tr.insertText('x', 11));
446
+ expect(attempted.doc.textContent).to.equal('1234567890');
447
+
448
+ // Deleting is always allowed.
449
+ state = state.apply(state.tr.delete(1, 6));
450
+ expect(state.doc.textContent).to.equal('67890');
451
+ });
452
+
453
+ it('suggestion minQueryLength keeps short queries inactive', () => {
454
+ const seen: SuggestionMatch[] = [];
455
+ let state = createEditorState({
456
+ doc: htmlToDoc(defaultSchema, '<p></p>'),
457
+ emoji: { onChange: m => seen.push(m) },
458
+ });
459
+ state = state.apply(state.tr.insertText(':s', 1));
460
+ expect(seen.filter(m => m.active)).to.have.length(0);
461
+ state = state.apply(state.tr.insertText('mi'));
462
+ const last = seen[seen.length - 1];
463
+ expect(last.active).to.equal(true);
464
+ expect(last.query).to.equal('smi');
465
+ });
466
+ });
467
+
468
+ describe('embeds', () => {
469
+ it('converts provider share URLs to embed URLs', () => {
470
+ expect(toEmbedUrl('https://www.youtube.com/watch?v=dQw4w9WgXcQ')).to.deep.equal({
471
+ src: 'https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ',
472
+ provider: 'youtube',
473
+ });
474
+ expect(toEmbedUrl('https://youtu.be/dQw4w9WgXcQ')!.src).to.include('/embed/dQw4w9WgXcQ');
475
+ expect(toEmbedUrl('https://www.youtube.com/shorts/dQw4w9WgXcQ')!.provider).to.equal('youtube');
476
+ expect(toEmbedUrl('https://vimeo.com/123456789')).to.deep.equal({
477
+ src: 'https://player.vimeo.com/video/123456789',
478
+ provider: 'vimeo',
479
+ });
480
+ expect(
481
+ toEmbedUrl('https://www.loom.com/share/abcdef0123456789abcdef0123456789')!.provider
482
+ ).to.equal('loom');
483
+ });
484
+
485
+ it('rejects non-provider and non-https URLs', () => {
486
+ expect(toEmbedUrl('https://evil.example.com/embed/x')).to.equal(null);
487
+ expect(toEmbedUrl('http://www.youtube.com/watch?v=dQw4w9WgXcQ')).to.equal(null);
488
+ expect(toEmbedUrl('javascript:alert(1)')).to.equal(null);
489
+ expect(toEmbedUrl('https://youtube.com.evil.com/watch?v=x')).to.equal(null);
490
+ expect(isAllowedEmbedSrc('https://evil.com/embed/x')).to.equal(false);
491
+ });
492
+
493
+ it('keeps allowlisted iframes through sanitization, drops the rest', () => {
494
+ const good = sanitizeHtml(
495
+ '<div data-embed-provider="youtube"><iframe src="https://www.youtube-nocookie.com/embed/abc123xyz"></iframe></div>'
496
+ );
497
+ expect(good).to.include('youtube-nocookie.com/embed');
498
+ const evil = sanitizeHtml('<iframe src="https://evil.example.com/steal"></iframe><p>ok</p>');
499
+ expect(evil).to.equal('<p>ok</p>');
500
+ });
501
+
502
+ it('round-trips embed nodes', () => {
503
+ const html =
504
+ '<div data-embed-provider="youtube"><iframe src="https://www.youtube-nocookie.com/embed/abc123xyz" title="Demo"></iframe></div>';
505
+ const doc = htmlToDoc(defaultSchema, html);
506
+ expect(doc.firstChild!.type.name).to.equal('embed');
507
+ const out = docToHtml(doc);
508
+ expect(out).to.include('data-embed-provider="youtube"');
509
+ expect(htmlToDoc(defaultSchema, out).eq(doc)).to.equal(true);
510
+ });
511
+
512
+ it('inserts embeds via the insertEmbed command', () => {
513
+ let state = stateWithAllSelected('<p></p>');
514
+ getCommand(state, 'insertEmbed', {
515
+ src: 'https://player.vimeo.com/video/123456789',
516
+ provider: 'vimeo',
517
+ })!(state, tr => {
518
+ state = state.apply(tr);
519
+ });
520
+ expect(state.doc.firstChild!.type.name).to.equal('embed');
521
+ });
522
+ });
523
+
524
+ describe('code highlighting', () => {
525
+ it('produces token decorations for code blocks', () => {
526
+ const state = createEditorState({
527
+ doc: htmlToDoc(
528
+ defaultSchema,
529
+ '<pre data-language="javascript"><code>const answer = 42; // why</code></pre>'
530
+ ),
531
+ });
532
+ const set = codeHighlightKey.getState(state)!;
533
+ const decos = set.find();
534
+ expect(decos.length).to.be.greaterThan(2);
535
+ });
536
+
537
+ it('skips plaintext blocks and updates the language attr', () => {
538
+ let state = createEditorState({
539
+ doc: htmlToDoc(
540
+ defaultSchema,
541
+ '<pre data-language="plaintext"><code>const answer = 42;</code></pre>'
542
+ ),
543
+ });
544
+ expect(codeHighlightKey.getState(state)!.find().length).to.equal(0);
545
+
546
+ state = state.apply(state.tr.setSelection(TextSelection.near(state.doc.resolve(1))));
547
+ getCommand(state, 'setCodeBlockLanguage', { language: 'javascript' })!(state, tr => {
548
+ state = state.apply(tr);
549
+ });
550
+ expect(state.doc.firstChild!.attrs.language).to.equal('javascript');
551
+ expect(codeHighlightKey.getState(state)!.find().length).to.be.greaterThan(1);
552
+ });
553
+ });
554
+
555
+ describe('phase 4: subscript & superscript', () => {
556
+ it('round-trips sub and sup marks', () => {
557
+ for (const html of ['<p>H<sub>2</sub>O</p>', '<p>x<sup>2</sup></p>']) {
558
+ const doc = htmlToDoc(defaultSchema, html);
559
+ expect(docToHtml(doc)).to.equal(html);
560
+ expect(htmlToDoc(defaultSchema, docToHtml(doc)).eq(doc)).to.equal(true);
561
+ }
562
+ });
563
+
564
+ it('parses vertical-align styles pasted from Word/Docs', () => {
565
+ expect(
566
+ docToHtml(htmlToDoc(defaultSchema, '<p><span style="vertical-align: sub">2</span></p>'))
567
+ ).to.include('<sub>');
568
+ expect(
569
+ docToHtml(htmlToDoc(defaultSchema, '<p><span style="vertical-align: super">2</span></p>'))
570
+ ).to.include('<sup>');
571
+ });
572
+
573
+ it('toggles sub/sup and keeps them mutually exclusive', () => {
574
+ let state = stateWithAllSelected('<p>x</p>');
575
+ getCommand(state, 'subscript')!(state, tr => {
576
+ state = state.apply(tr);
577
+ });
578
+ expect(docToHtml(state.doc)).to.equal('<p><sub>x</sub></p>');
579
+ // Applying superscript over a subscript replaces it (excludes).
580
+ getCommand(state, 'superscript')!(state, tr => {
581
+ state = state.apply(tr);
582
+ });
583
+ expect(docToHtml(state.doc)).to.equal('<p><sup>x</sup></p>');
584
+ });
585
+
586
+ it('reports sub/sup in toolbar state', () => {
587
+ expect(computeToolbarState(stateWithAllSelected('<p><sub>x</sub></p>')).subscript).to.equal(
588
+ true
589
+ );
590
+ expect(
591
+ computeToolbarState(stateWithAllSelected('<p><sup>x</sup></p>')).superscript
592
+ ).to.equal(true);
593
+ });
594
+ });
595
+
596
+ describe('phase 4: paste as plain text', () => {
597
+ it('builds a plain-text slice splitting on newlines', () => {
598
+ const slice = plainTextSlice(defaultSchema, 'line1\nline2');
599
+ expect(slice.content.childCount).to.equal(2);
600
+ expect(slice.content.firstChild!.textContent).to.equal('line1');
601
+ expect(slice.content.lastChild!.textContent).to.equal('line2');
602
+ });
603
+
604
+ it('strips marks and block structure from a rich slice', () => {
605
+ const rich = htmlToSlice(defaultSchema, '<h2><strong>bold</strong> head</h2>');
606
+ const plain = stripSliceFormatting(defaultSchema, rich);
607
+ const para = plain.content.firstChild!;
608
+ expect(para.type.name).to.equal('paragraph');
609
+ expect(para.textContent).to.equal('bold head');
610
+ expect(para.firstChild!.marks.length).to.equal(0);
611
+ });
612
+
613
+ it('only strips when the toggle reads true', () => {
614
+ let force = false;
615
+ const state = createEditorState({ getForcePlainText: () => force });
616
+ const paste = state.plugins
617
+ .map(p => p.props?.transformPasted)
618
+ .find(Boolean) as unknown as (slice: unknown, ...rest: unknown[]) => any;
619
+ const rich = htmlToSlice(defaultSchema, '<p><strong>bold</strong></p>');
620
+ // Off: slice passes through unchanged.
621
+ expect(paste(rich).eq(rich)).to.equal(true);
622
+ // On: formatting is dropped.
623
+ force = true;
624
+ const out = paste(rich);
625
+ expect(out.content.firstChild.firstChild.marks.length).to.equal(0);
626
+ });
627
+ });
628
+
629
+ describe('phase 4: more code languages', () => {
630
+ it('highlights newly registered languages', () => {
631
+ for (const language of ['go', 'rust', 'ruby', 'csharp']) {
632
+ const state = createEditorState({
633
+ doc: htmlToDoc(
634
+ defaultSchema,
635
+ `<pre data-language="${language}"><code>fn main() { let x = 1; }</code></pre>`
636
+ ),
637
+ });
638
+ expect(codeHighlightKey.getState(state)!.find().length, language).to.be.greaterThan(0);
639
+ }
640
+ });
641
+ });
642
+
643
+ describe('phase 4: markdown export', () => {
644
+ const cases: [string, string][] = [
645
+ ['<h2>Title</h2><p>Hello <strong>bold</strong> and <em>it</em></p>', '## Title\n\nHello **bold** and *it*\n'],
646
+ ['<ul><li><p>one</p></li><li><p>two</p></li></ul>', '- one\n- two\n'],
647
+ ['<ol><li><p>a</p></li><li><p>b</p></li></ol>', '1. a\n2. b\n'],
648
+ ['<blockquote><p>quoted</p></blockquote>', '> quoted\n'],
649
+ ['<p><a href="https://x.dev">link</a></p>', '[link](https://x.dev)\n'],
650
+ ['<p><code>x()</code></p>', '`x()`\n'],
651
+ ['<pre data-language="js"><code>const a = 1;</code></pre>', '```js\nconst a = 1;\n```\n'],
652
+ ['<p><img src="https://x.dev/a.png" alt="A"></p>', '![A](https://x.dev/a.png)\n'],
653
+ ['<hr>', '---\n'],
654
+ ['<p>H<sub>2</sub>O and x<sup>2</sup></p>', 'H<sub>2</sub>O and x<sup>2</sup>\n'],
655
+ ];
656
+
657
+ for (const [input, expected] of cases) {
658
+ it(`serializes ${input.slice(0, 36)}`, () => {
659
+ expect(docToMarkdown(htmlToDoc(defaultSchema, input))).to.equal(expected);
660
+ });
661
+ }
662
+
663
+ it('serializes checklists with checked state', () => {
664
+ const html =
665
+ '<ul data-task-list="true"><li data-task-item="true" data-checked="true"><p>done</p></li>' +
666
+ '<li data-task-item="true" data-checked="false"><p>todo</p></li></ul>';
667
+ expect(docToMarkdown(htmlToDoc(defaultSchema, html))).to.equal('- [x] done\n- [ ] todo\n');
668
+ });
669
+
670
+ it('serializes a GitHub-flavored table', () => {
671
+ const html =
672
+ '<table><tbody><tr><th><p>h1</p></th><th><p>h2</p></th></tr>' +
673
+ '<tr><td><p>a</p></td><td><p>b</p></td></tr></tbody></table>';
674
+ expect(docToMarkdown(htmlToDoc(defaultSchema, html))).to.equal(
675
+ '| h1 | h2 |\n| --- | --- |\n| a | b |\n'
676
+ );
677
+ });
678
+
679
+ it('returns an empty string for an empty document', () => {
680
+ expect(docToMarkdown(htmlToDoc(defaultSchema, '<p></p>'))).to.equal('');
681
+ });
682
+ });
683
+
684
+ describe('computeToolbarState', () => {
685
+ it('reports active marks and block info', () => {
686
+ const state = stateWithAllSelected('<h3><strong>bold heading</strong></h3>');
687
+ const ts = computeToolbarState(state);
688
+ expect(ts.bold).to.equal(true);
689
+ expect(ts.italic).to.equal(false);
690
+ expect(ts.blockType).to.equal('heading');
691
+ expect(ts.headingLevel).to.equal(3);
692
+ });
693
+
694
+ it('reports list and link context', () => {
695
+ const state = stateWithAllSelected(
696
+ '<ul><li><p><a href="https://x.dev">in list</a></p></li></ul>'
697
+ );
698
+ const ts = computeToolbarState(state);
699
+ expect(ts.inBulletList).to.equal(true);
700
+ expect(ts.linkActive).to.equal(true);
701
+ expect(ts.linkHref).to.equal('https://x.dev');
702
+ });
703
+
704
+ it('reports block info for a Ctrl+A AllSelection', () => {
705
+ const doc = htmlToDoc(defaultSchema, '<h1>sdasd</h1>');
706
+ const base = createEditorState({ doc });
707
+ const state = base.apply(base.tr.setSelection(new AllSelection(base.doc)));
708
+ const ts = computeToolbarState(state);
709
+ expect(ts.blockType).to.equal('heading');
710
+ expect(ts.headingLevel).to.equal(1);
711
+ });
712
+ });
713
+
714
+ describe('indent & outdent', () => {
715
+ /** Cursor inside the second item of a two-item bullet list. */
716
+ function stateInSecondItem() {
717
+ const doc = htmlToDoc(
718
+ defaultSchema,
719
+ '<ul><li><p>one</p></li><li><p>two</p></li></ul>'
720
+ );
721
+ const state = createEditorState({ doc });
722
+ // Position inside "two" (after "one" paragraph + item boundaries).
723
+ const pos = state.doc.content.size - 4;
724
+ return state.apply(
725
+ state.tr.setSelection(TextSelection.create(state.doc, pos))
726
+ );
727
+ }
728
+
729
+ it('indent sinks a list item into the previous one', () => {
730
+ let state = stateInSecondItem();
731
+ const applied = getCommand(state, 'indent')!(state, tr => {
732
+ state = state.apply(tr);
733
+ });
734
+ expect(applied).to.equal(true);
735
+ expect(docToHtml(state.doc)).to.equal(
736
+ '<ul><li><p>one</p><ul><li><p>two</p></li></ul></li></ul>'
737
+ );
738
+ });
739
+
740
+ it('outdent lifts a nested item back out', () => {
741
+ let state = stateInSecondItem();
742
+ getCommand(state, 'indent')!(state, tr => {
743
+ state = state.apply(tr);
744
+ });
745
+ getCommand(state, 'outdent')!(state, tr => {
746
+ state = state.apply(tr);
747
+ });
748
+ expect(docToHtml(state.doc)).to.equal(
749
+ '<ul><li><p>one</p></li><li><p>two</p></li></ul>'
750
+ );
751
+ });
752
+
753
+ it('indent adds margin steps to plain paragraphs', () => {
754
+ let state = stateWithAllSelected('<p>text</p>');
755
+ getCommand(state, 'indent')!(state, tr => {
756
+ state = state.apply(tr);
757
+ });
758
+ // Browsers may serialize style attributes with a trailing semicolon.
759
+ expect(docToHtml(state.doc)).to.include('margin-inline-start: 40px');
760
+ getCommand(state, 'indent')!(state, tr => {
761
+ state = state.apply(tr);
762
+ });
763
+ expect(docToHtml(state.doc)).to.include('margin-inline-start: 80px');
764
+ getCommand(state, 'outdent')!(state, tr => {
765
+ state = state.apply(tr);
766
+ });
767
+ getCommand(state, 'outdent')!(state, tr => {
768
+ state = state.apply(tr);
769
+ });
770
+ expect(docToHtml(state.doc)).to.equal('<p>text</p>');
771
+ });
772
+
773
+ it('outdent at indent 0 outside lists and quotes does nothing', () => {
774
+ let state = stateWithAllSelected('<p>text</p>');
775
+ const applied = getCommand(state, 'outdent')!(state, tr => {
776
+ state = state.apply(tr);
777
+ });
778
+ expect(applied).to.equal(false);
779
+ });
780
+
781
+ it('outdent lifts a block out of a blockquote', () => {
782
+ let state = stateWithAllSelected('<blockquote><p>quoted</p></blockquote>');
783
+ const applied = getCommand(state, 'outdent')!(state, tr => {
784
+ state = state.apply(tr);
785
+ });
786
+ expect(applied).to.equal(true);
787
+ expect(docToHtml(state.doc)).to.equal('<p>quoted</p>');
788
+ });
789
+ });
790
+
791
+ describe('list properties', () => {
792
+ it('sets and clears bullet marker styles', () => {
793
+ let state = stateWithAllSelected('<ul><li><p>a</p></li></ul>');
794
+ getCommand(state, 'setListStyle', { style: 'square' })!(state, tr => {
795
+ state = state.apply(tr);
796
+ });
797
+ expect(docToHtml(state.doc)).to.include('list-style-type: square');
798
+ getCommand(state, 'setListStyle', { style: null })!(state, tr => {
799
+ state = state.apply(tr);
800
+ });
801
+ expect(docToHtml(state.doc)).to.equal('<ul><li><p>a</p></li></ul>');
802
+ });
803
+
804
+ it('sets numbering style as the HTML type attribute', () => {
805
+ let state = stateWithAllSelected('<ol><li><p>a</p></li></ol>');
806
+ getCommand(state, 'setListStyle', { style: 'lower-roman' })!(state, tr => {
807
+ state = state.apply(tr);
808
+ });
809
+ expect(docToHtml(state.doc)).to.equal('<ol type="i"><li><p>a</p></li></ol>');
810
+ });
811
+
812
+ it('sets the start number of an ordered list', () => {
813
+ let state = stateWithAllSelected('<ol><li><p>a</p></li></ol>');
814
+ getCommand(state, 'setListStart', { start: 5 })!(state, tr => {
815
+ state = state.apply(tr);
816
+ });
817
+ expect(docToHtml(state.doc)).to.equal('<ol start="5"><li><p>a</p></li></ol>');
818
+ });
819
+
820
+ it('round-trips ol type through parsing', () => {
821
+ const doc = htmlToDoc(defaultSchema, '<ol type="A" start="3"><li><p>x</p></li></ol>');
822
+ expect(docToHtml(doc)).to.equal('<ol start="3" type="A"><li><p>x</p></li></ol>');
823
+ });
824
+ });
825
+
826
+ describe('figure & image commands', () => {
827
+ /** State with a NodeSelection on the inline image. */
828
+ function stateWithImageSelected() {
829
+ const doc = htmlToDoc(defaultSchema, '<p><img src="https://x.co/i.png" alt="pic"></p>');
830
+ const state = createEditorState({ doc });
831
+ // Image node position: inside the paragraph at pos 1.
832
+ return state.apply(state.tr.setSelection(NodeSelection.create(state.doc, 1)));
833
+ }
834
+
835
+ it('parses and serializes a figure with caption', () => {
836
+ const html =
837
+ '<figure><img src="https://x.co/i.png" alt="pic"><figcaption>My caption</figcaption></figure>';
838
+ const doc = htmlToDoc(defaultSchema, html);
839
+ const out = docToHtml(doc);
840
+ expect(out).to.include('<figure');
841
+ expect(out).to.include('src="https://x.co/i.png"');
842
+ expect(out).to.include('<figcaption');
843
+ expect(out).to.include('My caption');
844
+ });
845
+
846
+ it('parses image width from inline style', () => {
847
+ const doc = htmlToDoc(defaultSchema, '<p><img src="https://x.co/i.png" style="width: 240px"></p>');
848
+ expect(docToHtml(doc)).to.include('width: 240px');
849
+ });
850
+
851
+ it('toggleImageCaption converts an inline image into a figure', () => {
852
+ let state = stateWithImageSelected();
853
+ const applied = getCommand(state, 'toggleImageCaption')!(state, tr => {
854
+ state = state.apply(tr);
855
+ });
856
+ expect(applied).to.equal(true);
857
+ const out = docToHtml(state.doc);
858
+ expect(out).to.include('<figure');
859
+ expect(out).to.include('pic'); // alt prefills the caption
860
+ });
861
+
862
+ it('toggleImageCaption converts a figure back to an inline image', () => {
863
+ let state = stateWithAllSelected(
864
+ '<figure><img src="https://x.co/i.png"><figcaption>cap</figcaption></figure>'
865
+ );
866
+ // Cursor is inside the caption — selectedImageInfo resolves the figure.
867
+ const applied = getCommand(state, 'toggleImageCaption')!(state, tr => {
868
+ state = state.apply(tr);
869
+ });
870
+ expect(applied).to.equal(true);
871
+ const out = docToHtml(state.doc);
872
+ expect(out).to.not.include('<figure');
873
+ expect(out).to.include('<img');
874
+ });
875
+
876
+ it('setImageAlign promotes an inline image to an aligned figure', () => {
877
+ let state = stateWithImageSelected();
878
+ getCommand(state, 'setImageAlign', { align: 'center' })!(state, tr => {
879
+ state = state.apply(tr);
880
+ });
881
+ expect(docToHtml(state.doc)).to.include('data-align="center"');
882
+ });
883
+
884
+ it('setImageWidth writes the width attr', () => {
885
+ let state = stateWithImageSelected();
886
+ getCommand(state, 'setImageWidth', { width: 320 })!(state, tr => {
887
+ state = state.apply(tr);
888
+ });
889
+ expect(docToHtml(state.doc)).to.include('width: 320px');
890
+ });
891
+
892
+ it('deleteImage removes the selected image', () => {
893
+ let state = stateWithImageSelected();
894
+ getCommand(state, 'deleteImage')!(state, tr => {
895
+ state = state.apply(tr);
896
+ });
897
+ expect(docToHtml(state.doc)).to.not.include('<img');
898
+ });
899
+ });
900
+
901
+ describe('paste from Office', () => {
902
+ it('detects Word and Google Docs clipboard HTML', () => {
903
+ expect(isOfficeHtml('<p class="MsoNormal">x</p>')).to.equal(true);
904
+ expect(isOfficeHtml('<b id="docs-internal-guid-abc"><p>x</p></b>')).to.equal(true);
905
+ expect(isOfficeHtml('<p>plain</p>')).to.equal(false);
906
+ });
907
+
908
+ it('converts Word list paragraphs into a real bullet list', () => {
909
+ const word =
910
+ '<p class="MsoListParagraph" style="mso-list:l0 level1 lfo1">' +
911
+ '<span style="mso-list:Ignore">·<span>&nbsp;</span></span>Alpha</p>' +
912
+ '<p class="MsoListParagraph" style="mso-list:l0 level1 lfo1">' +
913
+ '<span style="mso-list:Ignore">·<span>&nbsp;</span></span>Beta</p>';
914
+ const out = cleanOfficeHtml(word);
915
+ expect(out).to.include('<ul>');
916
+ expect(out).to.include('Alpha');
917
+ expect(out).to.include('Beta');
918
+ expect(out).to.not.include('mso-list');
919
+ });
920
+
921
+ it('converts numbered Word paragraphs into an ordered list with nesting', () => {
922
+ const word =
923
+ '<p style="mso-list:l0 level1 lfo1"><span style="mso-list:Ignore">1.</span>One</p>' +
924
+ '<p style="mso-list:l0 level2 lfo1"><span style="mso-list:Ignore">a.</span>Nested</p>' +
925
+ '<p style="mso-list:l0 level1 lfo1"><span style="mso-list:Ignore">2.</span>Two</p>';
926
+ const out = cleanOfficeHtml(word);
927
+ expect(out.indexOf('<ol>')).to.be.greaterThan(-1);
928
+ // Nested list sits inside the first item.
929
+ expect(out.indexOf('Nested')).to.be.greaterThan(out.indexOf('One'));
930
+ expect(out.indexOf('Two')).to.be.greaterThan(out.indexOf('Nested'));
931
+ });
932
+
933
+ it('unwraps the Google Docs bold guid wrapper', () => {
934
+ const gdocs =
935
+ '<b id="docs-internal-guid-x" style="font-weight:normal"><p>hello</p></b>';
936
+ const out = cleanOfficeHtml(gdocs);
937
+ expect(out).to.equal('<p>hello</p>');
938
+ });
939
+
940
+ it('drops conditional comments and o:p tags', () => {
941
+ // Downlevel-hidden conditional: the marker content is inside the comment.
942
+ const word = '<p><!--[if !supportLists]>junk<![endif]-->text<o:p></o:p></p>';
943
+ const out = cleanOfficeHtml(word);
944
+ expect(out).to.not.include('junk');
945
+ expect(out).to.include('text');
946
+ });
947
+ });
948
+
949
+ describe('line height', () => {
950
+ it('sets and clears line height on textblocks', () => {
951
+ let state = stateWithAllSelected('<p>hello</p>');
952
+ getCommand(state, 'lineHeight', { lineHeight: '1.5' })!(state, tr => {
953
+ state = state.apply(tr);
954
+ });
955
+ expect(docToHtml(state.doc)).to.include('line-height: 1.5');
956
+ expect(computeToolbarState(state).lineHeight).to.equal('1.5');
957
+ getCommand(state, 'lineHeight', { lineHeight: null })!(state, tr => {
958
+ state = state.apply(tr);
959
+ });
960
+ expect(docToHtml(state.doc)).to.equal('<p>hello</p>');
961
+ });
962
+
963
+ it('parses line-height styles, converting percentages', () => {
964
+ const doc = htmlToDoc(defaultSchema, '<p style="line-height: 150%">a</p>');
965
+ expect(docToHtml(doc)).to.include('line-height: 1.5');
966
+ });
967
+
968
+ it('survives the sanitizer', () => {
969
+ expect(sanitizeHtml('<p style="line-height: 2">a</p>')).to.include('line-height: 2');
970
+ });
971
+
972
+ it('is cleared by clearFormatting', () => {
973
+ let state = stateWithAllSelected('<p style="line-height: 2">hello</p>');
974
+ getCommand(state, 'clearFormatting')!(state, tr => {
975
+ state = state.apply(tr);
976
+ });
977
+ expect(docToHtml(state.doc)).to.equal('<p>hello</p>');
978
+ });
979
+ });
980
+
981
+ describe('bookmarks', () => {
982
+ it('inserts a bookmark anchor at the cursor', () => {
983
+ let state = createEditorState({ doc: htmlToDoc(defaultSchema, '<p>hello</p>') });
984
+ state = state.apply(
985
+ state.tr.setSelection(TextSelection.create(state.doc, 1))
986
+ );
987
+ getCommand(state, 'insertBookmark', { id: 'intro' })!(state, tr => {
988
+ state = state.apply(tr);
989
+ });
990
+ expect(docToHtml(state.doc)).to.equal('<p><a id="intro" data-bookmark="true"></a>hello</p>');
991
+ });
992
+
993
+ it('rejects empty ids', () => {
994
+ const state = createEditorState({ doc: htmlToDoc(defaultSchema, '<p>hello</p>') });
995
+ expect(getCommand(state, 'insertBookmark', { id: ' ' })!(state)).to.equal(false);
996
+ });
997
+
998
+ it('round-trips id and legacy name anchors, but not links', () => {
999
+ const doc = htmlToDoc(
1000
+ defaultSchema,
1001
+ '<p><a id="one"></a>x<a name="two"></a>y<a href="https://a.b">link</a></p>'
1002
+ );
1003
+ const out = docToHtml(doc);
1004
+ expect(out).to.include('<a id="one" data-bookmark="true"></a>');
1005
+ expect(out).to.include('<a id="two" data-bookmark="true"></a>');
1006
+ expect(out).to.include('<a href="https://a.b">link</a>');
1007
+ });
1008
+ });
1009
+
1010
+ describe('layout tables', () => {
1011
+ const table = '<table><tr><td><p>a</p></td></tr></table>';
1012
+
1013
+ function stateInTable(html: string) {
1014
+ const doc = htmlToDoc(defaultSchema, html);
1015
+ const state = createEditorState({ doc });
1016
+ // Place the cursor inside the first cell's paragraph.
1017
+ let pos = 0;
1018
+ state.doc.descendants((node, p) => {
1019
+ if (!pos && node.isTextblock) pos = p + 1;
1020
+ return !pos;
1021
+ });
1022
+ return state.apply(state.tr.setSelection(TextSelection.create(state.doc, pos)));
1023
+ }
1024
+
1025
+ it('toggles the surrounding table into layout mode and back', () => {
1026
+ let state = stateInTable(table);
1027
+ getCommand(state, 'toggleLayoutTable')!(state, tr => {
1028
+ state = state.apply(tr);
1029
+ });
1030
+ expect(docToHtml(state.doc)).to.include('<table role="presentation" data-layout="true">');
1031
+ expect(computeToolbarState(state).tableLayout).to.equal(true);
1032
+ getCommand(state, 'toggleLayoutTable')!(state, tr => {
1033
+ state = state.apply(tr);
1034
+ });
1035
+ expect(docToHtml(state.doc)).to.not.include('data-layout');
1036
+ });
1037
+
1038
+ it('parses role="presentation" tables as layout tables', () => {
1039
+ const doc = htmlToDoc(
1040
+ defaultSchema,
1041
+ '<table role="presentation"><tr><td><p>a</p></td></tr></table>'
1042
+ );
1043
+ expect(docToHtml(doc)).to.include('role="presentation"');
1044
+ });
1045
+
1046
+ it('returns false outside a table', () => {
1047
+ const state = stateWithAllSelected('<p>hello</p>');
1048
+ expect(getCommand(state, 'toggleLayoutTable')!(state)).to.equal(false);
1049
+ });
1050
+ });
1051
+
1052
+ describe('multi-level lists', () => {
1053
+ const nested =
1054
+ '<ol data-list-style="multilevel"><li><p>one</p><ol><li><p>deep</p></li></ol></li></ol>';
1055
+
1056
+ it('round-trips the multilevel marker', () => {
1057
+ const doc = htmlToDoc(defaultSchema, nested);
1058
+ expect(docToHtml(doc)).to.include('data-list-style="multilevel"');
1059
+ });
1060
+
1061
+ it('survives the sanitizer', () => {
1062
+ expect(sanitizeHtml(nested)).to.include('data-list-style="multilevel"');
1063
+ });
1064
+
1065
+ it('applies multilevel to the outermost ordered list from a nested item', () => {
1066
+ const html = '<ol><li><p>one</p><ol><li><p>deep</p></li></ol></li></ol>';
1067
+ let state = createEditorState({ doc: htmlToDoc(defaultSchema, html) });
1068
+ let pos = 0;
1069
+ state.doc.descendants((node, p) => {
1070
+ if (node.isTextblock && node.textContent === 'deep') pos = p + 1;
1071
+ return pos === 0;
1072
+ });
1073
+ state = state.apply(state.tr.setSelection(TextSelection.create(state.doc, pos)));
1074
+ getCommand(state, 'setListStyle', { style: 'multilevel' })!(state, tr => {
1075
+ state = state.apply(tr);
1076
+ });
1077
+ const out = docToHtml(state.doc);
1078
+ // The outer list carries the marker, not the nested one.
1079
+ expect(out.startsWith('<ol data-list-style="multilevel">')).to.equal(true);
1080
+ expect(out.indexOf('data-list-style')).to.equal(out.lastIndexOf('data-list-style'));
1081
+ // The toolbar reports it from the nested cursor, and clearing removes it.
1082
+ expect(computeToolbarState(state).listStyle).to.equal('multilevel');
1083
+ getCommand(state, 'setListStyle', { style: null })!(state, tr => {
1084
+ state = state.apply(tr);
1085
+ });
1086
+ expect(docToHtml(state.doc)).to.not.include('data-list-style');
1087
+ });
1088
+ });