kempo-ui 0.4.4 → 0.4.6
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/Chat.js +201 -0
- package/dist/components/CodeEditor.js +21 -2
- package/dist/components/Dropdown.js +1 -1
- package/dist/components/HtmlEditor.js +42 -3
- package/dist/components/MarkdownEditor.js +173 -0
- package/dist/components/Resize.js +12 -2
- package/dist/components/TextToSpeech.js +4 -4
- package/dist/components/VoiceSelector.js +49 -0
- package/dist/components/markdownEditorControls/Bold.js +11 -0
- package/dist/components/markdownEditorControls/BulletList.js +11 -0
- package/dist/components/markdownEditorControls/Code.js +11 -0
- package/dist/components/markdownEditorControls/FormatBlock.js +30 -0
- package/dist/components/markdownEditorControls/Heading.js +11 -0
- package/dist/components/markdownEditorControls/Image.js +93 -0
- package/dist/components/markdownEditorControls/Italic.js +11 -0
- package/dist/components/markdownEditorControls/Link.js +11 -0
- package/dist/components/markdownEditorControls/MarkdownEditorControl.js +39 -0
- package/dist/components/markdownEditorControls/Menu.js +30 -0
- package/dist/components/markdownEditorControls/NumberedList.js +11 -0
- package/dist/components/markdownEditorControls/Quote.js +11 -0
- package/dist/components/markdownEditorControls/SpeechToText.js +16 -0
- package/dist/components/markdownEditorControls/Strikethrough.js +11 -0
- package/dist/components/markdownEditorControls/Table.js +80 -0
- package/dist/utils/marked.esm.js +1 -0
- package/dist/utils/renderMarkdown.js +1 -0
- package/dist/utils/sanitizeHtml.js +1 -0
- package/dist/utils/voice.js +1 -0
- package/docs/components/accordion.html +19 -0
- package/docs/components/aside.html +19 -0
- package/docs/components/calendar.html +19 -0
- package/docs/components/card.html +19 -0
- package/docs/components/chat.html +715 -0
- package/docs/components/code-editor.html +55 -0
- package/docs/components/color-picker.html +19 -0
- package/docs/components/combobox.html +19 -0
- package/docs/components/content-slider.html +19 -0
- package/docs/components/context.html +19 -0
- package/docs/components/dialog.html +19 -0
- package/docs/components/dropdown.html +19 -0
- package/docs/components/filter-list.html +19 -0
- package/docs/components/focus-capture.html +19 -0
- package/docs/components/html-editor.html +60 -0
- package/docs/components/hybrid-component.html +19 -0
- package/docs/components/icon.html +19 -0
- package/docs/components/import.html +19 -0
- package/docs/components/light-component.html +19 -0
- package/docs/components/markdown-editor.html +924 -0
- package/docs/components/nav-spacer.html +19 -0
- package/docs/components/nav.html +19 -0
- package/docs/components/photo-viewer.html +19 -0
- package/docs/components/progress.html +19 -0
- package/docs/components/resize.html +22 -0
- package/docs/components/rich-textarea.html +650 -0
- package/docs/components/shadow-component.html +19 -0
- package/docs/components/show-more.html +19 -0
- package/docs/components/slider.html +19 -0
- package/docs/components/sortable.html +19 -0
- package/docs/components/speech-to-text.html +19 -0
- package/docs/components/spinner.html +19 -0
- package/docs/components/split.html +19 -0
- package/docs/components/table.html +19 -0
- package/docs/components/tableControls.html +19 -0
- package/docs/components/tableCustomFields.html +19 -0
- package/docs/components/tableFetchRecords.html +19 -0
- package/docs/components/tableFieldSortHide.html +19 -0
- package/docs/components/tablePagination.html +19 -0
- package/docs/components/tablePlaceholder.html +19 -0
- package/docs/components/tableRecordEditing.html +19 -0
- package/docs/components/tableRecordFiltering.html +19 -0
- package/docs/components/tableRecordHiding.html +19 -0
- package/docs/components/tableRecordSearching.html +19 -0
- package/docs/components/tableRecordSelection.html +19 -0
- package/docs/components/tableRowControls.html +19 -0
- package/docs/components/tableServerSync.html +19 -0
- package/docs/components/tableSorting.html +19 -0
- package/docs/components/tabs.html +19 -0
- package/docs/components/tags.html +19 -0
- package/docs/components/text-to-speech.html +63 -1
- package/docs/components/theme-select.html +19 -0
- package/docs/components/theme-switcher.html +19 -0
- package/docs/components/time.html +19 -0
- package/docs/components/timestamp.html +19 -0
- package/docs/components/toast.html +19 -0
- package/docs/components/toggle.html +19 -0
- package/docs/components/tree.html +19 -0
- package/docs/components/voice-selector.html +610 -0
- package/docs/icons/done_all.svg +1 -0
- package/docs/icons/format_quote.svg +1 -0
- package/docs/icons/format_strikethrough.svg +1 -0
- package/docs/icons/send.svg +1 -0
- package/docs/icons/text_fields.svg +1 -0
- package/docs/index.html +49 -0
- package/docs/src/components/Chat.js +201 -0
- package/docs/src/components/CodeEditor.js +21 -2
- package/docs/src/components/Dropdown.js +1 -1
- package/docs/src/components/HtmlEditor.js +42 -3
- package/docs/src/components/MarkdownEditor.js +173 -0
- package/docs/src/components/Resize.js +12 -2
- package/docs/src/components/TextToSpeech.js +4 -4
- package/docs/src/components/VoiceSelector.js +49 -0
- package/docs/src/components/markdownEditorControls/Bold.js +11 -0
- package/docs/src/components/markdownEditorControls/BulletList.js +11 -0
- package/docs/src/components/markdownEditorControls/Code.js +11 -0
- package/docs/src/components/markdownEditorControls/FormatBlock.js +30 -0
- package/docs/src/components/markdownEditorControls/Heading.js +11 -0
- package/docs/src/components/markdownEditorControls/Image.js +93 -0
- package/docs/src/components/markdownEditorControls/Italic.js +11 -0
- package/docs/src/components/markdownEditorControls/Link.js +11 -0
- package/docs/src/components/markdownEditorControls/MarkdownEditorControl.js +39 -0
- package/docs/src/components/markdownEditorControls/Menu.js +30 -0
- package/docs/src/components/markdownEditorControls/NumberedList.js +11 -0
- package/docs/src/components/markdownEditorControls/Quote.js +11 -0
- package/docs/src/components/markdownEditorControls/SpeechToText.js +16 -0
- package/docs/src/components/markdownEditorControls/Strikethrough.js +11 -0
- package/docs/src/components/markdownEditorControls/Table.js +80 -0
- package/docs/src/utils/marked.esm.js +1 -0
- package/docs/src/utils/renderMarkdown.js +1 -0
- package/docs/src/utils/sanitizeHtml.js +1 -0
- package/docs/src/utils/voice.js +1 -0
- package/docs/utils/context.html +19 -0
- package/docs/utils/cookie.html +19 -0
- package/docs/utils/debounce.html +19 -0
- package/docs/utils/drag.html +19 -0
- package/docs/utils/elevation.html +23 -10
- package/docs/utils/formatTimestamp.html +19 -0
- package/docs/utils/object.html +19 -0
- package/docs/utils/propConverters.html +19 -0
- package/docs/utils/sanitizeHtml.html +555 -0
- package/docs/utils/string.html +19 -0
- package/docs/utils/theme.html +19 -0
- package/docs/utils/toTitleCase.html +19 -0
- package/docs/utils/type.html +19 -0
- package/docs/utils/voice.html +548 -0
- package/docs/utils/wait.html +19 -0
- package/docs-src/components/chat.page.html +230 -0
- package/docs-src/components/code-editor.page.html +36 -0
- package/docs-src/components/html-editor.page.html +41 -0
- package/docs-src/components/markdown-editor.page.html +439 -0
- package/docs-src/components/resize.page.html +3 -0
- package/docs-src/components/text-to-speech.page.html +44 -1
- package/docs-src/components/voice-selector.page.html +125 -0
- package/docs-src/index.page.html +30 -0
- package/docs-src/nav.fragment.html +19 -0
- package/docs-src/utils/elevation.page.html +4 -10
- package/docs-src/utils/sanitizeHtml.page.html +73 -0
- package/docs-src/utils/voice.page.html +66 -0
- package/icons/done_all.svg +1 -0
- package/icons/format_quote.svg +1 -0
- package/icons/format_strikethrough.svg +1 -0
- package/icons/send.svg +1 -0
- package/icons/text_fields.svg +1 -0
- package/llms.txt +7 -2
- package/package.json +3 -2
- package/src/components/Chat.js +435 -0
- package/src/components/CodeEditor.js +58 -2
- package/src/components/Dropdown.js +1 -1
- package/src/components/HtmlEditor.js +84 -4
- package/src/components/MarkdownEditor.js +654 -0
- package/src/components/Resize.js +17 -1
- package/src/components/TextToSpeech.js +13 -2
- package/src/components/VoiceSelector.js +271 -0
- package/src/components/markdownEditorControls/Bold.js +30 -0
- package/src/components/markdownEditorControls/BulletList.js +30 -0
- package/src/components/markdownEditorControls/Code.js +39 -0
- package/src/components/markdownEditorControls/FormatBlock.js +102 -0
- package/src/components/markdownEditorControls/Heading.js +45 -0
- package/src/components/markdownEditorControls/Image.js +250 -0
- package/src/components/markdownEditorControls/Italic.js +30 -0
- package/src/components/markdownEditorControls/Link.js +74 -0
- package/src/components/markdownEditorControls/MarkdownEditorControl.js +158 -0
- package/src/components/markdownEditorControls/Menu.js +86 -0
- package/src/components/markdownEditorControls/NumberedList.js +69 -0
- package/src/components/markdownEditorControls/Quote.js +30 -0
- package/src/components/markdownEditorControls/SpeechToText.js +65 -0
- package/src/components/markdownEditorControls/Strikethrough.js +35 -0
- package/src/components/markdownEditorControls/Table.js +164 -0
- package/src/utils/marked.esm.js +77 -0
- package/src/utils/renderMarkdown.js +29 -0
- package/src/utils/sanitizeHtml.js +137 -0
- package/src/utils/voice.js +103 -0
- package/tests/components/Chat.browser-test.js +540 -0
- package/tests/components/TextToSpeech.browser-test.js +150 -1
- package/tests/components/VoiceSelector.browser-test.js +374 -0
- package/tests/utils/sanitizeHtml.browser-test.js +179 -0
- package/tests/utils/voice.browser-test.js +128 -0
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Rich Textarea - Components - Kempo Docs - A Web Components Solution</title>
|
|
7
|
+
<link rel="icon" type="image/png" sizes="48x48" href="../media/icon48.png">
|
|
8
|
+
<link rel="manifest" href="../manifest.json" />
|
|
9
|
+
<link rel="stylesheet" href="../kempo-vars.css" />
|
|
10
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/kempo-css@2/dist/kempo.min.css" />
|
|
11
|
+
<link rel="stylesheet" href="../kempo-hljs.css" />
|
|
12
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
13
|
+
<script>window.litDisableBundleWarning = true;</script>
|
|
14
|
+
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
|
|
18
|
+
<k-nav
|
|
19
|
+
fixed
|
|
20
|
+
class="bg-primary"
|
|
21
|
+
>
|
|
22
|
+
<button
|
|
23
|
+
id="toggleNavSideMenu"
|
|
24
|
+
class="link"
|
|
25
|
+
>
|
|
26
|
+
<k-icon name="menu"></k-icon>
|
|
27
|
+
</button>
|
|
28
|
+
<a
|
|
29
|
+
href="../"
|
|
30
|
+
class="d-if ph"
|
|
31
|
+
style="align-items: center"
|
|
32
|
+
>
|
|
33
|
+
<img
|
|
34
|
+
src="../media/icon32.png"
|
|
35
|
+
alt="Kempo UI Icon"
|
|
36
|
+
class="pr"
|
|
37
|
+
/>
|
|
38
|
+
Kempo UI
|
|
39
|
+
</a>
|
|
40
|
+
<div
|
|
41
|
+
style="position:relative;margin:0 .25rem;align-self:center;"
|
|
42
|
+
theme="light"
|
|
43
|
+
>
|
|
44
|
+
<input
|
|
45
|
+
id="navSearchInput"
|
|
46
|
+
type="search"
|
|
47
|
+
placeholder="Search docs..."
|
|
48
|
+
autocomplete="off"
|
|
49
|
+
style="width:11rem;"
|
|
50
|
+
/>
|
|
51
|
+
<div
|
|
52
|
+
id="navSearchDropdown"
|
|
53
|
+
hidden
|
|
54
|
+
theme="light"
|
|
55
|
+
style="position:absolute;top:calc(100% + 4px);left:0;width:min(480px,90vw);max-height:70vh;background:var(--c_bg);border:1px solid var(--c_border);border-radius:var(--radius);overflow:auto;z-index:9999;box-shadow:0 4px 12px rgba(0,0,0,.3);"
|
|
56
|
+
>
|
|
57
|
+
<k-filter-list
|
|
58
|
+
id="navSearchList"
|
|
59
|
+
style="display:block;padding:.25rem 0;"
|
|
60
|
+
>
|
|
61
|
+
<k-filter-item filter-keywords="accordion components"><a
|
|
62
|
+
href="../components/accordion.html">Accordion<br><small>Component</small></a></k-filter-item>
|
|
63
|
+
<k-filter-item filter-keywords="aside sidebar components"><a
|
|
64
|
+
href="../components/aside.html">Aside<br><small>Component</small></a></k-filter-item>
|
|
65
|
+
<k-filter-item filter-keywords="calendar date picker range month day components"><a
|
|
66
|
+
href="../components/calendar.html"
|
|
67
|
+
>Calendar<br><small>Component</small></a></k-filter-item>
|
|
68
|
+
<k-filter-item filter-keywords="card components"><a
|
|
69
|
+
href="../components/card.html">Card<br><small>Component</small></a></k-filter-item>
|
|
70
|
+
<k-filter-item filter-keywords="chat message conversation messaging components"><a
|
|
71
|
+
href="../components/chat.html"
|
|
72
|
+
>Chat<br><small>Component</small></a></k-filter-item>
|
|
73
|
+
<k-filter-item filter-keywords="code editor codeeditor monaco components"><a
|
|
74
|
+
href="../components/code-editor.html"
|
|
75
|
+
>Code Editor<br><small>Component</small></a></k-filter-item>
|
|
76
|
+
<k-filter-item filter-keywords="combobox combo box search autocomplete components"><a
|
|
77
|
+
href="../components/combobox.html"
|
|
78
|
+
>Combobox<br><small>Component</small></a></k-filter-item>
|
|
79
|
+
<k-filter-item filter-keywords="color picker colorpicker components"><a
|
|
80
|
+
href="../components/color-picker.html"
|
|
81
|
+
>Color Picker<br><small>Component</small></a></k-filter-item>
|
|
82
|
+
<k-filter-item filter-keywords="content slider components"><a
|
|
83
|
+
href="../components/content-slider.html"
|
|
84
|
+
>Content Slider<br><small>Component</small></a></k-filter-item>
|
|
85
|
+
<k-filter-item filter-keywords="context state global components"><a
|
|
86
|
+
href="../components/context.html"
|
|
87
|
+
>Context<br><small>Component</small></a></k-filter-item>
|
|
88
|
+
<k-filter-item filter-keywords="dialog modal popup components"><a
|
|
89
|
+
href="../components/dialog.html">Dialog<br><small>Component</small></a></k-filter-item>
|
|
90
|
+
<k-filter-item filter-keywords="dropdown select components"><a
|
|
91
|
+
href="../components/dropdown.html">Dropdown<br><small>Component</small></a></k-filter-item>
|
|
92
|
+
<k-filter-item filter-keywords="filter list filterlist components"><a
|
|
93
|
+
href="../components/filter-list.html"
|
|
94
|
+
>Filter List<br><small>Component</small></a></k-filter-item>
|
|
95
|
+
<k-filter-item filter-keywords="focus capture focuscapture components"><a
|
|
96
|
+
href="../components/focus-capture.html"
|
|
97
|
+
>Focus Capture<br><small>Component</small></a></k-filter-item>
|
|
98
|
+
<k-filter-item filter-keywords="html editor components"><a
|
|
99
|
+
href="../components/html-editor.html">HTML
|
|
100
|
+
Editor<br><small>Component</small></a></k-filter-item>
|
|
101
|
+
<k-filter-item filter-keywords="icon components"><a
|
|
102
|
+
href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
103
|
+
<k-filter-item filter-keywords="import components"><a
|
|
104
|
+
href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
105
|
+
<k-filter-item filter-keywords="nav navbar navigation components"><a
|
|
106
|
+
href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
107
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a
|
|
108
|
+
href="../components/nav-spacer.html"
|
|
109
|
+
>Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
110
|
+
<k-filter-item filter-keywords="photo viewer photoviewer components"><a
|
|
111
|
+
href="../components/photo-viewer.html"
|
|
112
|
+
>Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
113
|
+
<k-filter-item filter-keywords="progress loading components"><a
|
|
114
|
+
href="../components/progress.html">Progress<br><small>Component</small></a></k-filter-item>
|
|
115
|
+
<k-filter-item filter-keywords="resize components"><a
|
|
116
|
+
href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
117
|
+
<k-filter-item filter-keywords="rich textarea richtextarea contenteditable input form bold italic underline components"><a
|
|
118
|
+
href="../components/rich-textarea.html"
|
|
119
|
+
>Rich Textarea<br><small>Component</small></a></k-filter-item>
|
|
120
|
+
<k-filter-item filter-keywords="show more showmore components"><a
|
|
121
|
+
href="../components/show-more.html"
|
|
122
|
+
>Show More<br><small>Component</small></a></k-filter-item>
|
|
123
|
+
<k-filter-item filter-keywords="slider range input step components"><a
|
|
124
|
+
href="../components/slider.html"
|
|
125
|
+
>Slider<br><small>Component</small></a></k-filter-item>
|
|
126
|
+
<k-filter-item filter-keywords="sortable drag drop sort components"><a
|
|
127
|
+
href="../components/sortable.html"
|
|
128
|
+
>Sortable<br><small>Component</small></a></k-filter-item>
|
|
129
|
+
<k-filter-item filter-keywords="speech to text speechtotext microphone voice recognition transcription components"><a
|
|
130
|
+
href="../components/speech-to-text.html"
|
|
131
|
+
>Speech To Text<br><small>Component</small></a></k-filter-item>
|
|
132
|
+
<k-filter-item filter-keywords="spinner loading components"><a
|
|
133
|
+
href="../components/spinner.html">Spinner<br><small>Component</small></a></k-filter-item>
|
|
134
|
+
<k-filter-item filter-keywords="split pane components"><a
|
|
135
|
+
href="../components/split.html">Split<br><small>Component</small></a></k-filter-item>
|
|
136
|
+
<k-filter-item filter-keywords="table data grid components"><a
|
|
137
|
+
href="../components/table.html">Table<br><small>Component</small></a></k-filter-item>
|
|
138
|
+
<k-filter-item filter-keywords="table controls advanced example"><a
|
|
139
|
+
href="../components/tableControls.html"
|
|
140
|
+
>Table — Controls<br><small>Advanced Example</small></a></k-filter-item>
|
|
141
|
+
<k-filter-item filter-keywords="table custom fields advanced example"><a
|
|
142
|
+
href="../components/tableCustomFields.html"
|
|
143
|
+
>Table — Custom Fields<br><small>Advanced Example</small></a></k-filter-item>
|
|
144
|
+
<k-filter-item filter-keywords="table fetch records advanced example"><a
|
|
145
|
+
href="../components/tableFetchRecords.html"
|
|
146
|
+
>Table — Fetch Records<br><small>Advanced Example</small></a></k-filter-item>
|
|
147
|
+
<k-filter-item filter-keywords="table field sort hide advanced example"><a
|
|
148
|
+
href="../components/tableFieldSortHide.html"
|
|
149
|
+
>Table — Field Sort & Hide<br><small>Advanced Example</small></a></k-filter-item>
|
|
150
|
+
<k-filter-item filter-keywords="table pagination advanced example"><a
|
|
151
|
+
href="../components/tablePagination.html"
|
|
152
|
+
>Table — Pagination<br><small>Advanced Example</small></a></k-filter-item>
|
|
153
|
+
<k-filter-item filter-keywords="table record editing advanced example"><a
|
|
154
|
+
href="../components/tableRecordEditing.html"
|
|
155
|
+
>Table — Record Editing<br><small>Advanced Example</small></a></k-filter-item>
|
|
156
|
+
<k-filter-item filter-keywords="table record filtering advanced example"><a
|
|
157
|
+
href="../components/tableRecordFiltering.html"
|
|
158
|
+
>Table — Record Filtering<br><small>Advanced Example</small></a></k-filter-item>
|
|
159
|
+
<k-filter-item filter-keywords="table record hiding advanced example"><a
|
|
160
|
+
href="../components/tableRecordHiding.html"
|
|
161
|
+
>Table — Record Hiding<br><small>Advanced Example</small></a></k-filter-item>
|
|
162
|
+
<k-filter-item filter-keywords="table record searching advanced example"><a
|
|
163
|
+
href="../components/tableRecordSearching.html"
|
|
164
|
+
>Table — Record Searching<br><small>Advanced Example</small></a></k-filter-item>
|
|
165
|
+
<k-filter-item filter-keywords="table record selection advanced example"><a
|
|
166
|
+
href="../components/tableRecordSelection.html"
|
|
167
|
+
>Table — Record Selection<br><small>Advanced Example</small></a></k-filter-item>
|
|
168
|
+
<k-filter-item filter-keywords="table row controls advanced example"><a
|
|
169
|
+
href="../components/tableRowControls.html"
|
|
170
|
+
>Table — Row Controls<br><small>Advanced Example</small></a></k-filter-item>
|
|
171
|
+
<k-filter-item filter-keywords="table server sync advanced example"><a
|
|
172
|
+
href="../components/tableServerSync.html"
|
|
173
|
+
>Table — Server Sync<br><small>Advanced Example</small></a></k-filter-item>
|
|
174
|
+
<k-filter-item filter-keywords="table sorting advanced example"><a
|
|
175
|
+
href="../components/tableSorting.html"
|
|
176
|
+
>Table — Sorting<br><small>Advanced Example</small></a></k-filter-item>
|
|
177
|
+
<k-filter-item filter-keywords="table placeholder advanced example"><a
|
|
178
|
+
href="../components/tablePlaceholder.html"
|
|
179
|
+
>Table — Placeholder<br><small>Advanced Example</small></a></k-filter-item>
|
|
180
|
+
<k-filter-item filter-keywords="tabs tab panel components"><a
|
|
181
|
+
href="../components/tabs.html">Tabs<br><small>Component</small></a></k-filter-item>
|
|
182
|
+
<k-filter-item filter-keywords="tags tag input components"><a
|
|
183
|
+
href="../components/tags.html">Tags<br><small>Component</small></a></k-filter-item>
|
|
184
|
+
<k-filter-item filter-keywords="text to speech texttospeech tts speak voice synthesis components"><a
|
|
185
|
+
href="../components/text-to-speech.html"
|
|
186
|
+
>Text To Speech<br><small>Component</small></a></k-filter-item>
|
|
187
|
+
<k-filter-item filter-keywords="theme select dropdown dark light components"><a
|
|
188
|
+
href="../components/theme-select.html"
|
|
189
|
+
>Theme Select<br><small>Component</small></a></k-filter-item>
|
|
190
|
+
<k-filter-item filter-keywords="theme switcher dark light components"><a
|
|
191
|
+
href="../components/theme-switcher.html"
|
|
192
|
+
>Theme Switcher<br><small>Component</small></a></k-filter-item>
|
|
193
|
+
<k-filter-item filter-keywords="time picker clock hour minute form components"><a
|
|
194
|
+
href="../components/time.html"
|
|
195
|
+
>Time<br><small>Component</small></a></k-filter-item>
|
|
196
|
+
<k-filter-item filter-keywords="timestamp date time components"><a
|
|
197
|
+
href="../components/timestamp.html"
|
|
198
|
+
>Timestamp<br><small>Component</small></a></k-filter-item>
|
|
199
|
+
<k-filter-item filter-keywords="toast notification alert components"><a
|
|
200
|
+
href="../components/toast.html"
|
|
201
|
+
>Toast<br><small>Component</small></a></k-filter-item>
|
|
202
|
+
<k-filter-item filter-keywords="toggle switch checkbox components"><a
|
|
203
|
+
href="../components/toggle.html"
|
|
204
|
+
>Toggle<br><small>Component</small></a></k-filter-item>
|
|
205
|
+
<k-filter-item filter-keywords="tree treeview components"><a
|
|
206
|
+
href="../components/tree.html">Tree<br><small>Component</small></a></k-filter-item>
|
|
207
|
+
<k-filter-item filter-keywords="voice selector dropdown speech synthesis preference components"><a
|
|
208
|
+
href="../components/voice-selector.html"
|
|
209
|
+
>Voice Selector<br><small>Component</small></a></k-filter-item>
|
|
210
|
+
<k-filter-item filter-keywords="shadow component base"><a
|
|
211
|
+
href="../components/shadow-component.html"
|
|
212
|
+
>Shadow Component<br><small>Base Component</small></a></k-filter-item>
|
|
213
|
+
<k-filter-item filter-keywords="light component base"><a
|
|
214
|
+
href="../components/light-component.html">Light Component<br><small>Base
|
|
215
|
+
Component</small></a></k-filter-item>
|
|
216
|
+
<k-filter-item filter-keywords="hybrid component base"><a
|
|
217
|
+
href="../components/hybrid-component.html"
|
|
218
|
+
>Hybrid Component<br><small>Base Component</small></a></k-filter-item>
|
|
219
|
+
<k-filter-item filter-keywords="cookie utils utility"><a
|
|
220
|
+
href="../utils/cookie.html">cookie<br><small>Utility</small></a></k-filter-item>
|
|
221
|
+
<k-filter-item filter-keywords="context utils utility"><a
|
|
222
|
+
href="../utils/context.html">context<br><small>Utility</small></a></k-filter-item>
|
|
223
|
+
<k-filter-item filter-keywords="debounce utils utility"><a
|
|
224
|
+
href="../utils/debounce.html">debounce<br><small>Utility</small></a></k-filter-item>
|
|
225
|
+
<k-filter-item filter-keywords="drag utils utility"><a
|
|
226
|
+
href="../utils/drag.html">drag<br><small>Utility</small></a></k-filter-item>
|
|
227
|
+
<k-filter-item filter-keywords="elevation z-index stacking utils"><a
|
|
228
|
+
href="../utils/elevation.html">elevation<br><small>Utility</small></a></k-filter-item>
|
|
229
|
+
<k-filter-item filter-keywords="formattimestamp timestamp format date time utils utility"><a
|
|
230
|
+
href="../utils/formatTimestamp.html"
|
|
231
|
+
>formatTimestamp<br><small>Utility</small></a></k-filter-item>
|
|
232
|
+
<k-filter-item filter-keywords="object utils utility"><a
|
|
233
|
+
href="../utils/object.html">object<br><small>Utility</small></a></k-filter-item>
|
|
234
|
+
<k-filter-item filter-keywords="propconverters prop converters utils utility"><a
|
|
235
|
+
href="../utils/propConverters.html"
|
|
236
|
+
>propConverters<br><small>Utility</small></a></k-filter-item>
|
|
237
|
+
<k-filter-item filter-keywords="sanitizehtml sanitize html xss security utils utility"><a
|
|
238
|
+
href="../utils/sanitizeHtml.html"
|
|
239
|
+
>sanitizeHtml<br><small>Utility</small></a></k-filter-item>
|
|
240
|
+
<k-filter-item filter-keywords="string utils utility"><a
|
|
241
|
+
href="../utils/string.html">string<br><small>Utility</small></a></k-filter-item>
|
|
242
|
+
<k-filter-item filter-keywords="theme utils utility"><a
|
|
243
|
+
href="../utils/theme.html">theme<br><small>Utility</small></a></k-filter-item>
|
|
244
|
+
<k-filter-item filter-keywords="type utils utility"><a
|
|
245
|
+
href="../utils/type.html">type<br><small>Utility</small></a></k-filter-item>
|
|
246
|
+
<k-filter-item filter-keywords="voice speech synthesis preference utils utility"><a
|
|
247
|
+
href="../utils/voice.html">voice<br><small>Utility</small></a></k-filter-item>
|
|
248
|
+
<k-filter-item filter-keywords="wait async utils utility"><a
|
|
249
|
+
href="../utils/wait.html">wait<br><small>Utility</small></a></k-filter-item>
|
|
250
|
+
</k-filter-list>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
<div class="flex"></div>
|
|
254
|
+
<a
|
|
255
|
+
href="https://github.com/dustinpoissant/kempo-ui?tab=License-1-ov-file#creative-commons-attribution-noncommercial-sharealike-20"
|
|
256
|
+
target="_blank"
|
|
257
|
+
><k-icon name="license"></k-icon></a>
|
|
258
|
+
<a
|
|
259
|
+
href="https://www.npmjs.com/package/kempo-ui"
|
|
260
|
+
target="_blank"
|
|
261
|
+
><k-icon name="npm"></k-icon></a>
|
|
262
|
+
<a
|
|
263
|
+
href="https://github.com/dustinpoissant/kempo-ui"
|
|
264
|
+
target="_blank"
|
|
265
|
+
><k-icon name="github-mark"></k-icon></a>
|
|
266
|
+
<k-theme-switcher
|
|
267
|
+
class="mr"
|
|
268
|
+
style="
|
|
269
|
+
--padding: 0.5rem;
|
|
270
|
+
--c_active: var(--tc_on_primary);
|
|
271
|
+
--tc_active: var(--c_primary);
|
|
272
|
+
--c_inactive__hover: rgba(255, 255, 255, 0.1);
|
|
273
|
+
"
|
|
274
|
+
></k-theme-switcher>
|
|
275
|
+
</k-nav>
|
|
276
|
+
<div style="width: 100%; height: 4rem;"></div>
|
|
277
|
+
<k-aside
|
|
278
|
+
id="navSideMenu"
|
|
279
|
+
main="overlay"
|
|
280
|
+
state="offscreen"
|
|
281
|
+
>
|
|
282
|
+
<menu>
|
|
283
|
+
<a
|
|
284
|
+
href="../"
|
|
285
|
+
class="ta-center bb mb r0"
|
|
286
|
+
>
|
|
287
|
+
<h1 class="tc-primary">Kempo UI</h1>
|
|
288
|
+
<img
|
|
289
|
+
src="../media/icon128.png"
|
|
290
|
+
alt="Kempo UI Icon"
|
|
291
|
+
/>
|
|
292
|
+
</a>
|
|
293
|
+
|
|
294
|
+
<div class="pl mb">
|
|
295
|
+
<h3>Components</h3>
|
|
296
|
+
<a href="../components/accordion.html">Accordion</a>
|
|
297
|
+
<a href="../components/aside.html">Aside</a>
|
|
298
|
+
<a href="../components/calendar.html">Calendar</a>
|
|
299
|
+
<a href="../components/card.html">Card</a>
|
|
300
|
+
<a href="../components/chat.html">Chat</a>
|
|
301
|
+
<a href="../components/code-editor.html">Code Editor</a>
|
|
302
|
+
<a href="../components/combobox.html">Combobox</a>
|
|
303
|
+
<a href="../components/color-picker.html">ColorPicker</a>
|
|
304
|
+
<a href="../components/content-slider.html">Content Slider</a>
|
|
305
|
+
<a href="../components/context.html">Context</a>
|
|
306
|
+
<a href="../components/dialog.html">Dialog</a>
|
|
307
|
+
<a href="../components/dropdown.html">Dropdown</a>
|
|
308
|
+
<a href="../components/filter-list.html">Filter List</a>
|
|
309
|
+
<a href="../components/focus-capture.html">FocusCapture</a>
|
|
310
|
+
<a href="../components/html-editor.html">HTML Editor</a>
|
|
311
|
+
<a href="../components/icon.html">Icon</a>
|
|
312
|
+
<a href="../components/import.html">Import</a>
|
|
313
|
+
<a href="../components/nav.html">Nav</a>
|
|
314
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
315
|
+
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
316
|
+
<a href="../components/progress.html">Progress</a>
|
|
317
|
+
<a href="../components/resize.html">Resize</a>
|
|
318
|
+
<a href="../components/rich-textarea.html">Rich Textarea</a>
|
|
319
|
+
<a href="../components/show-more.html">Show More</a>
|
|
320
|
+
<a href="../components/slider.html">Slider</a>
|
|
321
|
+
<a href="../components/sortable.html">Sortable</a>
|
|
322
|
+
<a href="../components/speech-to-text.html">Speech To Text</a>
|
|
323
|
+
<a href="../components/spinner.html">Spinner</a>
|
|
324
|
+
<a href="../components/split.html">Split</a>
|
|
325
|
+
<a href="../components/table.html">Table</a>
|
|
326
|
+
<a href="../components/tabs.html">Tabs</a>
|
|
327
|
+
<a href="../components/tags.html">Tags</a>
|
|
328
|
+
<a href="../components/text-to-speech.html">Text To Speech</a>
|
|
329
|
+
<a href="../components/theme-select.html">Theme Select</a>
|
|
330
|
+
<a href="../components/theme-switcher.html">Theme Switcher</a>
|
|
331
|
+
<a href="../components/time.html">Time</a>
|
|
332
|
+
<a href="../components/timestamp.html">Timestamp</a>
|
|
333
|
+
<a href="../components/toast.html">Toast</a>
|
|
334
|
+
<a href="../components/toggle.html">Toggle</a>
|
|
335
|
+
<a href="../components/tree.html">Tree</a>
|
|
336
|
+
<a href="../components/voice-selector.html">Voice Selector</a>
|
|
337
|
+
</div>
|
|
338
|
+
|
|
339
|
+
<h5 class="mb0">Base Components</h5>
|
|
340
|
+
<div class="pl mb">
|
|
341
|
+
<a href="../components/shadow-component.html">Shadow Component</a>
|
|
342
|
+
<a href="../components/light-component.html">Light Component</a>
|
|
343
|
+
<a href="../components/hybrid-component.html">Hybrid Component</a>
|
|
344
|
+
</div>
|
|
345
|
+
|
|
346
|
+
<h5 class="mb0">Utils</h5>
|
|
347
|
+
<div class="pl mb">
|
|
348
|
+
<a href="../utils/cookie.html">cookie</a>
|
|
349
|
+
<a href="../utils/context.html">context</a>
|
|
350
|
+
<a href="../utils/debounce.html">debounce</a>
|
|
351
|
+
<a href="../utils/drag.html">drag</a>
|
|
352
|
+
<a href="../utils/elevation.html">elevation</a>
|
|
353
|
+
<a href="../utils/formatTimestamp.html">formatTimestamp</a>
|
|
354
|
+
<a href="../utils/object.html">object</a>
|
|
355
|
+
<a href="../utils/propConverters.html">propConverters</a>
|
|
356
|
+
<a href="../utils/sanitizeHtml.html">sanitizeHtml</a>
|
|
357
|
+
<a href="../utils/string.html">string</a>
|
|
358
|
+
<a href="../utils/theme.html">theme</a>
|
|
359
|
+
<a href="../utils/type.html">type</a>
|
|
360
|
+
<a href="../utils/voice.html">voice</a>
|
|
361
|
+
<a href="../utils/wait.html">wait</a>
|
|
362
|
+
</div>
|
|
363
|
+
</menu>
|
|
364
|
+
</k-aside>
|
|
365
|
+
<style>
|
|
366
|
+
#navSearchList a {
|
|
367
|
+
display: block;
|
|
368
|
+
padding: .25rem .5rem;
|
|
369
|
+
border-radius: var(--radius);
|
|
370
|
+
text-decoration: none;
|
|
371
|
+
color: var(--tc);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
#navSearchList a:hover {
|
|
375
|
+
background: rgba(128, 128, 128, .15);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
#navSearchList a small {
|
|
379
|
+
display: block;
|
|
380
|
+
color: var(--tc_muted);
|
|
381
|
+
}
|
|
382
|
+
</style>
|
|
383
|
+
<script
|
|
384
|
+
src="../src/components/Nav.js"
|
|
385
|
+
type="module"
|
|
386
|
+
></script>
|
|
387
|
+
<script
|
|
388
|
+
src="../src/components/FilterList.js"
|
|
389
|
+
type="module"
|
|
390
|
+
></script>
|
|
391
|
+
<script
|
|
392
|
+
src="../src/components/FilterItem.js"
|
|
393
|
+
type="module"
|
|
394
|
+
></script>
|
|
395
|
+
<script
|
|
396
|
+
src="../src/components/Aside.js"
|
|
397
|
+
type="module"
|
|
398
|
+
></script>
|
|
399
|
+
<script
|
|
400
|
+
src="../src/components/Icon.js"
|
|
401
|
+
type="module"
|
|
402
|
+
></script>
|
|
403
|
+
<script
|
|
404
|
+
src="../src/components/ThemeSwitcher.js"
|
|
405
|
+
type="module"
|
|
406
|
+
></script>
|
|
407
|
+
<script type="module">
|
|
408
|
+
import debounce from '../src/utils/debounce.js';
|
|
409
|
+
|
|
410
|
+
document.getElementById('toggleNavSideMenu').addEventListener('click', async () => {
|
|
411
|
+
await window.customElements.whenDefined('k-aside');
|
|
412
|
+
document.getElementById('navSideMenu').toggle();
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
document.addEventListener('click', function (e) {
|
|
416
|
+
if (e.target.matches('a[href^="#"]')) {
|
|
417
|
+
e.preventDefault();
|
|
418
|
+
const targetId = e.target.getAttribute('href').replace('#', '');
|
|
419
|
+
const target = document.getElementById(targetId);
|
|
420
|
+
if (target) {
|
|
421
|
+
target.scrollIntoView({ behavior: 'smooth' });
|
|
422
|
+
const url = window.location.pathname + window.location.search + '#' + targetId;
|
|
423
|
+
history.replaceState(null, '', url);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
/*
|
|
429
|
+
Nav Search
|
|
430
|
+
*/
|
|
431
|
+
const searchInput = document.getElementById('navSearchInput');
|
|
432
|
+
const searchDropdown = document.getElementById('navSearchDropdown');
|
|
433
|
+
let navSearchList = null;
|
|
434
|
+
|
|
435
|
+
const openSearch = async () => {
|
|
436
|
+
await customElements.whenDefined('k-filter-list');
|
|
437
|
+
if (!navSearchList) navSearchList = document.getElementById('navSearchList');
|
|
438
|
+
navSearchList.filter(searchInput.value);
|
|
439
|
+
searchDropdown.hidden = false;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
const closeSearch = () => {
|
|
443
|
+
searchDropdown.hidden = true;
|
|
444
|
+
navSearchList?.clearFocus();
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
searchInput.addEventListener('focus', openSearch);
|
|
448
|
+
|
|
449
|
+
searchInput.addEventListener('input', debounce(e => {
|
|
450
|
+
navSearchList?.filter(e.target.value);
|
|
451
|
+
}, 150));
|
|
452
|
+
|
|
453
|
+
searchInput.addEventListener('keydown', e => {
|
|
454
|
+
if (e.key === 'Escape') {
|
|
455
|
+
searchInput.value = '';
|
|
456
|
+
searchInput.blur();
|
|
457
|
+
closeSearch();
|
|
458
|
+
} else if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter') {
|
|
459
|
+
navSearchList?.handleKeydown(e);
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
searchInput.addEventListener('blur', () => {
|
|
464
|
+
setTimeout(closeSearch, 150);
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
document.addEventListener('keydown', e => {
|
|
468
|
+
let active = document.activeElement;
|
|
469
|
+
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
470
|
+
const tag = active?.tagName;
|
|
471
|
+
if (tag === 'INPUT' || tag === 'TEXTAREA' || active?.isContentEditable) return;
|
|
472
|
+
if (e.metaKey || e.ctrlKey || e.altKey) return;
|
|
473
|
+
if (e.key.length === 1) {
|
|
474
|
+
searchInput.focus();
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
</script>
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
<h1 class="ta-center">Rich Textarea</h1>
|
|
481
|
+
|
|
482
|
+
<k-main>
|
|
483
|
+
|
|
484
|
+
<k-accordion persistent-id="toc" class="b r mb">
|
|
485
|
+
<k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
|
|
486
|
+
<k-accordion-panel name="toc-panel">
|
|
487
|
+
<div class="m pl">
|
|
488
|
+
<h6>Examples</h6>
|
|
489
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
490
|
+
<a href="#defaultValue">Default Value</a><br />
|
|
491
|
+
<a href="#formUsage">Form Usage</a><br />
|
|
492
|
+
<a href="#disabled">Disabled / Read-only</a><br />
|
|
493
|
+
|
|
494
|
+
<h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
|
|
495
|
+
<a href="#constructor">Constructor</a><br />
|
|
496
|
+
<a href="#requirements">Requirements</a><br />
|
|
497
|
+
<a href="#properties">Properties</a><br />
|
|
498
|
+
<a href="#methods">Methods</a><br />
|
|
499
|
+
<a href="#cssVariables">CSS Variables</a><br />
|
|
500
|
+
<a href="#events">Events</a><br />
|
|
501
|
+
</div>
|
|
502
|
+
</k-accordion-panel>
|
|
503
|
+
</k-accordion>
|
|
504
|
+
|
|
505
|
+
<p>A drop-in <code><textarea></code> replacement that supports rich text. The element is a styled <code>contenteditable</code> — the browser handles bold/italic/underline natively via <code>Cmd/Ctrl+B</code>, <code>Cmd/Ctrl+I</code>, <code>Cmd/Ctrl+U</code>. Includes placeholder support, default value, internal scrolling, and form participation. <strong>Not</strong> a full WYSIWYG — for toolbars, lists, links, code blocks, etc. use <a href="./html-editor.html"><code><k-html-editor></code></a> instead.</p>
|
|
506
|
+
|
|
507
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
508
|
+
<p>Behaves like a textarea: focusable, types into it, scrolls internally when content exceeds the max height. Bold/italic/underline are available via the standard browser shortcuts.</p>
|
|
509
|
+
<div class="row -mx">
|
|
510
|
+
<div class="col m-span-12 px">
|
|
511
|
+
<k-card label="HTML">
|
|
512
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-rich-textarea</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Type something..."</span>></span><span class="hljs-tag"></<span class="hljs-name">k-rich-textarea</span>></span></code></pre>
|
|
513
|
+
</k-card>
|
|
514
|
+
</div>
|
|
515
|
+
<div class="col m-span-12 px">
|
|
516
|
+
<k-card label="Output">
|
|
517
|
+
<k-rich-textarea placeholder="Type something..."></k-rich-textarea>
|
|
518
|
+
</k-card>
|
|
519
|
+
</div>
|
|
520
|
+
</div>
|
|
521
|
+
|
|
522
|
+
<h3 id="defaultValue"><a href="#defaultValue" class="no-link">Default Value</a></h3>
|
|
523
|
+
<p>Set initial content via the <code>value</code> attribute (HTML string) or by placing HTML inside the element — mirroring how <code><textarea></code> uses its children as default text.</p>
|
|
524
|
+
<div class="row -mx">
|
|
525
|
+
<div class="col m-span-12 px">
|
|
526
|
+
<k-card label="HTML">
|
|
527
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-rich-textarea</span>></span>Hello <span class="hljs-tag"><<span class="hljs-name">b</span>></span>world<span class="hljs-tag"></<span class="hljs-name">b</span>></span> <span class="hljs-symbol">&mdash;</span> you can edit me, or press Cmd/Ctrl+B/I/U to format.<span class="hljs-tag"></<span class="hljs-name">k-rich-textarea</span>></span></code></pre>
|
|
528
|
+
</k-card>
|
|
529
|
+
</div>
|
|
530
|
+
<div class="col m-span-12 px">
|
|
531
|
+
<k-card label="Output">
|
|
532
|
+
<k-rich-textarea>Hello <b>world</b> — you can edit me, or press Cmd/Ctrl+B/I/U to format.</k-rich-textarea>
|
|
533
|
+
</k-card>
|
|
534
|
+
</div>
|
|
535
|
+
</div>
|
|
536
|
+
|
|
537
|
+
<h3 id="formUsage"><a href="#formUsage" class="no-link">Form Usage</a></h3>
|
|
538
|
+
<p>The component is form-associated. Set a <code>name</code> and it participates in the form's <code>FormData</code>. The submitted value is the HTML the user produced. Add <code>required</code> to enforce non-empty input via the browser's standard form validation.</p>
|
|
539
|
+
<div class="row -mx">
|
|
540
|
+
<div class="col m-span-12 px">
|
|
541
|
+
<k-card label="HTML">
|
|
542
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">form</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"rtaForm"</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">label</span>></span>Bio:<span class="hljs-tag"></<span class="hljs-name">label</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">k-rich-textarea</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"bio"</span> <span class="hljs-attr">required</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Tell us about yourself"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-rich-textarea</span>></span><br> <span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span>></span>Submit<span class="hljs-tag"></<span class="hljs-name">button</span>></span><br><span class="hljs-tag"></<span class="hljs-name">form</span>></span><br><span class="hljs-tag"><<span class="hljs-name">p</span>></span>Form data: <span class="hljs-tag"><<span class="hljs-name">span</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"rtaOut"</span>></span><span class="hljs-tag"></<span class="hljs-name">span</span>></span><span class="hljs-tag"></<span class="hljs-name">p</span>></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><span class="language-javascript"><br> <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">'rtaForm'</span>).<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">'submit'</span>, <span class="hljs-function">(<span class="hljs-params">e</span>) =></span> {<br> e.<span class="hljs-title function_">preventDefault</span>();<br> <span class="hljs-keyword">const</span> fd = <span class="hljs-keyword">new</span> <span class="hljs-title class_">FormData</span>(e.<span class="hljs-property">target</span>);<br> <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">'rtaOut'</span>).<span class="hljs-property">textContent</span> = <span class="hljs-title class_">JSON</span>.<span class="hljs-title function_">stringify</span>([...fd.<span class="hljs-title function_">entries</span>()]);<br> });<br></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
543
|
+
</k-card>
|
|
544
|
+
</div>
|
|
545
|
+
<div class="col m-span-12 px">
|
|
546
|
+
<k-card label="Output">
|
|
547
|
+
<form id="rtaForm">
|
|
548
|
+
<label class="d-b mb">Bio:</label>
|
|
549
|
+
<k-rich-textarea name="bio" required placeholder="Tell us about yourself"></k-rich-textarea>
|
|
550
|
+
<div class="mt">
|
|
551
|
+
<button type="submit">Submit</button>
|
|
552
|
+
</div>
|
|
553
|
+
</form>
|
|
554
|
+
<p class="mt">Form data: <span id="rtaOut">(submit to see)</span></p>
|
|
555
|
+
<script type="module">
|
|
556
|
+
document.getElementById('rtaForm').addEventListener('submit', (e) => {
|
|
557
|
+
e.preventDefault();
|
|
558
|
+
const fd = new FormData(e.target);
|
|
559
|
+
document.getElementById('rtaOut').textContent = JSON.stringify([...fd.entries()]);
|
|
560
|
+
});
|
|
561
|
+
</script>
|
|
562
|
+
</k-card>
|
|
563
|
+
</div>
|
|
564
|
+
</div>
|
|
565
|
+
|
|
566
|
+
<h3 id="disabled"><a href="#disabled" class="no-link">Disabled / Read-only</a></h3>
|
|
567
|
+
<p>The <code>disabled</code> attribute prevents user interaction and skips the field for form submission. The <code>readonly</code> attribute lets the user select and copy text but not edit it; the value is still submitted with the form.</p>
|
|
568
|
+
<div class="row -mx">
|
|
569
|
+
<div class="col m-span-12 px">
|
|
570
|
+
<k-card label="Output">
|
|
571
|
+
<k-rich-textarea disabled value="Disabled — you can't edit this." class="mb"></k-rich-textarea>
|
|
572
|
+
<k-rich-textarea readonly value="Read-only — you can <b>select</b> and copy, just not type."></k-rich-textarea>
|
|
573
|
+
</k-card>
|
|
574
|
+
</div>
|
|
575
|
+
</div>
|
|
576
|
+
|
|
577
|
+
<h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
|
|
578
|
+
|
|
579
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
580
|
+
<h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
|
|
581
|
+
<h5><code>new RichTextarea()</code></h5>
|
|
582
|
+
|
|
583
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
584
|
+
<ul>
|
|
585
|
+
<li><a href="./shadow-component.html">ShadowComponent</a></li>
|
|
586
|
+
</ul>
|
|
587
|
+
|
|
588
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
589
|
+
<h5><code>value<i>: String</i></code></h5>
|
|
590
|
+
<p>The current HTML content. Reading returns whatever the user has typed; writing replaces the editor content. Initial value comes from the <code>value</code> attribute or, if absent, from the element's children at upgrade time (textarea-style).</p>
|
|
591
|
+
|
|
592
|
+
<h5><code>name<i>: String</i></code></h5>
|
|
593
|
+
<p>The form field name. When set inside a <code><form></code>, the component participates in form submission. Syncs to <code>name</code> attribute.</p>
|
|
594
|
+
|
|
595
|
+
<h5><code>placeholder<i>: String</i></code></h5>
|
|
596
|
+
<p>Placeholder text shown when the editor is empty. Syncs to <code>placeholder</code> attribute.</p>
|
|
597
|
+
|
|
598
|
+
<h5><code>disabled<i>: Boolean</i></code></h5>
|
|
599
|
+
<p>When <code>true</code>, the editor is non-interactive and excluded from form submission. Syncs to <code>disabled</code> attribute.</p>
|
|
600
|
+
|
|
601
|
+
<h5><code>required<i>: Boolean</i></code></h5>
|
|
602
|
+
<p>When <code>true</code> and the editor is empty (no non-whitespace text content), the element reports a <code>valueMissing</code> validity error. Syncs to <code>required</code> attribute.</p>
|
|
603
|
+
|
|
604
|
+
<h5><code>readonly<i>: Boolean</i></code></h5>
|
|
605
|
+
<p>When <code>true</code>, the user can select text but not edit. Form submission still includes the value. Syncs to <code>readonly</code> attribute.</p>
|
|
606
|
+
|
|
607
|
+
<h5><code>textValue<i>: String</i></code> (getter)</h5>
|
|
608
|
+
<p>Plain-text view of <code>value</code> — useful for character-count, search, or any check that ignores markup.</p>
|
|
609
|
+
|
|
610
|
+
<h5><code>isEmpty<i>: Boolean</i></code> (getter)</h5>
|
|
611
|
+
<p><code>true</code> when <code>textValue.trim()</code> is empty.</p>
|
|
612
|
+
|
|
613
|
+
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
614
|
+
<h5><code>focus()<i>: void</i></code></h5>
|
|
615
|
+
<p>Focuses the contenteditable so the user can start typing immediately.</p>
|
|
616
|
+
|
|
617
|
+
<h5><code>blur()<i>: void</i></code></h5>
|
|
618
|
+
<p>Removes focus.</p>
|
|
619
|
+
|
|
620
|
+
<h5><code>clear()<i>: void</i></code></h5>
|
|
621
|
+
<p>Empties the editor (equivalent to <code>el.value = ''</code>).</p>
|
|
622
|
+
|
|
623
|
+
<h3 id="cssVariables"><a href="#cssVariables" class="no-link">CSS Variables</a></h3>
|
|
624
|
+
<table class="b">
|
|
625
|
+
<thead><tr><th>Variable</th><th>Default</th><th>Description</th></tr></thead>
|
|
626
|
+
<tbody>
|
|
627
|
+
<tr><td><code>--min_height</code></td><td><code>3rem</code></td><td>Minimum height of the editor (also the lower bound when the user drags the resize handle)</td></tr>
|
|
628
|
+
<tr><td><code>--max_height</code></td><td><code>12rem</code></td><td>Maximum height before the editor scrolls internally (initial cap before the user manually resizes)</td></tr>
|
|
629
|
+
<tr><td><code>--padding</code></td><td><code>0.5rem 0.75rem</code></td><td>Padding inside the editor</td></tr>
|
|
630
|
+
</tbody>
|
|
631
|
+
</table>
|
|
632
|
+
<p class="mt">The component also uses kempo-css's global <code>--c_border</code>, <code>--c_bg</code>, <code>--tc</code>, <code>--radius</code>, <code>--animation_ms</code>, and <code>--focus_shadow</code>; override those globally for site-wide tuning.</p>
|
|
633
|
+
|
|
634
|
+
<h3 id="events"><a href="#events" class="no-link">Events</a></h3>
|
|
635
|
+
<h5><code>input</code></h5>
|
|
636
|
+
<p>Fires on every keystroke (and any other content change). <code>detail.value</code> is the current HTML.</p>
|
|
637
|
+
|
|
638
|
+
<h5><code>change</code></h5>
|
|
639
|
+
<p>Fires on blur. <code>detail.value</code> is the HTML at the moment focus left.</p>
|
|
640
|
+
|
|
641
|
+
</k-main>
|
|
642
|
+
<div style="height:33vh"></div>
|
|
643
|
+
<script type="module" src="../src/components/Main.js"></script>
|
|
644
|
+
|
|
645
|
+
<script type="module" src="../src/components/RichTextarea.js"></script>
|
|
646
|
+
<script type="module" src="../src/components/Accordion.js"></script>
|
|
647
|
+
<script type="module" src="../src/components/Card.js"></script>
|
|
648
|
+
|
|
649
|
+
</body>
|
|
650
|
+
</html>
|