@pie-element/match 12.1.2-next.8 → 12.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 { a as e, i as t, n, t as r } from "../browser-kkT1XVKw.js";
2
- import { $ as i, A as a, At as o, B as s, C as c, Ct as l, D as u, Dt as d, E as f, Et as p, F as m, G as h, H as g, I as _, J as v, K as y, L as b, M as x, Mt as S, N as C, Nt as w, Ot as ee, P as T, Q as te, R as E, S as ne, St as re, T as ie, Tt as D, U as ae, V as oe, W as se, X as ce, Y as le, Z as ue, _ as de, _t as fe, a as pe, at as me, b as he, bt as ge, c as _e, ct as ve, et as ye, ft as O, g as be, gt as xe, h as Se, ht as k, i as Ce, it as we, j as Te, jt as Ee, k as De, kt as A, l as Oe, lt as ke, m as Ae, mt as je, n as Me, nt as Ne, o as Pe, ot as Fe, q as Ie, r as Le, rt as Re, s as ze, st as Be, t as Ve, tt as He, ut as Ue, v as We, vt as Ge, w as Ke, wt as qe, xt as Je, y as Ye, yt as Xe, z as j } from "../Typography-BvyMwfyW.js";
2
+ import { $ as i, A as a, At as o, B as s, C as c, Ct as l, D as u, Dt as d, E as f, Et as p, F as m, G as h, H as g, I as _, J as v, K as y, L as b, M as x, Mt as S, N as C, Nt as w, Ot as ee, P as T, Q as te, R as E, S as ne, St as re, T as ie, Tt as D, U as ae, V as oe, W as se, X as ce, Y as le, Z as ue, _ as de, _t as fe, a as pe, at as me, b as he, bt as ge, c as _e, ct as ve, et as ye, ft as O, g as be, gt as xe, h as Se, ht as k, i as Ce, it as we, j as Te, jt as Ee, k as De, kt as A, l as Oe, lt as ke, m as Ae, mt as je, n as Me, nt as Ne, o as Pe, ot as Fe, q as Ie, r as Le, rt as Re, s as ze, st as Be, t as Ve, tt as He, ut as Ue, v as We, vt as Ge, w as Ke, wt as qe, xt as Je, y as Ye, yt as Xe, z as j } from "../Typography-DS6VD63M.js";
3
3
  import { a as Ze, c as Qe, d as $e, f as et, i as tt, l as nt, n as rt, o as it, p as at, r as ot, s as st, t as ct, u as lt } from "../dist-C4gh2n2Z.js";
4
4
  import * as M from "react";
5
5
  import N, { Component as ut, createContext as dt, createElement as ft, createRef as pt, forwardRef as mt, memo as ht, useCallback as gt, useContext as _t, useDebugValue as vt, useEffect as P, useLayoutEffect as yt, useMemo as bt, useReducer as xt, useRef as St, useState as Ct, version as wt } from "react";
@@ -41711,34 +41711,55 @@ var uX = ox.create({
41711
41711
  },
41712
41712
  addNodeView() {
41713
41713
  if (!this.options.resize || !this.options.resize.enabled || typeof document > "u") return null;
41714
- let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
41715
- return ({ node: i, getPos: a, HTMLAttributes: o, editor: s }) => {
41716
- let c = document.createElement("img");
41717
- Object.entries(o).forEach(([e, t]) => {
41714
+ let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize, i = /* @__PURE__ */ new Set([
41715
+ "src",
41716
+ "width",
41717
+ "height"
41718
+ ]);
41719
+ return ({ node: a, getPos: o, HTMLAttributes: s, editor: c }) => {
41720
+ let l = document.createElement("img");
41721
+ l.draggable = !1;
41722
+ let u = Jy(this.options.HTMLAttributes, s);
41723
+ Object.entries(u).forEach(([e, t]) => {
41718
41724
  if (t != null) switch (e) {
41725
+ case "src":
41719
41726
  case "width":
41720
41727
  case "height": break;
41721
- default:
41722
- c.setAttribute(e, t);
41723
- break;
41728
+ default: l.setAttribute(e, t);
41724
41729
  }
41725
- }), c.src = o.src;
41726
- let l = new Nx({
41727
- element: c,
41728
- editor: s,
41729
- node: i,
41730
- getPos: a,
41730
+ }), u.src !== null && (l.src = u.src);
41731
+ let d = { ...s }, f = (e) => {
41732
+ if (typeof e == "string" && e !== "") {
41733
+ l.getAttribute("src") !== e && (l.src = e);
41734
+ return;
41735
+ }
41736
+ l.hasAttribute("src") && l.removeAttribute("src"), l.src !== "" && (l.src = "");
41737
+ };
41738
+ f(s.src);
41739
+ let p = new Nx({
41740
+ element: l,
41741
+ editor: c,
41742
+ node: a,
41743
+ getPos: o,
41731
41744
  onResize: (e, t) => {
41732
- c.style.width = `${e}px`, c.style.height = `${t}px`;
41745
+ l.style.width = `${e}px`, l.style.height = `${t}px`;
41733
41746
  },
41734
41747
  onCommit: (e, t) => {
41735
- let n = a();
41748
+ let n = o();
41736
41749
  n !== void 0 && this.editor.chain().setNodeSelection(n).updateAttributes(this.name, {
41737
41750
  width: e,
41738
41751
  height: t
41739
41752
  }).run();
41740
41753
  },
41741
- onUpdate: (e, t, n) => e.type === i.type,
41754
+ onUpdate: (e) => {
41755
+ if (e.type !== a.type) return !1;
41756
+ let t = Yy(e, c.extensionManager.attributes.filter((t) => t.type === e.type.name));
41757
+ return Object.keys(d).forEach((e) => {
41758
+ !i.has(e) && !(e in t) && l.removeAttribute(e);
41759
+ }), Object.entries(t).forEach(([e, t]) => {
41760
+ i.has(e) || (t == null ? l.removeAttribute(e) : l.setAttribute(e, t));
41761
+ }), f(t.src), d = t, !0;
41762
+ },
41742
41763
  options: {
41743
41764
  directions: e,
41744
41765
  min: {
@@ -41747,10 +41768,10 @@ var uX = ox.create({
41747
41768
  },
41748
41769
  preserveAspectRatio: r === !0
41749
41770
  }
41750
- }), u = l.dom;
41751
- return u.style.visibility = "hidden", u.style.pointerEvents = "none", c.onload = () => {
41752
- u.style.visibility = "", u.style.pointerEvents = "";
41753
- }, l;
41771
+ }), m = p.dom, h = () => {
41772
+ m.style.visibility = "", m.style.pointerEvents = "";
41773
+ };
41774
+ return m.style.visibility = "hidden", m.style.pointerEvents = "none", l.complete && l.naturalWidth > 0 ? h() : (l.onload = h, l.onerror = h), p;
41754
41775
  };
41755
41776
  },
41756
41777
  addCommands() {