@pie-lib/editable-html-tip-tap 3.1.2-next.20261019223635 → 3.1.2-next.20261020062838
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.
- package/dist/extensions/css.d.ts +0 -1
- package/dist/extensions/css.js +19 -16
- package/package.json +1 -1
package/dist/extensions/css.d.ts
CHANGED
package/dist/extensions/css.js
CHANGED
|
@@ -6,28 +6,31 @@ import { createRoot as a } from "react-dom/client";
|
|
|
6
6
|
import o from "@mui/material/List";
|
|
7
7
|
import s from "@mui/material/ListItem";
|
|
8
8
|
//#region src/extensions/css.tsx
|
|
9
|
-
var c = () => {
|
|
10
|
-
|
|
11
|
-
}, l = ({ editor: e, callback: t, opts: l, selectedText: u, parentNode: d }) => {
|
|
9
|
+
var c = null, l = ({ editor: e, callback: t, opts: l, selectedText: u, parentNode: d }) => {
|
|
10
|
+
c?.();
|
|
12
11
|
let f = e.options.element, p = document.createElement("div"), { selection: m } = e.state;
|
|
13
|
-
|
|
12
|
+
p.className = "insert-css-dialog";
|
|
14
13
|
let h = a(p), g, _ = !1, v = (e) => {
|
|
15
14
|
if (_) {
|
|
16
15
|
let t = p.contains(e.target) || g, n = f.contains(e.target);
|
|
17
|
-
t || n ||
|
|
16
|
+
t || n || b();
|
|
18
17
|
} else _ = !0;
|
|
19
18
|
}, y = () => {
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
h.unmount(), p.remove(), document.body.removeEventListener("click", v), c === y && (c = null);
|
|
20
|
+
};
|
|
21
|
+
c = y;
|
|
22
|
+
let b = () => {
|
|
23
|
+
t(void 0, !0), y();
|
|
24
|
+
}, x = (e) => {
|
|
25
|
+
t(e, !0), y();
|
|
26
|
+
}, S = d?.attrs.class, C = (e) => {
|
|
24
27
|
let t = `<span class="${e}">${u}</span>`;
|
|
25
28
|
if (d) {
|
|
26
29
|
let e = "span";
|
|
27
|
-
d?.object === "inline" && (e = "span"), d?.object === "block" && (e = "div"), t = `<${e} class="${
|
|
30
|
+
d?.object === "inline" && (e = "span"), d?.object === "block" && (e = "div"), t = `<${e} class="${S}">${d.text.slice(0, m.$anchor.textOffset)}${t}${d.text.slice(m.$head.textOffset)}</${e}>`;
|
|
28
31
|
}
|
|
29
32
|
return t;
|
|
30
|
-
},
|
|
33
|
+
}, w = /* @__PURE__ */ i("div", {
|
|
31
34
|
style: {
|
|
32
35
|
background: "white",
|
|
33
36
|
height: 500,
|
|
@@ -38,22 +41,22 @@ var c = () => {
|
|
|
38
41
|
},
|
|
39
42
|
children: [
|
|
40
43
|
/* @__PURE__ */ r("h2", { children: "Please choose a css class" }),
|
|
41
|
-
|
|
44
|
+
S && /* @__PURE__ */ i("div", { children: ["The current parent has this class ", S] }),
|
|
42
45
|
/* @__PURE__ */ r(o, {
|
|
43
46
|
component: "nav",
|
|
44
47
|
style: { overflow: "scroll" },
|
|
45
48
|
children: l.names.map((e, t) => /* @__PURE__ */ i(s, {
|
|
46
49
|
button: !0,
|
|
47
|
-
onClick: () =>
|
|
50
|
+
onClick: () => x(e),
|
|
48
51
|
children: [/* @__PURE__ */ r("div", {
|
|
49
52
|
style: { marginRight: 20 },
|
|
50
53
|
children: e
|
|
51
|
-
}), /* @__PURE__ */ r("div", { dangerouslySetInnerHTML: { __html:
|
|
54
|
+
}), /* @__PURE__ */ r("div", { dangerouslySetInnerHTML: { __html: C(e) } })]
|
|
52
55
|
}, `rule-${t}`))
|
|
53
56
|
})
|
|
54
57
|
]
|
|
55
58
|
});
|
|
56
|
-
n(() => h.render(
|
|
59
|
+
n(() => h.render(w)), (() => {
|
|
57
60
|
let t = e.view.nodeDOM(e.state.selection.from)?.parentNode;
|
|
58
61
|
if (t) {
|
|
59
62
|
let e = f.parentElement.parentElement.parentElement.getBoundingClientRect(), n = t.getBoundingClientRect();
|
|
@@ -118,4 +121,4 @@ var c = () => {
|
|
|
118
121
|
}
|
|
119
122
|
});
|
|
120
123
|
//#endregion
|
|
121
|
-
export { u as CSSMark
|
|
124
|
+
export { u as CSSMark };
|