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