@cancia/toolbar 0.5.0 → 0.5.1

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
@@ -56,8 +56,8 @@ function applyOverlay() {
56
56
  if (el.dataset.cmsType === "link" || el.tagName === "A") {
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
  }
@@ -738,7 +738,9 @@ function buildLinkPopup(key, anchorEl, onClose) {
738
738
  wrap.dataset.canciaPopup = "1";
739
739
  applyPopupStyles(wrap);
740
740
  wrap.appendChild(buildHeader(key, onClose));
741
- const labelNode = anchorEl.querySelector("[data-cms-label]") ?? anchorEl;
741
+ const marked = anchorEl.querySelectorAll("[data-cms-label]");
742
+ const labelNodes = marked.length > 0 ? Array.from(marked) : [anchorEl];
743
+ const labelNode = labelNodes[0];
742
744
  const domLabel = labelNode.textContent?.trim() ?? "";
743
745
  const domHref = anchorEl.getAttribute("href") ?? "";
744
746
  const readCurrent = (lang) => {
@@ -830,7 +832,7 @@ function buildLinkPopup(key, anchorEl, onClose) {
830
832
  warn.style.cssText = `font-size:11px;color:#f0a; margin:-4px 0 10px; display:none;`;
831
833
  wrap.appendChild(warn);
832
834
  const paint = () => {
833
- labelNode.textContent = labelInput.value;
835
+ labelNodes.forEach((n) => n.textContent = labelInput.value);
834
836
  if (isSafeHrefValue(hrefInput.value)) anchorEl.setAttribute("href", hrefInput.value);
835
837
  };
836
838
  const stage = (lang) => {