@pie-element/inline-dropdown 10.1.2-next.8 → 10.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, Ft as m, G as h, H as g, I as _, It as v, J as y, K as b, L as x, Lt as S, M as C, Mt as w, N as ee, Nt as T, O as te, Ot as E, P as ne, Pt as re, Q as D, R as O, Rt as ie, St as ae, T as oe, Tt as k, U as se, V as ce, W as le, X as ue, Y as de, Z as fe, _ as pe, _t as me, a as he, at as ge, b as _e, bt as A, c as ve, ct as ye, et as be, ft as xe, g as Se, gt as Ce, h as we, ht as Te, i as Ee, it as De, j as Oe, jt as ke, kt as Ae, l as je, lt as Me, mt as Ne, n as Pe, nt as Fe, ot as Ie, pt as j, 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 M, v as Ge, vt as Ke, w as qe, wt as Je, x as Ye, xt as Xe, y as Ze, yt as Qe, z as $e } from "../Close-_y0oVYUk.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, Ft as m, G as h, H as g, I as _, It as v, J as y, K as b, L as x, Lt as S, M as C, Mt as w, N as ee, Nt as T, O as te, Ot as E, P as ne, Pt as re, Q as D, R as O, Rt as ie, St as ae, T as oe, Tt as k, U as se, V as ce, W as le, X as ue, Y as de, Z as fe, _ as pe, _t as me, a as he, at as ge, b as _e, bt as A, c as ve, ct as ye, et as be, ft as xe, g as Se, gt as Ce, h as we, ht as Te, i as Ee, it as De, j as Oe, jt as ke, kt as Ae, l as je, lt as Me, mt as Ne, n as Pe, nt as Fe, ot as Ie, pt as j, 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 M, v as Ge, vt as Ke, w as qe, wt as Je, x as Ye, xt as Xe, y as Ze, yt as Qe, z as $e } from "../Close-DvuMD5vl.js";
3
3
  import { _ as et, a as tt, c as nt, d as rt, f as it, g as at, h as ot, i as st, m as ct, n as lt, o as ut, p as dt, r as ft, t as pt, u as mt, v as ht, y as gt } from "../dist-BJd6t-uW.js";
4
4
  import * as N from "react";
5
5
  import _t, { Component as vt, createContext as yt, createElement as bt, createRef as xt, forwardRef as St, memo as Ct, useCallback as wt, useContext as Tt, useDebugValue as Et, useEffect as Dt, useLayoutEffect as Ot, useMemo as kt, useRef as At, useState as jt, version as Mt } from "react";
@@ -39313,34 +39313,55 @@ var Bq = ug.create({
39313
39313
  },
39314
39314
  addNodeView() {
39315
39315
  if (!this.options.resize || !this.options.resize.enabled || typeof document > "u") return null;
39316
- let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
39317
- return ({ node: i, getPos: a, HTMLAttributes: o, editor: s }) => {
39318
- let c = document.createElement("img");
39319
- Object.entries(o).forEach(([e, t]) => {
39316
+ let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize, i = /* @__PURE__ */ new Set([
39317
+ "src",
39318
+ "width",
39319
+ "height"
39320
+ ]);
39321
+ return ({ node: a, getPos: o, HTMLAttributes: s, editor: c }) => {
39322
+ let l = document.createElement("img");
39323
+ l.draggable = !1;
39324
+ let u = Qm(this.options.HTMLAttributes, s);
39325
+ Object.entries(u).forEach(([e, t]) => {
39320
39326
  if (t != null) switch (e) {
39327
+ case "src":
39321
39328
  case "width":
39322
39329
  case "height": break;
39323
- default:
39324
- c.setAttribute(e, t);
39325
- break;
39330
+ default: l.setAttribute(e, t);
39326
39331
  }
39327
- }), c.src = o.src;
39328
- let l = new Lg({
39329
- element: c,
39330
- editor: s,
39331
- node: i,
39332
- getPos: a,
39332
+ }), u.src !== null && (l.src = u.src);
39333
+ let d = { ...s }, f = (e) => {
39334
+ if (typeof e == "string" && e !== "") {
39335
+ l.getAttribute("src") !== e && (l.src = e);
39336
+ return;
39337
+ }
39338
+ l.hasAttribute("src") && l.removeAttribute("src"), l.src !== "" && (l.src = "");
39339
+ };
39340
+ f(s.src);
39341
+ let p = new Lg({
39342
+ element: l,
39343
+ editor: c,
39344
+ node: a,
39345
+ getPos: o,
39333
39346
  onResize: (e, t) => {
39334
- c.style.width = `${e}px`, c.style.height = `${t}px`;
39347
+ l.style.width = `${e}px`, l.style.height = `${t}px`;
39335
39348
  },
39336
39349
  onCommit: (e, t) => {
39337
- let n = a();
39350
+ let n = o();
39338
39351
  n !== void 0 && this.editor.chain().setNodeSelection(n).updateAttributes(this.name, {
39339
39352
  width: e,
39340
39353
  height: t
39341
39354
  }).run();
39342
39355
  },
39343
- onUpdate: (e, t, n) => e.type === i.type,
39356
+ onUpdate: (e) => {
39357
+ if (e.type !== a.type) return !1;
39358
+ let t = $m(e, c.extensionManager.attributes.filter((t) => t.type === e.type.name));
39359
+ return Object.keys(d).forEach((e) => {
39360
+ !i.has(e) && !(e in t) && l.removeAttribute(e);
39361
+ }), Object.entries(t).forEach(([e, t]) => {
39362
+ i.has(e) || (t == null ? l.removeAttribute(e) : l.setAttribute(e, t));
39363
+ }), f(t.src), d = t, !0;
39364
+ },
39344
39365
  options: {
39345
39366
  directions: e,
39346
39367
  min: {
@@ -39349,10 +39370,10 @@ var Bq = ug.create({
39349
39370
  },
39350
39371
  preserveAspectRatio: r === !0
39351
39372
  }
39352
- }), u = l.dom;
39353
- return u.style.visibility = "hidden", u.style.pointerEvents = "none", c.onload = () => {
39354
- u.style.visibility = "", u.style.pointerEvents = "";
39355
- }, l;
39373
+ }), m = p.dom, h = () => {
39374
+ m.style.visibility = "", m.style.pointerEvents = "";
39375
+ };
39376
+ return m.style.visibility = "hidden", m.style.pointerEvents = "none", l.complete && l.naturalWidth > 0 ? h() : (l.onload = h, l.onerror = h), p;
39356
39377
  };
39357
39378
  },
39358
39379
  addCommands() {