@pie-element/passage 7.1.2-next.8 → 7.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, Et as u, F as d, G as f, H as p, I as m, J as h, K as g, L as _, M as v, N as y, O as b, P as x, Q as S, R as C, S as w, St as T, T as E, Tt as ee, U as te, V as ne, W as re, X as D, Y as ie, Z as O, _ as ae, _t as oe, at as se, bt as ce, c as le, ct as k, d as ue, dt as de, et as fe, f as pe, ft as me, g as he, gt 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, ot as Oe, p as ke, pt as Ae, q as je, r as Me, rt as Ne, st as Pe, t as Fe, tt as Ie, u as Le, ut as Re, v as ze, vt as Be, w as Ve, wt as He, x as Ue, xt as We, y as Ge, yt as Ke, z as qe } from "../dist-CufhtHcn.js";
2
+ import { $ as r, A as i, B as a, C as o, Ct as s, D as c, E as l, Et as u, F as d, G as f, H as p, I as m, J as h, K as g, L as _, M as v, N as y, O as b, P as x, Q as S, R as C, S as w, St as T, T as E, Tt as ee, U as te, V as ne, W as re, X as D, Y as ie, Z as O, _ as ae, _t as oe, at as se, bt as ce, c as le, ct as k, d as ue, dt as de, et as fe, f as pe, ft as me, g as he, gt 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, ot as Oe, p as ke, pt as Ae, q as je, r as Me, rt as Ne, st as Pe, t as Fe, tt as Ie, u as Le, ut as Re, v as ze, vt as Be, w as Ve, wt as He, x as Ue, xt as We, y as Ge, yt as Ke, z as qe } from "../dist-CxgsQCZ6.js";
3
3
  import { a as Je, c as Ye, d as Xe, i as Ze, l as Qe, n as $e, o as et, r as tt, s as nt, t as rt, u as it } from "../dist-CiWlBjsz.js";
4
4
  import * as A from "react";
5
5
  import at, { Component as ot, createContext as st, createElement as ct, createRef as lt, forwardRef as ut, memo as dt, useCallback as ft, useContext as pt, useDebugValue as mt, useEffect as ht, useLayoutEffect as gt, useMemo as _t, useRef as vt, useState as yt, version as bt } from "react";
@@ -39657,34 +39657,55 @@ var _J = Ib.create({
39657
39657
  },
39658
39658
  addNodeView() {
39659
39659
  if (!this.options.resize || !this.options.resize.enabled || typeof document > "u") return null;
39660
- let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
39661
- return ({ node: i, getPos: a, HTMLAttributes: o, editor: s }) => {
39662
- let c = document.createElement("img");
39663
- Object.entries(o).forEach(([e, t]) => {
39660
+ let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize, i = /* @__PURE__ */ new Set([
39661
+ "src",
39662
+ "width",
39663
+ "height"
39664
+ ]);
39665
+ return ({ node: a, getPos: o, HTMLAttributes: s, editor: c }) => {
39666
+ let l = document.createElement("img");
39667
+ l.draggable = !1;
39668
+ let u = wy(this.options.HTMLAttributes, s);
39669
+ Object.entries(u).forEach(([e, t]) => {
39664
39670
  if (t != null) switch (e) {
39671
+ case "src":
39665
39672
  case "width":
39666
39673
  case "height": break;
39667
- default:
39668
- c.setAttribute(e, t);
39669
- break;
39674
+ default: l.setAttribute(e, t);
39670
39675
  }
39671
- }), c.src = o.src;
39672
- let l = new lx({
39673
- element: c,
39674
- editor: s,
39675
- node: i,
39676
- getPos: a,
39676
+ }), u.src !== null && (l.src = u.src);
39677
+ let d = { ...s }, f = (e) => {
39678
+ if (typeof e == "string" && e !== "") {
39679
+ l.getAttribute("src") !== e && (l.src = e);
39680
+ return;
39681
+ }
39682
+ l.hasAttribute("src") && l.removeAttribute("src"), l.src !== "" && (l.src = "");
39683
+ };
39684
+ f(s.src);
39685
+ let p = new lx({
39686
+ element: l,
39687
+ editor: c,
39688
+ node: a,
39689
+ getPos: o,
39677
39690
  onResize: (e, t) => {
39678
- c.style.width = `${e}px`, c.style.height = `${t}px`;
39691
+ l.style.width = `${e}px`, l.style.height = `${t}px`;
39679
39692
  },
39680
39693
  onCommit: (e, t) => {
39681
- let n = a();
39694
+ let n = o();
39682
39695
  n !== void 0 && this.editor.chain().setNodeSelection(n).updateAttributes(this.name, {
39683
39696
  width: e,
39684
39697
  height: t
39685
39698
  }).run();
39686
39699
  },
39687
- onUpdate: (e, t, n) => e.type === i.type,
39700
+ onUpdate: (e) => {
39701
+ if (e.type !== a.type) return !1;
39702
+ let t = Ty(e, c.extensionManager.attributes.filter((t) => t.type === e.type.name));
39703
+ return Object.keys(d).forEach((e) => {
39704
+ !i.has(e) && !(e in t) && l.removeAttribute(e);
39705
+ }), Object.entries(t).forEach(([e, t]) => {
39706
+ i.has(e) || (t == null ? l.removeAttribute(e) : l.setAttribute(e, t));
39707
+ }), f(t.src), d = t, !0;
39708
+ },
39688
39709
  options: {
39689
39710
  directions: e,
39690
39711
  min: {
@@ -39693,10 +39714,10 @@ var _J = Ib.create({
39693
39714
  },
39694
39715
  preserveAspectRatio: r === !0
39695
39716
  }
39696
- }), u = l.dom;
39697
- return u.style.visibility = "hidden", u.style.pointerEvents = "none", c.onload = () => {
39698
- u.style.visibility = "", u.style.pointerEvents = "";
39699
- }, l;
39717
+ }), m = p.dom, h = () => {
39718
+ m.style.visibility = "", m.style.pointerEvents = "";
39719
+ };
39720
+ return m.style.visibility = "hidden", m.style.pointerEvents = "none", l.complete && l.naturalWidth > 0 ? h() : (l.onload = h, l.onerror = h), p;
39700
39721
  };
39701
39722
  },
39702
39723
  addCommands() {