rt-native 1.0.106 → 1.0.107

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 +89 -275
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -33,22 +33,12 @@
33
33
  - [Code / Pre](#code--pre-variables)
34
34
  - [Modals & Dialogs](#modal--dialog-variables)
35
35
  8. [Theming with CSS Classes](#theming-with-css-classes)
36
- 9. [configure() Reference](#configure-reference)
37
- - [toolbar](#toolbar-options)
38
- - [button](#button-options)
39
- - [content](#content-options)
40
- - [editor](#editor-options)
41
- - [scroll](#scroll-options)
42
- - [modal](#modal-options)
43
- - [quote](#quote-options)
44
- - [code](#code-options)
45
- - [visibility](#visibility-options)
46
- 10. [Preview Window Styling](#preview-window-styling)
47
- 11. [Toolbar Buttons](#toolbar-buttons)
48
- 12. [Keyboard Shortcuts](#keyboard-shortcuts)
49
- 13. [Accessibility](#accessibility)
50
- 14. [Multiple Instances](#multiple-instances)
51
- 15. [Browser Support](#browser-support)
36
+ 9. [Preview Window Styling](#preview-window-styling)
37
+ 10. [Toolbar Buttons](#toolbar-buttons)
38
+ 11. [Keyboard Shortcuts](#keyboard-shortcuts)
39
+ 12. [Accessibility](#accessibility)
40
+ 13. [Multiple Instances](#multiple-instances)
41
+ 14. [Browser Support](#browser-support)
52
42
 
53
43
  ---
54
44
 
@@ -157,13 +147,8 @@ npm install rt-native
157
147
 
158
148
  <!-- Accessible label -->
159
149
  <rt-native aria-label="Article body"></rt-native>
160
-
161
- <!-- Declarative config (JSON attribute) -->
162
- <rt-native config='{"editor":{"height":"500px"},"visibility":{"embedMedia":false}}'></rt-native>
163
150
  ```
164
151
 
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
-
167
152
  ---
168
153
 
169
154
  ## JavaScript API
@@ -197,21 +182,95 @@ editor.setValue(''); // clear
197
182
 
198
183
  ### configure()
199
184
 
200
- Applies appearance and behaviour options. Can be called at any time style changes take effect immediately via CSS custom properties; visibility changes trigger a minimal toolbar re-render.
185
+ 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.
186
+
187
+ Use `clearAll: true` to hide everything first, then opt individual buttons back in.
201
188
 
202
189
  ```js
190
+ // Hide specific buttons
203
191
  editor.configure({
204
- toolbar: { /* ... */ },
205
- button: { /* ... */ },
206
- content: { /* ... */ },
207
- editor: { /* ... */ },
208
- scroll: { /* ... */ },
209
- modal: { /* ... */ },
210
- visibility: { /* ... */ },
192
+ visibility: {
193
+ embedMedia: false,
194
+ table: false,
195
+ imageUpload: false,
196
+ }
197
+ });
198
+
199
+ // Pass every key explicitly as true to restore full toolbar
200
+ editor.configure({
201
+ visibility: {
202
+ clearAll: true,
203
+ font: true, size: true, format: true, textStylesDivider: true,
204
+ bold: true, italic: true, underline: true, strikethrough: true,
205
+ subscript: true, superscript: true, formatDivider: true,
206
+ textColor: true, textColorDivider: true,
207
+ alignLeft: true, alignCenter: true, alignRight: true,
208
+ alignJustify: true, alignDivider: true,
209
+ copy: true, cut: true, paste: true, delete: true,
210
+ selectAll: true, actionDivider: true,
211
+ orderedList: true, unorderedList: true, indent: true, listDivider: true,
212
+ link: true, image: true, imageUpload: true,
213
+ quote: true, codeBlock: true, embedMedia: true,
214
+ table: true, horizontalRule: true, mediaDivider: true,
215
+ undo: true, redo: true, historyDivider: true,
216
+ saveHtml: true, htmlView: true, preview: true, statusBarToggle: true,
217
+ wordCount: true,
218
+ }
211
219
  });
212
220
  ```
213
221
 
214
- See [configure() Reference](#configure-reference) for the full option list.
222
+ **All visibility keys:**
223
+
224
+ | Key | Controls |
225
+ |---|---|
226
+ | font | Font family dropdown |
227
+ | size | Font size dropdown |
228
+ | format | Paragraph / heading format dropdown |
229
+ | textStylesDivider | Divider after the three dropdowns |
230
+ | bold | Bold button |
231
+ | italic | Italic button |
232
+ | underline | Underline button |
233
+ | strikethrough | Strikethrough button |
234
+ | subscript | Subscript button |
235
+ | superscript | Superscript button |
236
+ | formatDivider | Divider after text-format buttons |
237
+ | textColor | Text color, background color, and remove-color buttons |
238
+ | textColorDivider | Divider after color buttons |
239
+ | alignLeft | Align left button |
240
+ | alignCenter | Align center button |
241
+ | alignRight | Align right button |
242
+ | alignJustify | Justify button |
243
+ | alignDivider | Divider after alignment buttons |
244
+ | cut | Cut button |
245
+ | copy | Copy button |
246
+ | paste | Paste button |
247
+ | delete | Delete button |
248
+ | selectAll | Select all button |
249
+ | actionDivider | Divider after clipboard buttons |
250
+ | orderedList | Ordered list button |
251
+ | unorderedList | Unordered list button |
252
+ | indent | Increase / decrease indent buttons |
253
+ | listDivider | Divider after list buttons |
254
+ | link | Insert link and remove link buttons |
255
+ | image | Insert image button |
256
+ | imageUpload | Upload / embed image button |
257
+ | quote | Block quote button |
258
+ | codeBlock | Code block button |
259
+ | embedMedia | Embed media (audio / PDF / iframe) button |
260
+ | video | Video embed button |
261
+ | table | Insert table button |
262
+ | horizontalRule | Insert horizontal rule button |
263
+ | mediaDivider | Divider after insert buttons |
264
+ | undo | Undo button |
265
+ | redo | Redo button |
266
+ | historyDivider | Divider after undo / redo |
267
+ | statusBarToggle | Toggle Status Bar button |
268
+ | saveHtml | Save HTML file button |
269
+ | htmlView | Toggle HTML source view button |
270
+ | preview | Preview button |
271
+ | wordCount | Status bar (word / character count) — hidden by default |
272
+
273
+ > **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.
215
274
 
216
275
  ### setReadOnly()
217
276
 
@@ -639,228 +698,6 @@ rt-native.fluent-dark {
639
698
  ```html
640
699
  <rt-native class="fluent-dark" id="editor" height="400px"></rt-native>
641
700
  ```
642
-
643
- ---
644
-
645
- ## configure() Reference
646
-
647
- **configure()** accepts a single options object. Every property is optional. Calling **configure()** multiple times merges with the previous state.
648
-
649
- ### toolbar options
650
-
651
- ```js
652
- editor.configure({
653
- toolbar: {
654
- backgroundColor: '#f5f5f5',
655
- borderStyle: 'solid',
656
- borderWidth: '1px',
657
- borderColor: '#ddd',
658
- borderRadius: '4px',
659
- dropdownBackgroundColor: '#fff',
660
- dropdownTextColor: '#000',
661
- dropdownBackgroundColorHover: '#e5e5e5',
662
- dropdownTextColorHover: '#000',
663
- }
664
- });
665
- ```
666
-
667
- ### button options
668
-
669
- ```js
670
- editor.configure({
671
- button: {
672
- textColor: '#333',
673
- textSize: '14px',
674
- textFont: 'Arial, sans-serif',
675
- backgroundColor: 'transparent',
676
- backgroundColorHover: '#ddd',
677
- backgroundColorSelected: '#ccc',
678
- borderStyle: 'solid',
679
- borderWidth: '1px',
680
- borderColor: '#ccc',
681
- borderColorHover: '#aaa',
682
- borderColorSelected: '#aaa',
683
- borderRadius: '4px',
684
- }
685
- });
686
- ```
687
-
688
- ### content options
689
-
690
- ```js
691
- editor.configure({
692
- content: {
693
- textColor: '#222',
694
- textSize: '16px',
695
- textFont: 'Georgia, serif',
696
- backgroundColor: '#fff',
697
- boxShadow: 'none',
698
- }
699
- });
700
- ```
701
-
702
- ### editor options
703
-
704
- ```js
705
- editor.configure({
706
- editor: {
707
- width: '100%',
708
- height: '500px',
709
- borderStyle: 'solid',
710
- borderWidth: '1px',
711
- borderColor: '#ccc',
712
- borderRadius: '6px',
713
- boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
714
- removeResizeHandle: false, // true = hide the resize grip
715
- }
716
- });
717
- ```
718
-
719
- ### scroll options
720
-
721
- ```js
722
- editor.configure({
723
- scroll: {
724
- width: '8px',
725
- opacity: '0.8',
726
- backgroundColor: 'transparent',
727
- thumbBackground: '#bbb',
728
- thumbBackgroundHover:'#888',
729
- thumbBorderRadius: '4px',
730
- }
731
- });
732
- ```
733
-
734
- ### modal options
735
-
736
- ```js
737
- editor.configure({
738
- modal: {
739
- backgroundColor: '#fff',
740
- textColor: '#000',
741
- textSize: '15px',
742
- textFont: 'Arial, sans-serif',
743
- textboxBackgroundColor: '#fafafa',
744
- textboxTextColor: '#000',
745
- textboxBorderColor: '#ccc',
746
- checkboxAccentColor: '#0066cc',
747
- }
748
- });
749
- ```
750
-
751
- ### quote options
752
-
753
- ```js
754
- editor.configure({
755
- quote: {
756
- backgroundColor: '#f9f9f9',
757
- borderColor: '#ccc',
758
- borderWidth: '5px',
759
- }
760
- });
761
- ```
762
-
763
- ### code options
764
-
765
- ```js
766
- editor.configure({
767
- code: {
768
- backgroundColor: '#f9f9f9',
769
- borderRadius: '10px',
770
- }
771
- });
772
- ```
773
-
774
- ### visibility options
775
-
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.
777
-
778
- Use `clearAll: true` to hide everything first, then opt individual buttons back in.
779
-
780
- ```js
781
- // Hide specific buttons
782
- editor.configure({
783
- visibility: {
784
- embedMedia: false,
785
- table: false,
786
- imageUpload: false,
787
- }
788
- });
789
-
790
- // Essentials-only toolbar
791
- editor.configure({
792
- visibility: {
793
- clearAll: true, // hide all first
794
- bold: true,
795
- italic: true,
796
- underline: true,
797
- formatDivider: true,
798
- alignLeft: true,
799
- alignCenter: true,
800
- alignRight: true,
801
- alignDivider: true,
802
- undo: true,
803
- redo: true,
804
- historyDivider:true,
805
- htmlView: true,
806
- preview: true,
807
- }
808
- });
809
- ```
810
-
811
- **All visibility keys:**
812
-
813
- | Key | Controls |
814
- |---|---|
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.
863
-
864
701
  ---
865
702
 
866
703
  ## Preview Window Styling
@@ -871,28 +708,6 @@ When you load preview CSS with **setPreviewCssFiles()** or **setPreviewCss()**,
871
708
 
872
709
  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.
873
710
 
874
- ### Writing your own preview CSS
875
-
876
- Write plain CSS — no special selectors, no ID prefixes, no scoping wrappers needed:
877
-
878
- ```css
879
- /* my-content.css */
880
- p {
881
- font-family: Georgia, serif;
882
- line-height: 1.8;
883
- margin-bottom: 1em;
884
- }
885
-
886
- h1, h2, h3 { color: #0a2540; }
887
-
888
- blockquote {
889
- border-left: 4px solid #0070f3;
890
- background: #f0f7ff;
891
- padding: 12px 20px;
892
- font-style: italic;
893
- }
894
- ```
895
-
896
711
  ```js
897
712
  editor.setPreviewCssFiles('my-content.css');
898
713
  ```
@@ -1029,7 +844,6 @@ Each rt-native element is fully isolated. You can place as many on a page as nee
1029
844
  visibility: { clearAll: true, bold: true, italic: true }
1030
845
  });
1031
846
  document.getElementById('editor-2').setPreviewCssFiles('/styles/content.css');
1032
- document.getElementById('editor-3').configure({ editor: { height: '400px' } });
1033
847
  </script>
1034
848
  ```
1035
849
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rt-native",
3
- "version": "1.0.106",
3
+ "version": "1.0.107",
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": {