@aquera/nile-elements 1.9.8 → 1.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/README.md +3 -0
  2. package/dist/{index-249de90a.esm.js → index-289706c7.esm.js} +1 -1
  3. package/dist/{index-df196058.cjs.js → index-d7e6f1c6.cjs.js} +2 -2
  4. package/dist/index-d7e6f1c6.cjs.js.map +1 -0
  5. package/dist/index.cjs.js +1 -1
  6. package/dist/index.esm.js +1 -1
  7. package/dist/index.js +1577 -1275
  8. package/dist/katex-44476ab4.esm.js +1 -0
  9. package/dist/katex-f4186f87.cjs.js +2 -0
  10. package/dist/katex-f4186f87.cjs.js.map +1 -0
  11. package/dist/nile-color-picker/index.cjs.js +1 -1
  12. package/dist/nile-color-picker/index.esm.js +1 -1
  13. package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
  14. package/dist/nile-color-picker/nile-color-picker.cjs.js.map +1 -1
  15. package/dist/nile-color-picker/nile-color-picker.esm.js +1 -1
  16. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +1 -1
  17. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -1
  18. package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -1
  19. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +1 -1
  20. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -1
  21. package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -1
  22. package/dist/nile-wysiwyg-editor/engine/index.cjs.js +1 -1
  23. package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -1
  24. package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +1 -1
  25. package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +1 -1
  26. package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -1
  27. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +1 -1
  28. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -1
  29. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -1
  30. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +1 -1
  31. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -1
  32. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -1
  33. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +1 -1
  34. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -1
  35. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -1
  36. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js +1 -1
  37. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js.map +1 -1
  38. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.esm.js +1 -1
  39. package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js +2 -0
  40. package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js.map +1 -0
  41. package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.esm.js +1 -0
  42. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +1 -1
  43. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -1
  44. package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -1
  45. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +1 -1
  46. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -1
  47. package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -1
  48. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +1 -1
  49. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -1
  50. package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -1
  51. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +1 -1
  52. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -1
  53. package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -1
  54. package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
  55. package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
  56. package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js +2 -0
  57. package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js.map +1 -0
  58. package/dist/nile-wysiwyg-editor/math/katex-renderer.esm.js +1 -0
  59. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
  60. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -1
  61. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +1 -1
  62. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -1
  63. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +22 -3
  64. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +7 -6
  65. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
  66. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
  67. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js +2 -0
  68. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js.map +1 -0
  69. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.esm.js +1 -0
  70. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
  71. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js.map +1 -1
  72. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js +1 -1
  73. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js.map +1 -1
  74. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.esm.js +33 -54
  75. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +83 -95
  76. package/dist/nile-wysiwyg-editor/types.cjs.js +1 -1
  77. package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -1
  78. package/dist/nile-wysiwyg-editor/types.esm.js +1 -1
  79. package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js +2 -0
  80. package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js.map +1 -0
  81. package/dist/nile-wysiwyg-editor/ui/bubble-item.esm.js +1 -0
  82. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
  83. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
  84. package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +23 -15
  85. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +1 -1
  86. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -1
  87. package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +3 -3
  88. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +1 -1
  89. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -1
  90. package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +2 -2
  91. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +1 -1
  92. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -1
  93. package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +0 -3
  94. package/dist/nile-wysiwyg-editor/ui/preview.cjs.js +2 -0
  95. package/dist/nile-wysiwyg-editor/ui/preview.cjs.js.map +1 -0
  96. package/dist/nile-wysiwyg-editor/ui/preview.esm.js +8 -0
  97. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +1 -1
  98. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -1
  99. package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +225 -24
  100. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +1 -1
  101. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -1
  102. package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +9 -9
  103. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +1 -1
  104. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -1
  105. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +115 -13
  106. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
  107. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
  108. package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +13 -12
  109. package/dist/src/index.d.ts +5 -0
  110. package/dist/src/index.js +3 -0
  111. package/dist/src/index.js.map +1 -1
  112. package/dist/src/nile-color-picker/nile-color-picker.d.ts +1 -0
  113. package/dist/src/nile-color-picker/nile-color-picker.js +1 -0
  114. package/dist/src/nile-color-picker/nile-color-picker.js.map +1 -1
  115. package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +1 -0
  116. package/dist/src/nile-wysiwyg-editor/engine/index.js +1 -0
  117. package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -1
  118. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js +3 -0
  119. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js.map +1 -1
  120. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.d.ts +19 -4
  121. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js +23 -18
  122. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js.map +1 -1
  123. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.d.ts +8 -3
  124. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js +41 -4
  125. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js.map +1 -1
  126. package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.d.ts +17 -0
  127. package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js +174 -0
  128. package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js.map +1 -0
  129. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +33 -2
  130. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -1
  131. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +49 -8
  132. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -1
  133. package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +12 -0
  134. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +76 -8
  135. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -1
  136. package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +2 -0
  137. package/dist/src/nile-wysiwyg-editor/engine/schema.js +154 -2
  138. package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -1
  139. package/dist/src/nile-wysiwyg-editor/index.d.ts +5 -0
  140. package/dist/src/nile-wysiwyg-editor/index.js +3 -0
  141. package/dist/src/nile-wysiwyg-editor/index.js.map +1 -1
  142. package/dist/src/nile-wysiwyg-editor/math/katex-renderer.d.ts +38 -0
  143. package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js +40 -0
  144. package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js.map +1 -0
  145. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +22 -3
  146. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -1
  147. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +36 -0
  148. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +125 -8
  149. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
  150. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +5 -2
  151. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
  152. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.d.ts +2 -0
  153. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js +1 -0
  154. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js.map +1 -1
  155. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.d.ts +55 -0
  156. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js +79 -0
  157. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js.map +1 -0
  158. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +33 -54
  159. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -1
  160. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.d.ts +50 -2
  161. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js +158 -102
  162. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js.map +1 -1
  163. package/dist/src/nile-wysiwyg-editor/types.d.ts +4 -2
  164. package/dist/src/nile-wysiwyg-editor/types.js +2 -2
  165. package/dist/src/nile-wysiwyg-editor/types.js.map +1 -1
  166. package/dist/src/nile-wysiwyg-editor/ui/bubble-item.d.ts +48 -0
  167. package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js +69 -0
  168. package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js.map +1 -0
  169. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.d.ts +17 -2
  170. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +128 -35
  171. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -1
  172. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.d.ts +2 -1
  173. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +4 -3
  174. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -1
  175. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +0 -3
  176. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -1
  177. package/dist/src/nile-wysiwyg-editor/ui/preview.d.ts +20 -0
  178. package/dist/src/nile-wysiwyg-editor/ui/preview.js +44 -0
  179. package/dist/src/nile-wysiwyg-editor/ui/preview.js.map +1 -0
  180. package/dist/src/nile-wysiwyg-editor/ui/source-view.d.ts +35 -3
  181. package/dist/src/nile-wysiwyg-editor/ui/source-view.js +337 -24
  182. package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -1
  183. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.d.ts +1 -0
  184. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +9 -0
  185. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -1
  186. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.d.ts +13 -2
  187. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +166 -10
  188. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -1
  189. package/dist/src/nile-wysiwyg-editor/ui/table-menu.d.ts +1 -0
  190. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +10 -8
  191. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -1
  192. package/dist/src/version.js +1 -1
  193. package/dist/src/version.js.map +1 -1
  194. package/dist/tsconfig.tsbuildinfo +1 -1
  195. package/dist/xml-25c4108a.esm.js +1 -0
  196. package/dist/xml-90fd974e.cjs.js +2 -0
  197. package/dist/xml-90fd974e.cjs.js.map +1 -0
  198. package/package.json +2 -1
  199. package/rollup.config.js +1 -0
  200. package/src/index.ts +8 -0
  201. package/src/nile-color-picker/nile-color-picker.ts +1 -0
  202. package/src/nile-wysiwyg-editor/engine/index.ts +1 -0
  203. package/src/nile-wysiwyg-editor/engine/plugins/embed-view.ts +3 -0
  204. package/src/nile-wysiwyg-editor/engine/plugins/embeds.ts +26 -20
  205. package/src/nile-wysiwyg-editor/engine/plugins/math-view.ts +45 -4
  206. package/src/nile-wysiwyg-editor/engine/plugins/style-block-view.ts +178 -0
  207. package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +34 -2
  208. package/src/nile-wysiwyg-editor/engine/pm.test.ts +58 -8
  209. package/src/nile-wysiwyg-editor/engine/sanitize.ts +71 -8
  210. package/src/nile-wysiwyg-editor/engine/schema.ts +158 -7
  211. package/src/nile-wysiwyg-editor/index.ts +5 -0
  212. package/src/nile-wysiwyg-editor/math/katex-renderer.ts +59 -0
  213. package/src/nile-wysiwyg-editor/math/katex.d.ts +17 -0
  214. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +22 -3
  215. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +5 -2
  216. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +142 -7
  217. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.ts +2 -0
  218. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.ts +68 -0
  219. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +33 -54
  220. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.ts +202 -108
  221. package/src/nile-wysiwyg-editor/types.ts +6 -4
  222. package/src/nile-wysiwyg-editor/ui/bubble-item.ts +60 -0
  223. package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +147 -40
  224. package/src/nile-wysiwyg-editor/ui/embed-panel.ts +4 -3
  225. package/src/nile-wysiwyg-editor/ui/math-panel.ts +0 -3
  226. package/src/nile-wysiwyg-editor/ui/preview.ts +42 -0
  227. package/src/nile-wysiwyg-editor/ui/source-view.ts +339 -31
  228. package/src/nile-wysiwyg-editor/ui/suggest-list.ts +10 -0
  229. package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +160 -10
  230. package/src/nile-wysiwyg-editor/ui/table-menu.ts +10 -8
  231. package/vscode-html-custom-data.json +75 -6
  232. package/dist/index-df196058.cjs.js.map +0 -1
@@ -5,13 +5,15 @@ import { EditorView } from 'prosemirror-view';
5
5
  import { TextSelection } from 'prosemirror-state';
6
6
  import NileElement from '../internal/nile-element';
7
7
  import { styles } from './nile-wysiwyg-editor.css';
8
- import { defaultSchema, createEditorState, computeToolbarState, htmlToDoc, htmlToSlice, docToHtml, docToText, docToMarkdown, markdownToHtml, docToJson, jsonToDoc, isDocEmpty, sanitizeHtml, getCommand, getMarkRange, flattenToSingleParagraph, imageUploadKey, findUploadPos, countWords, TaskItemView, ImageView, FigureView, EmbedView, MathView, isOfficeHtml, cleanOfficeHtml, toInlineStyledHtml, buildWordDocument, buildPrintDocument, isFormatPainterArmed, armFormatPainter, disarmFormatPainter, applyFormatPainter, getFindState, searchTr, findStepTr, clearFindTr, replaceActiveTr, replaceAllTr, } from './engine';
8
+ import { defaultSchema, createEditorState, computeToolbarState, htmlToDoc, htmlToSlice, docToHtml, docToText, docToMarkdown, markdownToHtml, docToJson, jsonToDoc, isDocEmpty, sanitizeHtml, getCommand, getMarkRange, flattenToSingleParagraph, imageUploadKey, findUploadPos, countWords, TaskItemView, ImageView, FigureView, EmbedView, StyleBlockView, MathView, isOfficeHtml, cleanOfficeHtml, toInlineStyledHtml, buildWordDocument, buildPrintDocument, isFormatPainterArmed, armFormatPainter, disarmFormatPainter, applyFormatPainter, getFindState, searchTr, findStepTr, clearFindTr, replaceActiveTr, replaceAllTr, } from './engine';
9
9
  import { selectedImageInfo } from './engine/commands';
10
10
  import { DEFAULT_TOOLBAR } from './types';
11
11
  import { EMOJI } from './emoji';
12
12
  import './nile-wysiwyg-toolbar/nile-wysiwyg-toolbar';
13
+ import './nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item';
13
14
  import './ui/link-editor';
14
15
  import './ui/bubble-menu';
16
+ import './ui/bubble-item';
15
17
  import './ui/image-panel';
16
18
  import './ui/table-menu';
17
19
  import './ui/suggest-list';
@@ -165,6 +167,32 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
165
167
  this.pendingChange = false;
166
168
  /** Body overflow value before fullscreen locked it; null = not locked. */
167
169
  this.previousBodyOverflow = null;
170
+ /**
171
+ * True while a drag-selection is in progress with the format painter armed.
172
+ * Suppresses the mid-drag auto-apply in {@link handleTransaction} so the
173
+ * copied formatting lands on the final, complete selection (on mouse-up).
174
+ */
175
+ this.painterDragActive = false;
176
+ this.onPainterPointerDown = () => {
177
+ if (this.view && isFormatPainterArmed(this.view.state)) {
178
+ this.painterDragActive = true;
179
+ }
180
+ };
181
+ this.onPainterPointerUp = () => {
182
+ if (!this.painterDragActive)
183
+ return;
184
+ this.painterDragActive = false;
185
+ // Defer a frame so ProseMirror has synced the final DOM selection.
186
+ requestAnimationFrame(() => {
187
+ if (!this.view)
188
+ return;
189
+ if (this.view.state.selection.empty || !isFormatPainterArmed(this.view.state))
190
+ return;
191
+ const applyTr = applyFormatPainter(this.view.state);
192
+ if (applyTr)
193
+ this.view.dispatch(applyTr);
194
+ });
195
+ };
168
196
  /**
169
197
  * Closes any open insert panel when the pointer goes down outside of it —
170
198
  * whether elsewhere in the editor (e.g. the content area) or off the widget.
@@ -193,10 +221,32 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
193
221
  }
194
222
  // Close floating panels when the user clicks anywhere outside them.
195
223
  document.addEventListener('pointerdown', this.onOutsidePointerDown, true);
224
+ // Format painter applies on pointer release so a drag-selection is painted
225
+ // whole, not on the first mid-drag selection change.
226
+ document.addEventListener('mouseup', this.onPainterPointerUp);
227
+ // Discover an author-supplied toolbar / bubble menu (light-DOM
228
+ // <nile-wysiwyg-toolbar-item> / <nile-wysiwyg-bubble-item> children) and
229
+ // keep them in sync as they change.
230
+ this.syncAuthoredToolbar();
231
+ this.syncAuthoredBubble();
232
+ if (!this.toolbarObserver) {
233
+ this.toolbarObserver = new MutationObserver(() => {
234
+ this.syncAuthoredToolbar();
235
+ this.syncAuthoredBubble();
236
+ });
237
+ }
238
+ this.toolbarObserver.observe(this, {
239
+ childList: true,
240
+ subtree: true,
241
+ attributes: true,
242
+ attributeFilter: ['name', 'label', 'icon', 'divider', 'overflow'],
243
+ });
196
244
  }
197
245
  disconnectedCallback() {
198
246
  super.disconnectedCallback();
199
247
  document.removeEventListener('pointerdown', this.onOutsidePointerDown, true);
248
+ document.removeEventListener('mouseup', this.onPainterPointerUp);
249
+ this.toolbarObserver?.disconnect();
200
250
  if (this.changeTimer)
201
251
  clearTimeout(this.changeTimer);
202
252
  if (this.autosaveTimer)
@@ -210,8 +260,54 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
210
260
  }
211
261
  firstUpdated() {
212
262
  this.defaultValue = this.value;
263
+ // Re-read now that light-DOM children are guaranteed parsed (the initial
264
+ // connectedCallback read can run mid-parse before children exist).
265
+ this.syncAuthoredToolbar();
266
+ this.syncAuthoredBubble();
213
267
  this.mountView();
214
268
  }
269
+ /**
270
+ * Reads `<nile-wysiwyg-toolbar-item>` children into a structured toolbar and
271
+ * stores it on {@link authoredToolbar}. Absent items clear the override
272
+ * (falling back to the `toolbar` string). No-ops when nothing changed to
273
+ * avoid needless re-renders.
274
+ */
275
+ syncAuthoredToolbar() {
276
+ const nodes = this.querySelectorAll('nile-wysiwyg-toolbar-item');
277
+ const next = nodes.length
278
+ ? Array.from(nodes)
279
+ .map(el => ({
280
+ name: el.hasAttribute('divider') ? '|' : el.getAttribute('name') || '',
281
+ label: el.getAttribute('label') || undefined,
282
+ icon: el.getAttribute('icon') || undefined,
283
+ overflow: el.hasAttribute('overflow') || undefined,
284
+ }))
285
+ .filter(item => item.name)
286
+ : undefined;
287
+ if (JSON.stringify(next) !== JSON.stringify(this.authoredToolbar)) {
288
+ this.authoredToolbar = next;
289
+ }
290
+ }
291
+ /**
292
+ * Reads `<nile-wysiwyg-bubble-item>` children into a structured bubble-menu
293
+ * item list stored on {@link authoredBubble}. Absent items clear the override
294
+ * (falling back to the built-in default). No-ops when nothing changed.
295
+ */
296
+ syncAuthoredBubble() {
297
+ const nodes = this.querySelectorAll('nile-wysiwyg-bubble-item');
298
+ const next = nodes.length
299
+ ? Array.from(nodes)
300
+ .map(el => ({
301
+ name: el.hasAttribute('divider') ? '|' : el.getAttribute('name') || '',
302
+ label: el.getAttribute('label') || undefined,
303
+ icon: el.getAttribute('icon') || undefined,
304
+ }))
305
+ .filter(item => item.name)
306
+ : undefined;
307
+ if (JSON.stringify(next) !== JSON.stringify(this.authoredBubble)) {
308
+ this.authoredBubble = next;
309
+ }
310
+ }
215
311
  updated(changed) {
216
312
  if (changed.has('value') && this.view && !this.syncingValue) {
217
313
  const current = docToHtml(this.view.state.doc);
@@ -383,9 +479,11 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
383
479
  image: (node, view, getPos) => new ImageView(node, view, getPos),
384
480
  figure: (node, view, getPos) => new FigureView(node, view, getPos),
385
481
  embed: (node, view, getPos) => new EmbedView(node, view, getPos),
482
+ styleBlock: node => new StyleBlockView(node),
386
483
  math: node => new MathView(node, this.mathRenderer),
387
484
  },
388
485
  });
486
+ this.view.dom.addEventListener('mousedown', this.onPainterPointerDown);
389
487
  this.toolbarState = this.snapshotToolbar(this.view.state);
390
488
  this.counter = countWords(this.view.state.doc);
391
489
  this.syncFormValue(this.view.state.doc);
@@ -396,8 +494,15 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
396
494
  const newState = this.view.state.apply(tr);
397
495
  this.view.updateState(newState);
398
496
  // Format painter: once armed, the next non-empty selection the user makes
399
- // receives the copied formatting, then the painter disarms.
400
- if (tr.selectionSet && !newState.selection.empty && isFormatPainterArmed(newState)) {
497
+ // receives the copied formatting, then the painter disarms. While a pointer
498
+ // drag is building the selection we defer to the mouse-up handler
499
+ // (onPainterPointerUp) so the whole range is painted, not just the first
500
+ // mid-drag character. Single-shot selections (double-click, Shift+End,
501
+ // programmatic) still apply here.
502
+ if (tr.selectionSet &&
503
+ !newState.selection.empty &&
504
+ isFormatPainterArmed(newState) &&
505
+ !this.painterDragActive) {
401
506
  const applyTr = applyFormatPainter(newState);
402
507
  if (applyTr) {
403
508
  this.view.dispatch(applyTr);
@@ -1062,7 +1167,7 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
1062
1167
  /** Toggles raw-HTML source editing. Content re-sanitizes on the way back. */
1063
1168
  toggleSourceView() {
1064
1169
  if (this.sourceMode) {
1065
- this.applySourceView(this.sourceViewEl?.textarea?.value ?? null);
1170
+ this.applySourceView(this.sourceViewEl?.currentValue ?? null);
1066
1171
  }
1067
1172
  else {
1068
1173
  this.sourceMode = true;
@@ -1564,7 +1669,12 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
1564
1669
  this.closeMarkdownPanel(refocus);
1565
1670
  }
1566
1671
  render() {
1567
- const showToolbar = this.toolbar !== 'none' && !this.readonly && !this.sourceMode;
1672
+ const hasAuthoredToolbar = (this.authoredToolbar?.length ?? 0) > 0;
1673
+ // Keep the toolbar mounted in source mode too, so the main menu stays put
1674
+ // above the split source/preview view instead of being replaced by it. It
1675
+ // is disabled there — formatting commands would target the hidden rich-text
1676
+ // view — and the source view's own Cancel/Done bar handles exiting.
1677
+ const showToolbar = (this.toolbar !== 'none' || hasAuthoredToolbar) && !this.readonly;
1568
1678
  return html `
1569
1679
  <div
1570
1680
  class="nile-wysiwyg ${this.showBlocks ? 'nile-wysiwyg--show-blocks' : ''}"
@@ -1577,9 +1687,10 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
1577
1687
  ? html `
1578
1688
  <nile-wysiwyg-toolbar
1579
1689
  part="toolbar"
1580
- exportparts="button, select, color"
1690
+ exportparts="button, select, color, overflow, overflow-panel"
1581
1691
  config=${this.toolbar}
1582
- ?disabled=${this.disabled}
1692
+ .items=${this.authoredToolbar}
1693
+ ?disabled=${this.disabled || this.sourceMode}
1583
1694
  .toolbarState=${this.toolbarState}
1584
1695
  ></nile-wysiwyg-toolbar>
1585
1696
  `
@@ -1624,7 +1735,7 @@ let NileWysiwygEditor = class NileWysiwygEditor extends NileElement {
1624
1735
  this.closeShortcutHelp();
1625
1736
  }}
1626
1737
  ></nile-wysiwyg-shortcut-help>
1627
- <nile-wysiwyg-bubble-menu></nile-wysiwyg-bubble-menu>
1738
+ <nile-wysiwyg-bubble-menu .items=${this.authoredBubble}></nile-wysiwyg-bubble-menu>
1628
1739
  <nile-wysiwyg-table-menu></nile-wysiwyg-table-menu>
1629
1740
  <nile-wysiwyg-code-menu></nile-wysiwyg-code-menu>
1630
1741
  <nile-wysiwyg-image-menu></nile-wysiwyg-image-menu>
@@ -1803,6 +1914,12 @@ __decorate([
1803
1914
  __decorate([
1804
1915
  property({ type: String })
1805
1916
  ], NileWysiwygEditor.prototype, "toolbar", void 0);
1917
+ __decorate([
1918
+ state()
1919
+ ], NileWysiwygEditor.prototype, "authoredToolbar", void 0);
1920
+ __decorate([
1921
+ state()
1922
+ ], NileWysiwygEditor.prototype, "authoredBubble", void 0);
1806
1923
  __decorate([
1807
1924
  property({ type: Boolean, attribute: 'bubble-menu' })
1808
1925
  ], NileWysiwygEditor.prototype, "bubbleMenu", void 0);