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.
- package/lib/dom/index.d.ts +1 -1
- package/lib/index.cjs +23 -22
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +441 -440
- package/lib/index.js.map +1 -1
- package/lib/plugins/transfer/htmlTransfer.d.ts +7 -2
- package/package.json +1 -1
package/lib/dom/index.d.ts
CHANGED
|
@@ -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,
|
|
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",
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
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(
|
|
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 (;
|
|
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 =
|
|
897
|
+
const e = o(t());
|
|
891
898
|
e && s.push(e);
|
|
892
|
-
} else 3 ===
|
|
899
|
+
} else 3 === n && f();
|
|
893
900
|
return f(), a.length || a.push({
|
|
894
901
|
children: []
|
|
895
902
|
}), a;
|
|
896
|
-
},
|
|
897
|
-
|
|
898
|
-
|
|
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
|
};
|