@pie-element/ebsr 14.2.2-next.8 → 14.2.2-next.9

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,4 +1,4 @@
1
- import { $ as e, A as t, At as n, B as r, Bt as i, C as a, Ct as o, D as s, Dt as c, Et as l, F as u, Ft as d, G as f, H as p, Ht as m, I as h, It as g, J as _, K as v, L as y, Lt as b, M as x, Mt as S, Nt as C, O as w, Ot as ee, P as T, Pt as te, Q as E, R as ne, Rt as D, S as O, St as k, T as re, Tt as ie, U as ae, Ut as oe, V as se, Vt as ce, W as A, X as le, Y as ue, Z as de, a as fe, at as pe, b as me, bt as he, c as ge, ct as _e, d as ve, dt as ye, et as be, f as xe, ft as Se, gt as Ce, ht as we, i as Te, it as Ee, j as De, jt as j, k as Oe, kt as ke, l as Ae, lt as je, m as Me, mt as Ne, nt as Pe, o as Fe, ot as Ie, p as Le, pt as Re, q as ze, r as Be, rt as Ve, s as He, st as Ue, t as We, tt as Ge, u as Ke, ut as qe, w as Je, wt as Ye, x as Xe, xt as M, y as Ze, z as Qe, zt as $e } from "../private-tags-DgZL9Tec.js";
1
+ import { $ as e, A as t, At as n, B as r, Bt as i, C as a, Ct as o, D as s, Dt as c, Et as l, F as u, Ft as d, G as f, H as p, Ht as m, I as h, It as g, J as _, K as v, L as y, Lt as b, M as x, Mt as S, Nt as C, O as w, Ot as ee, P as T, Pt as te, Q as E, R as ne, Rt as D, S as O, St as k, T as re, Tt as ie, U as ae, Ut as oe, V as se, Vt as ce, W as A, X as le, Y as ue, Z as de, a as fe, at as pe, b as me, bt as he, c as ge, ct as _e, d as ve, dt as ye, et as be, f as xe, ft as Se, gt as Ce, ht as we, i as Te, it as Ee, j as De, jt as j, k as Oe, kt as ke, l as Ae, lt as je, m as Me, mt as Ne, nt as Pe, o as Fe, ot as Ie, p as Le, pt as Re, q as ze, r as Be, rt as Ve, s as He, st as Ue, t as We, tt as Ge, u as Ke, ut as qe, w as Je, wt as Ye, x as Xe, xt as M, y as Ze, z as Qe, zt as $e } from "../private-tags-DYR4StTM.js";
2
2
  import { a as et, c as tt, d as nt, f as rt, h as it, i as at, l as ot, m as st, n as ct, o as lt, p as ut, r as dt, s as ft, t as pt, u as mt } from "../dist-CHbLnyuX.js";
3
3
  import * as N from "react";
4
4
  import ht, { Component as gt, createContext as _t, createElement as vt, createRef as yt, forwardRef as bt, memo as xt, useCallback as St, useContext as Ct, useDebugValue as wt, useEffect as Tt, useLayoutEffect as Et, useMemo as Dt, useRef as Ot, useState as kt, version as At } from "react";
@@ -39342,34 +39342,55 @@ var Uq = Vm.create({
39342
39342
  },
39343
39343
  addNodeView() {
39344
39344
  if (!this.options.resize || !this.options.resize.enabled || typeof document > "u") return null;
39345
- let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
39346
- return ({ node: i, getPos: a, HTMLAttributes: o, editor: s }) => {
39347
- let c = document.createElement("img");
39348
- Object.entries(o).forEach(([e, t]) => {
39345
+ let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize, i = /* @__PURE__ */ new Set([
39346
+ "src",
39347
+ "width",
39348
+ "height"
39349
+ ]);
39350
+ return ({ node: a, getPos: o, HTMLAttributes: s, editor: c }) => {
39351
+ let l = document.createElement("img");
39352
+ l.draggable = !1;
39353
+ let u = kp(this.options.HTMLAttributes, s);
39354
+ Object.entries(u).forEach(([e, t]) => {
39349
39355
  if (t != null) switch (e) {
39356
+ case "src":
39350
39357
  case "width":
39351
39358
  case "height": break;
39352
- default:
39353
- c.setAttribute(e, t);
39354
- break;
39359
+ default: l.setAttribute(e, t);
39355
39360
  }
39356
- }), c.src = o.src;
39357
- let l = new mh({
39358
- element: c,
39359
- editor: s,
39360
- node: i,
39361
- getPos: a,
39361
+ }), u.src !== null && (l.src = u.src);
39362
+ let d = { ...s }, f = (e) => {
39363
+ if (typeof e == "string" && e !== "") {
39364
+ l.getAttribute("src") !== e && (l.src = e);
39365
+ return;
39366
+ }
39367
+ l.hasAttribute("src") && l.removeAttribute("src"), l.src !== "" && (l.src = "");
39368
+ };
39369
+ f(s.src);
39370
+ let p = new mh({
39371
+ element: l,
39372
+ editor: c,
39373
+ node: a,
39374
+ getPos: o,
39362
39375
  onResize: (e, t) => {
39363
- c.style.width = `${e}px`, c.style.height = `${t}px`;
39376
+ l.style.width = `${e}px`, l.style.height = `${t}px`;
39364
39377
  },
39365
39378
  onCommit: (e, t) => {
39366
- let n = a();
39379
+ let n = o();
39367
39380
  n !== void 0 && this.editor.chain().setNodeSelection(n).updateAttributes(this.name, {
39368
39381
  width: e,
39369
39382
  height: t
39370
39383
  }).run();
39371
39384
  },
39372
- onUpdate: (e, t, n) => e.type === i.type,
39385
+ onUpdate: (e) => {
39386
+ if (e.type !== a.type) return !1;
39387
+ let t = Ap(e, c.extensionManager.attributes.filter((t) => t.type === e.type.name));
39388
+ return Object.keys(d).forEach((e) => {
39389
+ !i.has(e) && !(e in t) && l.removeAttribute(e);
39390
+ }), Object.entries(t).forEach(([e, t]) => {
39391
+ i.has(e) || (t == null ? l.removeAttribute(e) : l.setAttribute(e, t));
39392
+ }), f(t.src), d = t, !0;
39393
+ },
39373
39394
  options: {
39374
39395
  directions: e,
39375
39396
  min: {
@@ -39378,10 +39399,10 @@ var Uq = Vm.create({
39378
39399
  },
39379
39400
  preserveAspectRatio: r === !0
39380
39401
  }
39381
- }), u = l.dom;
39382
- return u.style.visibility = "hidden", u.style.pointerEvents = "none", c.onload = () => {
39383
- u.style.visibility = "", u.style.pointerEvents = "";
39384
- }, l;
39402
+ }), m = p.dom, h = () => {
39403
+ m.style.visibility = "", m.style.pointerEvents = "";
39404
+ };
39405
+ return m.style.visibility = "hidden", m.style.pointerEvents = "none", l.complete && l.naturalWidth > 0 ? h() : (l.onload = h, l.onerror = h), p;
39385
39406
  };
39386
39407
  },
39387
39408
  addCommands() {