@pie-element/fraction-model 6.1.2-next.8 → 6.1.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, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as ee, Y as te, Z as ne, _ as re, _t as ie, a as ae, at as w, b as oe, bt as se, c as ce, ct as le, d as ue, dt as de, et as T, f as fe, ft as pe, g as me, gt as he, h as ge, ht as _e, i as ve, it as ye, j as be, k as xe, l as Se, lt as Ce, m as we, mt as Te, n as Ee, nt as De, o as Oe, ot as ke, p as Ae, pt as je, q as Me, r as Ne, rt as Pe, s as Fe, st as Ie, tt as Le, u as E, ut as Re, v as ze, vt as Be, w as Ve, x as He, y as Ue, yt as We, z as Ge } from "../delivery-Dno334Uk.js";
1
+ import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as ee, Y as te, Z as ne, _ as re, _t as ie, a as ae, at as w, b as oe, bt as se, c as ce, ct as le, d as ue, dt as de, et as T, f as fe, ft as pe, g as me, gt as he, h as ge, ht as _e, i as ve, it as ye, j as be, k as xe, l as Se, lt as Ce, m as we, mt as Te, n as Ee, nt as De, o as Oe, ot as ke, p as Ae, pt as je, q as Me, r as Ne, rt as Pe, s as Fe, st as Ie, tt as Le, u as E, ut as Re, v as ze, vt as Be, w as Ve, x as He, y as Ue, yt as We, z as Ge } from "../delivery-C4VfEPIn.js";
2
2
  import { a as Ke, c as qe, d as Je, i as Ye, l as Xe, n as Ze, o as Qe, r as $e, s as et, t as tt, u as nt } from "../dist-ClmZaEGT.js";
3
3
  import * as D from "react";
4
4
  import O, { Component as rt, createContext as it, createElement as at, createRef as ot, forwardRef as st, memo as ct, useCallback as lt, useContext as ut, useDebugValue as dt, useEffect as ft, useLayoutEffect as pt, useMemo as mt, useRef as ht, useState as gt, version as _t } from "react";
@@ -37872,34 +37872,55 @@ var aK = Ov.create({
37872
37872
  },
37873
37873
  addNodeView() {
37874
37874
  if (!this.options.resize || !this.options.resize.enabled || typeof document > "u") return null;
37875
- let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
37876
- return ({ node: i, getPos: a, HTMLAttributes: o, editor: s }) => {
37877
- let c = document.createElement("img");
37878
- Object.entries(o).forEach(([e, t]) => {
37875
+ let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize, i = /* @__PURE__ */ new Set([
37876
+ "src",
37877
+ "width",
37878
+ "height"
37879
+ ]);
37880
+ return ({ node: a, getPos: o, HTMLAttributes: s, editor: c }) => {
37881
+ let l = document.createElement("img");
37882
+ l.draggable = !1;
37883
+ let u = g_(this.options.HTMLAttributes, s);
37884
+ Object.entries(u).forEach(([e, t]) => {
37879
37885
  if (t != null) switch (e) {
37886
+ case "src":
37880
37887
  case "width":
37881
37888
  case "height": break;
37882
- default:
37883
- c.setAttribute(e, t);
37884
- break;
37889
+ default: l.setAttribute(e, t);
37885
37890
  }
37886
- }), c.src = o.src;
37887
- let l = new ty({
37888
- element: c,
37889
- editor: s,
37890
- node: i,
37891
- getPos: a,
37891
+ }), u.src !== null && (l.src = u.src);
37892
+ let d = { ...s }, f = (e) => {
37893
+ if (typeof e == "string" && e !== "") {
37894
+ l.getAttribute("src") !== e && (l.src = e);
37895
+ return;
37896
+ }
37897
+ l.hasAttribute("src") && l.removeAttribute("src"), l.src !== "" && (l.src = "");
37898
+ };
37899
+ f(s.src);
37900
+ let p = new ty({
37901
+ element: l,
37902
+ editor: c,
37903
+ node: a,
37904
+ getPos: o,
37892
37905
  onResize: (e, t) => {
37893
- c.style.width = `${e}px`, c.style.height = `${t}px`;
37906
+ l.style.width = `${e}px`, l.style.height = `${t}px`;
37894
37907
  },
37895
37908
  onCommit: (e, t) => {
37896
- let n = a();
37909
+ let n = o();
37897
37910
  n !== void 0 && this.editor.chain().setNodeSelection(n).updateAttributes(this.name, {
37898
37911
  width: e,
37899
37912
  height: t
37900
37913
  }).run();
37901
37914
  },
37902
- onUpdate: (e, t, n) => e.type === i.type,
37915
+ onUpdate: (e) => {
37916
+ if (e.type !== a.type) return !1;
37917
+ let t = __(e, c.extensionManager.attributes.filter((t) => t.type === e.type.name));
37918
+ return Object.keys(d).forEach((e) => {
37919
+ !i.has(e) && !(e in t) && l.removeAttribute(e);
37920
+ }), Object.entries(t).forEach(([e, t]) => {
37921
+ i.has(e) || (t == null ? l.removeAttribute(e) : l.setAttribute(e, t));
37922
+ }), f(t.src), d = t, !0;
37923
+ },
37903
37924
  options: {
37904
37925
  directions: e,
37905
37926
  min: {
@@ -37908,10 +37929,10 @@ var aK = Ov.create({
37908
37929
  },
37909
37930
  preserveAspectRatio: r === !0
37910
37931
  }
37911
- }), u = l.dom;
37912
- return u.style.visibility = "hidden", u.style.pointerEvents = "none", c.onload = () => {
37913
- u.style.visibility = "", u.style.pointerEvents = "";
37914
- }, l;
37932
+ }), m = p.dom, h = () => {
37933
+ m.style.visibility = "", m.style.pointerEvents = "";
37934
+ };
37935
+ return m.style.visibility = "hidden", m.style.pointerEvents = "none", l.complete && l.naturalWidth > 0 ? h() : (l.onload = h, l.onerror = h), p;
37915
37936
  };
37916
37937
  },
37917
37938
  addCommands() {