rt-native 1.0.110 → 1.0.112
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 +4 -4
- package/package.json +1 -1
- package/rt-native.js +24 -0
package/README.md
CHANGED
|
@@ -342,6 +342,10 @@ editor.setPreviewCss('');
|
|
|
342
342
|
|
|
343
343
|
**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.
|
|
344
344
|
|
|
345
|
+
### At-rules
|
|
346
|
+
|
|
347
|
+
@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.
|
|
348
|
+
|
|
345
349
|
---
|
|
346
350
|
|
|
347
351
|
## Events
|
|
@@ -708,10 +712,6 @@ When you load preview CSS with **setPreviewCssFiles()** or **setPreviewCss()**,
|
|
|
708
712
|
editor.setPreviewCssFiles('my-content.css');
|
|
709
713
|
```
|
|
710
714
|
|
|
711
|
-
### At-rules
|
|
712
|
-
|
|
713
|
-
@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.
|
|
714
|
-
|
|
715
715
|
---
|
|
716
716
|
|
|
717
717
|
## Toolbar Buttons
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rt-native",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.112",
|
|
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": {
|
package/rt-native.js
CHANGED
|
@@ -528,6 +528,30 @@ class RTBlazorfied {
|
|
|
528
528
|
event.preventDefault();
|
|
529
529
|
this.toggleStatusBar();
|
|
530
530
|
}
|
|
531
|
+
if (event.key === 'Backspace') {
|
|
532
|
+
const selection = this.Utilities.getSelection();
|
|
533
|
+
if (selection && selection.isCollapsed) {
|
|
534
|
+
const range = selection.getRangeAt(0);
|
|
535
|
+
const blockLevelElements = ['P', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'OL', 'UL', 'SECTION', 'ARTICLE', 'HEADER', 'FOOTER'];
|
|
536
|
+
let block = selection.anchorNode;
|
|
537
|
+
while (block && block !== this.content) {
|
|
538
|
+
if (block.nodeType === Node.ELEMENT_NODE && blockLevelElements.includes(block.nodeName)) break;
|
|
539
|
+
block = block.parentNode;
|
|
540
|
+
}
|
|
541
|
+
if (block && block !== this.content) {
|
|
542
|
+
const marginLeft = parseFloat(window.getComputedStyle(block).marginLeft) || 0;
|
|
543
|
+
if (marginLeft > 0) {
|
|
544
|
+
const testRange = document.createRange();
|
|
545
|
+
testRange.setStart(block, 0);
|
|
546
|
+
testRange.setEnd(range.startContainer, range.startOffset);
|
|
547
|
+
if (testRange.toString().length === 0) {
|
|
548
|
+
event.preventDefault();
|
|
549
|
+
this.decreaseIndent();
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
531
555
|
if (event.shiftKey && event.key === 'Tab') {
|
|
532
556
|
event.preventDefault();
|
|
533
557
|
this.decreaseIndent();
|