ngx-xtroedge-cms 1.4.1 → 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.global.js +1 -1
- package/dist/index.js +5 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -423,28 +423,6 @@ body.lcms-editing [data-cms] {
|
|
|
423
423
|
-webkit-user-select: text !important;
|
|
424
424
|
cursor: text !important;
|
|
425
425
|
}
|
|
426
|
-
|
|
427
|
-
/* Force text selection on buttons and other elements */
|
|
428
|
-
body.lcms-editing button[contenteditable="true"],
|
|
429
|
-
body.lcms-editing a[contenteditable="true"],
|
|
430
|
-
body.lcms-editing [contenteditable="true"] {
|
|
431
|
-
user-select: text !important;
|
|
432
|
-
-webkit-user-select: text !important;
|
|
433
|
-
-moz-user-select: text !important;
|
|
434
|
-
-ms-user-select: text !important;
|
|
435
|
-
cursor: text !important;
|
|
436
|
-
pointer-events: auto !important;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/* Prevent button default behavior in edit mode */
|
|
440
|
-
body.lcms-editing button[contenteditable="true"] {
|
|
441
|
-
background: none;
|
|
442
|
-
border: none;
|
|
443
|
-
padding: 0;
|
|
444
|
-
font: inherit;
|
|
445
|
-
color: inherit;
|
|
446
|
-
outline: revert;
|
|
447
|
-
}
|
|
448
426
|
`;
|
|
449
427
|
|
|
450
428
|
// src/xtroedge-cms.ts
|
|
@@ -1379,11 +1357,6 @@ var _XtroedgeCMS = class _XtroedgeCMS {
|
|
|
1379
1357
|
const inAnchor = el.tagName === "A" || !!e.target.closest("a");
|
|
1380
1358
|
if (inAnchor) {
|
|
1381
1359
|
e.preventDefault();
|
|
1382
|
-
const selection = window.getSelection();
|
|
1383
|
-
const hasSelection = selection && selection.toString().length > 0;
|
|
1384
|
-
if (!hasSelection) {
|
|
1385
|
-
focusEditableEnd();
|
|
1386
|
-
}
|
|
1387
1360
|
}
|
|
1388
1361
|
};
|
|
1389
1362
|
const sectionSlug = el.getAttribute("data-cms-section") || this.currentSlug;
|
|
@@ -1417,37 +1390,21 @@ var _XtroedgeCMS = class _XtroedgeCMS {
|
|
|
1417
1390
|
}
|
|
1418
1391
|
enableElementEdit(el, _key, blurH, keyH, inputH, clickH) {
|
|
1419
1392
|
const val = this.getPageText(_key);
|
|
1420
|
-
if (val
|
|
1393
|
+
if (val && document.activeElement !== el) {
|
|
1394
|
+
this.setElementContent(el, val);
|
|
1395
|
+
}
|
|
1421
1396
|
el.setAttribute("contenteditable", "true");
|
|
1422
1397
|
el.style.setProperty("outline", `2px dashed ${this.highlightColor}`, "important");
|
|
1423
1398
|
el.style.setProperty("outline-offset", "-2px", "important");
|
|
1424
1399
|
el.style.cursor = "text";
|
|
1425
1400
|
el.style.transition = "background 0.2s";
|
|
1426
1401
|
el.style.minWidth = "20px";
|
|
1427
|
-
const isButton = el.tagName === "BUTTON" || el.tagName === "A";
|
|
1428
|
-
if (isButton) {
|
|
1429
|
-
el.style.setProperty("user-select", "text", "important");
|
|
1430
|
-
el.style.setProperty("-webkit-user-select", "text", "important");
|
|
1431
|
-
el.style.setProperty("-moz-user-select", "text", "important");
|
|
1432
|
-
el.style.setProperty("pointer-events", "auto", "important");
|
|
1433
|
-
}
|
|
1434
1402
|
el.addEventListener("blur", blurH);
|
|
1435
1403
|
el.addEventListener("keydown", keyH);
|
|
1436
1404
|
el.addEventListener("input", inputH);
|
|
1437
1405
|
el.addEventListener("click", clickH, true);
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
el.addEventListener("touchstart", _XtroedgeCMS.stopProp, true);
|
|
1441
|
-
} else {
|
|
1442
|
-
const buttonMouseDownHandler = (e) => {
|
|
1443
|
-
const isTextSelection = window.getSelection()?.toString().length || 0;
|
|
1444
|
-
if (!isTextSelection) {
|
|
1445
|
-
e.stopPropagation();
|
|
1446
|
-
}
|
|
1447
|
-
};
|
|
1448
|
-
el.addEventListener("mousedown", buttonMouseDownHandler, true);
|
|
1449
|
-
el.dataset.cmsButtonHandler = "true";
|
|
1450
|
-
}
|
|
1406
|
+
el.addEventListener("mousedown", _XtroedgeCMS.stopProp, true);
|
|
1407
|
+
el.addEventListener("touchstart", _XtroedgeCMS.stopProp, true);
|
|
1451
1408
|
el.addEventListener("focus", () => this.showRichToolbar(el));
|
|
1452
1409
|
}
|
|
1453
1410
|
disableElementEdit(el, _key, blurH, keyH, inputH, clickH) {
|
|
@@ -1457,13 +1414,6 @@ var _XtroedgeCMS = class _XtroedgeCMS {
|
|
|
1457
1414
|
el.style.cursor = "";
|
|
1458
1415
|
el.style.transition = "";
|
|
1459
1416
|
el.style.minWidth = "";
|
|
1460
|
-
const isButton = el.tagName === "BUTTON" || el.tagName === "A";
|
|
1461
|
-
if (isButton) {
|
|
1462
|
-
el.style.removeProperty("user-select");
|
|
1463
|
-
el.style.removeProperty("-webkit-user-select");
|
|
1464
|
-
el.style.removeProperty("-moz-user-select");
|
|
1465
|
-
el.style.removeProperty("pointer-events");
|
|
1466
|
-
}
|
|
1467
1417
|
const val = this.getPageText(_key);
|
|
1468
1418
|
if (val) this.setElementContent(el, val);
|
|
1469
1419
|
el.removeEventListener("blur", blurH);
|
|
@@ -1472,9 +1422,6 @@ var _XtroedgeCMS = class _XtroedgeCMS {
|
|
|
1472
1422
|
el.removeEventListener("click", clickH, true);
|
|
1473
1423
|
el.removeEventListener("mousedown", _XtroedgeCMS.stopProp, true);
|
|
1474
1424
|
el.removeEventListener("touchstart", _XtroedgeCMS.stopProp, true);
|
|
1475
|
-
if (el.dataset.cmsButtonHandler) {
|
|
1476
|
-
delete el.dataset.cmsButtonHandler;
|
|
1477
|
-
}
|
|
1478
1425
|
}
|
|
1479
1426
|
applyEditMode(editMode) {
|
|
1480
1427
|
document.body.classList.toggle("lcms-editing", editMode);
|
|
@@ -1488,9 +1435,6 @@ var _XtroedgeCMS = class _XtroedgeCMS {
|
|
|
1488
1435
|
const isManagedImage = !!imageTarget && this.managedImages.has(imageTarget);
|
|
1489
1436
|
const isManagedTarget = isManagedEditable || isManagedImage || !!editable || !!imageTarget;
|
|
1490
1437
|
if (isManagedTarget) {
|
|
1491
|
-
if (isManagedEditable && editable) {
|
|
1492
|
-
this.focusEditableEnd(editable);
|
|
1493
|
-
}
|
|
1494
1438
|
e.stopPropagation();
|
|
1495
1439
|
const anchor = target.closest("a");
|
|
1496
1440
|
if (anchor) e.preventDefault();
|