@cancia/toolbar 0.5.0 → 0.5.2

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/cancia.js CHANGED
@@ -53,11 +53,11 @@ function applyOverlay() {
53
53
  el.src = savedValue;
54
54
  return;
55
55
  }
56
- if (el.dataset.cmsType === "link" || el.tagName === "A") {
56
+ if (el.dataset.cmsType === "link") {
57
57
  const link = parseLinkOverlay(savedValue);
58
58
  if (link.href && el.tagName === "A") el.setAttribute("href", link.href);
59
- const labelEl = el.querySelector("[data-cms-label]");
60
- if (labelEl) labelEl.textContent = link.label;
59
+ const labelEls = el.querySelectorAll("[data-cms-label]");
60
+ if (labelEls.length > 0) labelEls.forEach((n) => n.textContent = link.label);
61
61
  else if (el.childElementCount === 0) el.textContent = link.label;
62
62
  return;
63
63
  }
@@ -258,7 +258,6 @@ function fieldType(el) {
258
258
  if (el.dataset.cmsType === "image") return "image";
259
259
  if (el.dataset.cmsType === "link") return "link";
260
260
  if (el.tagName === "IMG") return "image";
261
- if (el.tagName === "A") return "link";
262
261
  return "text";
263
262
  }
264
263
  function elementMode(el) {
@@ -738,7 +737,9 @@ function buildLinkPopup(key, anchorEl, onClose) {
738
737
  wrap.dataset.canciaPopup = "1";
739
738
  applyPopupStyles(wrap);
740
739
  wrap.appendChild(buildHeader(key, onClose));
741
- const labelNode = anchorEl.querySelector("[data-cms-label]") ?? anchorEl;
740
+ const marked = anchorEl.querySelectorAll("[data-cms-label]");
741
+ const labelNodes = marked.length > 0 ? Array.from(marked) : [anchorEl];
742
+ const labelNode = labelNodes[0];
742
743
  const domLabel = labelNode.textContent?.trim() ?? "";
743
744
  const domHref = anchorEl.getAttribute("href") ?? "";
744
745
  const readCurrent = (lang) => {
@@ -830,7 +831,7 @@ function buildLinkPopup(key, anchorEl, onClose) {
830
831
  warn.style.cssText = `font-size:11px;color:#f0a; margin:-4px 0 10px; display:none;`;
831
832
  wrap.appendChild(warn);
832
833
  const paint = () => {
833
- labelNode.textContent = labelInput.value;
834
+ labelNodes.forEach((n) => n.textContent = labelInput.value);
834
835
  if (isSafeHrefValue(hrefInput.value)) anchorEl.setAttribute("href", hrefInput.value);
835
836
  };
836
837
  const stage = (lang) => {