autumnnote 2.7.0 → 2.7.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.
@@ -36,7 +36,7 @@ function s(e) {
36
36
  function c(e, t) {
37
37
  let n = {};
38
38
  for (let t of Object.keys(e)) n[t] = Array.isArray(e[t]) ? [...e[t]] : e[t];
39
- if (l(e) && l(t)) for (let r of Object.keys(t)) l(t[r]) ? n[r] = c(l(e[r]) ? e[r] : {}, t[r]) : Array.isArray(t[r]) ? n[r] = [...t[r]] : n[r] = t[r];
39
+ if (l(e) && l(t)) for (let r of Object.keys(t)) n[r] = l(t[r]) ? c(l(e[r]) ? e[r] : {}, t[r]) : Array.isArray(t[r]) ? [...t[r]] : t[r];
40
40
  return n;
41
41
  }
42
42
  function l(e) {
@@ -447,7 +447,7 @@ function nt(e) {
447
447
  let t = e.closest(".an-checklist");
448
448
  if (!t) return;
449
449
  let n = Array.from(t.children), r = n.indexOf(e), i = n.slice(r + 1), a = document.createElement("p");
450
- for (let t of e.childNodes) t.nodeType === 1 && t.tagName === "INPUT" || a.appendChild(t.cloneNode(!0));
450
+ for (let t of e.childNodes) (t.nodeType !== 1 || t.tagName !== "INPUT") && a.appendChild(t.cloneNode(!0));
451
451
  if (a.innerHTML = a.innerHTML.replaceAll("​", ""), (!a.hasChildNodes() || !a.textContent.trim()) && (a.innerHTML = "", a.appendChild(document.createTextNode("\xA0"))), i.length > 0) {
452
452
  let e = document.createElement("ul");
453
453
  e.className = "an-checklist", i.forEach((t) => e.appendChild(t)), t.parentNode.insertBefore(e, t.nextSibling);
@@ -580,28 +580,29 @@ function dt() {
580
580
  let t = e.getRangeAt(0), n = t.commonAncestorContainer;
581
581
  n.nodeType === 3 && (n = n.parentElement);
582
582
  let r = n?.closest("ul, ol");
583
- if (r) if (r.classList.contains("an-checklist")) {
584
- if (r.parentNode) {
585
- let t = Array.from(r.children), n = null;
586
- if (t.forEach((e) => {
587
- let t = document.createElement("p");
588
- for (let n of e.childNodes) n.nodeType === 1 && n.tagName === "INPUT" || t.appendChild(n.cloneNode(!0));
589
- t.innerHTML = t.innerHTML.replaceAll("​", "").replaceAll("​", ""), (!t.hasChildNodes() || !t.textContent.trim()) && (t.innerHTML = "", t.appendChild(document.createTextNode("\xA0"))), r.before(t), n ||= t;
590
- }), r.remove(), n) {
583
+ if (r) {
584
+ if (r.classList.contains("an-checklist")) {
585
+ if (r.parentNode) {
586
+ let t = Array.from(r.children), n = null;
587
+ if (t.forEach((e) => {
588
+ let t = document.createElement("p");
589
+ for (let n of e.childNodes) (n.nodeType !== 1 || n.tagName !== "INPUT") && t.appendChild(n.cloneNode(!0));
590
+ t.innerHTML = t.innerHTML.replaceAll("​", "").replaceAll("​", ""), (!t.hasChildNodes() || !t.textContent.trim()) && (t.innerHTML = "", t.appendChild(document.createTextNode("\xA0"))), r.before(t), n ||= t;
591
+ }), r.remove(), n) {
592
+ let t = document.createRange();
593
+ t.setStart(n.firstChild || n, 0), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
594
+ }
595
+ }
596
+ } else {
597
+ let t = E(r, "ul");
598
+ t.classList.add("an-checklist"), ut(t);
599
+ let n = t.querySelector("li");
600
+ if (n) {
591
601
  let t = document.createRange();
592
- t.setStart(n.firstChild || n, 0), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
602
+ t.selectNodeContents(n), t.collapse(!1), e.removeAllRanges(), e.addRange(t);
593
603
  }
594
604
  }
595
605
  } else {
596
- let t = E(r, "ul");
597
- t.classList.add("an-checklist"), ut(t);
598
- let n = t.querySelector("li");
599
- if (n) {
600
- let t = document.createRange();
601
- t.selectNodeContents(n), t.collapse(!1), e.removeAllRanges(), e.addRange(t);
602
- }
603
- }
604
- else {
605
606
  let r = n?.closest("[contenteditable=\"true\"]");
606
607
  if (t.collapsed) {
607
608
  let t = /* @__PURE__ */ new Set([
@@ -996,7 +997,7 @@ var mt = D("bold", "bold", "Bold (Ctrl+B)", () => Le(), () => document.queryComm
996
997
  externalAssetReferrerPolicy: "no-referrer",
997
998
  markdownPaste: !0,
998
999
  historyLimit: 100,
999
- historyMaxBytes: 10 * 1024 * 1024,
1000
+ historyMaxBytes: 10485760,
1000
1001
  defaultFontFamily: "Arial",
1001
1002
  defaultFontSize: "14px",
1002
1003
  fontFamilies: [
@@ -1041,7 +1042,7 @@ var mt = D("bold", "bold", "Bold (Ctrl+B)", () => Le(), () => document.queryComm
1041
1042
  collaborationAdapter: null,
1042
1043
  imageProcessor: null,
1043
1044
  blockIds: !1,
1044
- maxPasteSize: 5 * 1024 * 1024,
1045
+ maxPasteSize: 5242880,
1045
1046
  minImageSize: 20,
1046
1047
  bubbleToolbar: !1,
1047
1048
  bubbleToolbarItems: [
@@ -1565,12 +1566,14 @@ function _n(e, { allowIframes: t = !1 } = {}) {
1565
1566
  t.name === "src" && !bn(t.value) && e.removeAttribute(t.name);
1566
1567
  }
1567
1568
  }
1568
- if (t === "a" && e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer"), t === "input") if (!(e.closest("ul.an-checklist") !== null && e.closest("li") !== null) || e.getAttribute("type") !== "checkbox") e.remove();
1569
- else for (let t of Array.from(e.attributes)) [
1570
- "type",
1571
- "checked",
1572
- "contenteditable"
1573
- ].includes(t.name) || e.removeAttribute(t.name);
1569
+ if (t === "a" && e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer"), t === "input") {
1570
+ if (e.closest("ul.an-checklist") === null || e.closest("li") === null || e.getAttribute("type") !== "checkbox") e.remove();
1571
+ else for (let t of Array.from(e.attributes)) [
1572
+ "type",
1573
+ "checked",
1574
+ "contenteditable"
1575
+ ].includes(t.name) || e.removeAttribute(t.name);
1576
+ }
1574
1577
  }
1575
1578
  return n.body;
1576
1579
  }
@@ -1676,12 +1679,14 @@ var P = /* @__PURE__ */ new Map(), En = class {
1676
1679
  for (let { name: e, Class: t, enabled: n } of wn) {
1677
1680
  if (typeof n != "function") continue;
1678
1681
  let r = n(this.options);
1679
- if (r !== this._modules.has(e)) if (r) {
1680
- let n = new t(this);
1681
- this._modules.set(e, n), n.initialize();
1682
- } else {
1683
- let t = this._modules.get(e);
1684
- typeof t?.destroy == "function" && t.destroy(), this._modules.delete(e);
1682
+ if (r !== this._modules.has(e)) {
1683
+ if (r) {
1684
+ let n = new t(this);
1685
+ this._modules.set(e, n), n.initialize();
1686
+ } else {
1687
+ let t = this._modules.get(e);
1688
+ typeof t?.destroy == "function" && t.destroy(), this._modules.delete(e);
1689
+ }
1685
1690
  }
1686
1691
  }
1687
1692
  }
@@ -1980,7 +1985,7 @@ function Dn(e, t) {
1980
1985
  return r;
1981
1986
  }
1982
1987
  var On = class {
1983
- constructor(e, t = 100, n = 10 * 1024 * 1024) {
1988
+ constructor(e, t = 100, n = 10485760) {
1984
1989
  this.editable = e, this._limit = t, this._maxBytes = n, this._bytes = 0, this.stack = [], this.stackOffset = -1, this._savePoint();
1985
1990
  }
1986
1991
  _entrySize(e) {
@@ -2223,7 +2228,7 @@ function L(e, t) {
2223
2228
  }
2224
2229
  //#endregion
2225
2230
  //#region src/js/editing/Typing.js
2226
- var jn = /\bfa-/, R = (e) => !!(e?.nodeName === "I" && jn.test(e.className || "")), z = (e) => e?.nodeType === Node.TEXT_NODE && (e.textContent === "​" || e.textContent === "");
2231
+ var jn = /\bfa-/, R = (e) => !!(e?.nodeName === "I" && jn.test(e.className || "")), z = (e) => !(e?.nodeType !== Node.TEXT_NODE || e.textContent !== "​" && e.textContent !== "");
2227
2232
  function Mn(e, t, n) {
2228
2233
  let r = (e?.nodeType === Node.ELEMENT_NODE ? e : e?.parentElement ?? null)?.closest("td, th") ?? null;
2229
2234
  if (!r || !t.contains(r)) return !1;
@@ -2338,8 +2343,8 @@ function Fn(e, t, n = {}) {
2338
2343
  if (Mn(r.sc, t, e.shiftKey)) return e.preventDefault(), !0;
2339
2344
  let i = b(r.sc, t);
2340
2345
  if (i && ee(i)) return e.preventDefault(), e.shiftKey ? et() : Qe(), !0;
2341
- if (i?.nodeName.toUpperCase() === "PRE") return e.shiftKey ? !1 : (e.preventDefault(), T("insertText", " ".repeat(n.tabSize || 4)), !0);
2342
- if (n.tabSize) return e.shiftKey ? !1 : (e.preventDefault(), T("insertText", " ".repeat(n.tabSize)), !0);
2346
+ if (i?.nodeName.toUpperCase() === "PRE") return !e.shiftKey && (e.preventDefault(), T("insertText", " ".repeat(n.tabSize || 4)), !0);
2347
+ if (n.tabSize) return !e.shiftKey && (e.preventDefault(), T("insertText", " ".repeat(n.tabSize)), !0);
2343
2348
  }
2344
2349
  if (I(e, F.ENTER) && e.shiftKey) return e.preventDefault(), T("insertLineBreak"), !0;
2345
2350
  if (I(e, F.ENTER) && !e.shiftKey) {
@@ -2366,7 +2371,7 @@ function Fn(e, t, n = {}) {
2366
2371
  if (o) {
2367
2372
  e.preventDefault();
2368
2373
  let t = o.closest(".an-checklist"), n = globalThis.getSelection(), r = n.getRangeAt(0);
2369
- if (!((e) => Array.from(e.childNodes).filter((e) => !(e.nodeType === 1 && e.tagName === "INPUT")).map((e) => e.textContent).join("").replace(/[\u00a0\u200B]/g, " ").trim())(o)) {
2374
+ if (!((e) => Array.from(e.childNodes).filter((e) => e.nodeType !== 1 || e.tagName !== "INPUT").map((e) => e.textContent).join("").replace(/[\u00a0\u200B]/g, " ").trim())(o)) {
2370
2375
  let e = document.createElement("p");
2371
2376
  e.innerHTML = "\xA0", t.parentNode.insertBefore(e, t.nextSibling), o.remove(), t.children.length === 0 && t.remove();
2372
2377
  let r = document.createRange();
@@ -3593,7 +3598,7 @@ var Br = /* @__PURE__ */ new Set([
3593
3598
  }
3594
3599
  initialize() {
3595
3600
  let e = this.context.layoutInfo.editable;
3596
- return this._history = new On(e, this.options.historyLimit || 100, this.options.historyMaxBytes || 10 * 1024 * 1024), this._bindEvents(e), this;
3601
+ return this._history = new On(e, this.options.historyLimit || 100, this.options.historyMaxBytes || 10485760), this._bindEvents(e), this;
3597
3602
  }
3598
3603
  destroy() {
3599
3604
  this._disposers.forEach((e) => e()), this._disposers = [], this._history = null, clearTimeout(this._snapshotTimer), this._snapshotTimer = null;
@@ -4053,7 +4058,7 @@ var Br = /* @__PURE__ */ new Set([
4053
4058
  "aria-haspopup": "true",
4054
4059
  "aria-expanded": "false"
4055
4060
  });
4056
- this._faReady ? n.innerHTML = `<i class="${this.options.fontAwesomeClass || "fas"} fa-table" aria-hidden="true"></i>` : n.innerHTML = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"display:block\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"1\"/><line x1=\"3\" y1=\"9\" x2=\"21\" y2=\"9\"/><line x1=\"3\" y1=\"15\" x2=\"21\" y2=\"15\"/><line x1=\"9\" y1=\"3\" x2=\"9\" y2=\"21\"/><line x1=\"15\" y1=\"3\" x2=\"15\" y2=\"21\"/></svg>";
4061
+ n.innerHTML = this._faReady ? `<i class="${this.options.fontAwesomeClass || "fas"} fa-table" aria-hidden="true"></i>` : "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"display:block\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"1\"/><line x1=\"3\" y1=\"9\" x2=\"21\" y2=\"9\"/><line x1=\"3\" y1=\"15\" x2=\"21\" y2=\"15\"/><line x1=\"9\" y1=\"3\" x2=\"9\" y2=\"21\"/><line x1=\"15\" y1=\"3\" x2=\"15\" y2=\"21\"/></svg>";
4057
4062
  let r = x("div", {
4058
4063
  class: "an-table-picker-popup",
4059
4064
  role: "dialog",
@@ -4799,7 +4804,7 @@ var Zr = [
4799
4804
  }
4800
4805
  }
4801
4806
  }
4802
- ], Qr = "2.7.0";
4807
+ ], Qr = "2.7.1";
4803
4808
  //#endregion
4804
4809
  //#region src/js/core/lists.js
4805
4810
  function $r(e) {