kempo-ui 0.3.8 → 0.3.10

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 (248) hide show
  1. package/dist/components/CodeEditor.js +96 -0
  2. package/dist/components/HtmlEditor.js +155 -30
  3. package/dist/components/codeEditorControls/CodeEditorControl.js +17 -0
  4. package/dist/components/codeEditorControls/ControlGroup.js +12 -0
  5. package/dist/components/codeEditorControls/ControlSpacer.js +6 -0
  6. package/dist/components/codeEditorControls/CopyCode.js +9 -0
  7. package/dist/components/codeEditorControls/EditorTheme.js +26 -0
  8. package/dist/components/codeEditorControls/FindReplace.js +7 -0
  9. package/dist/components/codeEditorControls/FoldAll.js +7 -0
  10. package/dist/components/codeEditorControls/FontSize.js +13 -0
  11. package/dist/components/codeEditorControls/FormatCode.js +9 -0
  12. package/dist/components/codeEditorControls/Fullscreen.js +12 -0
  13. package/dist/components/codeEditorControls/LanguageSelect.js +15 -0
  14. package/dist/components/codeEditorControls/Minimap.js +8 -0
  15. package/dist/components/codeEditorControls/Redo.js +7 -0
  16. package/dist/components/codeEditorControls/Undo.js +7 -0
  17. package/dist/components/codeEditorControls/WordWrap.js +8 -0
  18. package/dist/components/htmlEditorControls/AlignCenter.js +4 -4
  19. package/dist/components/htmlEditorControls/AlignJustify.js +4 -4
  20. package/dist/components/htmlEditorControls/AlignLeft.js +4 -4
  21. package/dist/components/htmlEditorControls/AlignRight.js +4 -4
  22. package/dist/components/htmlEditorControls/Bold.js +4 -4
  23. package/dist/components/htmlEditorControls/BulletList.js +4 -4
  24. package/dist/components/htmlEditorControls/ClearFormatting.js +4 -4
  25. package/dist/components/htmlEditorControls/CodeBlock.js +2 -2
  26. package/dist/components/htmlEditorControls/ControlGroup.js +2 -4
  27. package/dist/components/htmlEditorControls/CreateLink.js +3 -3
  28. package/dist/components/htmlEditorControls/FormatBlock.js +4 -4
  29. package/dist/components/htmlEditorControls/FormatCode.js +1 -0
  30. package/dist/components/htmlEditorControls/HtmlEditorControl.js +2 -2
  31. package/dist/components/htmlEditorControls/InlineCode.js +2 -2
  32. package/dist/components/htmlEditorControls/InsertTable.js +3 -3
  33. package/dist/components/htmlEditorControls/Italic.js +4 -4
  34. package/dist/components/htmlEditorControls/Mode.js +3 -3
  35. package/dist/components/htmlEditorControls/NumberList.js +4 -4
  36. package/dist/components/htmlEditorControls/Strikethrough.js +4 -4
  37. package/dist/components/htmlEditorControls/TextBackgroundColor.js +1 -1
  38. package/dist/components/htmlEditorControls/TextColor.js +1 -1
  39. package/dist/components/htmlEditorControls/Underline.js +4 -4
  40. package/docs/components/accordion.html +2 -0
  41. package/docs/components/aside.html +2 -0
  42. package/docs/components/card.html +2 -0
  43. package/docs/components/code-editor.html +491 -0
  44. package/docs/components/color-picker.html +2 -0
  45. package/docs/components/content-slider.html +2 -0
  46. package/docs/components/context.html +2 -0
  47. package/docs/components/dialog.html +2 -0
  48. package/docs/components/dropdown.html +2 -0
  49. package/docs/components/filter-list.html +2 -0
  50. package/docs/components/focus-capture.html +2 -0
  51. package/docs/components/html-editor.html +525 -212
  52. package/docs/components/hybrid-component.html +2 -0
  53. package/docs/components/icon.html +2 -0
  54. package/docs/components/import.html +2 -0
  55. package/docs/components/light-component.html +2 -0
  56. package/docs/components/nav-spacer.html +2 -0
  57. package/docs/components/nav.html +2 -0
  58. package/docs/components/photo-viewer.html +2 -0
  59. package/docs/components/resize.html +2 -0
  60. package/docs/components/shadow-component.html +2 -0
  61. package/docs/components/show-more.html +2 -0
  62. package/docs/components/sortable.html +2 -0
  63. package/docs/components/spinner.html +2 -0
  64. package/docs/components/split.html +2 -0
  65. package/docs/components/table.html +2 -0
  66. package/docs/components/tableControls.html +2 -0
  67. package/docs/components/tableCustomFields.html +2 -0
  68. package/docs/components/tableFetchRecords.html +2 -0
  69. package/docs/components/tableFieldSortHide.html +2 -0
  70. package/docs/components/tablePagination.html +2 -0
  71. package/docs/components/tablePlaceholder.html +2 -0
  72. package/docs/components/tableRecordEditing.html +2 -0
  73. package/docs/components/tableRecordFiltering.html +2 -0
  74. package/docs/components/tableRecordHiding.html +2 -0
  75. package/docs/components/tableRecordSearching.html +2 -0
  76. package/docs/components/tableRecordSelection.html +2 -0
  77. package/docs/components/tableRowControls.html +2 -0
  78. package/docs/components/tableServerSync.html +2 -0
  79. package/docs/components/tableSorting.html +2 -0
  80. package/docs/components/tabs.html +2 -0
  81. package/docs/components/tags.html +2 -0
  82. package/docs/components/theme-select.html +2 -0
  83. package/docs/components/theme-switcher.html +2 -0
  84. package/docs/components/timestamp.html +2 -0
  85. package/docs/components/toast.html +2 -0
  86. package/docs/components/toggle.html +2 -0
  87. package/docs/components/tree.html +2 -0
  88. package/docs/icons/auto_fix_high.svg +1 -0
  89. package/docs/icons/content_copy.svg +1 -0
  90. package/docs/icons/contrast.svg +1 -0
  91. package/docs/icons/frame_source.svg +1 -0
  92. package/docs/icons/fullscreen.svg +1 -0
  93. package/docs/icons/fullscreen_exit.svg +1 -0
  94. package/docs/icons/map.svg +1 -0
  95. package/docs/icons/redo.svg +1 -0
  96. package/docs/icons/text_decrease.svg +1 -0
  97. package/docs/icons/text_increase.svg +1 -0
  98. package/docs/icons/undo.svg +1 -0
  99. package/docs/icons/unfold_less.svg +1 -0
  100. package/docs/icons/unfold_more.svg +1 -0
  101. package/docs/icons/wrap_text.svg +1 -0
  102. package/docs/index.html +8 -0
  103. package/docs/src/components/CodeEditor.js +96 -0
  104. package/docs/src/components/HtmlEditor.js +155 -30
  105. package/docs/src/components/codeEditorControls/CodeEditorControl.js +17 -0
  106. package/docs/src/components/codeEditorControls/ControlGroup.js +12 -0
  107. package/docs/src/components/codeEditorControls/ControlSpacer.js +6 -0
  108. package/docs/src/components/codeEditorControls/CopyCode.js +9 -0
  109. package/docs/src/components/codeEditorControls/EditorTheme.js +26 -0
  110. package/docs/src/components/codeEditorControls/FindReplace.js +7 -0
  111. package/docs/src/components/codeEditorControls/FoldAll.js +7 -0
  112. package/docs/src/components/codeEditorControls/FontSize.js +13 -0
  113. package/docs/src/components/codeEditorControls/FormatCode.js +9 -0
  114. package/docs/src/components/codeEditorControls/Fullscreen.js +12 -0
  115. package/docs/src/components/codeEditorControls/LanguageSelect.js +15 -0
  116. package/docs/src/components/codeEditorControls/Minimap.js +8 -0
  117. package/docs/src/components/codeEditorControls/Redo.js +7 -0
  118. package/docs/src/components/codeEditorControls/Undo.js +7 -0
  119. package/docs/src/components/codeEditorControls/WordWrap.js +8 -0
  120. package/docs/src/components/htmlEditorControls/AlignCenter.js +4 -4
  121. package/docs/src/components/htmlEditorControls/AlignJustify.js +4 -4
  122. package/docs/src/components/htmlEditorControls/AlignLeft.js +4 -4
  123. package/docs/src/components/htmlEditorControls/AlignRight.js +4 -4
  124. package/docs/src/components/htmlEditorControls/Bold.js +4 -4
  125. package/docs/src/components/htmlEditorControls/BulletList.js +4 -4
  126. package/docs/src/components/htmlEditorControls/ClearFormatting.js +4 -4
  127. package/docs/src/components/htmlEditorControls/CodeBlock.js +2 -2
  128. package/docs/src/components/htmlEditorControls/ControlGroup.js +2 -4
  129. package/docs/src/components/htmlEditorControls/CreateLink.js +3 -3
  130. package/docs/src/components/htmlEditorControls/FormatBlock.js +4 -4
  131. package/docs/src/components/htmlEditorControls/FormatCode.js +1 -0
  132. package/docs/src/components/htmlEditorControls/HtmlEditorControl.js +2 -2
  133. package/docs/src/components/htmlEditorControls/InlineCode.js +2 -2
  134. package/docs/src/components/htmlEditorControls/InsertTable.js +3 -3
  135. package/docs/src/components/htmlEditorControls/Italic.js +4 -4
  136. package/docs/src/components/htmlEditorControls/Mode.js +3 -3
  137. package/docs/src/components/htmlEditorControls/NumberList.js +4 -4
  138. package/docs/src/components/htmlEditorControls/Strikethrough.js +4 -4
  139. package/docs/src/components/htmlEditorControls/TextBackgroundColor.js +1 -1
  140. package/docs/src/components/htmlEditorControls/TextColor.js +1 -1
  141. package/docs/src/components/htmlEditorControls/Underline.js +4 -4
  142. package/docs/utils/context.html +2 -0
  143. package/docs/utils/cookie.html +2 -0
  144. package/docs/utils/debounce.html +2 -0
  145. package/docs/utils/drag.html +2 -0
  146. package/docs/utils/elevation.html +2 -0
  147. package/docs/utils/formatTimestamp.html +2 -0
  148. package/docs/utils/object.html +2 -0
  149. package/docs/utils/propConverters.html +2 -0
  150. package/docs/utils/string.html +2 -0
  151. package/docs/utils/theme.html +2 -0
  152. package/docs/utils/toTitleCase.html +2 -0
  153. package/docs/utils/type.html +2 -0
  154. package/docs/utils/wait.html +2 -0
  155. package/docs-src/components/code-editor.page.html +235 -0
  156. package/docs-src/components/html-editor.page.html +528 -214
  157. package/docs-src/index.page.html +6 -0
  158. package/docs-src/nav.fragment.html +2 -0
  159. package/icons/auto_fix_high.svg +1 -0
  160. package/icons/content_copy.svg +1 -0
  161. package/icons/contrast.svg +1 -0
  162. package/icons/frame_source.svg +1 -0
  163. package/icons/fullscreen.svg +1 -0
  164. package/icons/fullscreen_exit.svg +1 -0
  165. package/icons/map.svg +1 -0
  166. package/icons/redo.svg +1 -0
  167. package/icons/text_decrease.svg +1 -0
  168. package/icons/text_increase.svg +1 -0
  169. package/icons/undo.svg +1 -0
  170. package/icons/unfold_less.svg +1 -0
  171. package/icons/unfold_more.svg +1 -0
  172. package/icons/wrap_text.svg +1 -0
  173. package/llm.txt +2 -1
  174. package/package.json +3 -3
  175. package/src/components/CodeEditor.js +495 -0
  176. package/src/components/HtmlEditor.js +527 -152
  177. package/src/components/codeEditorControls/CodeEditorControl.js +134 -0
  178. package/src/components/codeEditorControls/ControlGroup.js +70 -0
  179. package/src/components/codeEditorControls/ControlSpacer.js +23 -0
  180. package/src/components/codeEditorControls/CopyCode.js +37 -0
  181. package/src/components/codeEditorControls/EditorTheme.js +81 -0
  182. package/src/components/codeEditorControls/FindReplace.js +35 -0
  183. package/src/components/codeEditorControls/FoldAll.js +49 -0
  184. package/src/components/codeEditorControls/FontSize.js +45 -0
  185. package/src/components/codeEditorControls/FormatCode.js +37 -0
  186. package/src/components/codeEditorControls/Fullscreen.js +72 -0
  187. package/src/components/codeEditorControls/LanguageSelect.js +74 -0
  188. package/src/components/codeEditorControls/Minimap.js +60 -0
  189. package/src/components/codeEditorControls/Redo.js +35 -0
  190. package/src/components/codeEditorControls/Undo.js +35 -0
  191. package/src/components/codeEditorControls/WordWrap.js +60 -0
  192. package/src/components/htmlEditorControls/AlignCenter.js +2 -4
  193. package/src/components/htmlEditorControls/AlignJustify.js +2 -4
  194. package/src/components/htmlEditorControls/AlignLeft.js +2 -4
  195. package/src/components/htmlEditorControls/AlignRight.js +2 -4
  196. package/src/components/htmlEditorControls/Bold.js +2 -4
  197. package/src/components/htmlEditorControls/BulletList.js +2 -4
  198. package/src/components/htmlEditorControls/ClearFormatting.js +2 -4
  199. package/src/components/htmlEditorControls/CodeBlock.js +3 -19
  200. package/src/components/htmlEditorControls/ControlGroup.js +16 -41
  201. package/src/components/htmlEditorControls/CreateLink.js +3 -5
  202. package/src/components/htmlEditorControls/FormatBlock.js +2 -4
  203. package/src/components/htmlEditorControls/FormatCode.js +7 -0
  204. package/src/components/htmlEditorControls/HtmlEditorControl.js +43 -5
  205. package/src/components/htmlEditorControls/InlineCode.js +3 -5
  206. package/src/components/htmlEditorControls/InsertTable.js +9 -53
  207. package/src/components/htmlEditorControls/Italic.js +2 -4
  208. package/src/components/htmlEditorControls/Mode.js +2 -0
  209. package/src/components/htmlEditorControls/NumberList.js +2 -4
  210. package/src/components/htmlEditorControls/Strikethrough.js +2 -4
  211. package/src/components/htmlEditorControls/TextBackgroundColor.js +0 -6
  212. package/src/components/htmlEditorControls/TextColor.js +0 -6
  213. package/src/components/htmlEditorControls/Underline.js +2 -4
  214. package/tests/components/CodeEditor.browser-test.js +297 -0
  215. package/tests/components/HtmlEditor.browser-test.js +207 -0
  216. package/tests/components/codeEditorControls/CopyCode.browser-test.js +57 -0
  217. package/tests/components/codeEditorControls/EditorTheme.browser-test.js +70 -0
  218. package/tests/components/codeEditorControls/FindReplace.browser-test.js +57 -0
  219. package/tests/components/codeEditorControls/FoldAll.browser-test.js +92 -0
  220. package/tests/components/codeEditorControls/FontSize.browser-test.js +74 -0
  221. package/tests/components/codeEditorControls/Fullscreen.browser-test.js +152 -0
  222. package/tests/components/codeEditorControls/LanguageSelect.browser-test.js +82 -0
  223. package/tests/components/codeEditorControls/Minimap.browser-test.js +84 -0
  224. package/tests/components/codeEditorControls/ModeVisibility.browser-test.js +82 -0
  225. package/tests/components/codeEditorControls/UndoRedo.browser-test.js +85 -0
  226. package/tests/components/codeEditorControls/WordWrap.browser-test.js +95 -0
  227. package/tests/components/htmlEditorControls/Align.browser-test.js +203 -0
  228. package/tests/components/htmlEditorControls/Bold.browser-test.js +127 -0
  229. package/tests/components/htmlEditorControls/BulletList.browser-test.js +127 -0
  230. package/tests/components/htmlEditorControls/CharacterCount.browser-test.js +106 -0
  231. package/tests/components/htmlEditorControls/ClearFormatting.browser-test.js +127 -0
  232. package/tests/components/htmlEditorControls/CodeBlock.browser-test.js +143 -0
  233. package/tests/components/htmlEditorControls/ControlGroup.browser-test.js +116 -0
  234. package/tests/components/htmlEditorControls/ControlSpacer.browser-test.js +69 -0
  235. package/tests/components/htmlEditorControls/CreateLink.browser-test.js +129 -0
  236. package/tests/components/htmlEditorControls/DropdownControl.browser-test.js +138 -0
  237. package/tests/components/htmlEditorControls/FormatBlock.browser-test.js +163 -0
  238. package/tests/components/htmlEditorControls/FormatCode.browser-test.js +155 -0
  239. package/tests/components/htmlEditorControls/InlineCode.browser-test.js +127 -0
  240. package/tests/components/htmlEditorControls/InsertTable.browser-test.js +129 -0
  241. package/tests/components/htmlEditorControls/Italic.browser-test.js +127 -0
  242. package/tests/components/htmlEditorControls/Mode.browser-test.js +138 -0
  243. package/tests/components/htmlEditorControls/NumberList.browser-test.js +127 -0
  244. package/tests/components/htmlEditorControls/Strikethrough.browser-test.js +127 -0
  245. package/tests/components/htmlEditorControls/TextBackgroundColor.browser-test.js +136 -0
  246. package/tests/components/htmlEditorControls/TextColor.browser-test.js +136 -0
  247. package/tests/components/htmlEditorControls/Underline.browser-test.js +127 -0
  248. package/tests/components/htmlEditorControls/WordCount.browser-test.js +106 -0
@@ -30,6 +30,7 @@
30
30
  <k-filter-item filter-keywords="accordion components"><a href="../components/accordion.html">Accordion<br><small>Component</small></a></k-filter-item>
31
31
  <k-filter-item filter-keywords="aside sidebar components"><a href="../components/aside.html">Aside<br><small>Component</small></a></k-filter-item>
32
32
  <k-filter-item filter-keywords="card components"><a href="../components/card.html">Card<br><small>Component</small></a></k-filter-item>
33
+ <k-filter-item filter-keywords="code editor codeeditor monaco components"><a href="../components/code-editor.html">Code Editor<br><small>Component</small></a></k-filter-item>
33
34
  <k-filter-item filter-keywords="color picker colorpicker components"><a href="../components/color-picker.html">Color Picker<br><small>Component</small></a></k-filter-item>
34
35
  <k-filter-item filter-keywords="content slider components"><a href="../components/content-slider.html">Content Slider<br><small>Component</small></a></k-filter-item>
35
36
  <k-filter-item filter-keywords="context state global components"><a href="../components/context.html">Context<br><small>Component</small></a></k-filter-item>
@@ -108,6 +109,7 @@
108
109
  <a href="../components/accordion.html">Accordion</a>
109
110
  <a href="../components/aside.html">Aside</a>
110
111
  <a href="../components/card.html">Card</a>
112
+ <a href="../components/code-editor.html">Code Editor</a>
111
113
  <a href="../components/color-picker.html">ColorPicker</a>
112
114
  <a href="../components/content-slider.html">Content Slider</a>
113
115
  <a href="../components/context.html">Context</a>
@@ -249,143 +251,264 @@
249
251
 
250
252
  <k-main>
251
253
 
252
- <k-accordion persistent-id="toc" class="b r mb">
254
+ <k-accordion
255
+ persistent-id="toc"
256
+ class="b r mb"
257
+ >
253
258
  <k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
254
259
  <k-accordion-panel name="toc-panel">
255
- <div class="m pl">
256
- <h6>Examples</h6>
257
- <a href="#fullExample">Complete Editor Example</a><br />
258
- <a href="#javascriptUsage">JavaScript API Example</a><br />
259
- <a href="#incompatibleContent">Incompatible Content Example</a><br />
260
- <a href="#customNodes">Custom Nodes Example</a><br />
261
-
262
- <h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
263
- <a href="#constructor">Constructor</a><br />
264
- <a href="#properties">Properties</a><br />
265
- <a href="#methods">Methods</a><br />
266
- <a href="#events">Events</a><br />
267
- </div>
268
- </k-accordion-panel>
260
+ <div class="m pl">
261
+ <h6>Examples</h6>
262
+ <a href="#fullExample">Complete Editor Example</a><br />
263
+ <a href="#incompatibleContent">Incompatible Content Example</a><br />
264
+ <a href="#customNodes">Custom Nodes Example</a><br />
265
+ <a href="#preConfigured">Pre-Configured Editors</a><br />
266
+ <a href="#height">Setting Height</a><br />
267
+ <a href="#javascriptUsage">JavaScript API Example</a><br />
268
+
269
+ <h6 class="mt"><a
270
+ href="#jsRef"
271
+ class="no-link"
272
+ >JavaScript Reference</a></h6>
273
+ <a href="#constructor">Constructor</a><br />
274
+ <a href="#properties">Properties</a><br />
275
+ <a href="#globalConfig">Global Configuration</a><br />
276
+ <a href="#methods">Methods</a><br />
277
+ <a href="#events">Events</a><br />
278
+ </div>
279
+ </k-accordion-panel>
269
280
  </k-accordion>
270
281
 
271
- <p>A WYSIWYG HTML editor component with support for visual and code editing modes, form integration, and extensive formatting capabilities.</p>
282
+ <p>A WYSIWYG HTML editor component with support for visual and code editing modes, form integration, and extensive
283
+ formatting capabilities.</p>
272
284
 
273
- <h3 id="fullExample"><a href="#fullExample" class="no-link">Complete Editor Example</a></h3>
285
+ <h3 id="fullExample"><a
286
+ href="#fullExample"
287
+ class="no-link"
288
+ >Complete Editor Example</a></h3>
274
289
  <p>A fully-featured editor with all controls. Copy and paste this example to get started quickly:</p>
290
+ <k-card label="HTML">
291
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&#x27;content&#x27;</span>&gt;</span><br> <span class="hljs-comment">&lt;!-- Text formatting --&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-left&#x27;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-bold</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-bold</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-italic</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-italic</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-underline</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-underline</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-strikethrough</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-strikethrough</span>&gt;</span><br> <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-inline-code</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-left&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-inline-code</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-dropdown</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-left&#x27;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-icon</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;icon&#x27;</span> <span class="hljs-attr">src</span>=<span class="hljs-string">&#x27;...&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-icon</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;label&#x27;</span>&gt;</span>Text Style<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">&#x27;p&#x27;</span>&gt;</span>Paragraph<span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-format-block</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">&#x27;h1&#x27;</span>&gt;</span>Heading 1<span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-format-block</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">&#x27;h2&#x27;</span>&gt;</span>Heading 2<span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-format-block</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">&#x27;h3&#x27;</span>&gt;</span>Heading 3<span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-format-block</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-code-block</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-code-block</span>&gt;</span><br> <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-dropdown</span>&gt;</span><br> <span class="hljs-comment">&lt;!-- Lists, alignment, colors, link, table --&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-left&#x27;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-bullet-list</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-bullet-list</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-number-list</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-number-list</span>&gt;</span><br> <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-left&#x27;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-align-left</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-align-left</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-align-center</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-align-center</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-align-right</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-align-right</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-align-justify</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-align-justify</span>&gt;</span><br> <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-left&#x27;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-text-color</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-text-color</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-text-background-color</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-text-background-color</span>&gt;</span><br> <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-clear-formatting</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-left&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-clear-formatting</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-left&#x27;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-create-link</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-create-link</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-insert-table</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-insert-table</span>&gt;</span><br> <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span><br> <span class="hljs-comment">&lt;!-- Mode toggle + format code --&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-right&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-mode</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-cec-format-code</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-right&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-cec-format-code</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-cec-fullscreen</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-right&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-cec-fullscreen</span>&gt;</span><br> <span class="hljs-comment">&lt;!-- Bottom toolbar stats --&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-word-count</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-bottom-left&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-word-count</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-character-count</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-bottom-left&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-character-count</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
292
+ </k-card>
293
+ <k-card label="Output">
294
+ <k-html-editor
295
+ class="b r"
296
+ value="<h3>Welcome to the HTML Editor</h3><p>This editor includes all formatting controls. Try selecting text and using the toolbar:</p><ul><li><b>Bold</b>, <i>italic</i>, <u>underline</u>, and <s>strikethrough</s></li><li>Text <span style='color: #e60000;'>colors</span> and <span style='background-color: #ffffcc;'>backgrounds</span></li><li>Lists, alignment, and <a href='#'>links</a></li><li>Format as <code>inline code</code> or code blocks</li></ul><p>Use the mode toggle to switch between visual and code editing.</p>"
297
+ style="height: 600px"
298
+ >
299
+ <k-hec-group slot="toolbar-top-left">
300
+ <k-hec-bold></k-hec-bold>
301
+ <k-hec-italic></k-hec-italic>
302
+ <k-hec-underline></k-hec-underline>
303
+ <k-hec-strikethrough></k-hec-strikethrough>
304
+ </k-hec-group>
305
+ <k-hec-inline-code slot="toolbar-top-left"></k-hec-inline-code>
306
+ <k-hec-dropdown slot="toolbar-top-left">
307
+ <k-icon
308
+ slot="icon"
309
+ name="format_paragraph"
310
+ ></k-icon>
311
+ <k-hec-format-block tag="p">Paragraph</k-hec-format-block>
312
+ <k-hec-format-block tag="h1">Heading 1</k-hec-format-block>
313
+ <k-hec-format-block tag="h2">Heading 2</k-hec-format-block>
314
+ <k-hec-format-block tag="h3">Heading 3</k-hec-format-block>
315
+ <k-hec-code-block>Code Block</k-hec-code-block>
316
+ </k-hec-dropdown>
317
+ <k-hec-group slot="toolbar-top-left">
318
+ <k-hec-bullet-list></k-hec-bullet-list>
319
+ <k-hec-number-list></k-hec-number-list>
320
+ </k-hec-group>
321
+ <k-hec-group slot="toolbar-top-left">
322
+ <k-hec-align-left></k-hec-align-left>
323
+ <k-hec-align-center></k-hec-align-center>
324
+ <k-hec-align-right></k-hec-align-right>
325
+ <k-hec-align-justify></k-hec-align-justify>
326
+ </k-hec-group>
327
+ <k-hec-group slot="toolbar-top-left">
328
+ <k-hec-text-color></k-hec-text-color>
329
+ <k-hec-text-background-color></k-hec-text-background-color>
330
+ </k-hec-group>
331
+ <k-hec-clear-formatting slot="toolbar-top-left"></k-hec-clear-formatting>
332
+ <k-hec-group slot="toolbar-top-left">
333
+ <k-hec-create-link></k-hec-create-link>
334
+ <k-hec-insert-table></k-hec-insert-table>
335
+ </k-hec-group>
336
+ <k-cec-format-code slot="toolbar-top-right"></k-cec-format-code>
337
+ <k-hec-mode slot="toolbar-top-right"></k-hec-mode>
338
+ <k-cec-fullscreen slot="toolbar-top-right"></k-cec-fullscreen>
339
+ <k-hec-word-count slot="toolbar-bottom-left"></k-hec-word-count>
340
+ <k-hec-character-count slot="toolbar-bottom-left"></k-hec-character-count>
341
+ </k-html-editor>
342
+ </k-card>
343
+
344
+
345
+ <h3 id="incompatibleContent"><a
346
+ href="#incompatibleContent"
347
+ class="no-link"
348
+ >Incompatible Content Example</a></h3>
349
+ <p>When the editor's value contains HTML that Lexical does not support (such as <code>&lt;svg&gt;</code>,
350
+ <code>&lt;script&gt;</code>, <code>&lt;style&gt;</code>, <code>&lt;video&gt;</code>, etc.), it automatically
351
+ defaults to code mode to preserve the content. If the user attempts to switch to visual mode, a confirmation
352
+ dialog warns that the incompatible code will be lost.
353
+ </p>
275
354
  <div class="row -mx">
276
355
  <div class="col m-span-12 px">
277
356
  <k-card label="HTML">
278
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"content"</span>&gt;</span>
279
- <span class="hljs-comment">&lt;!-- Text formatting --&gt;</span>
280
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>&gt;</span>
281
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-bold</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-bold</span>&gt;</span>
282
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-italic</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-italic</span>&gt;</span>
283
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-underline</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-underline</span>&gt;</span>
284
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-strikethrough</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-strikethrough</span>&gt;</span>
285
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span>
286
-
287
- <span class="hljs-comment">&lt;!-- Inline code --&gt;</span>
288
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-inline-code</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-inline-code</span>&gt;</span>
289
-
290
- <span class="hljs-comment">&lt;!-- Text style --&gt;</span>
291
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-dropdown</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>&gt;</span>
292
- <span class="hljs-tag">&lt;<span class="hljs-name">k-icon</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"icon"</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"..."</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-icon</span>&gt;</span>
293
- <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"label"</span>&gt;</span>Text Style<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>
294
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">"p"</span>&gt;</span>Paragraph<span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-format-block</span>&gt;</span>
295
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">"h1"</span>&gt;</span>Heading 1<span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-format-block</span>&gt;</span>
296
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">"h2"</span>&gt;</span>Heading 2<span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-format-block</span>&gt;</span>
297
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">"h3"</span>&gt;</span>Heading 3<span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-format-block</span>&gt;</span>
298
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-code-block</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-code-block</span>&gt;</span>
299
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-dropdown</span>&gt;</span>
300
-
301
- <span class="hljs-comment">&lt;!-- Lists --&gt;</span>
302
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>&gt;</span>
303
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-bullet-list</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-bullet-list</span>&gt;</span>
304
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-number-list</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-number-list</span>&gt;</span>
305
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span>
306
-
307
- <span class="hljs-comment">&lt;!-- Alignment --&gt;</span>
308
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>&gt;</span>
309
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-align-left</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-align-left</span>&gt;</span>
310
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-align-center</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-align-center</span>&gt;</span>
311
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-align-right</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-align-right</span>&gt;</span>
312
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-align-justify</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-align-justify</span>&gt;</span>
313
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span>
314
-
315
- <span class="hljs-comment">&lt;!-- Colors --&gt;</span>
316
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>&gt;</span>
317
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-text-color</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-text-color</span>&gt;</span>
318
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-text-background-color</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-text-background-color</span>&gt;</span>
319
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span>
320
-
321
- <span class="hljs-comment">&lt;!-- Clear formatting --&gt;</span>
322
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-clear-formatting</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-clear-formatting</span>&gt;</span>
323
-
324
- <span class="hljs-comment">&lt;!-- Link and table --&gt;</span>
325
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>&gt;</span>
326
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-create-link</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-create-link</span>&gt;</span>
327
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-insert-table</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-insert-table</span>&gt;</span>
328
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span>
329
-
330
- <span class="hljs-comment">&lt;!-- Spacer and mode toggle --&gt;</span>
331
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-spacer</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-spacer</span>&gt;</span>
332
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-mode</span>&gt;</span>
333
-
334
- <span class="hljs-comment">&lt;!-- Bottom toolbar stats --&gt;</span>
335
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-word-count</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-bottom"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-word-count</span>&gt;</span>
336
- <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-character-count</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-bottom"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-character-count</span>&gt;</span>
337
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
357
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">id</span>=<span class="hljs-string">svgEditor</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;...&quot;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-right&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-mode</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
338
358
  </k-card>
339
359
  </div>
340
360
  <div class="col m-span-12 px">
341
361
  <k-card label="Output">
342
- <k-html-editor class="b r" value="<h3>Welcome to the HTML Editor</h3><p>This editor includes all formatting controls. Try selecting text and using the toolbar:</p><ul><li><b>Bold</b>, <i>italic</i>, <u>underline</u>, and <s>strikethrough</s></li><li>Text <span style='color: #e60000;'>colors</span> and <span style='background-color: #ffffcc;'>backgrounds</span></li><li>Lists, alignment, and <a href='#'>links</a></li><li>Format as <code>inline code</code> or code blocks</li></ul><p>Use the mode toggle to switch between visual and code editing.</p>" style="height: 600px">
343
- <k-hec-group slot="toolbar-top">
344
- <k-hec-bold></k-hec-bold>
345
- <k-hec-italic></k-hec-italic>
346
- <k-hec-underline></k-hec-underline>
347
- <k-hec-strikethrough></k-hec-strikethrough>
348
- </k-hec-group>
349
- <k-hec-inline-code slot="toolbar-top"></k-hec-inline-code>
350
- <k-hec-dropdown slot="toolbar-top">
351
- <k-icon slot="icon" name="format_paragraph"></k-icon>
352
-
353
- <k-hec-format-block tag="p">Paragraph</k-hec-format-block>
354
- <k-hec-format-block tag="h1">Heading 1</k-hec-format-block>
355
- <k-hec-format-block tag="h2">Heading 2</k-hec-format-block>
356
- <k-hec-format-block tag="h3">Heading 3</k-hec-format-block>
357
- <k-hec-code-block>Code Block</k-hec-code-block>
358
- </k-hec-dropdown>
359
- <k-hec-group slot="toolbar-top">
360
- <k-hec-bullet-list></k-hec-bullet-list>
361
- <k-hec-number-list></k-hec-number-list>
362
- </k-hec-group>
363
- <k-hec-group slot="toolbar-top">
364
- <k-hec-align-left></k-hec-align-left>
365
- <k-hec-align-center></k-hec-align-center>
366
- <k-hec-align-right></k-hec-align-right>
367
- <k-hec-align-justify></k-hec-align-justify>
368
- </k-hec-group>
369
- <k-hec-group slot="toolbar-top">
370
- <k-hec-text-color></k-hec-text-color>
371
- <k-hec-text-background-color></k-hec-text-background-color>
372
- </k-hec-group>
373
- <k-hec-clear-formatting slot="toolbar-top"></k-hec-clear-formatting>
374
- <k-hec-group slot="toolbar-top">
375
- <k-hec-create-link></k-hec-create-link>
376
- <k-hec-insert-table></k-hec-insert-table>
377
- </k-hec-group>
378
- <k-hec-spacer slot="toolbar-top"></k-hec-spacer>
379
- <k-hec-mode slot="toolbar-top"></k-hec-mode>
380
- <k-hec-word-count slot="toolbar-bottom"></k-hec-word-count>
381
- <k-hec-character-count slot="toolbar-bottom"></k-hec-character-count>
362
+ <k-html-editor
363
+ id="svgEditor"
364
+ class="b r"
365
+ value="<p>This value contains an inline SVG which Lexical does not support:</p><svg width='120' height='60' xmlns='http://www.w3.org/2000/svg'><rect width='120' height='60' rx='8' fill='#4a90d9'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' fill='white' font-size='14'>SVG</text></svg><p>The editor detected incompatible content and defaulted to code mode automatically.</p>"
366
+ >
367
+ <k-hec-mode slot="toolbar-top-right"></k-hec-mode>
382
368
  </k-html-editor>
383
369
  </k-card>
384
370
  </div>
385
371
  </div>
386
372
 
387
- <h3 id="javascriptUsage"><a href="#javascriptUsage" class="no-link">JavaScript API Example</a></h3>
388
- <p>Use the editor without controls and interact with it programmatically using custom buttons and the JavaScript API:</p>
373
+ <h3 id="customNodes"><a
374
+ href="#customNodes"
375
+ class="no-link"
376
+ >Custom Nodes Example</a></h3>
377
+ <p>Custom nodes extend what Lexical understands in visual mode. Import a node file and list its name in the
378
+ <code>nodes</code> attribute (comma-separated filenames without <code>.js</code>). The built-in
379
+ <code>HtmlComment</code> node preserves HTML comments as inline visual chips rather than forcing code mode —
380
+ comments round-trip through the editor without being stripped.
381
+ </p>
382
+ <div class="row -mx">
383
+ <div class="col m-span-12 px">
384
+ <k-card label="HTML">
385
+ <pre><code class="hljs xml"><span class="hljs-comment">&lt;!-- Import the HtmlComment node --&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&#x27;module&#x27;</span> <span class="hljs-attr">src</span>=<span class="hljs-string">&#x27;src/components/htmlEditorNodes/HtmlComment.js&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span><br><span class="hljs-comment">&lt;!-- Register the node with nodes attribute --&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">nodes</span>=<span class="hljs-string">&#x27;HtmlComment&#x27;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&#x27;&lt;p&gt;This paragraph has an &lt;!-- important note --&gt; inline comment.&lt;/p&gt;&#x27;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top-right&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-mode</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
386
+ </k-card>
387
+ </div>
388
+ <div class="col m-span-12 px">
389
+ <k-card label="Output">
390
+ <script
391
+ type="module"
392
+ src="/src/components/htmlEditorNodes/HtmlComment.js"
393
+ ></script>
394
+ <k-html-editor
395
+ id="commentEditor"
396
+ class="b r"
397
+ nodes="HtmlComment"
398
+ value="<p>This paragraph has an <!-- important note --> inline comment.</p>"
399
+ >
400
+ <k-hec-mode slot="toolbar-top-right"></k-hec-mode>
401
+ </k-html-editor>
402
+ </k-card>
403
+ </div>
404
+ </div>
405
+
406
+ <h3 id="preConfigured"><a
407
+ href="#preConfigured"
408
+ class="no-link"
409
+ >Pre-Configured Editors</a></h3>
410
+ <p>The <code>controls</code> attribute lets you opt into a built-in toolbar without writing any slot markup. Set it
411
+ directly on <code>&lt;k-html-editor&gt;</code> to one of the four levels below.</p>
412
+ <p>The four toolbar slots — <code>toolbar-top-left</code>, <code>toolbar-top-right</code>,
413
+ <code>toolbar-bottom-left</code>, <code>toolbar-bottom-right</code> — all have slot fallback content driven by
414
+ the <code>controls</code> value. Providing your own child element for any of these slots replaces just that
415
+ section while leaving the others intact.
416
+ </p>
417
+
418
+ <h4>controls="full"</h4>
419
+ <p>Every available control: text formatting, inline code, text-style dropdown (p, h1–h3, blockquote, code block),
420
+ lists, alignment (with justify), text and background colours, clear formatting, link, table insertion, mode
421
+ toggle, and word/character count.</p>
422
+ <k-card label="HTML">
423
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">controls</span>=<span class="hljs-string">&quot;full&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
424
+ </k-card>
425
+ <k-card label="Output">
426
+ <k-html-editor
427
+ controls="full"
428
+ class="b r"
429
+ style="height:500px"
430
+ value="<h3>Full Editor</h3><p>All controls are pre-configured — just drop in the tag.</p>"
431
+ ></k-html-editor>
432
+ </k-card>
433
+
434
+ <h4>controls="normal"</h4>
435
+ <p>A balanced everyday toolbar: bold, italic, underline, strikethrough, inline code, text-style dropdown, lists,
436
+ alignment, link, and mode toggle. Word count shown in the bottom bar.</p>
437
+ <div class="row -mx">
438
+ <div class="col m-span-12 px">
439
+ <k-card label="HTML">
440
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">controls</span>=<span class="hljs-string">&quot;normal&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
441
+ </k-card>
442
+ </div>
443
+ <div class="col m-span-12 px">
444
+ <k-card label="Output">
445
+ <k-html-editor
446
+ class="b r"
447
+ controls="normal"
448
+ value="<p>Normal editor with a balanced set of controls.</p>"
449
+ ></k-html-editor>
450
+ </k-card>
451
+ </div>
452
+ </div>
453
+
454
+ <h4>controls="minimal"</h4>
455
+ <p>Essential controls only: bold, italic, underline, bullet list, numbered list, and mode toggle. Ideal for simple
456
+ content forms.</p>
457
+ <div class="row -mx">
458
+ <div class="col m-span-12 px">
459
+ <k-card label="HTML">
460
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">controls</span>=<span class="hljs-string">&quot;minimal&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
461
+ </k-card>
462
+ </div>
463
+ <div class="col m-span-12 px">
464
+ <k-card label="Output">
465
+ <k-html-editor
466
+ controls="minimal"
467
+ class="b r"
468
+ value="<p>Minimal editor with only the essential controls.</p>"
469
+ ></k-html-editor>
470
+ </k-card>
471
+ </div>
472
+ </div>
473
+
474
+ <p>All <code>controls</code> levels share the full JavaScript API — <code>getValue()</code>,
475
+ <code>setValue()</code>, <code>bold()</code>, etc. You can still target any individual section by slotting a child
476
+ into the relevant named slot.
477
+ </p>
478
+
479
+ <p>Slots available for custom content:
480
+ <code>toolbar-top-left</code>, <code>toolbar-top-right</code>,
481
+ <code>toolbar-bottom-left</code>, <code>toolbar-bottom-right</code>.
482
+ </p>
483
+
484
+ <h3 id="height"><a
485
+ href="#height"
486
+ class="no-link"
487
+ >Setting Height</a></h3>
488
+ <p>The default height is <code>400px</code>. Override it with an inline style or CSS class on the element:</p>
489
+ <div class="row -mx">
490
+ <div class="col m-span-12 px">
491
+ <k-card label="HTML">
492
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">style</span>=<span class="hljs-string">&#x27;height: 500px&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
493
+ </k-card>
494
+ </div>
495
+ <div class="col m-span-12 px">
496
+ <k-card label="Output">
497
+ <k-html-editor
498
+ class="b r"
499
+ style="height: 500px"
500
+ value="<p>Height set to 500px via style attribute.</p>"
501
+ ></k-html-editor>
502
+ </k-card>
503
+ </div>
504
+ </div>
505
+
506
+ <h3 id="javascriptUsage"><a
507
+ href="#javascriptUsage"
508
+ class="no-link"
509
+ >JavaScript API Example</a></h3>
510
+ <p>Use the editor without controls and interact with it programmatically using custom buttons and the JavaScript
511
+ API:</p>
389
512
  <div class="row -mx">
390
513
  <div class="col m-span-12 px">
391
514
  <k-card label="HTML">
@@ -428,17 +551,20 @@
428
551
  <button onclick="insertMyEditorHTML()">Insert</button>
429
552
  <button onclick="getMyEditorContent()">Get Value</button>
430
553
  </div>
431
- <k-html-editor id="myEditor" class="b r"></k-html-editor>
554
+ <k-html-editor
555
+ id="myEditor"
556
+ class="b r"
557
+ ></k-html-editor>
432
558
  <script>
433
559
  const myEditor = document.getElementById('myEditor');
434
560
  myEditor.addEventListener('ready', () => {
435
561
  myEditor.setValue('<p>Select text and use the buttons above to format it!</p><p>The editor works without any built-in controls - you have full control via JavaScript.</p>');
436
562
  });
437
-
563
+
438
564
  function insertMyEditorHTML() {
439
565
  myEditor.insertHTML('<p><b>Inserted content!</b></p>');
440
566
  }
441
-
567
+
442
568
  function getMyEditorContent() {
443
569
  alert(myEditor.getValue());
444
570
  }
@@ -447,51 +573,23 @@
447
573
  </div>
448
574
  </div>
449
575
 
450
- <h3 id="incompatibleContent"><a href="#incompatibleContent" class="no-link">Incompatible Content Example</a></h3>
451
- <p>When the editor's value contains HTML that Lexical does not support (such as <code>&lt;svg&gt;</code>, <code>&lt;script&gt;</code>, <code>&lt;style&gt;</code>, <code>&lt;video&gt;</code>, etc.), it automatically defaults to code mode to preserve the content. If the user attempts to switch to visual mode, a confirmation dialog warns that the incompatible code will be lost.</p>
452
- <div class="row -mx">
453
- <div class="col m-span-12 px">
454
- <k-card label="HTML">
455
- <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;svgEditor&quot;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;&lt;p&gt;This value contains an inline SVG which Lexical does not support:&lt;/p&gt;&lt;svg width=&#x27;120&#x27; height=&#x27;60&#x27; xmlns=&#x27;http://www.w3.org/2000/svg&#x27;&gt;&lt;rect width=&#x27;120&#x27; height=&#x27;60&#x27; rx=&#x27;8&#x27; fill=&#x27;#4a90d9&#x27;/&gt;&lt;text x=&#x27;50%&#x27; y=&#x27;50%&#x27; dominant-baseline=&#x27;middle&#x27; text-anchor=&#x27;middle&#x27; fill=&#x27;white&#x27; font-size=&#x27;14&#x27;&gt;SVG&lt;/text&gt;&lt;/svg&gt;&lt;p&gt;The editor detected incompatible content and defaulted to code mode automatically.&lt;/p&gt;&quot;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-spacer</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&quot;toolbar-top&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-spacer</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&quot;toolbar-top&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-mode</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
456
- </k-card>
457
- </div>
458
- <div class="col m-span-12 px">
459
- <k-card label="Output">
460
- <k-html-editor id="svgEditor" class="b r" value="<p>This value contains an inline SVG which Lexical does not support:</p><svg width='120' height='60' xmlns='http://www.w3.org/2000/svg'><rect width='120' height='60' rx='8' fill='#4a90d9'/><text x='50%' y='50%' dominant-baseline='middle' text-anchor='middle' fill='white' font-size='14'>SVG</text></svg><p>The editor detected incompatible content and defaulted to code mode automatically.</p>">
461
- <k-hec-spacer slot="toolbar-top"></k-hec-spacer>
462
- <k-hec-mode slot="toolbar-top"></k-hec-mode>
463
- </k-html-editor>
464
- </k-card>
465
- </div>
466
- </div>
576
+ <h2 id="jsRef"><a
577
+ href="#jsRef"
578
+ class="no-link"
579
+ >JavaScript Reference</a></h2>
467
580
 
468
- <h3 id="customNodes"><a href="#customNodes" class="no-link">Custom Nodes Example</a></h3>
469
- <p>Custom nodes extend what Lexical understands in visual mode. Import a node file and list its name in the <code>nodes</code> attribute (comma-separated filenames without <code>.js</code>). The built-in <code>HtmlComment</code> node preserves HTML comments as inline visual chips rather than forcing code mode — comments round-trip through the editor without being stripped.</p>
470
- <div class="row -mx">
471
- <div class="col m-span-12 px">
472
- <k-card label="HTML">
473
- <pre><code class="hljs xml"><span class="hljs-comment">&lt;!-- Import the HtmlComment node --&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&#x27;module&#x27;</span> <span class="hljs-attr">src</span>=<span class="hljs-string">&#x27;src/components/htmlEditorNodes/HtmlComment.js&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span><br><span class="hljs-comment">&lt;!-- Register the node with nodes attribute --&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">nodes</span>=<span class="hljs-string">&#x27;HtmlComment&#x27;</span> <span class="hljs-attr">value</span>=<span class="hljs-string">&#x27;&lt;p&gt;This paragraph has an &lt;!-- important note --&gt; inline comment.&lt;/p&gt;&#x27;</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-spacer</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-spacer</span>&gt;</span><br> <span class="hljs-tag">&lt;<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">&#x27;toolbar-top&#x27;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-mode</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
474
- </k-card>
475
- </div>
476
- <div class="col m-span-12 px">
477
- <k-card label="Output">
478
- <script type="module" src="/src/components/htmlEditorNodes/HtmlComment.js"></script>
479
- <k-html-editor id="commentEditor" class="b r" nodes="HtmlComment" value="<p>This paragraph has an <!-- important note --> inline comment.</p>">
480
- <k-hec-spacer slot="toolbar-top"></k-hec-spacer>
481
- <k-hec-mode slot="toolbar-top"></k-hec-mode>
482
- </k-html-editor>
483
- </k-card>
484
- </div>
485
- </div>
486
-
487
- <h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
488
-
489
- <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
581
+ <h3 id="constructor"><a
582
+ href="#constructor"
583
+ class="no-link"
584
+ >Constructor</a></h3>
490
585
  <p><code>new HtmlEditor()</code></p>
491
586
  <p>Extends <code>ShadowComponent</code> which extends <code>LitElement</code>.</p>
492
587
 
493
- <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
494
-
588
+ <h3 id="properties"><a
589
+ href="#properties"
590
+ class="no-link"
591
+ >Properties</a></h3>
592
+
495
593
  <h5><code>name<i>: String</i></code></h5>
496
594
  <p>The name attribute for form submission.</p>
497
595
 
@@ -499,20 +597,87 @@
499
597
  <p>The HTML content of the editor. Can be get or set via JavaScript or HTML attribute.</p>
500
598
 
501
599
  <h5><code>mode<i>: String</i></code></h5>
502
- <p>Current editing mode. Either <code>'visual'</code> (WYSIWYG) or <code>'code'</code> (raw HTML). Default: <code>'visual'</code>. If the initial <code>value</code> contains content that is incompatible with the visual editor (such as <code>&lt;svg&gt;</code>, <code>&lt;script&gt;</code>, <code>&lt;style&gt;</code>, etc.), the editor automatically switches to <code>'code'</code> mode to preserve the content. Custom nodes can extend what is considered compatible by defining a static <code>isVisualCompatible(domNode)</code> method.</p>
600
+ <p>Current editing mode. Either <code>'visual'</code> (WYSIWYG) or <code>'code'</code> (raw HTML). Default:
601
+ <code>'visual'</code>. If the initial <code>value</code> contains content that is incompatible with the visual
602
+ editor (such as <code>&lt;svg&gt;</code>, <code>&lt;script&gt;</code>, <code>&lt;style&gt;</code>, etc.), the
603
+ editor automatically switches to <code>'code'</code> mode to preserve the content. Custom nodes can extend what is
604
+ considered compatible by defining a static <code>isVisualCompatible(domNode)</code> method.
605
+ </p>
606
+
607
+ <h5><code>controls<i>: String</i></code></h5>
608
+ <p>Activates a built-in toolbar. Accepted values:</p>
609
+ <ul>
610
+ <li><code>'none'</code> (default) — no built-in toolbar; use named slots to build your own</li>
611
+ <li><code>'minimal'</code> — bold, italic, underline, lists, mode toggle</li>
612
+ <li><code>'normal'</code> — adds strikethrough, inline code, text-style dropdown, alignment, link, word count</li>
613
+ <li><code>'full'</code> — every available control including colours, clear formatting, table insertion, and
614
+ character count</li>
615
+ </ul>
616
+ <p>The built-in controls appear as slot fallback content in the six toolbar slots. Providing your own child with a
617
+ matching slot name for any section replaces just that section's defaults.</p>
503
618
 
504
619
  <h5><code>nodes<i>: String</i></code></h5>
505
- <p>Comma-separated list of custom Lexical node module filenames (without <code>.js</code>) to load from the <code>htmlEditorNodes/</code> directory. Custom nodes can define two static hooks:</p>
620
+ <p>Comma-separated list of custom Lexical node module filenames (without <code>.js</code>) to load from the
621
+ <code>htmlEditorNodes/</code> directory. Custom nodes can define two static hooks:
622
+ </p>
506
623
  <ul>
507
- <li><code>isVisualCompatible(domNode)</code> — returns <code>true</code> if the node handles a DOM construct that would otherwise be considered incompatible (e.g., HTML comments)</li>
508
- <li><code>preprocessHtml(htmlString)</code> transforms raw HTML before Lexical parses it (e.g., converting <code>&lt;!-- --&gt;</code> to a parseable <code>&lt;span&gt;</code>)</li>
624
+ <li><code>isVisualCompatible(domNode)</code> — returns <code>true</code> if the node handles a DOM construct that
625
+ would otherwise be considered incompatible (e.g., HTML comments)</li>
626
+ <li><code>preprocessHtml(htmlString)</code> — transforms raw HTML before Lexical parses it (e.g., converting
627
+ <code>&lt;!-- --&gt;</code> to a parseable <code>&lt;span&gt;</code>)
628
+ </li>
509
629
  </ul>
510
630
 
511
- <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
631
+ <h5><code>lexical-src<i>: String</i></code></h5>
632
+ <p>Base URL for loading Lexical modules on this specific editor instance. When set, this overrides both the global
633
+ <code>window.kempo.lexicalUrl</code> config and the built-in CDN default. See <a href="#globalConfig">Global
634
+ Configuration</a> for the full resolution order.
635
+ </p>
636
+
637
+ <h5><code>monaco-src<i>: String</i></code></h5>
638
+ <p>Base URL for loading the Monaco editor on this specific editor instance. When set, this overrides both the global
639
+ <code>window.kempo.monacoUrl</code> config and the built-in CDN default. See <a href="#globalConfig">Global
640
+ Configuration</a> for the full resolution order.
641
+ </p>
642
+
643
+ <h3 id="globalConfig"><a
644
+ href="#globalConfig"
645
+ class="no-link"
646
+ >Global Configuration</a></h3>
647
+ <p>The editor resolves dependency URLs in the following priority order (highest to lowest):</p>
648
+ <ol>
649
+ <li><strong>Element attribute</strong> — <code>lexical-src</code> / <code>monaco-src</code> on the element itself
650
+ </li>
651
+ <li><strong>Global config</strong> — <code>window.kempo.lexicalUrl</code> / <code>window.kempo.monacoUrl</code>
652
+ </li>
653
+ <li><strong>CDN fallback</strong> — <code>https://esm.sh</code> (Lexical) and
654
+ <code>https://cdn.jsdelivr.net/npm/monaco-editor@…/min</code> (Monaco)
655
+ </li>
656
+ </ol>
657
+ <p>Set the global config before any <code>&lt;k-html-editor&gt;</code> initialises to apply a custom URL site-wide.
658
+ This is useful when you have installed the packages locally via <code>npm install lexical</code> or
659
+ <code>npm install monaco-editor</code> and serve them yourself:
660
+ </p>
661
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
662
+ <span class="hljs-keyword">window</span>.kempo = <span class="hljs-keyword">window</span>.kempo || {};
663
+ <span class="hljs-comment">// Point to your locally served Lexical modules (must be an esm.sh-compatible base URL)</span>
664
+ <span class="hljs-keyword">window</span>.kempo.lexicalUrl = <span class="hljs-string">'/node_modules'</span>;
665
+ <span class="hljs-comment">// Point to your locally served Monaco build</span>
666
+ <span class="hljs-keyword">window</span>.kempo.monacoUrl = <span class="hljs-string">'/node_modules/monaco-editor/min'</span>;
667
+ </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
668
+ <p>The per-element attributes take precedence over the global config, so you can mix strategies — e.g., use a local
669
+ Lexical build globally while one specific editor still points to a CDN via its <code>lexical-src</code> attribute.
670
+ </p>
671
+
672
+ <h3 id="methods"><a
673
+ href="#methods"
674
+ class="no-link"
675
+ >Methods</a></h3>
512
676
 
513
677
  <h4>Mode Control</h4>
514
678
  <h5><code>setMode(mode)<i>: this</i></code></h5>
515
- <p>Set the editing mode. Accepts <code>'visual'</code> or <code>'code'</code>. If switching to <code>'visual'</code> and the current content is incompatible, a confirmation dialog warns that incompatible code will be lost.</p>
679
+ <p>Set the editing mode. Accepts <code>'visual'</code> or <code>'code'</code>. If switching to <code>'visual'</code>
680
+ and the current content is incompatible, a confirmation dialog warns that incompatible code will be lost.</p>
516
681
 
517
682
  <h5><code>toggleMode()<i>: this</i></code></h5>
518
683
  <p>Toggle between visual and code modes. Same incompatibility warning applies when switching to visual mode.</p>
@@ -522,7 +687,8 @@
522
687
  <p>Returns the current HTML content.</p>
523
688
 
524
689
  <h5><code>setValue(html)<i>: this</i></code></h5>
525
- <p>Sets the HTML content of the editor. If the editor is in visual mode and the new content is incompatible, automatically switches to code mode.</p>
690
+ <p>Sets the HTML content of the editor. If the editor is in visual mode and the new content is incompatible,
691
+ automatically switches to code mode.</p>
526
692
 
527
693
  <h5><code>clear()<i>: this</i></code></h5>
528
694
  <p>Clears all content from the editor.</p>
@@ -592,34 +758,41 @@
592
758
  <li><code>rows</code> - Number of rows to create</li>
593
759
  <li><code>columns</code> - Number of columns to create</li>
594
760
  <li><code>includeHeaders</code> - Boolean indicating whether to include header row (default: false)</li>
595
- <li><code>cellData</code> - Optional 2D array of cell content. If provided, rows/columns are determined from array dimensions</li>
761
+ <li><code>cellData</code> - Optional 2D array of cell content. If provided, rows/columns are determined from array
762
+ dimensions</li>
596
763
  </ul>
597
764
 
598
765
  <h5><code>insertElementAtCursor(element, selectAfter)<i>: this</i></code></h5>
599
766
  <p>Inserts a DOM element at the cursor position or replaces selection.</p>
600
767
  <ul>
601
768
  <li><code>element</code> - DOM element to insert</li>
602
- <li><code>selectAfter</code> - Boolean indicating whether to select the inserted element after insertion (default: true)</li>
769
+ <li><code>selectAfter</code> - Boolean indicating whether to select the inserted element after insertion (default:
770
+ true)</li>
603
771
  </ul>
604
772
 
605
773
  <h5><code>replaceSelectionWithElement(element, selectAfter)<i>: this</i></code></h5>
606
774
  <p>Replaces the current selection with a DOM element.</p>
607
775
  <ul>
608
776
  <li><code>element</code> - DOM element to insert</li>
609
- <li><code>selectAfter</code> - Boolean indicating whether to select the inserted element after replacement (default: true)</li>
777
+ <li><code>selectAfter</code> - Boolean indicating whether to select the inserted element after replacement
778
+ (default: true)</li>
610
779
  </ul>
611
780
 
612
781
  <h5><code>wrapSelection(before, after, savedSelection)<i>: this</i></code></h5>
613
- <p>Wraps the selected text with HTML tags. Handles complex cases like unwrapping existing tags and preventing nested pre tags.</p>
782
+ <p>Wraps the selected text with HTML tags. Handles complex cases like unwrapping existing tags and preventing nested
783
+ pre tags.</p>
614
784
  <ul>
615
785
  <li><code>before</code> - Opening HTML tag(s) to wrap with</li>
616
786
  <li><code>after</code> - Closing HTML tag(s) to wrap with</li>
617
- <li><code>savedSelection</code> - Optional previously saved selection text to use instead of current selection</li>
787
+ <li><code>savedSelection</code> - Optional previously saved selection text to use instead of current selection
788
+ </li>
618
789
  </ul>
619
790
 
620
791
  <h4>Selection Management</h4>
621
792
  <h5><code>getSelection()<i>: Object | null</i></code></h5>
622
- <p>Returns an object containing information about the current selection: <code>{ text, html, range, selection }</code></p>
793
+ <p>Returns an object containing information about the current selection:
794
+ <code>{ text, html, range, selection }</code>
795
+ </p>
623
796
 
624
797
  <h5><code>getSelectedText()<i>: String</i></code></h5>
625
798
  <p>Returns the plain text of the current selection.</p>
@@ -640,7 +813,8 @@
640
813
  <p>Deletes the currently selected content.</p>
641
814
 
642
815
  <h5><code>getValueWithSelectionMarkers()<i>: Object</i></code></h5>
643
- <p>Returns the editor content with special Unicode markers indicating cursor position or selection boundaries. Useful for preserving selection state during content transformations.</p>
816
+ <p>Returns the editor content with special Unicode markers indicating cursor position or selection boundaries.
817
+ Useful for preserving selection state during content transformations.</p>
644
818
  <p>Returns object with properties:</p>
645
819
  <ul>
646
820
  <li><code>html</code> - HTML content with markers inserted</li>
@@ -653,10 +827,13 @@
653
827
  </ul>
654
828
 
655
829
  <h5><code>setValueFromSelectionMarkers(html, markers)<i>: this</i></code></h5>
656
- <p>Sets editor content and restores cursor/selection from Unicode markers. Companion method to <code>getValueWithSelectionMarkers()</code>.</p>
830
+ <p>Sets editor content and restores cursor/selection from Unicode markers. Companion method to
831
+ <code>getValueWithSelectionMarkers()</code>.
832
+ </p>
657
833
  <ul>
658
834
  <li><code>html</code> - HTML content containing marker characters</li>
659
- <li><code>markers</code> - Object with marker information (hasCursor, hasSelection, cursorMarker, selectionStart, selectionEnd)</li>
835
+ <li><code>markers</code> - Object with marker information (hasCursor, hasSelection, cursorMarker, selectionStart,
836
+ selectionEnd)</li>
660
837
  </ul>
661
838
 
662
839
  <h4>Links and Media</h4>
@@ -671,52 +848,188 @@
671
848
 
672
849
  <h4>History</h4>
673
850
  <h5><code>undo()<i>: this</i></code></h5>
674
- <p>Undoes the last action.</p>
851
+ <p>Undoes the last action. Works in both visual mode (Lexical) and code mode (Monaco).</p>
675
852
 
676
853
  <h5><code>redo()<i>: this</i></code></h5>
677
- <p>Redoes the last undone action.</p>
854
+ <p>Redoes the last undone action. Works in both visual mode (Lexical) and code mode (Monaco).</p>
855
+
856
+ <h4>Code Editor Controls</h4>
857
+ <p>These methods control the Monaco code editor and are available in code mode. When used with
858
+ <code>controls="full"</code>, the toolbar exposes buttons for these automatically.
859
+ </p>
860
+
861
+ <h5><code>copyToClipboard()<i>: this</i></code></h5>
862
+ <p>Copies the full editor content to the clipboard.</p>
863
+
864
+ <h5><code>setEditorTheme(theme)<i>: this</i></code></h5>
865
+ <p>Sets the Monaco editor theme. Accepts <code>'auto'</code>, <code>'light'</code>, or <code>'dark'</code>.</p>
866
+
867
+ <h5><code>openFind()<i>: this</i></code></h5>
868
+ <p>Opens the Monaco Find &amp; Replace widget.</p>
869
+
870
+ <h5><code>foldAll()<i>: this</i></code></h5>
871
+ <p>Folds all collapsible regions in the code editor.</p>
872
+
873
+ <h5><code>unfoldAll()<i>: this</i></code></h5>
874
+ <p>Unfolds all collapsed regions in the code editor.</p>
875
+
876
+ <h5><code>increaseFontSize()<i>: this</i></code></h5>
877
+ <p>Increases the code editor font size by 2px (max 40px).</p>
878
+
879
+ <h5><code>decreaseFontSize()<i>: this</i></code></h5>
880
+ <p>Decreases the code editor font size by 2px (min 8px).</p>
881
+
882
+ <h5><code>setWordWrap(enabled)<i>: this</i></code></h5>
883
+ <p>Enables or disables word wrapping in the code editor.</p>
884
+
885
+ <h5><code>setMinimap(enabled)<i>: this</i></code></h5>
886
+ <p>Shows or hides the minimap in the code editor.</p>
887
+
888
+ <h5><code>resolveMonacoTheme()<i>: String</i></code></h5>
889
+ <p>Returns the resolved Monaco theme string (<code>'vs'</code> or <code>'vs-dark'</code>) based on the current
890
+ <code>editorTheme</code> setting.
891
+ </p>
678
892
 
679
- <h3 id="events"><a href="#events" class="no-link">Events</a></h3>
893
+ <h3 id="events"><a
894
+ href="#events"
895
+ class="no-link"
896
+ >Events</a></h3>
680
897
 
681
898
  <h5><code>change</code></h5>
682
899
  <p>Dispatched when the content changes. Event detail: <code>{ value: String }</code></p>
683
900
 
684
901
  <h5><code>mode-changed</code></h5>
685
- <p>Dispatched when the editing mode changes between 'visual' and 'code'. Event detail: <code>{ mode: String }</code></p>
902
+ <p>Dispatched when the editing mode changes between 'visual' and 'code'. Event detail: <code>{ mode: String }</code>
903
+ </p>
686
904
 
687
905
  </k-main>
688
906
  <div style="height:33vh"></div>
689
907
  <script type="module" src="../src/components/Main.js"></script>
690
908
 
691
- <script type="module" src="../src/components/HtmlEditor.js"></script>
692
- <script type="module" src="../src/components/Dropdown.js"></script>
693
- <script type="module" src="../src/components/htmlEditorControls/Bold.js"></script>
694
- <script type="module" src="../src/components/htmlEditorControls/Italic.js"></script>
695
- <script type="module" src="../src/components/htmlEditorControls/Underline.js"></script>
696
- <script type="module" src="../src/components/htmlEditorControls/Strikethrough.js"></script>
697
- <script type="module" src="../src/components/htmlEditorControls/BulletList.js"></script>
698
- <script type="module" src="../src/components/htmlEditorControls/NumberList.js"></script>
699
- <script type="module" src="../src/components/htmlEditorControls/AlignLeft.js"></script>
700
- <script type="module" src="../src/components/htmlEditorControls/AlignCenter.js"></script>
701
- <script type="module" src="../src/components/htmlEditorControls/AlignRight.js"></script>
702
- <script type="module" src="../src/components/htmlEditorControls/AlignJustify.js"></script>
703
- <script type="module" src="../src/components/htmlEditorControls/CreateLink.js"></script>
704
- <script type="module" src="../src/components/htmlEditorControls/Mode.js"></script>
705
- <script type="module" src="../src/components/htmlEditorControls/DropdownControl.js"></script>
706
- <script type="module" src="../src/components/htmlEditorControls/FormatBlock.js"></script>
707
- <script type="module" src="../src/components/htmlEditorControls/InlineCode.js"></script>
708
- <script type="module" src="../src/components/htmlEditorControls/CodeBlock.js"></script>
709
- <script type="module" src="../src/components/htmlEditorControls/ControlGroup.js"></script>
710
- <script type="module" src="../src/components/htmlEditorControls/ControlSpacer.js"></script>
711
- <script type="module" src="../src/components/htmlEditorControls/TextColor.js"></script>
712
- <script type="module" src="../src/components/htmlEditorControls/TextBackgroundColor.js"></script>
713
- <script type="module" src="../src/components/htmlEditorControls/ClearFormatting.js"></script>
714
- <script type="module" src="../src/components/htmlEditorControls/WordCount.js"></script>
715
- <script type="module" src="../src/components/htmlEditorControls/CharacterCount.js"></script>
716
- <script type="module" src="../src/components/htmlEditorControls/InsertTable.js"></script>
717
- <script type="module" src="../src/components/Resize.js"></script>
718
- <script type="module" src="../src/components/Accordion.js"></script>
719
- <script type="module" src="../src/components/Card.js"></script>
909
+ <script
910
+ type="module"
911
+ src="../src/components/HtmlEditor.js"
912
+ ></script>
913
+ <script
914
+ type="module"
915
+ src="../src/components/Dropdown.js"
916
+ ></script>
917
+ <script
918
+ type="module"
919
+ src="../src/components/htmlEditorControls/Bold.js"
920
+ ></script>
921
+ <script
922
+ type="module"
923
+ src="../src/components/htmlEditorControls/Italic.js"
924
+ ></script>
925
+ <script
926
+ type="module"
927
+ src="../src/components/htmlEditorControls/Underline.js"
928
+ ></script>
929
+ <script
930
+ type="module"
931
+ src="../src/components/htmlEditorControls/Strikethrough.js"
932
+ ></script>
933
+ <script
934
+ type="module"
935
+ src="../src/components/htmlEditorControls/BulletList.js"
936
+ ></script>
937
+ <script
938
+ type="module"
939
+ src="../src/components/htmlEditorControls/NumberList.js"
940
+ ></script>
941
+ <script
942
+ type="module"
943
+ src="../src/components/htmlEditorControls/AlignLeft.js"
944
+ ></script>
945
+ <script
946
+ type="module"
947
+ src="../src/components/htmlEditorControls/AlignCenter.js"
948
+ ></script>
949
+ <script
950
+ type="module"
951
+ src="../src/components/htmlEditorControls/AlignRight.js"
952
+ ></script>
953
+ <script
954
+ type="module"
955
+ src="../src/components/htmlEditorControls/AlignJustify.js"
956
+ ></script>
957
+ <script
958
+ type="module"
959
+ src="../src/components/htmlEditorControls/CreateLink.js"
960
+ ></script>
961
+ <script
962
+ type="module"
963
+ src="../src/components/htmlEditorControls/Mode.js"
964
+ ></script>
965
+ <script
966
+ type="module"
967
+ src="../src/components/htmlEditorControls/DropdownControl.js"
968
+ ></script>
969
+ <script
970
+ type="module"
971
+ src="../src/components/htmlEditorControls/FormatBlock.js"
972
+ ></script>
973
+ <script
974
+ type="module"
975
+ src="../src/components/htmlEditorControls/InlineCode.js"
976
+ ></script>
977
+ <script
978
+ type="module"
979
+ src="../src/components/htmlEditorControls/CodeBlock.js"
980
+ ></script>
981
+ <script
982
+ type="module"
983
+ src="../src/components/htmlEditorControls/ControlGroup.js"
984
+ ></script>
985
+ <script
986
+ type="module"
987
+ src="../src/components/htmlEditorControls/ControlSpacer.js"
988
+ ></script>
989
+ <script
990
+ type="module"
991
+ src="../src/components/codeEditorControls/FormatCode.js"
992
+ ></script>
993
+ <script
994
+ type="module"
995
+ src="../src/components/codeEditorControls/Fullscreen.js"
996
+ ></script>
997
+ <script
998
+ type="module"
999
+ src="../src/components/htmlEditorControls/TextColor.js"
1000
+ ></script>
1001
+ <script
1002
+ type="module"
1003
+ src="../src/components/htmlEditorControls/TextBackgroundColor.js"
1004
+ ></script>
1005
+ <script
1006
+ type="module"
1007
+ src="../src/components/htmlEditorControls/ClearFormatting.js"
1008
+ ></script>
1009
+ <script
1010
+ type="module"
1011
+ src="../src/components/htmlEditorControls/WordCount.js"
1012
+ ></script>
1013
+ <script
1014
+ type="module"
1015
+ src="../src/components/htmlEditorControls/CharacterCount.js"
1016
+ ></script>
1017
+ <script
1018
+ type="module"
1019
+ src="../src/components/htmlEditorControls/InsertTable.js"
1020
+ ></script>
1021
+ <script
1022
+ type="module"
1023
+ src="../src/components/Resize.js"
1024
+ ></script>
1025
+ <script
1026
+ type="module"
1027
+ src="../src/components/Accordion.js"
1028
+ ></script>
1029
+ <script
1030
+ type="module"
1031
+ src="../src/components/Card.js"
1032
+ ></script>
720
1033
 
721
1034
  </body>
722
1035
  </html>