rt-native 1.0.105 → 1.0.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +232 -225
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # `<rt-native>` — Native Web Component Rich Text Editor
1
+ # rt-native — Native Web Component Rich Text Editor
2
2
 
3
3
  **Author:** Ryan Kueter
4
4
  **Updated:** April, 2026
5
5
 
6
- `rt-native.js` HTML Editor is a free native web component that provides accessibility features and a wide variety of elements and customizations that make it one of the most robust and flexible HTML editors available. It allows the programmer to apply custom .css files to the preview window, so see how the content will be displayed in production. The editor uses embedded .svg Google Font Icons and the shadow DOM to isolate the HTML from inheriting the existing page styles. No frameworks, no build step, no dependencies — drop **one script tag** into any HTML page and you're done.
6
+ **rt-native.js** HTML Editor is a free native web component that provides accessibility features and a wide variety of elements and customizations that make it one of the most robust and flexible HTML editors available. It allows the programmer to apply custom .css files to the preview window, so see how the content will be displayed in production. The editor uses embedded .svg Google Font Icons and the shadow DOM to isolate the HTML from inheriting the existing page styles. No frameworks, no build step, no dependencies — drop **one script tag** into any HTML page and you're done.
7
7
 
8
8
  ---
9
9
 
@@ -56,7 +56,7 @@
56
56
 
57
57
  | File | Purpose |
58
58
  |---|---|
59
- | `rt-native.js` | **The only required file.** Contains the complete editor engine, web component wrapper, all CSS defaults, and all dialog styles — everything is self-contained. |
59
+ | rt-native.js | **The only required file.** Contains the complete editor engine, web component wrapper, all CSS defaults, and all dialog styles — everything is self-contained. |
60
60
 
61
61
  ---
62
62
 
@@ -136,14 +136,14 @@ npm install rt-native
136
136
 
137
137
  | Attribute | Type | Default | Description |
138
138
  |---|---|---|---|
139
- | `value` | `string` | `''` | Initial HTML content of the editor. |
140
- | `width` | `string` | `100%` | Editor width. Any valid CSS value (`px`, `%`, `vw`, etc.). |
141
- | `height` | `string` | `300px` | Editor height. Any valid CSS value. |
142
- | `placeholder` | `string` | — | Placeholder text shown when the editor is empty. |
143
- | `readonly` | boolean (presence) | — | Puts the editor in read-only mode. Hides the toolbar. |
144
- | `aria-label` | `string` | `'Rich text editor'` | Accessible name for the editor region. |
145
- | `label` | `string` | — | Alternative to `aria-label` for the accessible name. |
146
- | `config` | JSON string | — | Declarative configuration. Parsed and passed to `configure()` on connect. |
139
+ | value | string | '' | Initial HTML content of the editor. |
140
+ | width | string | 100% | Editor width. Any valid CSS value (px, %, vw, etc.). |
141
+ | height | string | 300px | Editor height. Any valid CSS value. |
142
+ | placeholder | string | — | Placeholder text shown when the editor is empty. |
143
+ | readonly | boolean (presence) | — | Puts the editor in read-only mode. Hides the toolbar. |
144
+ | aria-label | string | 'Rich text editor' | Accessible name for the editor region. |
145
+ | label | string | — | Alternative to **aria-label** for the accessible name. |
146
+ | config | JSON string | — | Declarative configuration. Parsed and passed to **configure()** on connect. |
147
147
 
148
148
  ### Example
149
149
 
@@ -162,7 +162,7 @@ npm install rt-native
162
162
  <rt-native config='{"editor":{"height":"500px"},"visibility":{"embedMedia":false}}'></rt-native>
163
163
  ```
164
164
 
165
- > **Note:** `width` and `height` are shorthand for `--rtb-editor-width` and `--rtb-editor-height`. They can also be set via CSS variables or `configure({ editor: { width, height } })`.
165
+ > **Note:** **width** and **height** are shorthand for --rtb-editor-width and --rtb-editor-height. They can also be set via CSS variables or **configure({ editor: { width, height } })**.
166
166
 
167
167
  ---
168
168
 
@@ -188,7 +188,7 @@ const text = editor.getPlainText();
188
188
 
189
189
  ### setValue()
190
190
 
191
- Replaces the editor content with the supplied HTML string. Passing an empty string or `null` clears the editor.
191
+ Replaces the editor content with the supplied HTML string. Passing an empty string or null clears the editor.
192
192
 
193
193
  ```js
194
194
  editor.setValue('<h2>New content</h2><p>Paragraph text.</p>');
@@ -222,7 +222,7 @@ editor.setReadOnly(true); // lock
222
222
  editor.setReadOnly(false); // unlock
223
223
  ```
224
224
 
225
- The `readOnly` getter reflects the current state:
225
+ The **readOnly** getter reflects the current state:
226
226
 
227
227
  ```js
228
228
  if (editor.readOnly) {
@@ -230,7 +230,7 @@ if (editor.readOnly) {
230
230
  }
231
231
  ```
232
232
 
233
- Read-only mode can also be set declaratively via the `readonly` HTML attribute:
233
+ Read-only mode can also be set declaratively via the **readonly** HTML attribute:
234
234
 
235
235
  ```html
236
236
  <rt-native readonly></rt-native>
@@ -251,11 +251,11 @@ editor.setPreviewCssFiles('/styles/my-content.css');
251
251
  editor.setPreviewCssFiles();
252
252
  ```
253
253
 
254
- > **CORS:** Files are loaded with `fetch()`. They must be served from the same origin or include appropriate `Access-Control-Allow-Origin` headers.
254
+ > **CORS:** Files are loaded with fetch(). They must be served from the same origin or include appropriate Access-Control-Allow-Origin headers.
255
255
 
256
256
  ### setPreviewCssFile()
257
257
 
258
- Convenience method that sets a **single** CSS file. Equivalent to `setPreviewCssFiles(url)`.
258
+ Convenience method that sets a **single** CSS file. Equivalent to **setPreviewCssFiles(url)**.
259
259
 
260
260
  ```js
261
261
  editor.setPreviewCssFile('/styles/content.css');
@@ -266,7 +266,7 @@ editor.setPreviewCssFile('');
266
266
 
267
267
  ### setPreviewCss()
268
268
 
269
- Supplies **inline CSS** to apply to both the editor content area and the preview window. Rules are automatically scoped, exactly like `setPreviewCssFiles()`. Call with no argument (or `''`) to clear.
269
+ Supplies **inline CSS** to apply to both the editor content area and the preview window. Rules are automatically scoped, exactly like **setPreviewCssFiles()**. Call with no argument (or '') to clear.
270
270
 
271
271
  ```js
272
272
  editor.setPreviewCss(`
@@ -281,13 +281,13 @@ editor.setPreviewCss(`
281
281
  editor.setPreviewCss('');
282
282
  ```
283
283
 
284
- `setPreviewCss()` and `setPreviewCssFiles()` are independent — both can be active at the same time. File rules are applied first; inline rules are appended after, so inline CSS always wins when there is a conflict.
284
+ **setPreviewCss()** and **setPreviewCssFiles()** are independent — both can be active at the same time. File rules are applied first; inline rules are appended after, so inline CSS always wins when there is a conflict.
285
285
 
286
286
  ---
287
287
 
288
288
  ## Events
289
289
 
290
- ### `change`
290
+ ### change
291
291
 
292
292
  Fired on the element whenever the editor content changes. The event **bubbles** and is **composed** (crosses shadow DOM boundaries).
293
293
 
@@ -300,15 +300,15 @@ editor.addEventListener('change', (event) => {
300
300
 
301
301
  | Property | Value |
302
302
  |---|---|
303
- | `event.detail.value` | Current editor HTML as a string |
304
- | `event.bubbles` | `true` |
305
- | `event.composed` | `true` |
303
+ | event.detail.value | Current editor HTML as a string |
304
+ | event.bubbles | true |
305
+ | event.composed | true |
306
306
 
307
307
  ---
308
308
 
309
309
  ## CSS Variables
310
310
 
311
- All visual aspects of the editor are controlled through CSS custom properties declared on the `rt-native` element. Default values are injected automatically by `rt-native.js` when the first editor mounts — no stylesheet required. Override any variable in your own CSS to theme the editor.
311
+ All visual aspects of the editor are controlled through CSS custom properties declared on the **rt-native** element. Default values are injected automatically by **rt-native.js** when the first editor mounts — no stylesheet required. Override any variable in your own CSS to theme the editor.
312
312
 
313
313
  ```css
314
314
  /* Override globally (all editors on the page) */
@@ -332,15 +332,15 @@ rt-native {
332
332
 
333
333
  | Variable | Default | Description |
334
334
  |---|---|---|
335
- | `--rtb-toolbar-bg` | `#FFF` | Toolbar background color |
336
- | `--rtb-toolbar-border-style` | `solid` | Toolbar bottom border style |
337
- | `--rtb-toolbar-border-width` | `1px` | Toolbar bottom border width |
338
- | `--rtb-toolbar-border-color` | `#EEE` | Toolbar bottom border color |
339
- | `--rtb-toolbar-border-radius` | `0px` | Toolbar corner radius (container clips top corners automatically) |
340
- | `--rtb-dropdown-bg` | `#FFF` | Font / Size / Format dropdown background |
341
- | `--rtb-dropdown-text` | `#000` | Dropdown item text color |
342
- | `--rtb-dropdown-bg-hover` | `#e5e5e5` | Dropdown item hover background |
343
- | `--rtb-dropdown-text-hover` | `#000` | Dropdown item hover text color |
335
+ | --rtb-toolbar-bg | #FFF | Toolbar background color |
336
+ | --rtb-toolbar-border-style | solid | Toolbar bottom border style |
337
+ | --rtb-toolbar-border-width | 1px | Toolbar bottom border width |
338
+ | --rtb-toolbar-border-color | #EEE | Toolbar bottom border color |
339
+ | --rtb-toolbar-border-radius | 0px | Toolbar corner radius (container clips top corners automatically) |
340
+ | --rtb-dropdown-bg | #FFF | Font / Size / Format dropdown background |
341
+ | --rtb-dropdown-text | #000 | Dropdown item text color |
342
+ | --rtb-dropdown-bg-hover | #e5e5e5 | Dropdown item hover background |
343
+ | --rtb-dropdown-text-hover | #000 | Dropdown item hover text color |
344
344
 
345
345
  ---
346
346
 
@@ -348,18 +348,18 @@ rt-native {
348
348
 
349
349
  | Variable | Default | Description |
350
350
  |---|---|---|
351
- | `--rtb-btn-text` | `#000` | Button icon color |
352
- | `--rtb-btn-size` | `16px` | Icon size (also drives button `min-height` and divider height) |
353
- | `--rtb-btn-font` | `Arial, sans-serif` | Font for dropdown buttons |
354
- | `--rtb-btn-bg` | `inherit` | Button background at rest |
355
- | `--rtb-btn-bg-hover` | `#DDD` | Button background on hover |
356
- | `--rtb-btn-bg-selected` | `#CCC` | Button background when active / selected |
357
- | `--rtb-btn-border-style` | `none` | Button border style |
358
- | `--rtb-btn-border-width` | `0px` | Button border width |
359
- | `--rtb-btn-border-color` | `#AAA` | Button border color at rest |
360
- | `--rtb-btn-border-hover` | `inherit` | Button border color on hover |
361
- | `--rtb-btn-border-selected` | `inherit` | Button border color when selected |
362
- | `--rtb-btn-border-radius` | `5px` | Button corner radius |
351
+ | --rtb-btn-text | #000 | Button icon color |
352
+ | --rtb-btn-size | 16px | Icon size (also drives button min-height and divider height) |
353
+ | --rtb-btn-font | Arial, sans-serif | Font for dropdown buttons |
354
+ | --rtb-btn-bg | inherit | Button background at rest |
355
+ | --rtb-btn-bg-hover | #DDD | Button background on hover |
356
+ | --rtb-btn-bg-selected | #CCC | Button background when active / selected |
357
+ | --rtb-btn-border-style | none | Button border style |
358
+ | --rtb-btn-border-width | 0px | Button border width |
359
+ | --rtb-btn-border-color | #AAA | Button border color at rest |
360
+ | --rtb-btn-border-hover | inherit | Button border color on hover |
361
+ | --rtb-btn-border-selected | inherit | Button border color when selected |
362
+ | --rtb-btn-border-radius | 5px | Button corner radius |
363
363
 
364
364
  ---
365
365
 
@@ -367,12 +367,12 @@ rt-native {
367
367
 
368
368
  | Variable | Default | Description |
369
369
  |---|---|---|
370
- | `--rtb-content-text` | `#000` | Editor text color |
371
- | `--rtb-content-size` | `16px` | Editor font size |
372
- | `--rtb-content-font` | `Arial, sans-serif` | Editor font family |
373
- | `--rtb-content-bg` | `#FFF` | Editor content background color |
374
- | `--rtb-content-shadow` | `none` | Inner box shadow on the content area |
375
- | `--rtb-placeholder-color` | `#9ca3af` | Placeholder text color |
370
+ | --rtb-content-text | #000 | Editor text color |
371
+ | --rtb-content-size | 16px | Editor font size |
372
+ | --rtb-content-font | Arial, sans-serif | Editor font family |
373
+ | --rtb-content-bg | #FFF | Editor content background color |
374
+ | --rtb-content-shadow | none | Inner box shadow on the content area |
375
+ | --rtb-placeholder-color | #9ca3af | Placeholder text color |
376
376
 
377
377
  ---
378
378
 
@@ -380,15 +380,15 @@ rt-native {
380
380
 
381
381
  | Variable | Default | Description |
382
382
  |---|---|---|
383
- | `--rtb-editor-width` | `100%` | Maximum width of the editor |
384
- | `--rtb-editor-height` | `300px` | Height of the editor |
385
- | `--rtb-editor-border-style` | `solid` | Outer border style |
386
- | `--rtb-editor-border-width` | `1px` | Outer border width |
387
- | `--rtb-editor-border-color` | `#EEE` | Outer border color |
388
- | `--rtb-editor-border-radius` | `0px` | Outer corner radius |
389
- | `--rtb-editor-shadow` | `none` | Outer box shadow |
390
- | `--rtb-editor-resize` | `auto` | `auto` shows the resize handle; `hidden` removes it |
391
- | `--rtb-z-index` | `1` | Z-index of the editor container — raise this to stack the editor above surrounding page content |
383
+ | --rtb-editor-width | 100% | Maximum width of the editor |
384
+ | --rtb-editor-height | 300px | Height of the editor |
385
+ | --rtb-editor-border-style | solid | Outer border style |
386
+ | --rtb-editor-border-width | 1px | Outer border width |
387
+ | --rtb-editor-border-color | #EEE | Outer border color |
388
+ | --rtb-editor-border-radius | 0px | Outer corner radius |
389
+ | --rtb-editor-shadow | none | Outer box shadow |
390
+ | --rtb-editor-resize | auto | auto shows the resize handle; hidden removes it |
391
+ | --rtb-z-index | 1 | Z-index of the editor container — raise this to stack the editor above surrounding page content |
392
392
 
393
393
  ---
394
394
 
@@ -396,12 +396,12 @@ rt-native {
396
396
 
397
397
  | Variable | Default | Description |
398
398
  |---|---|---|
399
- | `--rtb-scroll-width` | `10px` | Scrollbar track width |
400
- | `--rtb-scroll-opacity` | `1` | Scrollbar opacity |
401
- | `--rtb-scroll-bg` | `transparent` | Scrollbar track background |
402
- | `--rtb-scroll-thumb-bg` | `#AAA` | Scrollbar thumb color |
403
- | `--rtb-scroll-thumb-bg-hover` | `#DDD` | Scrollbar thumb color on hover |
404
- | `--rtb-scroll-thumb-radius` | `0` | Scrollbar thumb corner radius |
399
+ | --rtb-scroll-width | 10px | Scrollbar track width |
400
+ | --rtb-scroll-opacity | 1 | Scrollbar opacity |
401
+ | --rtb-scroll-bg | transparent | Scrollbar track background |
402
+ | --rtb-scroll-thumb-bg | #AAA | Scrollbar thumb color |
403
+ | --rtb-scroll-thumb-bg-hover | #DDD | Scrollbar thumb color on hover |
404
+ | --rtb-scroll-thumb-radius | 0 | Scrollbar thumb corner radius |
405
405
 
406
406
  ---
407
407
 
@@ -409,9 +409,9 @@ rt-native {
409
409
 
410
410
  | Variable | Default | Description |
411
411
  |---|---|---|
412
- | `--rtb-quote-bg` | `#f9f9f9` | Blockquote background color |
413
- | `--rtb-quote-border-color` | `#ccc` | Blockquote left-border color |
414
- | `--rtb-quote-border-width` | `5px` | Blockquote left-border width |
412
+ | --rtb-quote-bg | #f9f9f9 | Blockquote background color |
413
+ | --rtb-quote-border-color | #ccc | Blockquote left-border color |
414
+ | --rtb-quote-border-width | 5px | Blockquote left-border width |
415
415
 
416
416
  ---
417
417
 
@@ -419,8 +419,8 @@ rt-native {
419
419
 
420
420
  | Variable | Default | Description |
421
421
  |---|---|---|
422
- | `--rtb-code-bg` | `#f9f9f9` | Code block background color |
423
- | `--rtb-code-border-radius` | `10px` | Code block corner radius |
422
+ | --rtb-code-bg | #f9f9f9 | Code block background color |
423
+ | --rtb-code-border-radius | 10px | Code block corner radius |
424
424
 
425
425
  ---
426
426
 
@@ -428,14 +428,14 @@ rt-native {
428
428
 
429
429
  | Variable | Default | Description |
430
430
  |---|---|---|
431
- | `--rtb-modal-bg` | `#fefefe` | Dialog background color |
432
- | `--rtb-modal-text` | `#000` | Dialog text and close-button color |
433
- | `--rtb-modal-text-size` | `16px` | Dialog font size |
434
- | `--rtb-modal-text-font` | `Arial, sans-serif` | Dialog font family |
435
- | `--rtb-modal-input-bg` | `#fff` | Input field background |
436
- | `--rtb-modal-input-text` | `#000` | Input field text color |
437
- | `--rtb-modal-input-border` | `#CCC` | Input field border color |
438
- | `--rtb-modal-checkbox` | `#007bff` | Checkbox accent color |
431
+ | --rtb-modal-bg | #fefefe | Dialog background color |
432
+ | --rtb-modal-text | #000 | Dialog text and close-button color |
433
+ | --rtb-modal-text-size | 16px | Dialog font size |
434
+ | --rtb-modal-text-font | Arial, sans-serif | Dialog font family |
435
+ | --rtb-modal-input-bg | #fff | Input field background |
436
+ | --rtb-modal-input-text | #000 | Input field text color |
437
+ | --rtb-modal-input-border | #CCC | Input field border color |
438
+ | --rtb-modal-checkbox | #007bff | Checkbox accent color |
439
439
 
440
440
  ---
441
441
 
@@ -467,14 +467,21 @@ rt-native.dark {
467
467
 
468
468
  **Apply via HTML:**
469
469
  ```html
470
- <rt-native class="dark"></rt-native>
470
+ <rt-native class="dark" id="editor" height="400px"></rt-native>
471
471
  ```
472
472
 
473
473
  **Apply via JavaScript:**
474
474
  ```js
475
- editor.classList.add('dark');
476
- editor.classList.remove('dark');
477
- editor.classList.replace('dark', 'ocean');
475
+ var editor = document.getElementById("editor");
476
+ if (editor) {
477
+ if (editor.classList.contains('light')) {
478
+ editor.classList.remove('light');
479
+ }
480
+ if (editor.classList.contains('dark')) {
481
+ editor.classList.remove('dark');
482
+ }
483
+ editor.classList.add(theme);
484
+ }
478
485
  ```
479
486
 
480
487
  **Apply via media query (system dark mode):**
@@ -637,7 +644,7 @@ rt-native.fluent-dark {
637
644
 
638
645
  ## configure() Reference
639
646
 
640
- `configure()` accepts a single options object. Every property is optional. Calling `configure()` multiple times merges with the previous state.
647
+ **configure()** accepts a single options object. Every property is optional. Calling **configure()** multiple times merges with the previous state.
641
648
 
642
649
  ### toolbar options
643
650
 
@@ -766,7 +773,7 @@ editor.configure({
766
773
 
767
774
  ### visibility options
768
775
 
769
- Controls which toolbar buttons are rendered. All buttons are visible by default except the **status bar** (`wordCount`), which is hidden by default and revealed with the Toggle Status Bar button.
776
+ Controls which toolbar buttons are rendered. All buttons are visible by default except the **status bar** (wordCount), which is hidden by default and revealed with the Toggle Status Bar button.
770
777
 
771
778
  Use `clearAll: true` to hide everything first, then opt individual buttons back in.
772
779
 
@@ -805,64 +812,64 @@ editor.configure({
805
812
 
806
813
  | Key | Controls |
807
814
  |---|---|
808
- | `font` | Font family dropdown |
809
- | `size` | Font size dropdown |
810
- | `format` | Paragraph / heading format dropdown |
811
- | `textStylesDivider` | Divider after the three dropdowns |
812
- | `bold` | Bold button |
813
- | `italic` | Italic button |
814
- | `underline` | Underline button |
815
- | `strikethrough` | Strikethrough button |
816
- | `subscript` | Subscript button |
817
- | `superscript` | Superscript button |
818
- | `formatDivider` | Divider after text-format buttons |
819
- | `textColor` | Text color, background color, and remove-color buttons |
820
- | `textColorDivider` | Divider after color buttons |
821
- | `alignLeft` | Align left button |
822
- | `alignCenter` | Align center button |
823
- | `alignRight` | Align right button |
824
- | `alignJustify` | Justify button |
825
- | `alignDivider` | Divider after alignment buttons |
826
- | `cut` | Cut button |
827
- | `copy` | Copy button |
828
- | `paste` | Paste button |
829
- | `delete` | Delete button |
830
- | `selectAll` | Select all button |
831
- | `actionDivider` | Divider after clipboard buttons |
832
- | `orderedList` | Ordered list button |
833
- | `unorderedList` | Unordered list button |
834
- | `indent` | Increase / decrease indent buttons |
835
- | `listDivider` | Divider after list buttons |
836
- | `link` | Insert link and remove link buttons |
837
- | `image` | Insert image button |
838
- | `imageUpload` | Upload / embed image button |
839
- | `quote` | Block quote button |
840
- | `codeBlock` | Code block button |
841
- | `embedMedia` | Embed media (audio / PDF / iframe) button |
842
- | `video` | Video embed button |
843
- | `table` | Insert table button |
844
- | `horizontalRule` | Insert horizontal rule button |
845
- | `mediaDivider` | Divider after insert buttons |
846
- | `undo` | Undo button |
847
- | `redo` | Redo button |
848
- | `historyDivider` | Divider after undo / redo |
849
- | `statusBarToggle` | Toggle Status Bar button |
850
- | `saveHtml` | Save HTML file button |
851
- | `htmlView` | Toggle HTML source view button |
852
- | `preview` | Preview button |
853
- | `wordCount` | Status bar (word / character count) — hidden by default |
854
-
855
- > **Divider auto-hiding:** Dividers are only rendered when at least one button in their group is visible *and* the divider's own key is `true`.
815
+ | font | Font family dropdown |
816
+ | size | Font size dropdown |
817
+ | format | Paragraph / heading format dropdown |
818
+ | textStylesDivider | Divider after the three dropdowns |
819
+ | bold | Bold button |
820
+ | italic | Italic button |
821
+ | underline | Underline button |
822
+ | strikethrough | Strikethrough button |
823
+ | subscript | Subscript button |
824
+ | superscript | Superscript button |
825
+ | formatDivider | Divider after text-format buttons |
826
+ | textColor | Text color, background color, and remove-color buttons |
827
+ | textColorDivider | Divider after color buttons |
828
+ | alignLeft | Align left button |
829
+ | alignCenter | Align center button |
830
+ | alignRight | Align right button |
831
+ | alignJustify | Justify button |
832
+ | alignDivider | Divider after alignment buttons |
833
+ | cut | Cut button |
834
+ | copy | Copy button |
835
+ | paste | Paste button |
836
+ | delete | Delete button |
837
+ | selectAll | Select all button |
838
+ | actionDivider | Divider after clipboard buttons |
839
+ | orderedList | Ordered list button |
840
+ | unorderedList | Unordered list button |
841
+ | indent | Increase / decrease indent buttons |
842
+ | listDivider | Divider after list buttons |
843
+ | link | Insert link and remove link buttons |
844
+ | image | Insert image button |
845
+ | imageUpload | Upload / embed image button |
846
+ | quote | Block quote button |
847
+ | codeBlock | Code block button |
848
+ | embedMedia | Embed media (audio / PDF / iframe) button |
849
+ | video | Video embed button |
850
+ | table | Insert table button |
851
+ | horizontalRule | Insert horizontal rule button |
852
+ | mediaDivider | Divider after insert buttons |
853
+ | undo | Undo button |
854
+ | redo | Redo button |
855
+ | historyDivider | Divider after undo / redo |
856
+ | statusBarToggle | Toggle Status Bar button |
857
+ | saveHtml | Save HTML file button |
858
+ | htmlView | Toggle HTML source view button |
859
+ | preview | Preview button |
860
+ | wordCount | Status bar (word / character count) — hidden by default |
861
+
862
+ > **Divider auto-hiding:** Dividers are only rendered when at least one button in their group is visible *and* the divider's own key is true.
856
863
 
857
864
  ---
858
865
 
859
866
  ## Preview Window Styling
860
867
 
861
- When you load preview CSS with `setPreviewCssFiles()` or `setPreviewCss()`, the component applies the styles in two places simultaneously:
868
+ When you load preview CSS with **setPreviewCssFiles()** or **setPreviewCss()**, the component applies the styles in two places simultaneously:
862
869
 
863
- 1. **Editor content area** — CSS files are fetched, every selector is automatically prefixed with `.rich-text-box-content`, and the scoped rules are injected into the editor's shadow root. You see your production styles while you type, with no risk of styles escaping to the toolbar, menus, or the surrounding page.
870
+ 1. **Editor content area** — CSS files are fetched, every selector is automatically prefixed with .rich-text-box-content, and the scoped rules are injected into the editor's shadow root. You see your production styles while you type, with no risk of styles escaping to the toolbar, menus, or the surrounding page.
864
871
 
865
- 2. **Preview window** — Content is rendered inside an `<iframe srcdoc>` with a completely isolated browsing context. The preview shows exactly what a reader would see in production with a clean browser baseline.
872
+ 2. **Preview window** — Content is rendered inside an iframe srcdoc with a completely isolated browsing context. The preview shows exactly what a reader would see in production with a clean browser baseline.
866
873
 
867
874
  ### Writing your own preview CSS
868
875
 
@@ -892,7 +899,7 @@ editor.setPreviewCssFiles('my-content.css');
892
899
 
893
900
  ### At-rules
894
901
 
895
- `@media`, `@supports`, `@layer`, and `@container` blocks are handled correctly — selectors inside them are scoped. Other at-rules (`@keyframes`, `@font-face`, etc.) are passed through unchanged.
902
+ @media, @supports, @layer, and @container blocks are handled correctly — selectors inside them are scoped. Other at-rules (@keyframes, @font-face, etc.) are passed through unchanged.
896
903
 
897
904
  ---
898
905
 
@@ -903,113 +910,113 @@ Buttons appear left-to-right in the order listed. Dividers separate logical grou
903
910
  | Button | Action | Shortcut |
904
911
  |---|---|---|
905
912
  | Font | Set font family | — |
906
- | Size | Set font size | `Ctrl+Shift+<` / `Ctrl+Shift+>` |
907
- | Format | Apply block format (paragraph, headings 1–6) | `Ctrl+Shift+D` / `Ctrl+Shift+1`–`6` |
908
- | Bold | Bold | `Ctrl+B` |
909
- | Italic | Italic | `Ctrl+I` |
910
- | Underline | Underline | `Ctrl+U` |
911
- | Strikethrough | Strikethrough | `Ctrl+D` |
912
- | Subscript | Subscript | `Ctrl+=` |
913
- | Superscript | Superscript | `Ctrl+Shift++` |
914
- | Text Color | Open text color picker | `Ctrl+Shift+C` |
915
- | Background Color | Open text background color picker | `Ctrl+Shift+B` |
913
+ | Size | Set font size | Ctrl+Shift+< / Ctrl+Shift+> |
914
+ | Format | Apply block format (paragraph, headings 1–6) | Ctrl+Shift+D / Ctrl+Shift+16 |
915
+ | Bold | Bold | Ctrl+B |
916
+ | Italic | Italic | Ctrl+I |
917
+ | Underline | Underline | Ctrl+U |
918
+ | Strikethrough | Strikethrough | Ctrl+D |
919
+ | Subscript | Subscript | Ctrl+= |
920
+ | Superscript | Superscript | Ctrl+Shift++ |
921
+ | Text Color | Open text color picker | Ctrl+Shift+C |
922
+ | Background Color | Open text background color picker | Ctrl+Shift+B |
916
923
  | Remove Color | Strip text and background color | — |
917
- | Align Left | Left-align | `Ctrl+L` |
918
- | Align Center | Center-align | `Ctrl+E` |
919
- | Align Right | Right-align | `Ctrl+R` |
920
- | Justify | Justify | `Ctrl+J` |
921
- | Cut | Cut selection | `Ctrl+X` |
922
- | Copy | Copy selection | `Ctrl+C` |
923
- | Paste | Paste from clipboard | `Ctrl+V` |
924
- | Delete | Delete selection | `Delete` |
925
- | Select All | Select all content | `Ctrl+A` |
926
- | Ordered List | Insert numbered list | `Ctrl+Shift+O` |
927
- | Unordered List | Insert bulleted list | `Ctrl+Shift+U` |
928
- | Increase Indent | Indent / promote list item | `Tab` |
929
- | Decrease Indent | Outdent / demote list item | `Shift+Tab` |
930
- | Insert Link | Open link dialog | `Ctrl+Shift+K` |
924
+ | Align Left | Left-align | Ctrl+L |
925
+ | Align Center | Center-align | Ctrl+E |
926
+ | Align Right | Right-align | Ctrl+R |
927
+ | Justify | Justify | Ctrl+J |
928
+ | Cut | Cut selection | Ctrl+X |
929
+ | Copy | Copy selection | Ctrl+C |
930
+ | Paste | Paste from clipboard | Ctrl+V |
931
+ | Delete | Delete selection | Delete |
932
+ | Select All | Select all content | Ctrl+A |
933
+ | Ordered List | Insert numbered list | Ctrl+Shift+O |
934
+ | Unordered List | Insert bulleted list | Ctrl+Shift+U |
935
+ | Increase Indent | Indent / promote list item | Tab |
936
+ | Decrease Indent | Outdent / demote list item | Shift+Tab |
937
+ | Insert Link | Open link dialog | Ctrl+Shift+K |
931
938
  | Remove Link | Remove hyperlink | — |
932
- | Insert Image | Open image URL dialog | `Ctrl+Shift+I` |
933
- | Upload Image | Open image upload / embed dialog | `Ctrl+Shift+&` |
934
- | Block Quote | Open block quote dialog | `Ctrl+Shift+Q` |
935
- | Embed Media | Open media embed dialog (audio, PDF, iframe) | `Ctrl+Shift+M` |
936
- | Video | Open video embed dialog | `Ctrl+Shift+V` |
937
- | Insert Table | Open table dialog | `Ctrl+Shift+L` |
938
- | Code Block | Open code block dialog | `Ctrl+Shift+*` |
939
- | Horizontal Rule | Insert `<hr>` at cursor position | `Ctrl+Shift+H` |
940
- | Undo | Undo last action | `Ctrl+Z` |
941
- | Redo | Redo last action | `Ctrl+Y` |
942
- | Toggle Status Bar | Show / hide the word and character count bar | `Ctrl+\` |
943
- | Save HTML | Download editor content as an `.html` file | `Ctrl+Shift+S` |
944
- | HTML Source | Toggle raw HTML source view | `Ctrl+Shift+A` |
945
- | Preview | Open preview dialog | `Ctrl+Shift+P` |
939
+ | Insert Image | Open image URL dialog | Ctrl+Shift+I |
940
+ | Upload Image | Open image upload / embed dialog | Ctrl+Shift+& |
941
+ | Block Quote | Open block quote dialog | Ctrl+Shift+Q |
942
+ | Embed Media | Open media embed dialog (audio, PDF, iframe) | Ctrl+Shift+M |
943
+ | Video | Open video embed dialog | Ctrl+Shift+V |
944
+ | Insert Table | Open table dialog | Ctrl+Shift+L |
945
+ | Code Block | Open code block dialog | Ctrl+Shift+* |
946
+ | Horizontal Rule | Insert \<hr\> at cursor position | Ctrl+Shift+H |
947
+ | Undo | Undo last action | Ctrl+Z |
948
+ | Redo | Redo last action | Ctrl+Y |
949
+ | Toggle Status Bar | Show / hide the word and character count bar | Ctrl+\ |
950
+ | Save HTML | Download editor content as an .html file | Ctrl+Shift+S |
951
+ | HTML Source | Toggle raw HTML source view | Ctrl+Shift+A |
952
+ | Preview | Open preview dialog | Ctrl+Shift+P |
946
953
 
947
954
  ---
948
955
 
949
956
  ## Keyboard Shortcuts
950
957
 
951
- All shortcuts are active when the editor content area has focus. The `Ctrl+\` and `Ctrl+Shift+A/P/S` shortcuts also work when the HTML source textarea has focus.
958
+ All shortcuts are active when the editor content area has focus. The Ctrl+\ and Ctrl+Shift+A/P/S shortcuts also work when the HTML source textarea has focus.
952
959
 
953
960
  | Category | Action | Shortcut |
954
961
  |---|---|---|
955
- | **Formatting** | Bold | `Ctrl+B` |
956
- | | Italic | `Ctrl+I` |
957
- | | Underline | `Ctrl+U` |
958
- | | Strikethrough | `Ctrl+D` |
959
- | | Subscript | `Ctrl+=` |
960
- | | Superscript | `Ctrl+Shift++` |
961
- | **Color** | Text color | `Ctrl+Shift+C` |
962
- | | Text background color | `Ctrl+Shift+B` |
963
- | **Alignment** | Align left | `Ctrl+L` |
964
- | | Align center | `Ctrl+E` |
965
- | | Align right | `Ctrl+R` |
966
- | | Justify | `Ctrl+J` |
967
- | **Editing** | Cut | `Ctrl+X` |
968
- | | Copy | `Ctrl+C` |
969
- | | Paste | `Ctrl+V` |
970
- | | Select all | `Ctrl+A` |
971
- | | Undo | `Ctrl+Z` |
972
- | | Redo | `Ctrl+Y` |
973
- | **Lists** | Ordered list | `Ctrl+Shift+O` |
974
- | | Unordered list | `Ctrl+Shift+U` |
975
- | | Increase indent | `Tab` |
976
- | | Decrease indent | `Shift+Tab` |
977
- | **Insert** | Insert link | `Ctrl+Shift+K` |
978
- | | Insert image | `Ctrl+Shift+I` |
979
- | | Upload image | `Ctrl+Shift+&` |
980
- | | Block quote | `Ctrl+Shift+Q` |
981
- | | Video | `Ctrl+Shift+V` |
982
- | | Embed media | `Ctrl+Shift+M` |
983
- | | Insert table | `Ctrl+Shift+L` |
984
- | | Code block | `Ctrl+Shift+*` |
985
- | | Horizontal rule | `Ctrl+Shift+H` |
986
- | **Format** | Paragraph | `Ctrl+Shift+D` |
987
- | | Heading 1–6 | `Ctrl+Shift+1``Ctrl+Shift+6` |
988
- | | Increase font size | `Ctrl+Shift+>` |
989
- | | Decrease font size | `Ctrl+Shift+<` |
990
- | **View** | Toggle status bar | `Ctrl+\` |
991
- | | Toggle HTML source | `Ctrl+Shift+A` |
992
- | | Preview | `Ctrl+Shift+P` |
993
- | | Save HTML | `Ctrl+Shift+S` |
962
+ | **Formatting** | Bold | Ctrl+B |
963
+ | | Italic | Ctrl+I |
964
+ | | Underline | Ctrl+U |
965
+ | | Strikethrough | Ctrl+D |
966
+ | | Subscript | Ctrl+= |
967
+ | | Superscript | Ctrl+Shift++ |
968
+ | **Color** | Text color | Ctrl+Shift+C |
969
+ | | Text background color | Ctrl+Shift+B |
970
+ | **Alignment** | Align left | Ctrl+L |
971
+ | | Align center | Ctrl+E |
972
+ | | Align right | Ctrl+R |
973
+ | | Justify | Ctrl+J |
974
+ | **Editing** | Cut | Ctrl+X |
975
+ | | Copy | Ctrl+C |
976
+ | | Paste | Ctrl+V |
977
+ | | Select all | Ctrl+A |
978
+ | | Undo | Ctrl+Z |
979
+ | | Redo | Ctrl+Y |
980
+ | **Lists** | Ordered list | Ctrl+Shift+O |
981
+ | | Unordered list | Ctrl+Shift+U |
982
+ | | Increase indent | Tab |
983
+ | | Decrease indent | Shift+Tab |
984
+ | **Insert** | Insert link | Ctrl+Shift+K |
985
+ | | Insert image | Ctrl+Shift+I |
986
+ | | Upload image | Ctrl+Shift+& |
987
+ | | Block quote | Ctrl+Shift+Q |
988
+ | | Video | Ctrl+Shift+V |
989
+ | | Embed media | Ctrl+Shift+M |
990
+ | | Insert table | Ctrl+Shift+L |
991
+ | | Code block | Ctrl+Shift+* |
992
+ | | Horizontal rule | Ctrl+Shift+H |
993
+ | **Format** | Paragraph | Ctrl+Shift+D |
994
+ | | Heading 1–6 | Ctrl+Shift+1 – Ctrl+Shift+6 |
995
+ | | Increase font size | Ctrl+Shift+> |
996
+ | | Decrease font size | Ctrl+Shift+< |
997
+ | **View** | Toggle status bar | Ctrl+\ |
998
+ | | Toggle HTML source | Ctrl+Shift+A |
999
+ | | Preview | Ctrl+Shift+P |
1000
+ | | Save HTML | Ctrl+Shift+S |
994
1001
 
995
1002
  ---
996
1003
 
997
1004
  ## Accessibility
998
1005
 
999
- `rt-native` is built with WCAG 2.1 AA compliance in mind:
1006
+ **rt-native** is built with WCAG 2.1 AA compliance in mind:
1000
1007
 
1001
- - **Editor region** — The content area carries `role="textbox"`, `aria-multiline="true"`, and an `aria-label` (defaults to `"Rich text editor"`; override with the `aria-label` or `label` attribute on the host element).
1002
- - **Read-only state** — `aria-readonly` is kept in sync with the `readonly` attribute and `setReadOnly()`.
1003
- - **Toolbar** — The toolbar container has `role="toolbar"` and `aria-label="Formatting toolbar"`. Every button has an `aria-label` derived from its tooltip text (e.g. `"Bold (Ctrl+B)"`) and an `aria-pressed` attribute that is kept in sync with the button's active/selected state.
1004
- - **Status bar** — Carries `role="status"`, `aria-live="polite"`, and `aria-atomic="true"` so word and character count updates are announced non-intrusively by screen readers.
1005
- - **Dialogs** — Every dialog has `aria-modal="true"` and `aria-labelledby` pointing to its title element. Close buttons are native `<button>` elements with descriptive `aria-label` text.
1006
- - **HTML source textarea** — Has `aria-label="HTML source"` to distinguish it from the main editor.
1008
+ - **Editor region** — The content area carries role="textbox", aria-multiline="true", and an aria-label (defaults to "Rich text editor"; override with the **aria-label** or **label** attribute on the host element).
1009
+ - **Read-only state** — aria-readonly is kept in sync with the **readonly** attribute and **setReadOnly()**.
1010
+ - **Toolbar** — The toolbar container has role="toolbar" and aria-label="Formatting toolbar". Every button has an aria-label derived from its tooltip text (e.g. "Bold (Ctrl+B)") and an aria-pressed attribute that is kept in sync with the button's active/selected state.
1011
+ - **Status bar** — Carries role="status", aria-live="polite", and aria-atomic="true" so word and character count updates are announced non-intrusively by screen readers.
1012
+ - **Dialogs** — Every dialog has aria-modal="true" and aria-labelledby pointing to its title element. Close buttons are native button elements with descriptive aria-label text.
1013
+ - **HTML source textarea** — Has aria-label="HTML source" to distinguish it from the main editor.
1007
1014
 
1008
1015
  ---
1009
1016
 
1010
1017
  ## Multiple Instances
1011
1018
 
1012
- Each `<rt-native>` element is fully isolated. You can place as many on a page as needed — each gets its own unique ID, shadow root, and state.
1019
+ Each rt-native element is fully isolated. You can place as many on a page as needed — each gets its own unique ID, shadow root, and state.
1013
1020
 
1014
1021
  ```html
1015
1022
  <rt-native id="editor-1" height="200px"></rt-native>
@@ -1034,8 +1041,8 @@ Requires browsers with native support for:
1034
1041
 
1035
1042
  - [Custom Elements v1](https://caniuse.com/custom-elementsv1)
1036
1043
  - [Shadow DOM v1](https://caniuse.com/shadowdomv1)
1037
- - [`<dialog>` element](https://caniuse.com/dialog)
1044
+ - [dialog element](https://caniuse.com/dialog)
1038
1045
  - [CSS Custom Properties](https://caniuse.com/css-variables)
1039
- - [`fetch()`](https://caniuse.com/fetch) *(required for `setPreviewCssFiles()` / `setPreviewCssFile()`)*
1046
+ - [fetch()](https://caniuse.com/fetch) *(required for **setPreviewCssFiles()** / **setPreviewCssFile()**)*
1040
1047
 
1041
1048
  All modern browsers (Chrome 67+, Firefox 63+, Safari 12.1+, Edge 79+) are supported. Internet Explorer is not supported.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rt-native",
3
- "version": "1.0.105",
3
+ "version": "1.0.106",
4
4
  "description": "rt-native HTML Editor is a free native web component that provides accessibility features and a wide variety of elements and customizations that make it one of the most robust and flexible HTML editors available. It allows the programmer to apply custom .css files to the preview window, so see how the content will be displayed in production. The editor uses embedded .svg Google Font Icons and the shadow DOM to isolate the HTML from inheriting the existing page styles. No frameworks, no build step, no dependencies — drop one script tag into any HTML page and you're done.",
5
5
  "main": "rt-native.js",
6
6
  "exports": {