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.
- package/dist/components/CodeEditor.js +96 -0
- package/dist/components/HtmlEditor.js +155 -30
- package/dist/components/codeEditorControls/CodeEditorControl.js +17 -0
- package/dist/components/codeEditorControls/ControlGroup.js +12 -0
- package/dist/components/codeEditorControls/ControlSpacer.js +6 -0
- package/dist/components/codeEditorControls/CopyCode.js +9 -0
- package/dist/components/codeEditorControls/EditorTheme.js +26 -0
- package/dist/components/codeEditorControls/FindReplace.js +7 -0
- package/dist/components/codeEditorControls/FoldAll.js +7 -0
- package/dist/components/codeEditorControls/FontSize.js +13 -0
- package/dist/components/codeEditorControls/FormatCode.js +9 -0
- package/dist/components/codeEditorControls/Fullscreen.js +12 -0
- package/dist/components/codeEditorControls/LanguageSelect.js +15 -0
- package/dist/components/codeEditorControls/Minimap.js +8 -0
- package/dist/components/codeEditorControls/Redo.js +7 -0
- package/dist/components/codeEditorControls/Undo.js +7 -0
- package/dist/components/codeEditorControls/WordWrap.js +8 -0
- package/dist/components/htmlEditorControls/AlignCenter.js +4 -4
- package/dist/components/htmlEditorControls/AlignJustify.js +4 -4
- package/dist/components/htmlEditorControls/AlignLeft.js +4 -4
- package/dist/components/htmlEditorControls/AlignRight.js +4 -4
- package/dist/components/htmlEditorControls/Bold.js +4 -4
- package/dist/components/htmlEditorControls/BulletList.js +4 -4
- package/dist/components/htmlEditorControls/ClearFormatting.js +4 -4
- package/dist/components/htmlEditorControls/CodeBlock.js +2 -2
- package/dist/components/htmlEditorControls/ControlGroup.js +2 -4
- package/dist/components/htmlEditorControls/CreateLink.js +3 -3
- package/dist/components/htmlEditorControls/FormatBlock.js +4 -4
- package/dist/components/htmlEditorControls/FormatCode.js +1 -0
- package/dist/components/htmlEditorControls/HtmlEditorControl.js +2 -2
- package/dist/components/htmlEditorControls/InlineCode.js +2 -2
- package/dist/components/htmlEditorControls/InsertTable.js +3 -3
- package/dist/components/htmlEditorControls/Italic.js +4 -4
- package/dist/components/htmlEditorControls/Mode.js +3 -3
- package/dist/components/htmlEditorControls/NumberList.js +4 -4
- package/dist/components/htmlEditorControls/Strikethrough.js +4 -4
- package/dist/components/htmlEditorControls/TextBackgroundColor.js +1 -1
- package/dist/components/htmlEditorControls/TextColor.js +1 -1
- package/dist/components/htmlEditorControls/Underline.js +4 -4
- package/docs/components/accordion.html +2 -0
- package/docs/components/aside.html +2 -0
- package/docs/components/card.html +2 -0
- package/docs/components/code-editor.html +491 -0
- package/docs/components/color-picker.html +2 -0
- package/docs/components/content-slider.html +2 -0
- package/docs/components/context.html +2 -0
- package/docs/components/dialog.html +2 -0
- package/docs/components/dropdown.html +2 -0
- package/docs/components/filter-list.html +2 -0
- package/docs/components/focus-capture.html +2 -0
- package/docs/components/html-editor.html +525 -212
- package/docs/components/hybrid-component.html +2 -0
- package/docs/components/icon.html +2 -0
- package/docs/components/import.html +2 -0
- package/docs/components/light-component.html +2 -0
- package/docs/components/nav-spacer.html +2 -0
- package/docs/components/nav.html +2 -0
- package/docs/components/photo-viewer.html +2 -0
- package/docs/components/resize.html +2 -0
- package/docs/components/shadow-component.html +2 -0
- package/docs/components/show-more.html +2 -0
- package/docs/components/sortable.html +2 -0
- package/docs/components/spinner.html +2 -0
- package/docs/components/split.html +2 -0
- package/docs/components/table.html +2 -0
- package/docs/components/tableControls.html +2 -0
- package/docs/components/tableCustomFields.html +2 -0
- package/docs/components/tableFetchRecords.html +2 -0
- package/docs/components/tableFieldSortHide.html +2 -0
- package/docs/components/tablePagination.html +2 -0
- package/docs/components/tablePlaceholder.html +2 -0
- package/docs/components/tableRecordEditing.html +2 -0
- package/docs/components/tableRecordFiltering.html +2 -0
- package/docs/components/tableRecordHiding.html +2 -0
- package/docs/components/tableRecordSearching.html +2 -0
- package/docs/components/tableRecordSelection.html +2 -0
- package/docs/components/tableRowControls.html +2 -0
- package/docs/components/tableServerSync.html +2 -0
- package/docs/components/tableSorting.html +2 -0
- package/docs/components/tabs.html +2 -0
- package/docs/components/tags.html +2 -0
- package/docs/components/theme-select.html +2 -0
- package/docs/components/theme-switcher.html +2 -0
- package/docs/components/timestamp.html +2 -0
- package/docs/components/toast.html +2 -0
- package/docs/components/toggle.html +2 -0
- package/docs/components/tree.html +2 -0
- package/docs/icons/auto_fix_high.svg +1 -0
- package/docs/icons/content_copy.svg +1 -0
- package/docs/icons/contrast.svg +1 -0
- package/docs/icons/frame_source.svg +1 -0
- package/docs/icons/fullscreen.svg +1 -0
- package/docs/icons/fullscreen_exit.svg +1 -0
- package/docs/icons/map.svg +1 -0
- package/docs/icons/redo.svg +1 -0
- package/docs/icons/text_decrease.svg +1 -0
- package/docs/icons/text_increase.svg +1 -0
- package/docs/icons/undo.svg +1 -0
- package/docs/icons/unfold_less.svg +1 -0
- package/docs/icons/unfold_more.svg +1 -0
- package/docs/icons/wrap_text.svg +1 -0
- package/docs/index.html +8 -0
- package/docs/src/components/CodeEditor.js +96 -0
- package/docs/src/components/HtmlEditor.js +155 -30
- package/docs/src/components/codeEditorControls/CodeEditorControl.js +17 -0
- package/docs/src/components/codeEditorControls/ControlGroup.js +12 -0
- package/docs/src/components/codeEditorControls/ControlSpacer.js +6 -0
- package/docs/src/components/codeEditorControls/CopyCode.js +9 -0
- package/docs/src/components/codeEditorControls/EditorTheme.js +26 -0
- package/docs/src/components/codeEditorControls/FindReplace.js +7 -0
- package/docs/src/components/codeEditorControls/FoldAll.js +7 -0
- package/docs/src/components/codeEditorControls/FontSize.js +13 -0
- package/docs/src/components/codeEditorControls/FormatCode.js +9 -0
- package/docs/src/components/codeEditorControls/Fullscreen.js +12 -0
- package/docs/src/components/codeEditorControls/LanguageSelect.js +15 -0
- package/docs/src/components/codeEditorControls/Minimap.js +8 -0
- package/docs/src/components/codeEditorControls/Redo.js +7 -0
- package/docs/src/components/codeEditorControls/Undo.js +7 -0
- package/docs/src/components/codeEditorControls/WordWrap.js +8 -0
- package/docs/src/components/htmlEditorControls/AlignCenter.js +4 -4
- package/docs/src/components/htmlEditorControls/AlignJustify.js +4 -4
- package/docs/src/components/htmlEditorControls/AlignLeft.js +4 -4
- package/docs/src/components/htmlEditorControls/AlignRight.js +4 -4
- package/docs/src/components/htmlEditorControls/Bold.js +4 -4
- package/docs/src/components/htmlEditorControls/BulletList.js +4 -4
- package/docs/src/components/htmlEditorControls/ClearFormatting.js +4 -4
- package/docs/src/components/htmlEditorControls/CodeBlock.js +2 -2
- package/docs/src/components/htmlEditorControls/ControlGroup.js +2 -4
- package/docs/src/components/htmlEditorControls/CreateLink.js +3 -3
- package/docs/src/components/htmlEditorControls/FormatBlock.js +4 -4
- package/docs/src/components/htmlEditorControls/FormatCode.js +1 -0
- package/docs/src/components/htmlEditorControls/HtmlEditorControl.js +2 -2
- package/docs/src/components/htmlEditorControls/InlineCode.js +2 -2
- package/docs/src/components/htmlEditorControls/InsertTable.js +3 -3
- package/docs/src/components/htmlEditorControls/Italic.js +4 -4
- package/docs/src/components/htmlEditorControls/Mode.js +3 -3
- package/docs/src/components/htmlEditorControls/NumberList.js +4 -4
- package/docs/src/components/htmlEditorControls/Strikethrough.js +4 -4
- package/docs/src/components/htmlEditorControls/TextBackgroundColor.js +1 -1
- package/docs/src/components/htmlEditorControls/TextColor.js +1 -1
- package/docs/src/components/htmlEditorControls/Underline.js +4 -4
- package/docs/utils/context.html +2 -0
- package/docs/utils/cookie.html +2 -0
- package/docs/utils/debounce.html +2 -0
- package/docs/utils/drag.html +2 -0
- package/docs/utils/elevation.html +2 -0
- package/docs/utils/formatTimestamp.html +2 -0
- package/docs/utils/object.html +2 -0
- package/docs/utils/propConverters.html +2 -0
- package/docs/utils/string.html +2 -0
- package/docs/utils/theme.html +2 -0
- package/docs/utils/toTitleCase.html +2 -0
- package/docs/utils/type.html +2 -0
- package/docs/utils/wait.html +2 -0
- package/docs-src/components/code-editor.page.html +235 -0
- package/docs-src/components/html-editor.page.html +528 -214
- package/docs-src/index.page.html +6 -0
- package/docs-src/nav.fragment.html +2 -0
- package/icons/auto_fix_high.svg +1 -0
- package/icons/content_copy.svg +1 -0
- package/icons/contrast.svg +1 -0
- package/icons/frame_source.svg +1 -0
- package/icons/fullscreen.svg +1 -0
- package/icons/fullscreen_exit.svg +1 -0
- package/icons/map.svg +1 -0
- package/icons/redo.svg +1 -0
- package/icons/text_decrease.svg +1 -0
- package/icons/text_increase.svg +1 -0
- package/icons/undo.svg +1 -0
- package/icons/unfold_less.svg +1 -0
- package/icons/unfold_more.svg +1 -0
- package/icons/wrap_text.svg +1 -0
- package/llm.txt +2 -1
- package/package.json +3 -3
- package/src/components/CodeEditor.js +495 -0
- package/src/components/HtmlEditor.js +527 -152
- package/src/components/codeEditorControls/CodeEditorControl.js +134 -0
- package/src/components/codeEditorControls/ControlGroup.js +70 -0
- package/src/components/codeEditorControls/ControlSpacer.js +23 -0
- package/src/components/codeEditorControls/CopyCode.js +37 -0
- package/src/components/codeEditorControls/EditorTheme.js +81 -0
- package/src/components/codeEditorControls/FindReplace.js +35 -0
- package/src/components/codeEditorControls/FoldAll.js +49 -0
- package/src/components/codeEditorControls/FontSize.js +45 -0
- package/src/components/codeEditorControls/FormatCode.js +37 -0
- package/src/components/codeEditorControls/Fullscreen.js +72 -0
- package/src/components/codeEditorControls/LanguageSelect.js +74 -0
- package/src/components/codeEditorControls/Minimap.js +60 -0
- package/src/components/codeEditorControls/Redo.js +35 -0
- package/src/components/codeEditorControls/Undo.js +35 -0
- package/src/components/codeEditorControls/WordWrap.js +60 -0
- package/src/components/htmlEditorControls/AlignCenter.js +2 -4
- package/src/components/htmlEditorControls/AlignJustify.js +2 -4
- package/src/components/htmlEditorControls/AlignLeft.js +2 -4
- package/src/components/htmlEditorControls/AlignRight.js +2 -4
- package/src/components/htmlEditorControls/Bold.js +2 -4
- package/src/components/htmlEditorControls/BulletList.js +2 -4
- package/src/components/htmlEditorControls/ClearFormatting.js +2 -4
- package/src/components/htmlEditorControls/CodeBlock.js +3 -19
- package/src/components/htmlEditorControls/ControlGroup.js +16 -41
- package/src/components/htmlEditorControls/CreateLink.js +3 -5
- package/src/components/htmlEditorControls/FormatBlock.js +2 -4
- package/src/components/htmlEditorControls/FormatCode.js +7 -0
- package/src/components/htmlEditorControls/HtmlEditorControl.js +43 -5
- package/src/components/htmlEditorControls/InlineCode.js +3 -5
- package/src/components/htmlEditorControls/InsertTable.js +9 -53
- package/src/components/htmlEditorControls/Italic.js +2 -4
- package/src/components/htmlEditorControls/Mode.js +2 -0
- package/src/components/htmlEditorControls/NumberList.js +2 -4
- package/src/components/htmlEditorControls/Strikethrough.js +2 -4
- package/src/components/htmlEditorControls/TextBackgroundColor.js +0 -6
- package/src/components/htmlEditorControls/TextColor.js +0 -6
- package/src/components/htmlEditorControls/Underline.js +2 -4
- package/tests/components/CodeEditor.browser-test.js +297 -0
- package/tests/components/HtmlEditor.browser-test.js +207 -0
- package/tests/components/codeEditorControls/CopyCode.browser-test.js +57 -0
- package/tests/components/codeEditorControls/EditorTheme.browser-test.js +70 -0
- package/tests/components/codeEditorControls/FindReplace.browser-test.js +57 -0
- package/tests/components/codeEditorControls/FoldAll.browser-test.js +92 -0
- package/tests/components/codeEditorControls/FontSize.browser-test.js +74 -0
- package/tests/components/codeEditorControls/Fullscreen.browser-test.js +152 -0
- package/tests/components/codeEditorControls/LanguageSelect.browser-test.js +82 -0
- package/tests/components/codeEditorControls/Minimap.browser-test.js +84 -0
- package/tests/components/codeEditorControls/ModeVisibility.browser-test.js +82 -0
- package/tests/components/codeEditorControls/UndoRedo.browser-test.js +85 -0
- package/tests/components/codeEditorControls/WordWrap.browser-test.js +95 -0
- package/tests/components/htmlEditorControls/Align.browser-test.js +203 -0
- package/tests/components/htmlEditorControls/Bold.browser-test.js +127 -0
- package/tests/components/htmlEditorControls/BulletList.browser-test.js +127 -0
- package/tests/components/htmlEditorControls/CharacterCount.browser-test.js +106 -0
- package/tests/components/htmlEditorControls/ClearFormatting.browser-test.js +127 -0
- package/tests/components/htmlEditorControls/CodeBlock.browser-test.js +143 -0
- package/tests/components/htmlEditorControls/ControlGroup.browser-test.js +116 -0
- package/tests/components/htmlEditorControls/ControlSpacer.browser-test.js +69 -0
- package/tests/components/htmlEditorControls/CreateLink.browser-test.js +129 -0
- package/tests/components/htmlEditorControls/DropdownControl.browser-test.js +138 -0
- package/tests/components/htmlEditorControls/FormatBlock.browser-test.js +163 -0
- package/tests/components/htmlEditorControls/FormatCode.browser-test.js +155 -0
- package/tests/components/htmlEditorControls/InlineCode.browser-test.js +127 -0
- package/tests/components/htmlEditorControls/InsertTable.browser-test.js +129 -0
- package/tests/components/htmlEditorControls/Italic.browser-test.js +127 -0
- package/tests/components/htmlEditorControls/Mode.browser-test.js +138 -0
- package/tests/components/htmlEditorControls/NumberList.browser-test.js +127 -0
- package/tests/components/htmlEditorControls/Strikethrough.browser-test.js +127 -0
- package/tests/components/htmlEditorControls/TextBackgroundColor.browser-test.js +136 -0
- package/tests/components/htmlEditorControls/TextColor.browser-test.js +136 -0
- package/tests/components/htmlEditorControls/Underline.browser-test.js +127 -0
- package/tests/components/htmlEditorControls/WordCount.browser-test.js +106 -0
|
@@ -1,142 +1,266 @@
|
|
|
1
|
-
<page
|
|
1
|
+
<page
|
|
2
|
+
pageName="HtmlEditor"
|
|
3
|
+
title="HtmlEditor - Components - Kempo Docs - A Web Components Solution"
|
|
4
|
+
>
|
|
2
5
|
<content>
|
|
3
|
-
<k-accordion
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
|
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
|
|
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"><<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">name</span>=<span class="hljs-string">'content'</span>></span><br> <span class="hljs-comment"><!-- Text formatting --></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-left'</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-bold</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-bold</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-italic</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-italic</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-underline</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-underline</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-strikethrough</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-strikethrough</span>></span><br> <span class="hljs-tag"></<span class="hljs-name">k-hec-group</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-inline-code</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-left'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-inline-code</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-dropdown</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-left'</span>></span><br> <span class="hljs-tag"><<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>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">span</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'label'</span>></span>Text Style<span class="hljs-tag"></<span class="hljs-name">span</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">'p'</span>></span>Paragraph<span class="hljs-tag"></<span class="hljs-name">k-hec-format-block</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">'h1'</span>></span>Heading 1<span class="hljs-tag"></<span class="hljs-name">k-hec-format-block</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">'h2'</span>></span>Heading 2<span class="hljs-tag"></<span class="hljs-name">k-hec-format-block</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">'h3'</span>></span>Heading 3<span class="hljs-tag"></<span class="hljs-name">k-hec-format-block</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-code-block</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-code-block</span>></span><br> <span class="hljs-tag"></<span class="hljs-name">k-hec-dropdown</span>></span><br> <span class="hljs-comment"><!-- Lists, alignment, colors, link, table --></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-left'</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-bullet-list</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-bullet-list</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-number-list</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-number-list</span>></span><br> <span class="hljs-tag"></<span class="hljs-name">k-hec-group</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-left'</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-align-left</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-align-left</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-align-center</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-align-center</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-align-right</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-align-right</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-align-justify</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-align-justify</span>></span><br> <span class="hljs-tag"></<span class="hljs-name">k-hec-group</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-left'</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-text-color</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-text-color</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-text-background-color</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-text-background-color</span>></span><br> <span class="hljs-tag"></<span class="hljs-name">k-hec-group</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-clear-formatting</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-left'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-clear-formatting</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-left'</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-create-link</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-create-link</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-insert-table</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-insert-table</span>></span><br> <span class="hljs-tag"></<span class="hljs-name">k-hec-group</span>></span><br> <span class="hljs-comment"><!-- Mode toggle + format code --></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-right'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-mode</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-cec-format-code</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-right'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-cec-format-code</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-cec-fullscreen</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-right'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-cec-fullscreen</span>></span><br> <span class="hljs-comment"><!-- Bottom toolbar stats --></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-word-count</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-bottom-left'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-word-count</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-character-count</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-bottom-left'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-character-count</span>></span><br><span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></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><svg></code>,
|
|
102
|
+
<code><script></code>, <code><style></code>, <code><video></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"><<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"
|
|
30
|
-
<span class="hljs-comment"><!-- Text formatting --></span>
|
|
31
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span>
|
|
32
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-bold</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-bold</span>></span>
|
|
33
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-italic</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-italic</span>></span>
|
|
34
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-underline</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-underline</span>></span>
|
|
35
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-strikethrough</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-strikethrough</span>></span>
|
|
36
|
-
<span class="hljs-tag"></<span class="hljs-name">k-hec-group</span>></span>
|
|
37
|
-
|
|
38
|
-
<span class="hljs-comment"><!-- Inline code --></span>
|
|
39
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-inline-code</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-inline-code</span>></span>
|
|
40
|
-
|
|
41
|
-
<span class="hljs-comment"><!-- Text style --></span>
|
|
42
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-dropdown</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span>
|
|
43
|
-
<span class="hljs-tag"><<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>></span><span class="hljs-tag"></<span class="hljs-name">k-icon</span>></span>
|
|
44
|
-
<span class="hljs-tag"><<span class="hljs-name">span</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"label"</span>></span>Text Style<span class="hljs-tag"></<span class="hljs-name">span</span>></span>
|
|
45
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">"p"</span>></span>Paragraph<span class="hljs-tag"></<span class="hljs-name">k-hec-format-block</span>></span>
|
|
46
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">"h1"</span>></span>Heading 1<span class="hljs-tag"></<span class="hljs-name">k-hec-format-block</span>></span>
|
|
47
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">"h2"</span>></span>Heading 2<span class="hljs-tag"></<span class="hljs-name">k-hec-format-block</span>></span>
|
|
48
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-format-block</span> <span class="hljs-attr">tag</span>=<span class="hljs-string">"h3"</span>></span>Heading 3<span class="hljs-tag"></<span class="hljs-name">k-hec-format-block</span>></span>
|
|
49
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-code-block</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-code-block</span>></span>
|
|
50
|
-
<span class="hljs-tag"></<span class="hljs-name">k-hec-dropdown</span>></span>
|
|
51
|
-
|
|
52
|
-
<span class="hljs-comment"><!-- Lists --></span>
|
|
53
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span>
|
|
54
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-bullet-list</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-bullet-list</span>></span>
|
|
55
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-number-list</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-number-list</span>></span>
|
|
56
|
-
<span class="hljs-tag"></<span class="hljs-name">k-hec-group</span>></span>
|
|
57
|
-
|
|
58
|
-
<span class="hljs-comment"><!-- Alignment --></span>
|
|
59
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span>
|
|
60
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-align-left</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-align-left</span>></span>
|
|
61
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-align-center</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-align-center</span>></span>
|
|
62
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-align-right</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-align-right</span>></span>
|
|
63
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-align-justify</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-align-justify</span>></span>
|
|
64
|
-
<span class="hljs-tag"></<span class="hljs-name">k-hec-group</span>></span>
|
|
65
|
-
|
|
66
|
-
<span class="hljs-comment"><!-- Colors --></span>
|
|
67
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span>
|
|
68
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-text-color</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-text-color</span>></span>
|
|
69
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-text-background-color</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-text-background-color</span>></span>
|
|
70
|
-
<span class="hljs-tag"></<span class="hljs-name">k-hec-group</span>></span>
|
|
71
|
-
|
|
72
|
-
<span class="hljs-comment"><!-- Clear formatting --></span>
|
|
73
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-clear-formatting</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-clear-formatting</span>></span>
|
|
74
|
-
|
|
75
|
-
<span class="hljs-comment"><!-- Link and table --></span>
|
|
76
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-group</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span>
|
|
77
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-create-link</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-create-link</span>></span>
|
|
78
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-insert-table</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-insert-table</span>></span>
|
|
79
|
-
<span class="hljs-tag"></<span class="hljs-name">k-hec-group</span>></span>
|
|
80
|
-
|
|
81
|
-
<span class="hljs-comment"><!-- Spacer and mode toggle --></span>
|
|
82
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-spacer</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-spacer</span>></span>
|
|
83
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-mode</span>></span>
|
|
84
|
-
|
|
85
|
-
<span class="hljs-comment"><!-- Bottom toolbar stats --></span>
|
|
86
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-word-count</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-bottom"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-word-count</span>></span>
|
|
87
|
-
<span class="hljs-tag"><<span class="hljs-name">k-hec-character-count</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-bottom"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-character-count</span>></span>
|
|
88
|
-
<span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></span></code></pre>
|
|
109
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<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">"..."</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-right'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-mode</span>></span><br><span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></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
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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="
|
|
139
|
-
|
|
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"><!-- Import the HtmlComment node --></span><br><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">'module'</span> <span class="hljs-attr">src</span>=<span class="hljs-string">'src/components/htmlEditorNodes/HtmlComment.js'</span>></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span><br><span class="hljs-comment"><!-- Register the node with nodes attribute --></span><br><span class="hljs-tag"><<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">nodes</span>=<span class="hljs-string">'HtmlComment'</span> <span class="hljs-attr">value</span>=<span class="hljs-string">'<p>This paragraph has an <!-- important note --> inline comment.</p>'</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top-right'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-mode</span>></span><br><span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></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><k-html-editor></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"><<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">controls</span>=<span class="hljs-string">"full"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></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"><<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">controls</span>=<span class="hljs-string">"normal"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></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"><<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">controls</span>=<span class="hljs-string">"minimal"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></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"><<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">style</span>=<span class="hljs-string">'height: 500px'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></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
|
|
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
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
<k-card label="HTML">
|
|
206
|
-
<pre><code class="hljs xml"><span class="hljs-tag"><<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">"<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>"</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-spacer</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-spacer</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">"toolbar-top"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-mode</span>></span><br><span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></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"><!-- Import the HtmlComment node --></span><br><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">'module'</span> <span class="hljs-attr">src</span>=<span class="hljs-string">'src/components/htmlEditorNodes/HtmlComment.js'</span>></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span><br><span class="hljs-comment"><!-- Register the node with nodes attribute --></span><br><span class="hljs-tag"><<span class="hljs-name">k-html-editor</span> <span class="hljs-attr">nodes</span>=<span class="hljs-string">'HtmlComment'</span> <span class="hljs-attr">value</span>=<span class="hljs-string">'<p>This paragraph has an <!-- important note --> inline comment.</p>'</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-spacer</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-spacer</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-hec-mode</span> <span class="hljs-attr">slot</span>=<span class="hljs-string">'toolbar-top'</span>></span><span class="hljs-tag"></<span class="hljs-name">k-hec-mode</span>></span><br><span class="hljs-tag"></<span class="hljs-name">k-html-editor</span>></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
|
|
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
|
|
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:
|
|
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><svg></code>, <code><script></code>, <code><style></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
|
|
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
|
|
259
|
-
|
|
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><!-- --></code> to a parseable <code><span></code>)
|
|
380
|
+
</li>
|
|
260
381
|
</ul>
|
|
261
382
|
|
|
262
|
-
<
|
|
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><k-html-editor></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"><<span class="hljs-name">script</span>></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"></<span class="hljs-name">script</span>></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>
|
|
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,
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
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.
|
|
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
|
|
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,
|
|
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 & 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
|
|
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
|
|
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
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
<script
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
<script
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
<script
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
<script
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
<script
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
<script
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
<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>
|