@pie-element/matrix 4.1.2-next.8 → 4.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,5 +1,5 @@
1
1
  import { i as e, r as t, t as n } from "../rolldown-runtime-CWhphoD1.js";
2
- import { $ as r, A as i, At as a, B as o, C as s, Ct as c, D as l, Dt as u, E as d, Et as f, F as p, G as m, H as h, I as g, J as _, K as v, L as y, M as b, N as x, O as S, Ot as C, P as w, Q as ee, R as te, S as ne, St as T, Tt as re, U as ie, V as E, W as ae, X as oe, Y as se, Z as ce, _ as le, _t as ue, a as de, at as fe, b as pe, bt as me, c as he, ct as ge, dt as _e, et as ve, f as ye, ft as be, g as xe, gt as Se, h as Ce, ht as we, i as Te, it as D, j as Ee, k as De, kt as Oe, l as O, lt as ke, m as Ae, mt as k, n as je, nt as Me, o as Ne, ot as Pe, p as Fe, pt as Ie, q as Le, r as Re, rt as ze, s as Be, st as Ve, t as He, tt as Ue, u as We, ut as Ge, v as Ke, vt as qe, w as Je, wt as Ye, x as Xe, xt as Ze, yt as Qe, z as $e } from "../Radio-DOR4NyIK.js";
2
+ import { $ as r, A as i, At as a, B as o, C as s, Ct as c, D as l, Dt as u, E as d, Et as f, F as p, G as m, H as h, I as g, J as _, K as v, L as y, M as b, N as x, O as S, Ot as C, P as w, Q as ee, R as te, S as ne, St as T, Tt as re, U as ie, V as E, W as ae, X as oe, Y as se, Z as ce, _ as le, _t as ue, a as de, at as fe, b as pe, bt as me, c as he, ct as ge, dt as _e, et as ve, f as ye, ft as be, g as xe, gt as Se, h as Ce, ht as we, i as Te, it as D, j as Ee, k as De, kt as Oe, l as O, lt as ke, m as Ae, mt as k, n as je, nt as Me, o as Ne, ot as Pe, p as Fe, pt as Ie, q as Le, r as Re, rt as ze, s as Be, st as Ve, t as He, tt as Ue, u as We, ut as Ge, v as Ke, vt as qe, w as Je, wt as Ye, x as Xe, xt as Ze, yt as Qe, z as $e } from "../Radio-C7WmM7gR.js";
3
3
  import { a as et, c as tt, d as nt, f as rt, i as it, l as at, n as ot, o as st, r as ct, s as lt, t as ut, u as dt } from "../dist-Do2L8-B6.js";
4
4
  import * as A from "react";
5
5
  import ft, { Component as pt, createContext as mt, createElement as ht, createRef as gt, forwardRef as _t, memo as vt, useCallback as yt, useContext as bt, useDebugValue as xt, useEffect as St, useLayoutEffect as Ct, useMemo as wt, useRef as Tt, useState as Et, version as Dt } from "react";
@@ -39543,34 +39543,55 @@ var Gq = Bm.create({
39543
39543
  },
39544
39544
  addNodeView() {
39545
39545
  if (!this.options.resize || !this.options.resize.enabled || typeof document > "u") return null;
39546
- let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
39547
- return ({ node: i, getPos: a, HTMLAttributes: o, editor: s }) => {
39548
- let c = document.createElement("img");
39549
- Object.entries(o).forEach(([e, t]) => {
39546
+ let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize, i = /* @__PURE__ */ new Set([
39547
+ "src",
39548
+ "width",
39549
+ "height"
39550
+ ]);
39551
+ return ({ node: a, getPos: o, HTMLAttributes: s, editor: c }) => {
39552
+ let l = document.createElement("img");
39553
+ l.draggable = !1;
39554
+ let u = Op(this.options.HTMLAttributes, s);
39555
+ Object.entries(u).forEach(([e, t]) => {
39550
39556
  if (t != null) switch (e) {
39557
+ case "src":
39551
39558
  case "width":
39552
39559
  case "height": break;
39553
- default:
39554
- c.setAttribute(e, t);
39555
- break;
39560
+ default: l.setAttribute(e, t);
39556
39561
  }
39557
- }), c.src = o.src;
39558
- let l = new ph({
39559
- element: c,
39560
- editor: s,
39561
- node: i,
39562
- getPos: a,
39562
+ }), u.src !== null && (l.src = u.src);
39563
+ let d = { ...s }, f = (e) => {
39564
+ if (typeof e == "string" && e !== "") {
39565
+ l.getAttribute("src") !== e && (l.src = e);
39566
+ return;
39567
+ }
39568
+ l.hasAttribute("src") && l.removeAttribute("src"), l.src !== "" && (l.src = "");
39569
+ };
39570
+ f(s.src);
39571
+ let p = new ph({
39572
+ element: l,
39573
+ editor: c,
39574
+ node: a,
39575
+ getPos: o,
39563
39576
  onResize: (e, t) => {
39564
- c.style.width = `${e}px`, c.style.height = `${t}px`;
39577
+ l.style.width = `${e}px`, l.style.height = `${t}px`;
39565
39578
  },
39566
39579
  onCommit: (e, t) => {
39567
- let n = a();
39580
+ let n = o();
39568
39581
  n !== void 0 && this.editor.chain().setNodeSelection(n).updateAttributes(this.name, {
39569
39582
  width: e,
39570
39583
  height: t
39571
39584
  }).run();
39572
39585
  },
39573
- onUpdate: (e, t, n) => e.type === i.type,
39586
+ onUpdate: (e) => {
39587
+ if (e.type !== a.type) return !1;
39588
+ let t = kp(e, c.extensionManager.attributes.filter((t) => t.type === e.type.name));
39589
+ return Object.keys(d).forEach((e) => {
39590
+ !i.has(e) && !(e in t) && l.removeAttribute(e);
39591
+ }), Object.entries(t).forEach(([e, t]) => {
39592
+ i.has(e) || (t == null ? l.removeAttribute(e) : l.setAttribute(e, t));
39593
+ }), f(t.src), d = t, !0;
39594
+ },
39574
39595
  options: {
39575
39596
  directions: e,
39576
39597
  min: {
@@ -39579,10 +39600,10 @@ var Gq = Bm.create({
39579
39600
  },
39580
39601
  preserveAspectRatio: r === !0
39581
39602
  }
39582
- }), u = l.dom;
39583
- return u.style.visibility = "hidden", u.style.pointerEvents = "none", c.onload = () => {
39584
- u.style.visibility = "", u.style.pointerEvents = "";
39585
- }, l;
39603
+ }), m = p.dom, h = () => {
39604
+ m.style.visibility = "", m.style.pointerEvents = "";
39605
+ };
39606
+ return m.style.visibility = "hidden", m.style.pointerEvents = "none", l.complete && l.naturalWidth > 0 ? h() : (l.onload = h, l.onerror = h), p;
39586
39607
  };
39587
39608
  },
39588
39609
  addCommands() {