@toantranmei/editor 0.3.0 → 0.3.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.
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2023,16 +2023,20 @@ var za = yn.extend({
|
|
|
2023
2023
|
addNodeView() {
|
|
2024
2024
|
let e = this.parent?.();
|
|
2025
2025
|
return e ? (t) => {
|
|
2026
|
-
let n = e(t), r = n.
|
|
2026
|
+
let n = e(t), r = n.update?.bind(n), i = t.node, a = !!t.node.attrs.open && !!r;
|
|
2027
|
+
a && setTimeout(() => {
|
|
2028
|
+
a = !1, r?.(i);
|
|
2029
|
+
});
|
|
2030
|
+
let o = n.dom, s = (e) => {
|
|
2027
2031
|
for (let [t, n] of [
|
|
2028
2032
|
["data-level", e.level],
|
|
2029
2033
|
["data-text-color", e.blockColor],
|
|
2030
2034
|
["data-bg-color", e.blockBg]
|
|
2031
|
-
]) n ?
|
|
2032
|
-
}
|
|
2035
|
+
]) n ? o.setAttribute(t, String(n)) : o.removeAttribute(t);
|
|
2036
|
+
};
|
|
2033
2037
|
return Object.assign(n, { update: (e, ...n) => {
|
|
2034
|
-
let
|
|
2035
|
-
return
|
|
2038
|
+
let o = r && !a ? r(e, ...n) : e.type === t.node.type;
|
|
2039
|
+
return o && a && (i = e), o && s(e.attrs), o;
|
|
2036
2040
|
} });
|
|
2037
2041
|
} : null;
|
|
2038
2042
|
}
|