autumnnote 1.4.1 → 1.4.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.
@@ -633,9 +633,16 @@
633
633
  if (selectedLis.length > 0) {
634
634
  let firstP = null;
635
635
  selectedLis.forEach((li) => {
636
- const text = Array.from(li.childNodes).filter((n) => !(n.nodeType === 1 && n.tagName === "INPUT")).map((n) => n.textContent).join("").replace(/\u00a0/g, " ").trim();
637
636
  const p = document.createElement("p");
638
- p.textContent = text || "\xA0";
637
+ for (const child of li.childNodes) {
638
+ if (child.nodeType === 1 && child.tagName === "INPUT") continue;
639
+ p.appendChild(child.cloneNode(true));
640
+ }
641
+ p.innerHTML = p.innerHTML.replace(/\u200b/g, "");
642
+ if (!p.hasChildNodes() || !p.textContent.trim()) {
643
+ p.innerHTML = "";
644
+ p.appendChild(document.createTextNode("\xA0"));
645
+ }
639
646
  ul.parentNode.insertBefore(p, ul);
640
647
  if (!firstP) firstP = p;
641
648
  ul.removeChild(li);
@@ -4960,13 +4967,13 @@
4960
4967
  function _inline(text) {
4961
4968
  text = text.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (_, alt, src) => `<img src="${_escAttr(src)}" alt="${_escAttr(alt)}" class="an-image">`);
4962
4969
  text = text.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, label, href) => `<a href="${_escAttr(href)}">${_esc(label)}</a>`);
4963
- text = text.replace(/\*{3}(.+?)\*{3}/g, (_, c) => `<strong><em>${_esc(c)}</em></strong>`);
4964
- text = text.replace(/_{3}(.+?)_{3}/g, (_, c) => `<strong><em>${_esc(c)}</em></strong>`);
4965
- text = text.replace(/\*{2}(.+?)\*{2}/g, (_, c) => `<strong>${_esc(c)}</strong>`);
4966
- text = text.replace(/_{2}(.+?)_{2}/g, (_, c) => `<strong>${_esc(c)}</strong>`);
4970
+ text = text.replace(/\*{3}([^*\n]+?)\*{3}/g, (_, c) => `<strong><em>${_esc(c)}</em></strong>`);
4971
+ text = text.replace(/_{3}([^_\n]+?)_{3}/g, (_, c) => `<strong><em>${_esc(c)}</em></strong>`);
4972
+ text = text.replace(/\*{2}([^*\n]+?)\*{2}/g, (_, c) => `<strong>${_esc(c)}</strong>`);
4973
+ text = text.replace(/_{2}([^_\n]+?)_{2}/g, (_, c) => `<strong>${_esc(c)}</strong>`);
4967
4974
  text = text.replace(/\*([^*\n]+?)\*/g, (_, c) => `<em>${_esc(c)}</em>`);
4968
4975
  text = text.replace(/_([^_\n]+?)_/g, (_, c) => `<em>${_esc(c)}</em>`);
4969
- text = text.replace(/~~(.+?)~~/g, (_, c) => `<del>${_esc(c)}</del>`);
4976
+ text = text.replace(/~~([^\n]+?)~~/g, (_, c) => `<del>${_esc(c)}</del>`);
4970
4977
  text = text.replace(/`([^`]+)`/g, (_, c) => `<code>${_esc(c)}</code>`);
4971
4978
  return text;
4972
4979
  }
@@ -16010,7 +16017,7 @@
16010
16017
  registerButton(btnDef);
16011
16018
  return this;
16012
16019
  },
16013
- version: "1.4.1"
16020
+ version: "1.4.2"
16014
16021
  };
16015
16022
  /**
16016
16023
  * @param {string|Element|NodeList|Element[]} selector