@jackuait/blok 0.23.3 → 0.23.4
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 +3 -3
- package/dist/blok.cjs +1 -1
- package/dist/blok.iife.js +13 -13
- package/dist/blok.mjs +2 -2
- package/dist/blok.umd.js +2 -2
- package/dist/chunks/{blok-1H9roBGf.mjs → blok-BydOC-jj.mjs} +12 -5
- package/dist/chunks/{blok-J3Lfa_bK.cjs → blok-qwtrt5R3.cjs} +2 -2
- package/dist/chunks/{constants-BJ79cqMa.mjs → constants-DZtdGLlr.mjs} +1 -1
- package/dist/chunks/{constants-BZUc1kAY.cjs → constants-Y3Af_xZ7.cjs} +1 -1
- package/dist/chunks/{tools-OHDv2C7w.cjs → tools-BmSYWm8L.cjs} +1 -1
- package/dist/chunks/{tools-ByOjWADT.mjs → tools-DOZaLyYm.mjs} +1 -1
- package/dist/full.cjs +1 -1
- package/dist/full.mjs +3 -3
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +36 -31
- package/dist/tools.cjs +1 -1
- package/dist/tools.mjs +2 -2
- package/package.json +1 -1
- package/src/components/modules/modificationsObserver.ts +40 -2
- package/src/react/BlokEditor.tsx +10 -2
- package/src/react/config-keys.ts +1 -0
- package/src/react/types.ts +4 -0
- package/src/react/useBlok.ts +29 -6
- package/types/configs/blok-config.d.ts +17 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./chunk-5O_1xk2F.mjs";
|
|
2
|
-
import { $i as t, $n as n, $r as r, A as i, Aa as a, Ai as o, Bi as s, C as c, Ca as l, D as u, Da as d, Di as f, Dt as p, E as m, Ea as h, Ei as g, Fi as _, Fn as v, Gi as y, Gn as ee, H as te, Hi as b, Ii as ne, Ji as re, K as ie, Ki as ae, Li as oe, Lt as se, M as ce, Ma as x, N as le, Na as S, Ni as ue, Nr as de, O as fe, Oa as pe, Oi as me, On as he, Q as ge, Qi as C, Qn as _e, Qt as ve, Ri as ye, Sa as w, Si as be, T as xe, Ta as Se, Tn as Ce, Ui as we, V as Te, Vi as Ee, Vn as De, Wi as Oe, Xi as ke, Y as Ae, Yi as je, Zr as Me, _a as Ne, _i as Pe, aa as T, ai as Fe, an as Ie, b as Le, ba as Re, bi as ze, ca as Be, ci as Ve, da as He, di as Ue, dn as We, ea as Ge, fa as Ke, fi as qe, ga as Je, gi as Ye, h as Xe, ha as Ze, hi as Qe, j as $e, ja as et, ji as tt, k as nt, ka as rt, ki as E, la as it, ln as at, m as ot, ma as st, mi as ct, mr as lt, na as ut, ni as dt, oi as ft, or as pt, p as mt, pa as ht, qi as gt, qn as _t, qt as vt, ra as yt, ri as bt, rn as xt, sa as St, ta as Ct, ti as wt, tn as Tt, tt as Et, u as Dt, ua as Ot, ui as kt, va as At, vi as jt, w as Mt, wa as Nt, xa as D, xi as Pt, xt as Ft, ya as It, yi as Lt, zi as Rt } from "./constants-
|
|
2
|
+
import { $i as t, $n as n, $r as r, A as i, Aa as a, Ai as o, Bi as s, C as c, Ca as l, D as u, Da as d, Di as f, Dt as p, E as m, Ea as h, Ei as g, Fi as _, Fn as v, Gi as y, Gn as ee, H as te, Hi as b, Ii as ne, Ji as re, K as ie, Ki as ae, Li as oe, Lt as se, M as ce, Ma as x, N as le, Na as S, Ni as ue, Nr as de, O as fe, Oa as pe, Oi as me, On as he, Q as ge, Qi as C, Qn as _e, Qt as ve, Ri as ye, Sa as w, Si as be, T as xe, Ta as Se, Tn as Ce, Ui as we, V as Te, Vi as Ee, Vn as De, Wi as Oe, Xi as ke, Y as Ae, Yi as je, Zr as Me, _a as Ne, _i as Pe, aa as T, ai as Fe, an as Ie, b as Le, ba as Re, bi as ze, ca as Be, ci as Ve, da as He, di as Ue, dn as We, ea as Ge, fa as Ke, fi as qe, ga as Je, gi as Ye, h as Xe, ha as Ze, hi as Qe, j as $e, ja as et, ji as tt, k as nt, ka as rt, ki as E, la as it, ln as at, m as ot, ma as st, mi as ct, mr as lt, na as ut, ni as dt, oi as ft, or as pt, p as mt, pa as ht, qi as gt, qn as _t, qt as vt, ra as yt, ri as bt, rn as xt, sa as St, ta as Ct, ti as wt, tn as Tt, tt as Et, u as Dt, ua as Ot, ui as kt, va as At, vi as jt, w as Mt, wa as Nt, xa as D, xi as Pt, xt as Ft, ya as It, yi as Lt, zi as Rt } from "./constants-DZtdGLlr.mjs";
|
|
3
3
|
import { n as zt, t as O } from "./objectSpread2-jlBcdYeb.mjs";
|
|
4
4
|
import { n as k, t as Bt } from "./tw-DmW6-pCY.mjs";
|
|
5
5
|
import { t as Vt } from "./types-Csz3ou4X.mjs";
|
|
@@ -9893,7 +9893,7 @@ var Nf = {
|
|
|
9893
9893
|
super({
|
|
9894
9894
|
config: e,
|
|
9895
9895
|
eventsDispatcher: t
|
|
9896
|
-
}), this.disabled = !1, this.batchingTimeout = null, this.batchingOnChangeQueue = /* @__PURE__ */ new Map(), this.batchTime = 400, this.mutationObserver = new MutationObserver((e) => {
|
|
9896
|
+
}), this.disabled = !1, this.batchingTimeout = null, this.batchingOnChangeQueue = /* @__PURE__ */ new Map(), this.batchTime = 400, this.destroyed = !1, this.mutationObserver = new MutationObserver((e) => {
|
|
9897
9897
|
this.redactorChanged(e);
|
|
9898
9898
|
}), this.eventsDispatcher.on(qt, (e) => {
|
|
9899
9899
|
this.particularBlockChanged(e.event);
|
|
@@ -9915,15 +9915,22 @@ var Nf = {
|
|
|
9915
9915
|
this.mutationObserver.disconnect(), this.disabled = !0;
|
|
9916
9916
|
}
|
|
9917
9917
|
particularBlockChanged(e) {
|
|
9918
|
-
this.disabled || !D(this.config.onChange) || (this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`, e), this.batchingTimeout && clearTimeout(this.batchingTimeout), this.batchingTimeout = setTimeout(() => {
|
|
9918
|
+
this.disabled || !D(this.config.onChange) && !D(this.config.onSave) || (this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`, e), this.batchingTimeout && clearTimeout(this.batchingTimeout), this.batchingTimeout = setTimeout(() => {
|
|
9919
9919
|
let e = Array.from(this.batchingOnChangeQueue.values());
|
|
9920
9920
|
if (e.length === 0) return;
|
|
9921
9921
|
let t = e.length === 1 ? e[0] : e;
|
|
9922
|
-
this.config.onChange && this.config.onChange(this.Blok.API.methods, t), this.batchingOnChangeQueue.clear();
|
|
9922
|
+
D(this.config.onChange) && this.config.onChange(this.Blok.API.methods, t), D(this.config.onSave) && this.emitOnSave(), this.batchingOnChangeQueue.clear();
|
|
9923
9923
|
}, this.batchTime));
|
|
9924
9924
|
}
|
|
9925
|
+
emitOnSave() {
|
|
9926
|
+
this.Blok.Saver.save().then((e) => {
|
|
9927
|
+
if (this.destroyed || e === void 0) return;
|
|
9928
|
+
let { onSave: t } = this.config;
|
|
9929
|
+
D(t) && t(e, this.Blok.API.methods);
|
|
9930
|
+
}).catch(() => {});
|
|
9931
|
+
}
|
|
9925
9932
|
destroy() {
|
|
9926
|
-
this.disabled = !0, this.mutationObserver.disconnect(), this.batchingTimeout !== null && (clearTimeout(this.batchingTimeout), this.batchingTimeout = null), this.batchingOnChangeQueue.clear();
|
|
9933
|
+
this.disabled = !0, this.destroyed = !0, this.mutationObserver.disconnect(), this.batchingTimeout !== null && (clearTimeout(this.batchingTimeout), this.batchingTimeout = null), this.batchingOnChangeQueue.clear();
|
|
9927
9934
|
}
|
|
9928
9935
|
redactorChanged(e) {
|
|
9929
9936
|
this.eventsDispatcher.emit(tn, { mutations: e });
|