@pie-element/math-inline 12.1.1-next.18 → 12.1.1-next.19

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, d as n, i as r, m as i, n as a, o, p as s, r as c, s as l, t as u, u as d, y as f } from "../dist--pvq7WNe.js";
2
- import { $ as p, A as m, B as h, Ct as g, D as _, Dt as v, E as y, Et as b, F as x, G as S, H as C, I as w, J as T, K as E, N as ee, O as D, Ot as te, P as ne, Q as re, R as O, St as k, Tt as ie, U as ae, V as oe, W as se, X as ce, Y as le, Z as ue, _t as de, a as fe, at as pe, b as me, bt as he, c as ge, ct as _e, d as ve, dt as A, et as j, 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 M, n as Ae, nt as je, o as Me, ot as Ne, p as Pe, pt as Fe, q as N, r as Ie, rt as Le, s as Re, st as ze, t as Be, tt as Ve, u as He, v as Ue, vt as We, wt as P, x as Ge, xt as Ke, y as qe, yt as Je, z as Ye } from "../dist-D8taXDhz.js";
2
+ import { $ as p, A as m, B as h, Ct as g, D as _, Dt as v, E as y, Et as b, F as x, G as S, H as C, I as w, J as T, K as E, N as ee, O as D, Ot as te, P as ne, Q as re, R as O, St as k, Tt as ie, U as ae, V as oe, W as se, X as ce, Y as le, Z as ue, _t as de, a as fe, at as pe, b as me, bt as he, c as ge, ct as _e, d as ve, dt as A, et as j, 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 M, n as Ae, nt as je, o as Me, ot as Ne, p as Pe, pt as Fe, q as N, r as Ie, rt as Le, s as Re, st as ze, t as Be, tt as Ve, u as He, v as Ue, vt as We, wt as P, x as Ge, xt as Ke, y as qe, yt as Je, z as Ye } from "../dist--1is1n1O.js";
3
3
  import * as F from "react";
4
4
  import I, { Component as Xe, createContext as Ze, createElement as Qe, createRef as $e, forwardRef as et, memo as tt, useCallback as nt, useContext as rt, useDebugValue as it, useEffect as L, useLayoutEffect as at, useMemo as ot, useRef as st, useState as ct, version as lt } from "react";
5
5
  import { createRoot as ut } from "react-dom/client";
@@ -33060,34 +33060,55 @@ var tB = W_.create({
33060
33060
  },
33061
33061
  addNodeView() {
33062
33062
  if (!this.options.resize || !this.options.resize.enabled || typeof document > "u") return null;
33063
- let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
33064
- return ({ node: i, getPos: a, HTMLAttributes: o, editor: s }) => {
33065
- let c = document.createElement("img");
33066
- Object.entries(o).forEach(([e, t]) => {
33063
+ let { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize, i = /* @__PURE__ */ new Set([
33064
+ "src",
33065
+ "width",
33066
+ "height"
33067
+ ]);
33068
+ return ({ node: a, getPos: o, HTMLAttributes: s, editor: c }) => {
33069
+ let l = document.createElement("img");
33070
+ l.draggable = !1;
33071
+ let u = Mg(this.options.HTMLAttributes, s);
33072
+ Object.entries(u).forEach(([e, t]) => {
33067
33073
  if (t != null) switch (e) {
33074
+ case "src":
33068
33075
  case "width":
33069
33076
  case "height": break;
33070
- default:
33071
- c.setAttribute(e, t);
33072
- break;
33077
+ default: l.setAttribute(e, t);
33073
33078
  }
33074
- }), c.src = o.src;
33075
- let l = new gv({
33076
- element: c,
33077
- editor: s,
33078
- node: i,
33079
- getPos: a,
33079
+ }), u.src !== null && (l.src = u.src);
33080
+ let d = { ...s }, f = (e) => {
33081
+ if (typeof e == "string" && e !== "") {
33082
+ l.getAttribute("src") !== e && (l.src = e);
33083
+ return;
33084
+ }
33085
+ l.hasAttribute("src") && l.removeAttribute("src"), l.src !== "" && (l.src = "");
33086
+ };
33087
+ f(s.src);
33088
+ let p = new gv({
33089
+ element: l,
33090
+ editor: c,
33091
+ node: a,
33092
+ getPos: o,
33080
33093
  onResize: (e, t) => {
33081
- c.style.width = `${e}px`, c.style.height = `${t}px`;
33094
+ l.style.width = `${e}px`, l.style.height = `${t}px`;
33082
33095
  },
33083
33096
  onCommit: (e, t) => {
33084
- let n = a();
33097
+ let n = o();
33085
33098
  n !== void 0 && this.editor.chain().setNodeSelection(n).updateAttributes(this.name, {
33086
33099
  width: e,
33087
33100
  height: t
33088
33101
  }).run();
33089
33102
  },
33090
- onUpdate: (e, t, n) => e.type === i.type,
33103
+ onUpdate: (e) => {
33104
+ if (e.type !== a.type) return !1;
33105
+ let t = Ng(e, c.extensionManager.attributes.filter((t) => t.type === e.type.name));
33106
+ return Object.keys(d).forEach((e) => {
33107
+ !i.has(e) && !(e in t) && l.removeAttribute(e);
33108
+ }), Object.entries(t).forEach(([e, t]) => {
33109
+ i.has(e) || (t == null ? l.removeAttribute(e) : l.setAttribute(e, t));
33110
+ }), f(t.src), d = t, !0;
33111
+ },
33091
33112
  options: {
33092
33113
  directions: e,
33093
33114
  min: {
@@ -33096,10 +33117,10 @@ var tB = W_.create({
33096
33117
  },
33097
33118
  preserveAspectRatio: r === !0
33098
33119
  }
33099
- }), u = l.dom;
33100
- return u.style.visibility = "hidden", u.style.pointerEvents = "none", c.onload = () => {
33101
- u.style.visibility = "", u.style.pointerEvents = "";
33102
- }, l;
33120
+ }), m = p.dom, h = () => {
33121
+ m.style.visibility = "", m.style.pointerEvents = "";
33122
+ };
33123
+ return m.style.visibility = "hidden", m.style.pointerEvents = "none", l.complete && l.naturalWidth > 0 ? h() : (l.onload = h, l.onerror = h), p;
33103
33124
  };
33104
33125
  },
33105
33126
  addCommands() {