@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.
@@ -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-BJ79cqMa.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-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 });