autumnnote 1.4.0 → 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.
package/README.md CHANGED
@@ -12,9 +12,9 @@
12
12
  [![jQuery](https://img.shields.io/badge/jQuery-free-lightgrey)](#)
13
13
  [![TypeScript](https://img.shields.io/badge/TypeScript-definitions-3178C6?logo=typescript&logoColor=white)](types/index.d.ts)
14
14
 
15
- A modern, lightweight WYSIWYG rich-text editor built with vanilla JavaScript (ES2022+) — no jQuery, no heavy dependencies.
15
+ A modern WYSIWYG rich-text editor built with vanilla JavaScript (ES2022+) — no jQuery, no heavy dependencies.
16
16
 
17
- > Write rich text. No dependencies. No drama.
17
+ > **Fast. Lightweight. Reliable. Efficient.**
18
18
 
19
19
  [Live Demo](https://cmm-cmm.github.io/Autumn-Note/) · [Docs](https://cmm-cmm.github.io/Autumn-Note/docs.html) · [Playground](https://cmm-cmm.github.io/Autumn-Note/playground.html)
20
20
 
@@ -919,9 +919,16 @@ function toggleChecklist() {
919
919
  if (selectedLis.length > 0) {
920
920
  let firstP = null;
921
921
  selectedLis.forEach((li) => {
922
- const text = Array.from(li.childNodes).filter((n) => !(n.nodeType === 1 && n.tagName === "INPUT")).map((n) => n.textContent).join("").replace(/\u00a0/g, " ").trim();
923
922
  const p = document.createElement("p");
924
- p.textContent = text || "\xA0";
923
+ for (const child of li.childNodes) {
924
+ if (child.nodeType === 1 && child.tagName === "INPUT") continue;
925
+ p.appendChild(child.cloneNode(true));
926
+ }
927
+ p.innerHTML = p.innerHTML.replace(/\u200b/g, "");
928
+ if (!p.hasChildNodes() || !p.textContent.trim()) {
929
+ p.innerHTML = "";
930
+ p.appendChild(document.createTextNode("\xA0"));
931
+ }
925
932
  ul.parentNode.insertBefore(p, ul);
926
933
  if (!firstP) firstP = p;
927
934
  ul.removeChild(li);
@@ -5255,13 +5262,13 @@ function _parseTableRow(row) {
5255
5262
  function _inline(text) {
5256
5263
  text = text.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (_, alt, src) => `<img src="${_escAttr(src)}" alt="${_escAttr(alt)}" class="an-image">`);
5257
5264
  text = text.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, label, href) => `<a href="${_escAttr(href)}">${_esc(label)}</a>`);
5258
- text = text.replace(/\*{3}(.+?)\*{3}/g, (_, c) => `<strong><em>${_esc(c)}</em></strong>`);
5259
- text = text.replace(/_{3}(.+?)_{3}/g, (_, c) => `<strong><em>${_esc(c)}</em></strong>`);
5260
- text = text.replace(/\*{2}(.+?)\*{2}/g, (_, c) => `<strong>${_esc(c)}</strong>`);
5261
- text = text.replace(/_{2}(.+?)_{2}/g, (_, c) => `<strong>${_esc(c)}</strong>`);
5265
+ text = text.replace(/\*{3}([^*\n]+?)\*{3}/g, (_, c) => `<strong><em>${_esc(c)}</em></strong>`);
5266
+ text = text.replace(/_{3}([^_\n]+?)_{3}/g, (_, c) => `<strong><em>${_esc(c)}</em></strong>`);
5267
+ text = text.replace(/\*{2}([^*\n]+?)\*{2}/g, (_, c) => `<strong>${_esc(c)}</strong>`);
5268
+ text = text.replace(/_{2}([^_\n]+?)_{2}/g, (_, c) => `<strong>${_esc(c)}</strong>`);
5262
5269
  text = text.replace(/\*([^*\n]+?)\*/g, (_, c) => `<em>${_esc(c)}</em>`);
5263
5270
  text = text.replace(/_([^_\n]+?)_/g, (_, c) => `<em>${_esc(c)}</em>`);
5264
- text = text.replace(/~~(.+?)~~/g, (_, c) => `<del>${_esc(c)}</del>`);
5271
+ text = text.replace(/~~([^\n]+?)~~/g, (_, c) => `<del>${_esc(c)}</del>`);
5265
5272
  text = text.replace(/`([^`]+)`/g, (_, c) => `<code>${_esc(c)}</code>`);
5266
5273
  return text;
5267
5274
  }
@@ -16423,7 +16430,7 @@ var AutumnNote = {
16423
16430
  registerButton(btnDef);
16424
16431
  return this;
16425
16432
  },
16426
- version: "1.4.0"
16433
+ version: "1.4.2"
16427
16434
  };
16428
16435
  /**
16429
16436
  * @param {string|Element|NodeList|Element[]} selector