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
@@ -1,142 +1,266 @@
1
- <page pageName="HtmlEditor" title="HtmlEditor - Components - Kempo Docs - A Web Components Solution">
1
+ <page
2
+ pageName="HtmlEditor"
3
+ title="HtmlEditor - Components - Kempo Docs - A Web Components Solution"
4
+ >
2
5
  <content>
3
- <k-accordion persistent-id="toc" class="b r mb">
6
+ <k-accordion
7
+ persistent-id="toc"
8
+ class="b r mb"
9
+ >
4
10
  <k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
5
11
  <k-accordion-panel name="toc-panel">
6
- <div class="m pl">
7
- <h6>Examples</h6>
8
- <a href="#fullExample">Complete Editor Example</a><br />
9
- <a href="#javascriptUsage">JavaScript API Example</a><br />
10
- <a href="#incompatibleContent">Incompatible Content Example</a><br />
11
- <a href="#customNodes">Custom Nodes Example</a><br />
12
-
13
- <h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
14
- <a href="#constructor">Constructor</a><br />
15
- <a href="#properties">Properties</a><br />
16
- <a href="#methods">Methods</a><br />
17
- <a href="#events">Events</a><br />
18
- </div>
19
- </k-accordion-panel>
12
+ <div class="m pl">
13
+ <h6>Examples</h6>
14
+ <a href="#fullExample">Complete Editor Example</a><br />
15
+ <a href="#incompatibleContent">Incompatible Content Example</a><br />
16
+ <a href="#customNodes">Custom Nodes Example</a><br />
17
+ <a href="#preConfigured">Pre-Configured Editors</a><br />
18
+ <a href="#height">Setting Height</a><br />
19
+ <a href="#javascriptUsage">JavaScript API Example</a><br />
20
+
21
+ <h6 class="mt"><a
22
+ href="#jsRef"
23
+ class="no-link"
24
+ >JavaScript Reference</a></h6>
25
+ <a href="#constructor">Constructor</a><br />
26
+ <a href="#properties">Properties</a><br />
27
+ <a href="#globalConfig">Global Configuration</a><br />
28
+ <a href="#methods">Methods</a><br />
29
+ <a href="#events">Events</a><br />
30
+ </div>
31
+ </k-accordion-panel>
20
32
  </k-accordion>
21
33
 
22
- <p>A WYSIWYG HTML editor component with support for visual and code editing modes, form integration, and extensive formatting capabilities.</p>
34
+ <p>A WYSIWYG HTML editor component with support for visual and code editing modes, form integration, and extensive
35
+ formatting capabilities.</p>
23
36
 
24
- <h3 id="fullExample"><a href="#fullExample" class="no-link">Complete Editor Example</a></h3>
37
+ <h3 id="fullExample"><a
38
+ href="#fullExample"
39
+ class="no-link"
40
+ >Complete Editor Example</a></h3>
25
41
  <p>A fully-featured editor with all controls. Copy and paste this example to get started quickly:</p>
42
+ <k-card label="HTML">
43
+ <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>
44
+ </k-card>
45
+ <k-card label="Output">
46
+ <k-html-editor
47
+ class="b r"
48
+ 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>"
49
+ style="height: 600px"
50
+ >
51
+ <k-hec-group slot="toolbar-top-left">
52
+ <k-hec-bold></k-hec-bold>
53
+ <k-hec-italic></k-hec-italic>
54
+ <k-hec-underline></k-hec-underline>
55
+ <k-hec-strikethrough></k-hec-strikethrough>
56
+ </k-hec-group>
57
+ <k-hec-inline-code slot="toolbar-top-left"></k-hec-inline-code>
58
+ <k-hec-dropdown slot="toolbar-top-left">
59
+ <k-icon
60
+ slot="icon"
61
+ name="format_paragraph"
62
+ ></k-icon>
63
+ <k-hec-format-block tag="p">Paragraph</k-hec-format-block>
64
+ <k-hec-format-block tag="h1">Heading 1</k-hec-format-block>
65
+ <k-hec-format-block tag="h2">Heading 2</k-hec-format-block>
66
+ <k-hec-format-block tag="h3">Heading 3</k-hec-format-block>
67
+ <k-hec-code-block>Code Block</k-hec-code-block>
68
+ </k-hec-dropdown>
69
+ <k-hec-group slot="toolbar-top-left">
70
+ <k-hec-bullet-list></k-hec-bullet-list>
71
+ <k-hec-number-list></k-hec-number-list>
72
+ </k-hec-group>
73
+ <k-hec-group slot="toolbar-top-left">
74
+ <k-hec-align-left></k-hec-align-left>
75
+ <k-hec-align-center></k-hec-align-center>
76
+ <k-hec-align-right></k-hec-align-right>
77
+ <k-hec-align-justify></k-hec-align-justify>
78
+ </k-hec-group>
79
+ <k-hec-group slot="toolbar-top-left">
80
+ <k-hec-text-color></k-hec-text-color>
81
+ <k-hec-text-background-color></k-hec-text-background-color>
82
+ </k-hec-group>
83
+ <k-hec-clear-formatting slot="toolbar-top-left"></k-hec-clear-formatting>
84
+ <k-hec-group slot="toolbar-top-left">
85
+ <k-hec-create-link></k-hec-create-link>
86
+ <k-hec-insert-table></k-hec-insert-table>
87
+ </k-hec-group>
88
+ <k-cec-format-code slot="toolbar-top-right"></k-cec-format-code>
89
+ <k-hec-mode slot="toolbar-top-right"></k-hec-mode>
90
+ <k-cec-fullscreen slot="toolbar-top-right"></k-cec-fullscreen>
91
+ <k-hec-word-count slot="toolbar-bottom-left"></k-hec-word-count>
92
+ <k-hec-character-count slot="toolbar-bottom-left"></k-hec-character-count>
93
+ </k-html-editor>
94
+ </k-card>
95
+
96
+
97
+ <h3 id="incompatibleContent"><a
98
+ href="#incompatibleContent"
99
+ class="no-link"
100
+ >Incompatible Content Example</a></h3>
101
+ <p>When the editor's value contains HTML that Lexical does not support (such as <code>&lt;svg&gt;</code>,
102
+ <code>&lt;script&gt;</code>, <code>&lt;style&gt;</code>, <code>&lt;video&gt;</code>, etc.), it automatically
103
+ defaults to code mode to preserve the content. If the user attempts to switch to visual mode, a confirmation
104
+ dialog warns that the incompatible code will be lost.
105
+ </p>
26
106
  <div class="row -mx">
27
107
  <div class="col m-span-12 px">
28
108
  <k-card label="HTML">
29
- <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>
30
- <span class="hljs-comment">&lt;!-- Text formatting --&gt;</span>
31
- <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>
32
- <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>
33
- <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>
34
- <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>
35
- <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>
36
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span>
37
-
38
- <span class="hljs-comment">&lt;!-- Inline code --&gt;</span>
39
- <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>
40
-
41
- <span class="hljs-comment">&lt;!-- Text style --&gt;</span>
42
- <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>
43
- <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>
44
- <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>
45
- <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>
46
- <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>
47
- <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>
48
- <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>
49
- <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>
50
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-dropdown</span>&gt;</span>
51
-
52
- <span class="hljs-comment">&lt;!-- Lists --&gt;</span>
53
- <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>
54
- <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>
55
- <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>
56
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span>
57
-
58
- <span class="hljs-comment">&lt;!-- Alignment --&gt;</span>
59
- <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>
60
- <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>
61
- <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>
62
- <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>
63
- <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>
64
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span>
65
-
66
- <span class="hljs-comment">&lt;!-- Colors --&gt;</span>
67
- <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>
68
- <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>
69
- <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>
70
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span>
71
-
72
- <span class="hljs-comment">&lt;!-- Clear formatting --&gt;</span>
73
- <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>
74
-
75
- <span class="hljs-comment">&lt;!-- Link and table --&gt;</span>
76
- <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>
77
- <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>
78
- <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>
79
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-hec-group</span>&gt;</span>
80
-
81
- <span class="hljs-comment">&lt;!-- Spacer and mode toggle --&gt;</span>
82
- <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>
83
- <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>
84
-
85
- <span class="hljs-comment">&lt;!-- Bottom toolbar stats --&gt;</span>
86
- <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>
87
- <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>
88
- <span class="hljs-tag">&lt;/<span class="hljs-name">k-html-editor</span>&gt;</span></code></pre>
109
+ <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>
89
110
  </k-card>
90
111
  </div>
91
112
  <div class="col m-span-12 px">
92
113
  <k-card label="Output">
93
- <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">
94
- <k-hec-group slot="toolbar-top">
95
- <k-hec-bold></k-hec-bold>
96
- <k-hec-italic></k-hec-italic>
97
- <k-hec-underline></k-hec-underline>
98
- <k-hec-strikethrough></k-hec-strikethrough>
99
- </k-hec-group>
100
- <k-hec-inline-code slot="toolbar-top"></k-hec-inline-code>
101
- <k-hec-dropdown slot="toolbar-top">
102
- <k-icon slot="icon" name="format_paragraph"></k-icon>
103
-
104
- <k-hec-format-block tag="p">Paragraph</k-hec-format-block>
105
- <k-hec-format-block tag="h1">Heading 1</k-hec-format-block>
106
- <k-hec-format-block tag="h2">Heading 2</k-hec-format-block>
107
- <k-hec-format-block tag="h3">Heading 3</k-hec-format-block>
108
- <k-hec-code-block>Code Block</k-hec-code-block>
109
- </k-hec-dropdown>
110
- <k-hec-group slot="toolbar-top">
111
- <k-hec-bullet-list></k-hec-bullet-list>
112
- <k-hec-number-list></k-hec-number-list>
113
- </k-hec-group>
114
- <k-hec-group slot="toolbar-top">
115
- <k-hec-align-left></k-hec-align-left>
116
- <k-hec-align-center></k-hec-align-center>
117
- <k-hec-align-right></k-hec-align-right>
118
- <k-hec-align-justify></k-hec-align-justify>
119
- </k-hec-group>
120
- <k-hec-group slot="toolbar-top">
121
- <k-hec-text-color></k-hec-text-color>
122
- <k-hec-text-background-color></k-hec-text-background-color>
123
- </k-hec-group>
124
- <k-hec-clear-formatting slot="toolbar-top"></k-hec-clear-formatting>
125
- <k-hec-group slot="toolbar-top">
126
- <k-hec-create-link></k-hec-create-link>
127
- <k-hec-insert-table></k-hec-insert-table>
128
- </k-hec-group>
129
- <k-hec-spacer slot="toolbar-top"></k-hec-spacer>
130
- <k-hec-mode slot="toolbar-top"></k-hec-mode>
131
- <k-hec-word-count slot="toolbar-bottom"></k-hec-word-count>
132
- <k-hec-character-count slot="toolbar-bottom"></k-hec-character-count>
114
+ <k-html-editor
115
+ id="svgEditor"
116
+ class="b r"
117
+ 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>"
118
+ >
119
+ <k-hec-mode slot="toolbar-top-right"></k-hec-mode>
133
120
  </k-html-editor>
134
121
  </k-card>
135
122
  </div>
136
123
  </div>
137
124
 
138
- <h3 id="javascriptUsage"><a href="#javascriptUsage" class="no-link">JavaScript API Example</a></h3>
139
- <p>Use the editor without controls and interact with it programmatically using custom buttons and the JavaScript API:</p>
125
+ <h3 id="customNodes"><a
126
+ href="#customNodes"
127
+ class="no-link"
128
+ >Custom Nodes Example</a></h3>
129
+ <p>Custom nodes extend what Lexical understands in visual mode. Import a node file and list its name in the
130
+ <code>nodes</code> attribute (comma-separated filenames without <code>.js</code>). The built-in
131
+ <code>HtmlComment</code> node preserves HTML comments as inline visual chips rather than forcing code mode —
132
+ comments round-trip through the editor without being stripped.
133
+ </p>
134
+ <div class="row -mx">
135
+ <div class="col m-span-12 px">
136
+ <k-card label="HTML">
137
+ <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>
138
+ </k-card>
139
+ </div>
140
+ <div class="col m-span-12 px">
141
+ <k-card label="Output">
142
+ <script
143
+ type="module"
144
+ src="/src/components/htmlEditorNodes/HtmlComment.js"
145
+ ></script>
146
+ <k-html-editor
147
+ id="commentEditor"
148
+ class="b r"
149
+ nodes="HtmlComment"
150
+ value="<p>This paragraph has an <!-- important note --> inline comment.</p>"
151
+ >
152
+ <k-hec-mode slot="toolbar-top-right"></k-hec-mode>
153
+ </k-html-editor>
154
+ </k-card>
155
+ </div>
156
+ </div>
157
+
158
+ <h3 id="preConfigured"><a
159
+ href="#preConfigured"
160
+ class="no-link"
161
+ >Pre-Configured Editors</a></h3>
162
+ <p>The <code>controls</code> attribute lets you opt into a built-in toolbar without writing any slot markup. Set it
163
+ directly on <code>&lt;k-html-editor&gt;</code> to one of the four levels below.</p>
164
+ <p>The four toolbar slots — <code>toolbar-top-left</code>, <code>toolbar-top-right</code>,
165
+ <code>toolbar-bottom-left</code>, <code>toolbar-bottom-right</code> — all have slot fallback content driven by
166
+ the <code>controls</code> value. Providing your own child element for any of these slots replaces just that
167
+ section while leaving the others intact.
168
+ </p>
169
+
170
+ <h4>controls="full"</h4>
171
+ <p>Every available control: text formatting, inline code, text-style dropdown (p, h1–h3, blockquote, code block),
172
+ lists, alignment (with justify), text and background colours, clear formatting, link, table insertion, mode
173
+ toggle, and word/character count.</p>
174
+ <k-card label="HTML">
175
+ <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>
176
+ </k-card>
177
+ <k-card label="Output">
178
+ <k-html-editor
179
+ controls="full"
180
+ class="b r"
181
+ style="height:500px"
182
+ value="<h3>Full Editor</h3><p>All controls are pre-configured — just drop in the tag.</p>"
183
+ ></k-html-editor>
184
+ </k-card>
185
+
186
+ <h4>controls="normal"</h4>
187
+ <p>A balanced everyday toolbar: bold, italic, underline, strikethrough, inline code, text-style dropdown, lists,
188
+ alignment, link, and mode toggle. Word count shown in the bottom bar.</p>
189
+ <div class="row -mx">
190
+ <div class="col m-span-12 px">
191
+ <k-card label="HTML">
192
+ <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>
193
+ </k-card>
194
+ </div>
195
+ <div class="col m-span-12 px">
196
+ <k-card label="Output">
197
+ <k-html-editor
198
+ class="b r"
199
+ controls="normal"
200
+ value="<p>Normal editor with a balanced set of controls.</p>"
201
+ ></k-html-editor>
202
+ </k-card>
203
+ </div>
204
+ </div>
205
+
206
+ <h4>controls="minimal"</h4>
207
+ <p>Essential controls only: bold, italic, underline, bullet list, numbered list, and mode toggle. Ideal for simple
208
+ content forms.</p>
209
+ <div class="row -mx">
210
+ <div class="col m-span-12 px">
211
+ <k-card label="HTML">
212
+ <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>
213
+ </k-card>
214
+ </div>
215
+ <div class="col m-span-12 px">
216
+ <k-card label="Output">
217
+ <k-html-editor
218
+ controls="minimal"
219
+ class="b r"
220
+ value="<p>Minimal editor with only the essential controls.</p>"
221
+ ></k-html-editor>
222
+ </k-card>
223
+ </div>
224
+ </div>
225
+
226
+ <p>All <code>controls</code> levels share the full JavaScript API — <code>getValue()</code>,
227
+ <code>setValue()</code>, <code>bold()</code>, etc. You can still target any individual section by slotting a child
228
+ into the relevant named slot.
229
+ </p>
230
+
231
+ <p>Slots available for custom content:
232
+ <code>toolbar-top-left</code>, <code>toolbar-top-right</code>,
233
+ <code>toolbar-bottom-left</code>, <code>toolbar-bottom-right</code>.
234
+ </p>
235
+
236
+ <h3 id="height"><a
237
+ href="#height"
238
+ class="no-link"
239
+ >Setting Height</a></h3>
240
+ <p>The default height is <code>400px</code>. Override it with an inline style or CSS class on the element:</p>
241
+ <div class="row -mx">
242
+ <div class="col m-span-12 px">
243
+ <k-card label="HTML">
244
+ <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>
245
+ </k-card>
246
+ </div>
247
+ <div class="col m-span-12 px">
248
+ <k-card label="Output">
249
+ <k-html-editor
250
+ class="b r"
251
+ style="height: 500px"
252
+ value="<p>Height set to 500px via style attribute.</p>"
253
+ ></k-html-editor>
254
+ </k-card>
255
+ </div>
256
+ </div>
257
+
258
+ <h3 id="javascriptUsage"><a
259
+ href="#javascriptUsage"
260
+ class="no-link"
261
+ >JavaScript API Example</a></h3>
262
+ <p>Use the editor without controls and interact with it programmatically using custom buttons and the JavaScript
263
+ API:</p>
140
264
  <div class="row -mx">
141
265
  <div class="col m-span-12 px">
142
266
  <k-card label="HTML">
@@ -179,17 +303,20 @@
179
303
  <button onclick="insertMyEditorHTML()">Insert</button>
180
304
  <button onclick="getMyEditorContent()">Get Value</button>
181
305
  </div>
182
- <k-html-editor id="myEditor" class="b r"></k-html-editor>
306
+ <k-html-editor
307
+ id="myEditor"
308
+ class="b r"
309
+ ></k-html-editor>
183
310
  <script>
184
311
  const myEditor = document.getElementById('myEditor');
185
312
  myEditor.addEventListener('ready', () => {
186
313
  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>');
187
314
  });
188
-
315
+
189
316
  function insertMyEditorHTML() {
190
317
  myEditor.insertHTML('<p><b>Inserted content!</b></p>');
191
318
  }
192
-
319
+
193
320
  function getMyEditorContent() {
194
321
  alert(myEditor.getValue());
195
322
  }
@@ -198,51 +325,23 @@
198
325
  </div>
199
326
  </div>
200
327
 
201
- <h3 id="incompatibleContent"><a href="#incompatibleContent" class="no-link">Incompatible Content Example</a></h3>
202
- <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>
203
- <div class="row -mx">
204
- <div class="col m-span-12 px">
205
- <k-card label="HTML">
206
- <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>
207
- </k-card>
208
- </div>
209
- <div class="col m-span-12 px">
210
- <k-card label="Output">
211
- <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>">
212
- <k-hec-spacer slot="toolbar-top"></k-hec-spacer>
213
- <k-hec-mode slot="toolbar-top"></k-hec-mode>
214
- </k-html-editor>
215
- </k-card>
216
- </div>
217
- </div>
218
-
219
- <h3 id="customNodes"><a href="#customNodes" class="no-link">Custom Nodes Example</a></h3>
220
- <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>
221
- <div class="row -mx">
222
- <div class="col m-span-12 px">
223
- <k-card label="HTML">
224
- <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>
225
- </k-card>
226
- </div>
227
- <div class="col m-span-12 px">
228
- <k-card label="Output">
229
- <script type="module" src="/src/components/htmlEditorNodes/HtmlComment.js"></script>
230
- <k-html-editor id="commentEditor" class="b r" nodes="HtmlComment" value="<p>This paragraph has an <!-- important note --> inline comment.</p>">
231
- <k-hec-spacer slot="toolbar-top"></k-hec-spacer>
232
- <k-hec-mode slot="toolbar-top"></k-hec-mode>
233
- </k-html-editor>
234
- </k-card>
235
- </div>
236
- </div>
237
-
238
- <h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
328
+ <h2 id="jsRef"><a
329
+ href="#jsRef"
330
+ class="no-link"
331
+ >JavaScript Reference</a></h2>
239
332
 
240
- <h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
333
+ <h3 id="constructor"><a
334
+ href="#constructor"
335
+ class="no-link"
336
+ >Constructor</a></h3>
241
337
  <p><code>new HtmlEditor()</code></p>
242
338
  <p>Extends <code>ShadowComponent</code> which extends <code>LitElement</code>.</p>
243
339
 
244
- <h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
245
-
340
+ <h3 id="properties"><a
341
+ href="#properties"
342
+ class="no-link"
343
+ >Properties</a></h3>
344
+
246
345
  <h5><code>name<i>: String</i></code></h5>
247
346
  <p>The name attribute for form submission.</p>
248
347
 
@@ -250,20 +349,87 @@
250
349
  <p>The HTML content of the editor. Can be get or set via JavaScript or HTML attribute.</p>
251
350
 
252
351
  <h5><code>mode<i>: String</i></code></h5>
253
- <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>
352
+ <p>Current editing mode. Either <code>'visual'</code> (WYSIWYG) or <code>'code'</code> (raw HTML). Default:
353
+ <code>'visual'</code>. If the initial <code>value</code> contains content that is incompatible with the visual
354
+ editor (such as <code>&lt;svg&gt;</code>, <code>&lt;script&gt;</code>, <code>&lt;style&gt;</code>, etc.), the
355
+ editor automatically switches to <code>'code'</code> mode to preserve the content. Custom nodes can extend what is
356
+ considered compatible by defining a static <code>isVisualCompatible(domNode)</code> method.
357
+ </p>
358
+
359
+ <h5><code>controls<i>: String</i></code></h5>
360
+ <p>Activates a built-in toolbar. Accepted values:</p>
361
+ <ul>
362
+ <li><code>'none'</code> (default) — no built-in toolbar; use named slots to build your own</li>
363
+ <li><code>'minimal'</code> — bold, italic, underline, lists, mode toggle</li>
364
+ <li><code>'normal'</code> — adds strikethrough, inline code, text-style dropdown, alignment, link, word count</li>
365
+ <li><code>'full'</code> — every available control including colours, clear formatting, table insertion, and
366
+ character count</li>
367
+ </ul>
368
+ <p>The built-in controls appear as slot fallback content in the six toolbar slots. Providing your own child with a
369
+ matching slot name for any section replaces just that section's defaults.</p>
254
370
 
255
371
  <h5><code>nodes<i>: String</i></code></h5>
256
- <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>
372
+ <p>Comma-separated list of custom Lexical node module filenames (without <code>.js</code>) to load from the
373
+ <code>htmlEditorNodes/</code> directory. Custom nodes can define two static hooks:
374
+ </p>
257
375
  <ul>
258
- <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>
259
- <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>
376
+ <li><code>isVisualCompatible(domNode)</code> — returns <code>true</code> if the node handles a DOM construct that
377
+ would otherwise be considered incompatible (e.g., HTML comments)</li>
378
+ <li><code>preprocessHtml(htmlString)</code> — transforms raw HTML before Lexical parses it (e.g., converting
379
+ <code>&lt;!-- --&gt;</code> to a parseable <code>&lt;span&gt;</code>)
380
+ </li>
260
381
  </ul>
261
382
 
262
- <h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
383
+ <h5><code>lexical-src<i>: String</i></code></h5>
384
+ <p>Base URL for loading Lexical modules on this specific editor instance. When set, this overrides both the global
385
+ <code>window.kempo.lexicalUrl</code> config and the built-in CDN default. See <a href="#globalConfig">Global
386
+ Configuration</a> for the full resolution order.
387
+ </p>
388
+
389
+ <h5><code>monaco-src<i>: String</i></code></h5>
390
+ <p>Base URL for loading the Monaco editor on this specific editor instance. When set, this overrides both the global
391
+ <code>window.kempo.monacoUrl</code> config and the built-in CDN default. See <a href="#globalConfig">Global
392
+ Configuration</a> for the full resolution order.
393
+ </p>
394
+
395
+ <h3 id="globalConfig"><a
396
+ href="#globalConfig"
397
+ class="no-link"
398
+ >Global Configuration</a></h3>
399
+ <p>The editor resolves dependency URLs in the following priority order (highest to lowest):</p>
400
+ <ol>
401
+ <li><strong>Element attribute</strong> — <code>lexical-src</code> / <code>monaco-src</code> on the element itself
402
+ </li>
403
+ <li><strong>Global config</strong> — <code>window.kempo.lexicalUrl</code> / <code>window.kempo.monacoUrl</code>
404
+ </li>
405
+ <li><strong>CDN fallback</strong> — <code>https://esm.sh</code> (Lexical) and
406
+ <code>https://cdn.jsdelivr.net/npm/monaco-editor@…/min</code> (Monaco)
407
+ </li>
408
+ </ol>
409
+ <p>Set the global config before any <code>&lt;k-html-editor&gt;</code> initialises to apply a custom URL site-wide.
410
+ This is useful when you have installed the packages locally via <code>npm install lexical</code> or
411
+ <code>npm install monaco-editor</code> and serve them yourself:
412
+ </p>
413
+ <pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
414
+ <span class="hljs-keyword">window</span>.kempo = <span class="hljs-keyword">window</span>.kempo || {};
415
+ <span class="hljs-comment">// Point to your locally served Lexical modules (must be an esm.sh-compatible base URL)</span>
416
+ <span class="hljs-keyword">window</span>.kempo.lexicalUrl = <span class="hljs-string">'/node_modules'</span>;
417
+ <span class="hljs-comment">// Point to your locally served Monaco build</span>
418
+ <span class="hljs-keyword">window</span>.kempo.monacoUrl = <span class="hljs-string">'/node_modules/monaco-editor/min'</span>;
419
+ </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></code></pre>
420
+ <p>The per-element attributes take precedence over the global config, so you can mix strategies — e.g., use a local
421
+ Lexical build globally while one specific editor still points to a CDN via its <code>lexical-src</code> attribute.
422
+ </p>
423
+
424
+ <h3 id="methods"><a
425
+ href="#methods"
426
+ class="no-link"
427
+ >Methods</a></h3>
263
428
 
264
429
  <h4>Mode Control</h4>
265
430
  <h5><code>setMode(mode)<i>: this</i></code></h5>
266
- <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>
431
+ <p>Set the editing mode. Accepts <code>'visual'</code> or <code>'code'</code>. If switching to <code>'visual'</code>
432
+ and the current content is incompatible, a confirmation dialog warns that incompatible code will be lost.</p>
267
433
 
268
434
  <h5><code>toggleMode()<i>: this</i></code></h5>
269
435
  <p>Toggle between visual and code modes. Same incompatibility warning applies when switching to visual mode.</p>
@@ -273,7 +439,8 @@
273
439
  <p>Returns the current HTML content.</p>
274
440
 
275
441
  <h5><code>setValue(html)<i>: this</i></code></h5>
276
- <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>
442
+ <p>Sets the HTML content of the editor. If the editor is in visual mode and the new content is incompatible,
443
+ automatically switches to code mode.</p>
277
444
 
278
445
  <h5><code>clear()<i>: this</i></code></h5>
279
446
  <p>Clears all content from the editor.</p>
@@ -343,34 +510,41 @@
343
510
  <li><code>rows</code> - Number of rows to create</li>
344
511
  <li><code>columns</code> - Number of columns to create</li>
345
512
  <li><code>includeHeaders</code> - Boolean indicating whether to include header row (default: false)</li>
346
- <li><code>cellData</code> - Optional 2D array of cell content. If provided, rows/columns are determined from array dimensions</li>
513
+ <li><code>cellData</code> - Optional 2D array of cell content. If provided, rows/columns are determined from array
514
+ dimensions</li>
347
515
  </ul>
348
516
 
349
517
  <h5><code>insertElementAtCursor(element, selectAfter)<i>: this</i></code></h5>
350
518
  <p>Inserts a DOM element at the cursor position or replaces selection.</p>
351
519
  <ul>
352
520
  <li><code>element</code> - DOM element to insert</li>
353
- <li><code>selectAfter</code> - Boolean indicating whether to select the inserted element after insertion (default: true)</li>
521
+ <li><code>selectAfter</code> - Boolean indicating whether to select the inserted element after insertion (default:
522
+ true)</li>
354
523
  </ul>
355
524
 
356
525
  <h5><code>replaceSelectionWithElement(element, selectAfter)<i>: this</i></code></h5>
357
526
  <p>Replaces the current selection with a DOM element.</p>
358
527
  <ul>
359
528
  <li><code>element</code> - DOM element to insert</li>
360
- <li><code>selectAfter</code> - Boolean indicating whether to select the inserted element after replacement (default: true)</li>
529
+ <li><code>selectAfter</code> - Boolean indicating whether to select the inserted element after replacement
530
+ (default: true)</li>
361
531
  </ul>
362
532
 
363
533
  <h5><code>wrapSelection(before, after, savedSelection)<i>: this</i></code></h5>
364
- <p>Wraps the selected text with HTML tags. Handles complex cases like unwrapping existing tags and preventing nested pre tags.</p>
534
+ <p>Wraps the selected text with HTML tags. Handles complex cases like unwrapping existing tags and preventing nested
535
+ pre tags.</p>
365
536
  <ul>
366
537
  <li><code>before</code> - Opening HTML tag(s) to wrap with</li>
367
538
  <li><code>after</code> - Closing HTML tag(s) to wrap with</li>
368
- <li><code>savedSelection</code> - Optional previously saved selection text to use instead of current selection</li>
539
+ <li><code>savedSelection</code> - Optional previously saved selection text to use instead of current selection
540
+ </li>
369
541
  </ul>
370
542
 
371
543
  <h4>Selection Management</h4>
372
544
  <h5><code>getSelection()<i>: Object | null</i></code></h5>
373
- <p>Returns an object containing information about the current selection: <code>{ text, html, range, selection }</code></p>
545
+ <p>Returns an object containing information about the current selection:
546
+ <code>{ text, html, range, selection }</code>
547
+ </p>
374
548
 
375
549
  <h5><code>getSelectedText()<i>: String</i></code></h5>
376
550
  <p>Returns the plain text of the current selection.</p>
@@ -391,7 +565,8 @@
391
565
  <p>Deletes the currently selected content.</p>
392
566
 
393
567
  <h5><code>getValueWithSelectionMarkers()<i>: Object</i></code></h5>
394
- <p>Returns the editor content with special Unicode markers indicating cursor position or selection boundaries. Useful for preserving selection state during content transformations.</p>
568
+ <p>Returns the editor content with special Unicode markers indicating cursor position or selection boundaries.
569
+ Useful for preserving selection state during content transformations.</p>
395
570
  <p>Returns object with properties:</p>
396
571
  <ul>
397
572
  <li><code>html</code> - HTML content with markers inserted</li>
@@ -404,10 +579,13 @@
404
579
  </ul>
405
580
 
406
581
  <h5><code>setValueFromSelectionMarkers(html, markers)<i>: this</i></code></h5>
407
- <p>Sets editor content and restores cursor/selection from Unicode markers. Companion method to <code>getValueWithSelectionMarkers()</code>.</p>
582
+ <p>Sets editor content and restores cursor/selection from Unicode markers. Companion method to
583
+ <code>getValueWithSelectionMarkers()</code>.
584
+ </p>
408
585
  <ul>
409
586
  <li><code>html</code> - HTML content containing marker characters</li>
410
- <li><code>markers</code> - Object with marker information (hasCursor, hasSelection, cursorMarker, selectionStart, selectionEnd)</li>
587
+ <li><code>markers</code> - Object with marker information (hasCursor, hasSelection, cursorMarker, selectionStart,
588
+ selectionEnd)</li>
411
589
  </ul>
412
590
 
413
591
  <h4>Links and Media</h4>
@@ -422,48 +600,184 @@
422
600
 
423
601
  <h4>History</h4>
424
602
  <h5><code>undo()<i>: this</i></code></h5>
425
- <p>Undoes the last action.</p>
603
+ <p>Undoes the last action. Works in both visual mode (Lexical) and code mode (Monaco).</p>
426
604
 
427
605
  <h5><code>redo()<i>: this</i></code></h5>
428
- <p>Redoes the last undone action.</p>
606
+ <p>Redoes the last undone action. Works in both visual mode (Lexical) and code mode (Monaco).</p>
607
+
608
+ <h4>Code Editor Controls</h4>
609
+ <p>These methods control the Monaco code editor and are available in code mode. When used with
610
+ <code>controls="full"</code>, the toolbar exposes buttons for these automatically.
611
+ </p>
612
+
613
+ <h5><code>copyToClipboard()<i>: this</i></code></h5>
614
+ <p>Copies the full editor content to the clipboard.</p>
615
+
616
+ <h5><code>setEditorTheme(theme)<i>: this</i></code></h5>
617
+ <p>Sets the Monaco editor theme. Accepts <code>'auto'</code>, <code>'light'</code>, or <code>'dark'</code>.</p>
618
+
619
+ <h5><code>openFind()<i>: this</i></code></h5>
620
+ <p>Opens the Monaco Find &amp; Replace widget.</p>
621
+
622
+ <h5><code>foldAll()<i>: this</i></code></h5>
623
+ <p>Folds all collapsible regions in the code editor.</p>
624
+
625
+ <h5><code>unfoldAll()<i>: this</i></code></h5>
626
+ <p>Unfolds all collapsed regions in the code editor.</p>
627
+
628
+ <h5><code>increaseFontSize()<i>: this</i></code></h5>
629
+ <p>Increases the code editor font size by 2px (max 40px).</p>
630
+
631
+ <h5><code>decreaseFontSize()<i>: this</i></code></h5>
632
+ <p>Decreases the code editor font size by 2px (min 8px).</p>
633
+
634
+ <h5><code>setWordWrap(enabled)<i>: this</i></code></h5>
635
+ <p>Enables or disables word wrapping in the code editor.</p>
636
+
637
+ <h5><code>setMinimap(enabled)<i>: this</i></code></h5>
638
+ <p>Shows or hides the minimap in the code editor.</p>
639
+
640
+ <h5><code>resolveMonacoTheme()<i>: String</i></code></h5>
641
+ <p>Returns the resolved Monaco theme string (<code>'vs'</code> or <code>'vs-dark'</code>) based on the current
642
+ <code>editorTheme</code> setting.
643
+ </p>
429
644
 
430
- <h3 id="events"><a href="#events" class="no-link">Events</a></h3>
645
+ <h3 id="events"><a
646
+ href="#events"
647
+ class="no-link"
648
+ >Events</a></h3>
431
649
 
432
650
  <h5><code>change</code></h5>
433
651
  <p>Dispatched when the content changes. Event detail: <code>{ value: String }</code></p>
434
652
 
435
653
  <h5><code>mode-changed</code></h5>
436
- <p>Dispatched when the editing mode changes between 'visual' and 'code'. Event detail: <code>{ mode: String }</code></p>
654
+ <p>Dispatched when the editing mode changes between 'visual' and 'code'. Event detail: <code>{ mode: String }</code>
655
+ </p>
437
656
  </content>
438
657
  <content location="scripts">
439
- <script type="module" src="{{pathToRoot}}src/components/HtmlEditor.js"></script>
440
- <script type="module" src="{{pathToRoot}}src/components/Dropdown.js"></script>
441
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/Bold.js"></script>
442
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/Italic.js"></script>
443
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/Underline.js"></script>
444
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/Strikethrough.js"></script>
445
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/BulletList.js"></script>
446
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/NumberList.js"></script>
447
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/AlignLeft.js"></script>
448
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/AlignCenter.js"></script>
449
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/AlignRight.js"></script>
450
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/AlignJustify.js"></script>
451
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/CreateLink.js"></script>
452
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/Mode.js"></script>
453
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/DropdownControl.js"></script>
454
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/FormatBlock.js"></script>
455
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/InlineCode.js"></script>
456
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/CodeBlock.js"></script>
457
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/ControlGroup.js"></script>
458
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/ControlSpacer.js"></script>
459
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/TextColor.js"></script>
460
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/TextBackgroundColor.js"></script>
461
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/ClearFormatting.js"></script>
462
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/WordCount.js"></script>
463
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/CharacterCount.js"></script>
464
- <script type="module" src="{{pathToRoot}}src/components/htmlEditorControls/InsertTable.js"></script>
465
- <script type="module" src="{{pathToRoot}}src/components/Resize.js"></script>
466
- <script type="module" src="{{pathToRoot}}src/components/Accordion.js"></script>
467
- <script type="module" src="{{pathToRoot}}src/components/Card.js"></script>
658
+ <script
659
+ type="module"
660
+ src="{{pathToRoot}}src/components/HtmlEditor.js"
661
+ ></script>
662
+ <script
663
+ type="module"
664
+ src="{{pathToRoot}}src/components/Dropdown.js"
665
+ ></script>
666
+ <script
667
+ type="module"
668
+ src="{{pathToRoot}}src/components/htmlEditorControls/Bold.js"
669
+ ></script>
670
+ <script
671
+ type="module"
672
+ src="{{pathToRoot}}src/components/htmlEditorControls/Italic.js"
673
+ ></script>
674
+ <script
675
+ type="module"
676
+ src="{{pathToRoot}}src/components/htmlEditorControls/Underline.js"
677
+ ></script>
678
+ <script
679
+ type="module"
680
+ src="{{pathToRoot}}src/components/htmlEditorControls/Strikethrough.js"
681
+ ></script>
682
+ <script
683
+ type="module"
684
+ src="{{pathToRoot}}src/components/htmlEditorControls/BulletList.js"
685
+ ></script>
686
+ <script
687
+ type="module"
688
+ src="{{pathToRoot}}src/components/htmlEditorControls/NumberList.js"
689
+ ></script>
690
+ <script
691
+ type="module"
692
+ src="{{pathToRoot}}src/components/htmlEditorControls/AlignLeft.js"
693
+ ></script>
694
+ <script
695
+ type="module"
696
+ src="{{pathToRoot}}src/components/htmlEditorControls/AlignCenter.js"
697
+ ></script>
698
+ <script
699
+ type="module"
700
+ src="{{pathToRoot}}src/components/htmlEditorControls/AlignRight.js"
701
+ ></script>
702
+ <script
703
+ type="module"
704
+ src="{{pathToRoot}}src/components/htmlEditorControls/AlignJustify.js"
705
+ ></script>
706
+ <script
707
+ type="module"
708
+ src="{{pathToRoot}}src/components/htmlEditorControls/CreateLink.js"
709
+ ></script>
710
+ <script
711
+ type="module"
712
+ src="{{pathToRoot}}src/components/htmlEditorControls/Mode.js"
713
+ ></script>
714
+ <script
715
+ type="module"
716
+ src="{{pathToRoot}}src/components/htmlEditorControls/DropdownControl.js"
717
+ ></script>
718
+ <script
719
+ type="module"
720
+ src="{{pathToRoot}}src/components/htmlEditorControls/FormatBlock.js"
721
+ ></script>
722
+ <script
723
+ type="module"
724
+ src="{{pathToRoot}}src/components/htmlEditorControls/InlineCode.js"
725
+ ></script>
726
+ <script
727
+ type="module"
728
+ src="{{pathToRoot}}src/components/htmlEditorControls/CodeBlock.js"
729
+ ></script>
730
+ <script
731
+ type="module"
732
+ src="{{pathToRoot}}src/components/htmlEditorControls/ControlGroup.js"
733
+ ></script>
734
+ <script
735
+ type="module"
736
+ src="{{pathToRoot}}src/components/htmlEditorControls/ControlSpacer.js"
737
+ ></script>
738
+ <script
739
+ type="module"
740
+ src="{{pathToRoot}}src/components/codeEditorControls/FormatCode.js"
741
+ ></script>
742
+ <script
743
+ type="module"
744
+ src="{{pathToRoot}}src/components/codeEditorControls/Fullscreen.js"
745
+ ></script>
746
+ <script
747
+ type="module"
748
+ src="{{pathToRoot}}src/components/htmlEditorControls/TextColor.js"
749
+ ></script>
750
+ <script
751
+ type="module"
752
+ src="{{pathToRoot}}src/components/htmlEditorControls/TextBackgroundColor.js"
753
+ ></script>
754
+ <script
755
+ type="module"
756
+ src="{{pathToRoot}}src/components/htmlEditorControls/ClearFormatting.js"
757
+ ></script>
758
+ <script
759
+ type="module"
760
+ src="{{pathToRoot}}src/components/htmlEditorControls/WordCount.js"
761
+ ></script>
762
+ <script
763
+ type="module"
764
+ src="{{pathToRoot}}src/components/htmlEditorControls/CharacterCount.js"
765
+ ></script>
766
+ <script
767
+ type="module"
768
+ src="{{pathToRoot}}src/components/htmlEditorControls/InsertTable.js"
769
+ ></script>
770
+ <script
771
+ type="module"
772
+ src="{{pathToRoot}}src/components/Resize.js"
773
+ ></script>
774
+ <script
775
+ type="module"
776
+ src="{{pathToRoot}}src/components/Accordion.js"
777
+ ></script>
778
+ <script
779
+ type="module"
780
+ src="{{pathToRoot}}src/components/Card.js"
781
+ ></script>
468
782
  </content>
469
- </page>
783
+ </page>