@pie-lib/editable-html-tip-tap 2.1.2-next.30 → 2.1.2-next.32
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/components/CharacterPicker.js +22 -12
- package/dist/components/EditableHtml.js +121 -107
- package/dist/components/MenuBar.js +135 -75
- package/dist/components/TiptapContainer.js +16 -3
- package/dist/components/common/done-button.js +1 -1
- package/dist/components/common/toolbar-buttons.js +23 -18
- package/dist/components/icons/TableIcons.js +2 -0
- package/dist/components/icons/TextAlign.js +10 -1
- package/dist/components/image/AltDialog.js +1 -1
- package/dist/components/image/ImageToolbar.js +2 -2
- package/dist/components/media/MediaDialog.js +1 -1
- package/dist/components/respArea/DragInTheBlank/DragInTheBlank.js +1 -1
- package/dist/components/respArea/DragInTheBlank/choice.js +3 -2
- package/dist/components/respArea/ExplicitConstructedResponse.js +40 -39
- package/dist/components/respArea/InlineDropdown.js +58 -51
- package/dist/components/respArea/MathTemplated.js +15 -14
- package/dist/components/respArea/inlineDropdownUtils.js +1 -1
- package/dist/extensions/css.js +8 -3
- package/dist/extensions/extended-table.js +1 -1
- package/dist/extensions/image-component.js +17 -12
- package/dist/extensions/math.js +131 -76
- package/dist/extensions/media.js +2 -2
- package/dist/extensions/responseArea.js +1 -5
- package/dist/index.js +1 -1
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +1 -1
- package/dist/utils/toolbar.d.ts +10 -0
- package/dist/utils/toolbar.js +7 -0
- package/package.json +13 -8
|
@@ -10,6 +10,8 @@ var o = () => /* @__PURE__ */ t("svg", {
|
|
|
10
10
|
viewBox: "0 0 66 66",
|
|
11
11
|
fill: "none",
|
|
12
12
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
focusable: "false",
|
|
13
15
|
children: /* @__PURE__ */ t("path", {
|
|
14
16
|
d: "M42.1875 4.75C42.1875 7.38672 39.9902 9.4375 37.5 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H37.5C39.9902 0.0625 42.1875 2.25977 42.1875 4.75ZM42.1875 42.25C42.1875 44.8867 39.9902 46.9375 37.5 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H37.5C39.9902 37.5625 42.1875 39.7598 42.1875 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z",
|
|
15
17
|
fill: "currentColor"
|
|
@@ -20,6 +22,8 @@ var o = () => /* @__PURE__ */ t("svg", {
|
|
|
20
22
|
viewBox: "0 0 66 66",
|
|
21
23
|
fill: "none",
|
|
22
24
|
xmlns: "http://www.w3.org/2000/svg",
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
focusable: "false",
|
|
23
27
|
children: /* @__PURE__ */ t("path", {
|
|
24
28
|
d: "M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H28.125C25.4883 9.4375 23.4375 7.38672 23.4375 4.75C23.4375 2.25977 25.4883 0.0625 28.125 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H28.125C25.4883 46.9375 23.4375 44.8867 23.4375 42.25C23.4375 39.7598 25.4883 37.5625 28.125 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z",
|
|
25
29
|
fill: "currentColor"
|
|
@@ -30,6 +34,8 @@ var o = () => /* @__PURE__ */ t("svg", {
|
|
|
30
34
|
viewBox: "0 0 66 66",
|
|
31
35
|
fill: "none",
|
|
32
36
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
focusable: "false",
|
|
33
39
|
children: /* @__PURE__ */ t("path", {
|
|
34
40
|
d: "M51.5625 4.75C51.5625 7.38672 49.3652 9.4375 46.875 9.4375H18.75C16.1133 9.4375 14.0625 7.38672 14.0625 4.75C14.0625 2.25977 16.1133 0.0625 18.75 0.0625H46.875C49.3652 0.0625 51.5625 2.25977 51.5625 4.75ZM65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5ZM0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61ZM51.5625 42.25C51.5625 44.8867 49.3652 46.9375 46.875 46.9375H18.75C16.1133 46.9375 14.0625 44.8867 14.0625 42.25C14.0625 39.7598 16.1133 37.5625 18.75 37.5625H46.875C49.3652 37.5625 51.5625 39.7598 51.5625 42.25Z",
|
|
35
41
|
fill: "currentColor"
|
|
@@ -40,6 +46,8 @@ var o = () => /* @__PURE__ */ t("svg", {
|
|
|
40
46
|
viewBox: "0 0 66 66",
|
|
41
47
|
fill: "none",
|
|
42
48
|
xmlns: "http://www.w3.org/2000/svg",
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
focusable: "false",
|
|
43
51
|
children: /* @__PURE__ */ t("path", {
|
|
44
52
|
d: "M65.625 4.75C65.625 7.38672 63.4277 9.4375 60.9375 9.4375H4.6875C2.05078 9.4375 0 7.38672 0 4.75C0 2.25977 2.05078 0.0625 4.6875 0.0625H60.9375C63.4277 0.0625 65.625 2.25977 65.625 4.75ZM65.625 42.25C65.625 44.8867 63.4277 46.9375 60.9375 46.9375H4.6875C2.05078 46.9375 0 44.8867 0 42.25C0 39.7598 2.05078 37.5625 4.6875 37.5625H60.9375C63.4277 37.5625 65.625 39.7598 65.625 42.25ZM0 23.5C0 21.0098 2.05078 18.8125 4.6875 18.8125H60.9375C63.4277 18.8125 65.625 21.0098 65.625 23.5C65.625 26.1367 63.4277 28.1875 60.9375 28.1875H4.6875C2.05078 28.1875 0 26.1367 0 23.5ZM65.625 61C65.625 63.6367 63.4277 65.6875 60.9375 65.6875H4.6875C2.05078 65.6875 0 63.6367 0 61C0 58.5098 2.05078 56.3125 4.6875 56.3125H60.9375C63.4277 56.3125 65.625 58.5098 65.625 61Z",
|
|
45
53
|
fill: "currentColor"
|
|
@@ -77,6 +85,7 @@ var o = () => /* @__PURE__ */ t("svg", {
|
|
|
77
85
|
marginLeft: "5px",
|
|
78
86
|
fontSize: "8px"
|
|
79
87
|
},
|
|
88
|
+
"aria-hidden": "true",
|
|
80
89
|
children: "▼"
|
|
81
90
|
})]
|
|
82
91
|
}), /* @__PURE__ */ t(a, {
|
|
@@ -131,4 +140,4 @@ var o = () => /* @__PURE__ */ t("svg", {
|
|
|
131
140
|
})] });
|
|
132
141
|
};
|
|
133
142
|
//#endregion
|
|
134
|
-
export { u as default };
|
|
143
|
+
export { c as AlignCenter, l as AlignJustify, o as AlignLeft, s as AlignRight, u as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from "./AltDialog.js";
|
|
1
|
+
import { AltDialog as e } from "./AltDialog.js";
|
|
2
2
|
import { MarkButton as t } from "../common/toolbar-buttons.js";
|
|
3
3
|
import n from "react";
|
|
4
4
|
import { styled as r } from "@mui/material/styles";
|
|
@@ -77,4 +77,4 @@ var m = class extends n.Component {
|
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
//#endregion
|
|
80
|
-
export { m as default };
|
|
80
|
+
export { m as ImageToolbar, m as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from "../../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
1
|
+
import { clsx as e } from "../../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
2
2
|
import { GripIcon as t } from "../../icons/RespArea.js";
|
|
3
3
|
import { useEffect as n, useRef as r, useState as i } from "react";
|
|
4
4
|
import { styled as a } from "@mui/material/styles";
|
|
@@ -10,6 +10,7 @@ import { renderMath as f } from "@pie-element/shared-math-rendering-mathjax";
|
|
|
10
10
|
//#region src/components/respArea/DragInTheBlank/choice.tsx
|
|
11
11
|
var p = a("span")(({ theme: e }) => ({
|
|
12
12
|
border: `solid 0px ${e.palette.primary.main}`,
|
|
13
|
+
"& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn": { fontSize: "120% !important" },
|
|
13
14
|
"& mjx-frac": { fontSize: "120% !important" }
|
|
14
15
|
}));
|
|
15
16
|
function m({ n: e, children: a, isDragging: o, isOver: l, dragItem: u, value: p, selected: m }) {
|
|
@@ -153,4 +154,4 @@ h.propTypes = {
|
|
|
153
154
|
selected: o.bool
|
|
154
155
|
};
|
|
155
156
|
//#endregion
|
|
156
|
-
export { h as default };
|
|
157
|
+
export { m as BlankContent, h as default };
|
|
@@ -1,62 +1,63 @@
|
|
|
1
1
|
import e from "../../extensions/custom-toolbar-wrapper.js";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import o from "react
|
|
5
|
-
import s from "
|
|
6
|
-
import
|
|
2
|
+
import { setToolbarOpened as t } from "../../utils/toolbar.js";
|
|
3
|
+
import n, { useEffect as r, useRef as i, useState as a } from "react";
|
|
4
|
+
import { NodeViewWrapper as o } from "@tiptap/react";
|
|
5
|
+
import s from "react-dom";
|
|
6
|
+
import c from "prop-types";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
8
|
//#region src/components/respArea/ExplicitConstructedResponse.tsx
|
|
8
|
-
var
|
|
9
|
-
let { editor:
|
|
10
|
-
if (
|
|
11
|
-
let e =
|
|
12
|
-
|
|
9
|
+
var d = (c) => {
|
|
10
|
+
let { editor: d, node: f, getPos: p, options: m, selected: h } = c, { attrs: g } = f, { value: _ } = g, { respAreaToolbar: v, error: y } = m, b = p(), [x, S] = a(!1), C = v([f, b], d, () => {}), w = i(null), T;
|
|
11
|
+
if (y) {
|
|
12
|
+
let e = y(), t = parseInt(g.index, 10);
|
|
13
|
+
T = !!e?.[t]?.[0];
|
|
13
14
|
}
|
|
14
|
-
return
|
|
15
|
-
let { selection: e } =
|
|
16
|
-
|
|
15
|
+
return r(() => {
|
|
16
|
+
let { selection: e } = d.state, t = e.from + f.nodeSize === e.to;
|
|
17
|
+
h ? t && S(h) : S(h);
|
|
17
18
|
}, [
|
|
18
|
-
u,
|
|
19
19
|
d,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
f,
|
|
21
|
+
h
|
|
22
|
+
]), r(() => {
|
|
22
23
|
let e = (e) => {
|
|
23
|
-
!(e.target.closest(".insert-character-dialog") || e.target.closest("[data-toolbar-for]")) &&
|
|
24
|
+
!(e.target.closest(".insert-character-dialog") || e.target.closest("[data-toolbar-for]")) && w.current && !w.current.contains(e.target) && !e.target.closest("[data-inline-node]") && S(!1);
|
|
24
25
|
};
|
|
25
|
-
return
|
|
26
|
-
}, [
|
|
26
|
+
return x ? document.addEventListener("mousedown", e) : document.removeEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
27
|
+
}, [x]), /* @__PURE__ */ u(o, {
|
|
27
28
|
className: "drag-in-the-blank",
|
|
28
|
-
"data-selected":
|
|
29
|
+
"data-selected": h,
|
|
29
30
|
style: {
|
|
30
31
|
display: "inline-flex",
|
|
31
32
|
minHeight: "55px",
|
|
32
33
|
position: "relative",
|
|
33
34
|
cursor: "pointer"
|
|
34
35
|
},
|
|
35
|
-
children: [/* @__PURE__ */
|
|
36
|
-
...
|
|
36
|
+
children: [/* @__PURE__ */ l("div", {
|
|
37
|
+
...g,
|
|
37
38
|
style: {
|
|
38
39
|
display: "inline-flex",
|
|
39
40
|
width: "100%",
|
|
40
41
|
minHeight: "46px",
|
|
41
42
|
height: "46px",
|
|
42
43
|
backgroundColor: "#FFF",
|
|
43
|
-
border: `1px solid ${
|
|
44
|
+
border: `1px solid ${T ? "red" : "#C0C3CF"}`,
|
|
44
45
|
boxSizing: "border-box",
|
|
45
46
|
borderRadius: "4px",
|
|
46
47
|
overflow: "hidden",
|
|
47
48
|
padding: "12px 21px",
|
|
48
49
|
margin: "0 4px",
|
|
49
50
|
minWidth: "178px",
|
|
50
|
-
visibility:
|
|
51
|
+
visibility: x ? "hidden" : "visible"
|
|
51
52
|
},
|
|
52
|
-
onClick: () =>
|
|
53
|
-
dangerouslySetInnerHTML: { __html:
|
|
54
|
-
}),
|
|
55
|
-
ref:
|
|
53
|
+
onClick: () => S(!0),
|
|
54
|
+
dangerouslySetInnerHTML: { __html: _ || "<div> </div>" }
|
|
55
|
+
}), x && /* @__PURE__ */ u(n.Fragment, { children: [/* @__PURE__ */ l("div", {
|
|
56
|
+
ref: w,
|
|
56
57
|
className: "absolute z-50 bg-white shadow-lg rounded p-2",
|
|
57
58
|
style: { zIndex: 1 },
|
|
58
|
-
children: /* @__PURE__ */
|
|
59
|
-
}),
|
|
59
|
+
children: /* @__PURE__ */ l(C, {})
|
|
60
|
+
}), d._tiptapContainerEl && s.createPortal(/* @__PURE__ */ l(e, {
|
|
60
61
|
deletable: !0,
|
|
61
62
|
toolbarOpts: { minWidth: "auto" },
|
|
62
63
|
autoWidth: !0,
|
|
@@ -66,18 +67,18 @@ var u = (s) => {
|
|
|
66
67
|
right: 0
|
|
67
68
|
},
|
|
68
69
|
onDelete: () => {
|
|
69
|
-
let { tr: e } =
|
|
70
|
-
e.delete(
|
|
70
|
+
let { tr: e } = d.state;
|
|
71
|
+
e.delete(b, b + f.nodeSize), t(d, !1), d.view.dispatch(e), S(!1), d.commands.focus();
|
|
71
72
|
},
|
|
72
73
|
showDone: !1
|
|
73
|
-
}),
|
|
74
|
+
}), d._tiptapContainerEl)] })]
|
|
74
75
|
});
|
|
75
76
|
};
|
|
76
|
-
|
|
77
|
-
attributes:
|
|
78
|
-
error:
|
|
79
|
-
value:
|
|
80
|
-
isFocused:
|
|
77
|
+
d.propTypes = {
|
|
78
|
+
attributes: c.object,
|
|
79
|
+
error: c.any,
|
|
80
|
+
value: c.string,
|
|
81
|
+
isFocused: c.bool
|
|
81
82
|
};
|
|
82
83
|
//#endregion
|
|
83
|
-
export {
|
|
84
|
+
export { d as default };
|
|
@@ -1,57 +1,65 @@
|
|
|
1
1
|
import e from "../../extensions/custom-toolbar-wrapper.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import c from "
|
|
7
|
-
import l from "
|
|
8
|
-
import
|
|
2
|
+
import { setToolbarOpened as t } from "../../utils/toolbar.js";
|
|
3
|
+
import { Chevron as n } from "../icons/RespArea.js";
|
|
4
|
+
import r, { useEffect as i, useRef as a, useState as o } from "react";
|
|
5
|
+
import { NodeViewWrapper as s } from "@tiptap/react";
|
|
6
|
+
import { NodeSelection as c } from "prosemirror-state";
|
|
7
|
+
import l from "react-dom";
|
|
8
|
+
import u from "prop-types";
|
|
9
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { renderMath as p } from "@pie-element/shared-math-rendering-mathjax";
|
|
9
11
|
//#region src/components/respArea/InlineDropdown.tsx
|
|
10
|
-
var
|
|
11
|
-
let { editor:
|
|
12
|
+
var m = (u) => {
|
|
13
|
+
let { editor: m, node: h, getPos: g, options: _, selected: v } = u, { attrs: y } = h, { value: b, error: x } = y, S = b || "<div> </div>", C = g(), w = a(null), T = a(null), E = a(!1), D = a(null), O = () => m._holdInlineDropdownToolbarIndex != null && String(m._holdInlineDropdownToolbarIndex) === String(h.attrs.index), [k, A] = o(!1), [j, M] = o({
|
|
12
14
|
top: 0,
|
|
13
15
|
left: 0
|
|
14
|
-
}),
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
let { tr: e } =
|
|
16
|
+
}), N = () => {
|
|
17
|
+
O() || (A(!1), _.onInlineDropdownToolbarClose?.(m));
|
|
18
|
+
}, P = _.respAreaToolbar([h, C], m, N), F = () => {
|
|
19
|
+
let { tr: e } = m.state, t = e.doc.nodeAt(C);
|
|
18
20
|
if (!t) return;
|
|
19
21
|
let { selection: n } = e;
|
|
20
|
-
n.from ===
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
n.from === C && n.to === C + t.nodeSize || (e.setSelection(c.create(e.doc, C)), m.view.dispatch(e));
|
|
23
|
+
}, I = () => {
|
|
24
|
+
E.current || (_.onToolbarCloseRequest ? (E.current = !0, _.onToolbarCloseRequest([h, C], m, () => {
|
|
25
|
+
E.current = !1, delete m._holdInlineDropdownToolbarIndex, N();
|
|
24
26
|
}, () => {
|
|
25
|
-
|
|
26
|
-
})) :
|
|
27
|
+
E.current = !1, delete m._holdInlineDropdownToolbarIndex, A(!0), setTimeout(F, 0);
|
|
28
|
+
})) : N());
|
|
27
29
|
};
|
|
28
|
-
|
|
29
|
-
let { selection: e } =
|
|
30
|
-
|
|
30
|
+
i(() => {
|
|
31
|
+
let { selection: e } = m.state, t = e.from + h.nodeSize === e.to;
|
|
32
|
+
v ? t && A(!0) : k && I();
|
|
31
33
|
}, [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
])
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
m,
|
|
35
|
+
h,
|
|
36
|
+
v
|
|
37
|
+
]);
|
|
38
|
+
let L = (e) => e.clientX > document.documentElement.clientWidth || e.clientY > document.documentElement.clientHeight || e.target === document.documentElement;
|
|
39
|
+
return i(() => {
|
|
40
|
+
D.current && typeof p == "function" && p(D.current);
|
|
41
|
+
}, [b]), i(() => {
|
|
42
|
+
let e = document.body.getBoundingClientRect(), { from: t } = m.state.selection, n = m.view.coordsAtPos(t);
|
|
43
|
+
M({
|
|
38
44
|
top: n.top + Math.abs(e.top) + 40,
|
|
39
45
|
left: n.left
|
|
40
46
|
});
|
|
41
47
|
let r = (e) => {
|
|
48
|
+
if (L(e)) return;
|
|
42
49
|
let t = e.target.closest("[data-toolbar-for]");
|
|
43
|
-
!e.target.closest("[data-inline-dropdown-toolbar]") && (!t || t.dataset.toolbarFor !==
|
|
50
|
+
!e.target.closest("[data-inline-dropdown-toolbar]") && (!t || t.dataset.toolbarFor !== T.current?.instanceId) && !m._toolbarOpened && w.current && !w.current.contains(e.target) && !e.target.closest("[data-inline-node]") && I();
|
|
44
51
|
};
|
|
45
|
-
return
|
|
46
|
-
}, [
|
|
52
|
+
return k ? document.addEventListener("mousedown", r) : document.removeEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
|
|
53
|
+
}, [k, h]), /* @__PURE__ */ f(s, {
|
|
47
54
|
className: "inline-dropdown",
|
|
48
|
-
"data-selected":
|
|
55
|
+
"data-selected": v,
|
|
49
56
|
style: {
|
|
50
57
|
display: "inline-flex",
|
|
51
58
|
height: "50px",
|
|
52
59
|
cursor: "pointer"
|
|
53
60
|
},
|
|
54
|
-
children: [/* @__PURE__ */
|
|
61
|
+
children: [/* @__PURE__ */ f("div", {
|
|
62
|
+
ref: D,
|
|
55
63
|
style: {
|
|
56
64
|
display: "inline-flex",
|
|
57
65
|
minWidth: "178px",
|
|
@@ -64,8 +72,8 @@ var f = (l) => {
|
|
|
64
72
|
position: "relative",
|
|
65
73
|
alignItems: "center"
|
|
66
74
|
},
|
|
67
|
-
onClick: () =>
|
|
68
|
-
children: [/* @__PURE__ */
|
|
75
|
+
onClick: () => A(!0),
|
|
76
|
+
children: [/* @__PURE__ */ d("div", {
|
|
69
77
|
style: {
|
|
70
78
|
flex: 1,
|
|
71
79
|
overflow: "hidden",
|
|
@@ -73,14 +81,14 @@ var f = (l) => {
|
|
|
73
81
|
whiteSpace: "nowrap",
|
|
74
82
|
textOverflow: "ellipsis"
|
|
75
83
|
},
|
|
76
|
-
children: /* @__PURE__ */
|
|
84
|
+
children: /* @__PURE__ */ d("span", {
|
|
77
85
|
style: {
|
|
78
86
|
display: "inline-block",
|
|
79
87
|
verticalAlign: "middle"
|
|
80
88
|
},
|
|
81
|
-
dangerouslySetInnerHTML: { __html:
|
|
89
|
+
dangerouslySetInnerHTML: { __html: S }
|
|
82
90
|
})
|
|
83
|
-
}), /* @__PURE__ */
|
|
91
|
+
}), /* @__PURE__ */ d(n, {
|
|
84
92
|
direction: "down",
|
|
85
93
|
style: {
|
|
86
94
|
position: "absolute",
|
|
@@ -88,13 +96,12 @@ var f = (l) => {
|
|
|
88
96
|
right: "5px"
|
|
89
97
|
}
|
|
90
98
|
})]
|
|
91
|
-
}),
|
|
92
|
-
ref:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
C.current = e;
|
|
99
|
+
}), k && /* @__PURE__ */ f(r.Fragment, { children: [l.createPortal(/* @__PURE__ */ d("div", {
|
|
100
|
+
ref: w,
|
|
101
|
+
children: /* @__PURE__ */ d(P, { editorCallback: (e) => {
|
|
102
|
+
T.current = e;
|
|
96
103
|
} })
|
|
97
|
-
}), document.body),
|
|
104
|
+
}), m?._tiptapContainerEl || document.body), m._tiptapContainerEl && l.createPortal(/* @__PURE__ */ d(e, {
|
|
98
105
|
deletable: !0,
|
|
99
106
|
toolbarOpts: { minWidth: "auto" },
|
|
100
107
|
autoWidth: !0,
|
|
@@ -104,16 +111,16 @@ var f = (l) => {
|
|
|
104
111
|
right: 0
|
|
105
112
|
},
|
|
106
113
|
onDelete: () => {
|
|
107
|
-
let { tr: e } =
|
|
108
|
-
e.delete(
|
|
114
|
+
let { tr: e } = m.state;
|
|
115
|
+
e.delete(C, C + h.nodeSize), t(m, !1), delete m._holdInlineDropdownToolbarIndex, m.view.dispatch(e), A(!1), m.commands.focus();
|
|
109
116
|
},
|
|
110
117
|
showDone: !1
|
|
111
|
-
}),
|
|
118
|
+
}), m._tiptapContainerEl)] })]
|
|
112
119
|
});
|
|
113
120
|
};
|
|
114
|
-
|
|
115
|
-
attributes:
|
|
116
|
-
selectedItem:
|
|
121
|
+
m.propTypes = {
|
|
122
|
+
attributes: u.object,
|
|
123
|
+
selectedItem: u.oneOfType([u.string, u.object])
|
|
117
124
|
};
|
|
118
125
|
//#endregion
|
|
119
|
-
export {
|
|
126
|
+
export { m as default };
|
|
@@ -3,11 +3,12 @@ import { NodeViewWrapper as e } from "@tiptap/react";
|
|
|
3
3
|
import { styled as t } from "@mui/material/styles";
|
|
4
4
|
import n from "prop-types";
|
|
5
5
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
6
|
+
import { color as a } from "@pie-lib/render-ui";
|
|
7
|
+
import { mq as o } from "@pie-lib/math-input";
|
|
7
8
|
//#region src/components/respArea/MathTemplated.tsx
|
|
8
|
-
var
|
|
9
|
+
var s = t("span")(() => ({
|
|
9
10
|
display: "inline-flex",
|
|
10
|
-
border:
|
|
11
|
+
border: `1px solid ${a.border()}`,
|
|
11
12
|
margin: "1px 5px",
|
|
12
13
|
cursor: "pointer",
|
|
13
14
|
alignItems: "center",
|
|
@@ -15,11 +16,11 @@ var o = t("span")(() => ({
|
|
|
15
16
|
minWidth: "50px",
|
|
16
17
|
minHeight: "36px",
|
|
17
18
|
height: "fit-content"
|
|
18
|
-
})),
|
|
19
|
-
background:
|
|
20
|
-
color:
|
|
19
|
+
})), c = t("div")(() => ({
|
|
20
|
+
background: a.backgroundDark(),
|
|
21
|
+
color: a.text(),
|
|
21
22
|
display: "inline-flex",
|
|
22
|
-
borderRight:
|
|
23
|
+
borderRight: `2px solid ${a.border()}`,
|
|
23
24
|
boxSizing: "border-box",
|
|
24
25
|
overflow: "hidden",
|
|
25
26
|
fontSize: "12px",
|
|
@@ -28,7 +29,7 @@ var o = t("span")(() => ({
|
|
|
28
29
|
alignItems: "center",
|
|
29
30
|
fontFamily: "Symbola, Times New Roman, serif",
|
|
30
31
|
padding: "0 2px"
|
|
31
|
-
})),
|
|
32
|
+
})), l = t("div")(() => ({
|
|
32
33
|
flex: 8,
|
|
33
34
|
color: "var(--pie-text, black)",
|
|
34
35
|
padding: "4px !important",
|
|
@@ -71,8 +72,8 @@ var o = t("span")(() => ({
|
|
|
71
72
|
} },
|
|
72
73
|
"& .mq-overarrow-inner-right": { display: "none !important" },
|
|
73
74
|
"& .mq-overarrow-inner-left": { display: "none !important" }
|
|
74
|
-
})),
|
|
75
|
-
let { node: n, options:
|
|
75
|
+
})), u = (t) => {
|
|
76
|
+
let { node: n, options: a, selected: u } = t, { attrs: d } = n, { value: f, index: p } = d, m = `R ${parseInt(p) + 1}`;
|
|
76
77
|
return /* @__PURE__ */ r(e, {
|
|
77
78
|
className: "math-templated",
|
|
78
79
|
"data-selected": u,
|
|
@@ -82,16 +83,16 @@ var o = t("span")(() => ({
|
|
|
82
83
|
minWidth: "50px",
|
|
83
84
|
cursor: "pointer"
|
|
84
85
|
},
|
|
85
|
-
children: /* @__PURE__ */ i(
|
|
86
|
+
children: /* @__PURE__ */ i(s, {
|
|
86
87
|
...d,
|
|
87
|
-
children: [/* @__PURE__ */ r(
|
|
88
|
+
children: [/* @__PURE__ */ r(c, { children: m }), /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(o.Static, { latex: f }) })]
|
|
88
89
|
})
|
|
89
90
|
});
|
|
90
91
|
};
|
|
91
|
-
|
|
92
|
+
u.propTypes = {
|
|
92
93
|
attributes: n.object,
|
|
93
94
|
value: n.string,
|
|
94
95
|
keyToDisplay: n.string
|
|
95
96
|
};
|
|
96
97
|
//#endregion
|
|
97
|
-
export {
|
|
98
|
+
export { u as default };
|
|
@@ -12,4 +12,4 @@ var e = "_holdInlineDropdownToolbarIndex", t = (e, t) => {
|
|
|
12
12
|
return s ? (o.delete(a, a + s.nodeSize), e.view.dispatch(o), n(e), !0) : (n(e), !1);
|
|
13
13
|
};
|
|
14
14
|
//#endregion
|
|
15
|
-
export { r as deleteInlineDropdownByIndex };
|
|
15
|
+
export { e as HOLD_INLINE_DROPDOWN_TOOLBAR_INDEX, r as deleteInlineDropdownByIndex, t as findInlineDropdownPos, n as releaseInlineDropdownToolbarHold };
|
package/dist/extensions/css.js
CHANGED
|
@@ -81,8 +81,13 @@ var s = () => {
|
|
|
81
81
|
return [{
|
|
82
82
|
tag: "span[class]",
|
|
83
83
|
getAttrs: (e) => {
|
|
84
|
-
let t = e.getAttribute("class") || ""
|
|
85
|
-
|
|
84
|
+
let t = e.getAttribute("class") || "";
|
|
85
|
+
if (!t) return !1;
|
|
86
|
+
if ((this.options && this.options.classes || []).length > 0) {
|
|
87
|
+
let e = this.options.classes.find((e) => t.includes(e));
|
|
88
|
+
return e ? { class: e } : !1;
|
|
89
|
+
}
|
|
90
|
+
return { class: t };
|
|
86
91
|
}
|
|
87
92
|
}];
|
|
88
93
|
},
|
|
@@ -112,4 +117,4 @@ var s = () => {
|
|
|
112
117
|
}
|
|
113
118
|
});
|
|
114
119
|
//#endregion
|
|
115
|
-
export { l as CSSMark };
|
|
120
|
+
export { l as CSSMark, s as removeDialogs };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from "./custom-toolbar-wrapper.js";
|
|
2
2
|
import t from "../components/image/InsertImageHandler.js";
|
|
3
|
-
import n from "../components/image/ImageToolbar.js";
|
|
3
|
+
import { ImageToolbar as n } from "../components/image/ImageToolbar.js";
|
|
4
4
|
import { useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
5
5
|
import { isEqual as c } from "@pie-element/shared-lodash";
|
|
6
6
|
import { NodeViewWrapper as l } from "@tiptap/react";
|
|
@@ -68,7 +68,7 @@ function C(u) {
|
|
|
68
68
|
...e
|
|
69
69
|
}));
|
|
70
70
|
}, [h, V]), U = r(() => {
|
|
71
|
-
if (!f.attrs.width || !L.current) return;
|
|
71
|
+
if (!f.attrs.width || !L.current || !L.current.naturalWidth) return;
|
|
72
72
|
let e = B(f.attrs.width);
|
|
73
73
|
f.attrs.resizePercent !== e && H({ resizePercent: e });
|
|
74
74
|
}, [
|
|
@@ -83,11 +83,15 @@ function C(u) {
|
|
|
83
83
|
pos: A
|
|
84
84
|
};
|
|
85
85
|
}, [f, A]), i(() => {
|
|
86
|
-
T ? N && (!String(f.attrs?.src ?? "").trim() && E.imageHandling?.insertImageRequested && E.imageHandling.insertImageRequested(h, [f, A], (e) => new t(h, [f, A], e)), F(T)) : F(T);
|
|
87
|
-
}, [
|
|
86
|
+
T ? N && h.isEditable && (!String(f.attrs?.src ?? "").trim() && E.imageHandling?.insertImageRequested && E.imageHandling.insertImageRequested(h, [f, A], (e) => new t(h, [f, A], e)), F(T)) : F(T);
|
|
87
|
+
}, [
|
|
88
|
+
N,
|
|
89
|
+
T,
|
|
90
|
+
h.isEditable
|
|
91
|
+
]), i(() => {
|
|
88
92
|
U();
|
|
89
|
-
let e = R
|
|
90
|
-
return e && e.addEventListener("mousedown", Y, !1), () => {
|
|
93
|
+
let e = R?.current;
|
|
94
|
+
return e && h.isEditable && e.addEventListener("mousedown", Y, !1), () => {
|
|
91
95
|
e && e.removeEventListener("mousedown", Y, !1);
|
|
92
96
|
};
|
|
93
97
|
}, []), i(() => {
|
|
@@ -128,16 +132,16 @@ function C(u) {
|
|
|
128
132
|
}, K = r((e) => {
|
|
129
133
|
let t = L.current;
|
|
130
134
|
if (!t) return;
|
|
131
|
-
let n = e.target.getBoundingClientRect(), r =
|
|
135
|
+
let n = e.target.getBoundingClientRect(), r = {
|
|
132
136
|
width: t.naturalWidth,
|
|
133
137
|
height: t.naturalHeight
|
|
134
|
-
}, {
|
|
138
|
+
}, i = G(r, {
|
|
135
139
|
width: e.clientX - n.left,
|
|
136
140
|
height: e.clientY - n.top
|
|
137
141
|
});
|
|
138
|
-
|
|
139
|
-
width:
|
|
140
|
-
height:
|
|
142
|
+
i.width > 50 && i.height > 50 && i.width <= 700 && i.height <= 900 && (t.style.width = `${i.width}px`, t.style.height = `${i.height}px`, H({
|
|
143
|
+
width: i.width,
|
|
144
|
+
height: i.height
|
|
141
145
|
}));
|
|
142
146
|
}, [h, H]), q = r((e) => {
|
|
143
147
|
H(e);
|
|
@@ -176,7 +180,8 @@ function C(u) {
|
|
|
176
180
|
alt: f.attrs.alt
|
|
177
181
|
}), /* @__PURE__ */ p(x, {
|
|
178
182
|
ref: R,
|
|
179
|
-
className: "resize"
|
|
183
|
+
className: "resize",
|
|
184
|
+
style: { display: h.isEditable ? void 0 : "none" }
|
|
180
185
|
})]
|
|
181
186
|
})]
|
|
182
187
|
}), P && h._tiptapContainerEl && d.createPortal(/* @__PURE__ */ p("div", {
|