rt-native 1.0.111 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/rt-native.js +24 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rt-native",
3
- "version": "1.0.111",
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();