ngx-xtroedge-cms 1.4.3 → 1.4.4

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/dist/index.js CHANGED
@@ -423,12 +423,6 @@ body.lcms-editing [data-cms] {
423
423
  -webkit-user-select: text !important;
424
424
  cursor: text !important;
425
425
  }
426
-
427
- /* Ensure editable elements appear above other content */
428
- body.lcms-editing [contenteditable="true"] {
429
- position: relative !important;
430
- z-index: 9999 !important;
431
- }
432
426
  `;
433
427
 
434
428
  // src/xtroedge-cms.ts
@@ -680,26 +674,6 @@ var _XtroedgeCMS = class _XtroedgeCMS {
680
674
  this.observer.observe(document.body, { childList: true, subtree: true });
681
675
  window.addEventListener("popstate", this.boundPopState);
682
676
  window.addEventListener("hashchange", this.boundHashChange);
683
- document.addEventListener("click", (e) => {
684
- if (!document.body.classList.contains("lcms-editing")) return;
685
- const target = e.target;
686
- const anchor = target.closest("a");
687
- if (anchor) {
688
- let editableEl = null;
689
- if (target.getAttribute("contenteditable") === "true") {
690
- editableEl = target;
691
- } else {
692
- editableEl = target.closest('[contenteditable="true"]') || anchor.querySelector('[contenteditable="true"]');
693
- }
694
- if (editableEl) {
695
- e.preventDefault();
696
- e.stopPropagation();
697
- setTimeout(() => {
698
- editableEl.focus();
699
- }, 0);
700
- }
701
- }
702
- }, true);
703
677
  this.handleNavigation();
704
678
  }
705
679
  destroy() {
@@ -720,14 +694,6 @@ var _XtroedgeCMS = class _XtroedgeCMS {
720
694
  if (this.toastTimer) clearTimeout(this.toastTimer);
721
695
  this.db?.close();
722
696
  }
723
- /**
724
- * Manually trigger a rescan of the DOM to detect new editable elements.
725
- * Useful when elements are dynamically shown/hidden or added to the page.
726
- */
727
- rescan() {
728
- if (this.scanTimeout) clearTimeout(this.scanTimeout);
729
- this.autoDetectAndScan();
730
- }
731
697
  // 24 hours
732
698
  async validateLicense() {
733
699
  const licenseKey = this.config.licenseKey || _XtroedgeCMS.secureGet("builder_token") || "";
@@ -1424,7 +1390,9 @@ var _XtroedgeCMS = class _XtroedgeCMS {
1424
1390
  }
1425
1391
  enableElementEdit(el, _key, blurH, keyH, inputH, clickH) {
1426
1392
  const val = this.getPageText(_key);
1427
- if (val) this.setElementContent(el, val);
1393
+ if (val && document.activeElement !== el) {
1394
+ this.setElementContent(el, val);
1395
+ }
1428
1396
  el.setAttribute("contenteditable", "true");
1429
1397
  el.style.setProperty("outline", `2px dashed ${this.highlightColor}`, "important");
1430
1398
  el.style.setProperty("outline-offset", "-2px", "important");
@@ -1655,11 +1623,6 @@ var _XtroedgeCMS = class _XtroedgeCMS {
1655
1623
  }
1656
1624
  }
1657
1625
  this.observer?.observe(document.body, { childList: true, subtree: true });
1658
- setTimeout(() => {
1659
- if (this.editMode) {
1660
- this.applyEditMode(true);
1661
- }
1662
- }, 200);
1663
1626
  }
1664
1627
  cleanupManagedElements() {
1665
1628
  for (const [el] of this.managedElements) this.detachElement(el);