@pie-element/rubric 8.1.2-next.8 → 8.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, B as a, C as o, Ct as s, D as c, E as l, F as u, G as d, H as f, I as p, J as m, K as h, L as g, M as _, N as v, O as y, P as b, Q as x, R as S, S as C, St as ee, T as te, Tt as w, U as ne, V as re, W as ie, X as ae, Y as oe, Z as se, _ as ce, _t as le, a as ue, at as de, b as fe, bt as pe, c as me, ct as he, d as ge, dt as _e, et as ve, ft as T, g as ye, gt as be, h as xe, ht as Se, i as Ce, it as we, j as Te, k as Ee, l as De, lt as Oe, m as ke, mt as Ae, n as je, nt as Me, o as Ne, ot as Pe, p as Fe, pt as E, q as Ie, r as Le, rt as Re, s as ze, st as Be, t as Ve, tt as D, u as He, ut as Ue, v as We, vt as Ge, w as Ke, wt as qe, x as Je, xt as Ye, y as Xe, yt as Ze, z as Qe } from "../dist-DHt-8m4G.js";
2
+ import { $ as r, A as i, B as a, C as o, Ct as s, D as c, E as l, F as u, G as d, H as f, I as p, J as m, K as h, L as g, M as _, N as v, O as y, P as b, Q as x, R as S, S as C, St as ee, T as te, Tt as w, U as ne, V as re, W as ie, X as ae, Y as oe, Z as se, _ as ce, _t as le, a as ue, at as de, b as fe, bt as pe, c as me, ct as he, d as ge, dt as _e, et as ve, ft as T, g as ye, gt as be, h as xe, ht as Se, i as Ce, it as we, j as Te, k as Ee, l as De, lt as Oe, m as ke, mt as Ae, n as je, nt as Me, o as Ne, ot as Pe, p as Fe, pt as E, q as Ie, r as Le, rt as Re, s as ze, st as Be, t as Ve, tt as D, u as He, ut as Ue, v as We, vt as Ge, w as Ke, wt as qe, x as Je, xt as Ye, y as Xe, yt as Ze, z as Qe } from "../dist-DxOJn-ON.js";
3
3
  import { a as $e, c as et, d as tt, f as nt, i as rt, l as it, n as at, o as ot, p as st, r as ct, s as lt, t as ut, u as dt } from "../dist-B8zq6W6A.js";
4
4
  import * as O from "react";
5
5
  import k, { Component as ft, createContext as pt, createElement as mt, createRef as ht, forwardRef as gt, memo as _t, useCallback as vt, useContext as yt, useDebugValue as bt, useEffect as xt, useLayoutEffect as St, useMemo as Ct, useRef as A, useState as wt, version as Tt } from "react";
@@ -44701,34 +44701,55 @@ var u4 = QT.create({
44701
44701
  },
44702
44702
  addNodeView() {
44703
44703
  if (!this.options.resize || !this.options.resize.enabled || typeof document > "u") return null;
44704
- let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
44705
- return ({ node: i, getPos: a, HTMLAttributes: o, editor: s }) => {
44706
- let c = document.createElement("img");
44707
- Object.entries(o).forEach(([e, t]) => {
44704
+ let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize, i = /* @__PURE__ */ new Set([
44705
+ "src",
44706
+ "width",
44707
+ "height"
44708
+ ]);
44709
+ return ({ node: a, getPos: o, HTMLAttributes: s, editor: c }) => {
44710
+ let l = document.createElement("img");
44711
+ l.draggable = !1;
44712
+ let u = Bw(this.options.HTMLAttributes, s);
44713
+ Object.entries(u).forEach(([e, t]) => {
44708
44714
  if (t != null) switch (e) {
44715
+ case "src":
44709
44716
  case "width":
44710
44717
  case "height": break;
44711
- default:
44712
- c.setAttribute(e, t);
44713
- break;
44718
+ default: l.setAttribute(e, t);
44714
44719
  }
44715
- }), c.src = o.src;
44716
- let l = new TE({
44717
- element: c,
44718
- editor: s,
44719
- node: i,
44720
- getPos: a,
44720
+ }), u.src !== null && (l.src = u.src);
44721
+ let d = { ...s }, f = (e) => {
44722
+ if (typeof e == "string" && e !== "") {
44723
+ l.getAttribute("src") !== e && (l.src = e);
44724
+ return;
44725
+ }
44726
+ l.hasAttribute("src") && l.removeAttribute("src"), l.src !== "" && (l.src = "");
44727
+ };
44728
+ f(s.src);
44729
+ let p = new TE({
44730
+ element: l,
44731
+ editor: c,
44732
+ node: a,
44733
+ getPos: o,
44721
44734
  onResize: (e, t) => {
44722
- c.style.width = `${e}px`, c.style.height = `${t}px`;
44735
+ l.style.width = `${e}px`, l.style.height = `${t}px`;
44723
44736
  },
44724
44737
  onCommit: (e, t) => {
44725
- let n = a();
44738
+ let n = o();
44726
44739
  n !== void 0 && this.editor.chain().setNodeSelection(n).updateAttributes(this.name, {
44727
44740
  width: e,
44728
44741
  height: t
44729
44742
  }).run();
44730
44743
  },
44731
- onUpdate: (e, t, n) => e.type === i.type,
44744
+ onUpdate: (e) => {
44745
+ if (e.type !== a.type) return !1;
44746
+ let t = Vw(e, c.extensionManager.attributes.filter((t) => t.type === e.type.name));
44747
+ return Object.keys(d).forEach((e) => {
44748
+ !i.has(e) && !(e in t) && l.removeAttribute(e);
44749
+ }), Object.entries(t).forEach(([e, t]) => {
44750
+ i.has(e) || (t == null ? l.removeAttribute(e) : l.setAttribute(e, t));
44751
+ }), f(t.src), d = t, !0;
44752
+ },
44732
44753
  options: {
44733
44754
  directions: e,
44734
44755
  min: {
@@ -44737,10 +44758,10 @@ var u4 = QT.create({
44737
44758
  },
44738
44759
  preserveAspectRatio: r === !0
44739
44760
  }
44740
- }), u = l.dom;
44741
- return u.style.visibility = "hidden", u.style.pointerEvents = "none", c.onload = () => {
44742
- u.style.visibility = "", u.style.pointerEvents = "";
44743
- }, l;
44761
+ }), m = p.dom, h = () => {
44762
+ m.style.visibility = "", m.style.pointerEvents = "";
44763
+ };
44764
+ return m.style.visibility = "hidden", m.style.pointerEvents = "none", l.complete && l.naturalWidth > 0 ? h() : (l.onload = h, l.onerror = h), p;
44744
44765
  };
44745
44766
  },
44746
44767
  addCommands() {