rt-native 1.0.107 → 1.0.109
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/README.md +1 -1
- package/package.json +2 -2
- package/rt-native.js +42 -2
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# rt-native — Native Web Component Rich Text Editor
|
|
2
2
|
|
|
3
3
|
**Author:** Ryan Kueter
|
|
4
|
-
**Updated:**
|
|
4
|
+
**Updated:** May, 2026
|
|
5
5
|
|
|
6
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
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rt-native",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.109",
|
|
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": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"homepage": "https://github.com/ryankueter/rt-native",
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
38
|
-
"url": "git+https://github.com/
|
|
38
|
+
"url": "git+https://github.com/ryankueter/rt-native"
|
|
39
39
|
},
|
|
40
40
|
"bugs": {
|
|
41
41
|
"url": "https://github.com/ryankueter/rt-native"
|
package/rt-native.js
CHANGED
|
@@ -619,7 +619,7 @@ class RTBlazorfied {
|
|
|
619
619
|
if (this.preview && previewWindow) {
|
|
620
620
|
this.loadPreviewWindow(previewWindow);
|
|
621
621
|
this.addPreviewEventListeners(this.preview);
|
|
622
|
-
this.preview.
|
|
622
|
+
this.preview.showModal();
|
|
623
623
|
previewWindow.scrollTop = 0;
|
|
624
624
|
previewWindow.scrollLeft = 0;
|
|
625
625
|
}
|
|
@@ -728,10 +728,44 @@ class RTBlazorfied {
|
|
|
728
728
|
}
|
|
729
729
|
closePreview = () => {
|
|
730
730
|
this.disablePreview();
|
|
731
|
+
this._resetPreviewMaximize();
|
|
731
732
|
this.preview.close();
|
|
732
733
|
this.source.focus();
|
|
733
734
|
this.content.focus();
|
|
734
735
|
}
|
|
736
|
+
togglePreviewMaximize = () => {
|
|
737
|
+
const dialog = this.shadowRoot.getElementById(`${this.id}_Preview`);
|
|
738
|
+
const btn = this.shadowRoot.getElementById(`${this.id}_PreviewMaxBtn`);
|
|
739
|
+
if (!dialog || !btn) return;
|
|
740
|
+
const isMax = !dialog.hasAttribute('data-maximized');
|
|
741
|
+
const maximize_props = [
|
|
742
|
+
['width', '100vw'], ['height', '100vh'],
|
|
743
|
+
['max-width', '100vw'], ['max-height', '100vh'],
|
|
744
|
+
['top', '0'], ['left', '0'],
|
|
745
|
+
['transform', 'none'], ['border-radius', '0'], ['resize', 'none']
|
|
746
|
+
];
|
|
747
|
+
if (isMax) {
|
|
748
|
+
dialog.setAttribute('data-maximized', '');
|
|
749
|
+
maximize_props.forEach(([p, v]) => dialog.style.setProperty(p, v));
|
|
750
|
+
} else {
|
|
751
|
+
dialog.removeAttribute('data-maximized');
|
|
752
|
+
maximize_props.forEach(([p]) => dialog.style.removeProperty(p));
|
|
753
|
+
}
|
|
754
|
+
btn.setAttribute('aria-label', isMax ? 'Restore preview' : 'Maximize preview');
|
|
755
|
+
btn.querySelector('svg').innerHTML = isMax
|
|
756
|
+
? '<path d="M4.5 1.5V4.5H1.5M7.5 10.5V7.5H10.5M4.5 4.5L1.5 1.5M7.5 7.5L10.5 10.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" fill="none"/>'
|
|
757
|
+
: '<path d="M1.5 4.5V1.5H4.5M10.5 7.5V10.5H7.5M1.5 1.5L4.5 4.5M10.5 10.5L7.5 7.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" fill="none"/>';
|
|
758
|
+
}
|
|
759
|
+
_resetPreviewMaximize = () => {
|
|
760
|
+
const dialog = this.shadowRoot.getElementById(`${this.id}_Preview`);
|
|
761
|
+
const btn = this.shadowRoot.getElementById(`${this.id}_PreviewMaxBtn`);
|
|
762
|
+
if (!dialog || !btn) return;
|
|
763
|
+
dialog.removeAttribute('data-maximized');
|
|
764
|
+
['width','height','max-width','max-height','top','left','transform','border-radius','resize']
|
|
765
|
+
.forEach(p => dialog.style.removeProperty(p));
|
|
766
|
+
btn.setAttribute('aria-label', 'Maximize preview');
|
|
767
|
+
btn.querySelector('svg').innerHTML = '<path d="M1.5 4.5V1.5H4.5M10.5 7.5V10.5H7.5M1.5 1.5L4.5 4.5M10.5 10.5L7.5 7.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" fill="none"/>';
|
|
768
|
+
}
|
|
735
769
|
// ---- Horizontal Rule -------------------------------------------------------
|
|
736
770
|
|
|
737
771
|
insertHorizontalRule = () => {
|
|
@@ -5606,6 +5640,9 @@ const _RTB_SHADOW_CSS = `
|
|
|
5606
5640
|
.rtb-preview-dialog[open] {
|
|
5607
5641
|
display: flex;
|
|
5608
5642
|
}
|
|
5643
|
+
.rtb-preview-dialog::backdrop {
|
|
5644
|
+
background: transparent;
|
|
5645
|
+
}
|
|
5609
5646
|
.rtb-preview-dialog-body {
|
|
5610
5647
|
display: flex;
|
|
5611
5648
|
flex-direction: column;
|
|
@@ -6803,7 +6840,10 @@ rt-native {
|
|
|
6803
6840
|
<dialog id="${id}_Preview" class="rich-text-box-modal rich-text-box-scroll rtb-preview-dialog" aria-modal="true" aria-labelledby="${id}_Preview-title">
|
|
6804
6841
|
<div class="rtb-modal-header">
|
|
6805
6842
|
<div id="${id}_Preview-title" class="rich-text-box-modal-title">Preview</div>
|
|
6806
|
-
<
|
|
6843
|
+
<div style="display:flex;gap:2px;align-items:center;">
|
|
6844
|
+
<button id="${id}_PreviewMaxBtn" class="rich-text-box-modal-close" aria-label="Maximize preview" onclick="RTBlazorfied_Method('togglePreviewMaximize','${id}')"><svg viewBox="0 0 12 12" aria-hidden="true" focusable="false" width="11" height="11" style="display:block"><path d="M1.5 4.5V1.5H4.5M10.5 7.5V10.5H7.5M1.5 1.5L4.5 4.5M10.5 10.5L7.5 7.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" fill="none"/></svg></button>
|
|
6845
|
+
<button class="rich-text-box-modal-close" aria-label="Close preview" onclick="RTBlazorfied_Method('closePreview','${id}')"><svg viewBox="0 0 12 12" aria-hidden="true" focusable="false" width="8" height="8" style="display:block"><path d="M2 2L10 10M10 2L2 10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" fill="none"/></svg></button>
|
|
6846
|
+
</div>
|
|
6807
6847
|
</div>
|
|
6808
6848
|
<div class="rtb-preview-dialog-body">
|
|
6809
6849
|
<div id="rich-text-box-preview" class="rtb-preview-window"></div>
|