editate 0.6.7 → 0.6.8

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.
@@ -1,2 +1,2 @@
1
- export { createParser } from './parser.js';
1
+ export { createParser, TOKEN_TEXT, TOKEN_VOID, TOKEN_SOFT_BREAK, TOKEN_BLOCK, } from './parser.js';
2
2
  export { defaultIsBlockNode } from './default.js';
package/lib/index.cjs CHANGED
@@ -417,7 +417,7 @@ var ne = [], re = () => {}, oe = e => {
417
417
  }
418
418
  return [ e, t ];
419
419
  })(n, g, e);
420
- (({type: e}) => e === d || e === p || e === h)(e) && !m(t) || (n = t, g = r);
420
+ (({type: e}) => e === d || e === p || e === h)(e) && !m(t) || (n = t, V(r));
421
421
  } catch (t) {
422
422
  _("rollback operation: " + t);
423
423
  }
@@ -870,38 +870,39 @@ exports.Delete = function(t, n = e(t.selection)) {
870
870
  const o = e.hook("copy", e => {
871
871
  const t = document.createElement("div");
872
872
  t.appendChild(X(j(n), n).cloneContents()), e.setData("text/html", t.innerHTML);
873
- }), s = e.hook("paste", ((e, t, n = []) => r => {
874
- const o = r.getData("text/html");
875
- if (o) {
876
- let r = (new DOMParser).parseFromString(o, "text/html").body, s = !1;
877
- for (const e of [ ...r.childNodes ]) V(e) ? "StartFragment" === e.data ? (s = !0,
878
- r = new DocumentFragment) : "EndFragment" === e.data && (s = !1) : s && r.appendChild(e);
879
- return ((e, t, n, r) => t(({u: e, h: t}) => {
880
- let o, s = null, c = "", i = !1;
873
+ }), s = e.hook("paste", e => {
874
+ const n = e.getData("text/html");
875
+ return n ? ((e, t, n) => {
876
+ const r = n.text, o = e => {
877
+ const t = n[e.tagName.toLowerCase()];
878
+ if (t) {
879
+ const n = t(e);
880
+ if (n) return n;
881
+ }
882
+ };
883
+ let s = (new DOMParser).parseFromString(e, "text/html").body, c = !1;
884
+ for (const i of [ ...s.childNodes ]) V(i) ? "StartFragment" === i.data ? (c = !0,
885
+ s = new DocumentFragment) : "EndFragment" === i.data && (c = !1) : c && s.appendChild(i);
886
+ return t(({u: e, h: t}) => {
887
+ let n, s = null, c = "", i = !1;
881
888
  const a = [], l = () => {
882
- c && (s || (s = []), s.push(n(c)), c = "");
889
+ c && (s || (s = []), s.push(r(c)), c = "");
883
890
  }, f = () => {
884
891
  l(), !s && i && (s = []), s && a.push({
885
892
  children: s
886
893
  }), s = null, i = !1;
887
894
  };
888
- for (;o = e(); ) if (4 === o) f(); else if (i = !0, 1 === o) c += t().data; else if (2 === o) {
895
+ for (;n = e(); ) if (4 === n) f(); else if (i = !0, 1 === n) c += t().data; else if (2 === n) {
889
896
  l();
890
- const e = r(t());
897
+ const e = o(t());
891
898
  e && s.push(e);
892
- } else 3 === o && f();
899
+ } else 3 === n && f();
893
900
  return f(), a.length || a.push({
894
901
  children: []
895
902
  }), a;
896
- }, e))(r, e, t, e => {
897
- for (const t of n) {
898
- const n = t(e);
899
- if (n) return n;
900
- }
901
- });
902
- }
903
- return null;
904
- })(r, t.serializeText, t.serializers));
903
+ }, s);
904
+ })(n, r, t.serializers) : null;
905
+ });
905
906
  return () => {
906
907
  o(), s();
907
908
  };