@pie-lib/editable-html-tip-tap 3.0.5-next.20261012220936 → 3.0.5-next.20261013192424
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/MenuBar.js +1 -1
- package/dist/components/TiptapContainer.js +2 -7
- package/dist/components/common/done-button.js +4 -4
- package/dist/components/respArea/DragInTheBlank/choice.js +1 -1
- package/dist/components/respArea/ExplicitConstructedResponse.js +30 -29
- package/dist/components/respArea/InlineDropdown.js +47 -46
- package/dist/components/respArea/MathTemplated.js +2 -2
- package/package.json +6 -6
|
@@ -11,8 +11,8 @@ import { useLayoutEffect as d, useMemo as ae, useRef as f, useState as p } from
|
|
|
11
11
|
import { useEditorState as m } from "@tiptap/react";
|
|
12
12
|
import { styled as h, useTheme as g } from "@mui/material/styles";
|
|
13
13
|
import { NodeSelection as _ } from "prosemirror-state";
|
|
14
|
-
import oe from "@mui/icons-material/Delete";
|
|
15
14
|
import { color as v } from "@pie-lib/render-ui";
|
|
15
|
+
import oe from "@mui/icons-material/Delete";
|
|
16
16
|
import y from "@pie-lib/translator";
|
|
17
17
|
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
18
18
|
import S from "@mui/icons-material/FormatBold";
|
|
@@ -5,14 +5,10 @@ import { styled as o } from "@mui/material/styles";
|
|
|
5
5
|
import { color as s } from "@pie-lib/render-ui";
|
|
6
6
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/TiptapContainer.tsx
|
|
8
|
-
var u = o("div", { shouldForwardProp: (e) => ![
|
|
9
|
-
"noBorder",
|
|
10
|
-
"error",
|
|
11
|
-
"highlightShape"
|
|
12
|
-
].includes(e) })(({ theme: e, noBorder: t, error: n, highlightShape: r }) => ({
|
|
8
|
+
var u = o("div", { shouldForwardProp: (e) => !["noBorder", "error"].includes(e) })(({ theme: e, noBorder: t, error: n }) => ({
|
|
13
9
|
position: "relative",
|
|
14
10
|
padding: "0px",
|
|
15
|
-
border: t ? "none" : `1px solid ${
|
|
11
|
+
border: t ? "none" : `1px solid ${s.borderDark()}`,
|
|
16
12
|
borderRadius: "4px",
|
|
17
13
|
cursor: "text",
|
|
18
14
|
"& [data-slate-editor=\"true\"]": {
|
|
@@ -144,7 +140,6 @@ function p(o) {
|
|
|
144
140
|
return /* @__PURE__ */ l(u, {
|
|
145
141
|
noBorder: S && S.noBorder,
|
|
146
142
|
error: S && S.error,
|
|
147
|
-
highlightShape: j,
|
|
148
143
|
className: o.className,
|
|
149
144
|
style: {
|
|
150
145
|
width: N.width,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import { styled as e } from "@mui/material/styles";
|
|
3
3
|
import t from "prop-types";
|
|
4
|
-
import n from "@
|
|
5
|
-
import
|
|
4
|
+
import { color as n } from "@pie-lib/render-ui";
|
|
5
|
+
import r from "@mui/material/IconButton";
|
|
6
6
|
import i from "@mui/icons-material/Check";
|
|
7
7
|
import a from "@pie-lib/translator";
|
|
8
8
|
import { jsx as o } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/common/done-button.tsx
|
|
10
|
-
var { translator: s } = a, c = e(
|
|
10
|
+
var { translator: s } = a, c = e(r)({
|
|
11
11
|
verticalAlign: "top",
|
|
12
12
|
width: "28px",
|
|
13
13
|
height: "28px",
|
|
14
|
-
color: `var(--editable-html-toolbar-check, ${
|
|
14
|
+
color: `var(--editable-html-toolbar-check, ${n.correctWithIcon()})`,
|
|
15
15
|
padding: "4px"
|
|
16
16
|
}), l = ({ onClick: e, doneButtonRef: t, language: n }) => /* @__PURE__ */ o(c, {
|
|
17
17
|
"aria-label": s.t("editableHtml.buttons.done", { lng: n }),
|
|
@@ -34,7 +34,7 @@ function m({ n: e, children: a, isDragging: o, isOver: u, dragItem: d, value: p,
|
|
|
34
34
|
});
|
|
35
35
|
} else !u && h && g(null);
|
|
36
36
|
}, [u, h]);
|
|
37
|
-
let y = d && u ? d.value.value : p.value || "\xA0", b = o ? "\xA0" : y, x = b !== "\xA0", S = d && u, C = m ? `2px solid ${s.primaryDark()}` :
|
|
37
|
+
let y = d && u ? d.value.value : p.value || "\xA0", b = o ? "\xA0" : y, x = b !== "\xA0", S = d && u, C = m ? `2px solid ${s.primaryDark()}` : `1px solid ${s.defaults.BORDER_DARK}`;
|
|
38
38
|
return /* @__PURE__ */ l("div", {
|
|
39
39
|
ref: _,
|
|
40
40
|
className: m ? "selected" : void 0,
|
|
@@ -4,60 +4,61 @@ import n, { useEffect as r, useRef as i, useState as a } from "react";
|
|
|
4
4
|
import { NodeViewWrapper as o } from "@tiptap/react";
|
|
5
5
|
import s from "react-dom";
|
|
6
6
|
import c from "prop-types";
|
|
7
|
-
import {
|
|
7
|
+
import { color as l } from "@pie-lib/render-ui";
|
|
8
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
9
|
//#region src/components/respArea/ExplicitConstructedResponse.tsx
|
|
9
|
-
var
|
|
10
|
-
let { editor:
|
|
11
|
-
if (
|
|
12
|
-
let e =
|
|
13
|
-
|
|
10
|
+
var f = (c) => {
|
|
11
|
+
let { editor: f, node: p, getPos: m, options: h, selected: g } = c, { attrs: _ } = p, { value: v } = _, { respAreaToolbar: y, error: b } = h, x = m(), [S, C] = a(!1), w = y([p, x], f, () => {}), T = i(null), E;
|
|
12
|
+
if (b) {
|
|
13
|
+
let e = b(), t = parseInt(_.index, 10);
|
|
14
|
+
E = !!e?.[t]?.[0];
|
|
14
15
|
}
|
|
15
16
|
return r(() => {
|
|
16
|
-
let { selection: e } =
|
|
17
|
-
|
|
17
|
+
let { selection: e } = f.state, t = e.from + p.nodeSize === e.to;
|
|
18
|
+
g ? t && C(g) : C(g);
|
|
18
19
|
}, [
|
|
19
|
-
d,
|
|
20
20
|
f,
|
|
21
|
-
|
|
21
|
+
p,
|
|
22
|
+
g
|
|
22
23
|
]), r(() => {
|
|
23
24
|
let e = (e) => {
|
|
24
|
-
!(e.target.closest(".insert-character-dialog") || e.target.closest("[data-toolbar-for]")) &&
|
|
25
|
+
!(e.target.closest(".insert-character-dialog") || e.target.closest("[data-toolbar-for]")) && T.current && !T.current.contains(e.target) && !e.target.closest("[data-inline-node]") && C(!1);
|
|
25
26
|
};
|
|
26
|
-
return
|
|
27
|
-
}, [
|
|
27
|
+
return S ? document.addEventListener("mousedown", e) : document.removeEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
28
|
+
}, [S]), /* @__PURE__ */ d(o, {
|
|
28
29
|
className: "drag-in-the-blank",
|
|
29
|
-
"data-selected":
|
|
30
|
+
"data-selected": g,
|
|
30
31
|
style: {
|
|
31
32
|
display: "inline-flex",
|
|
32
33
|
minHeight: "55px",
|
|
33
34
|
position: "relative",
|
|
34
35
|
cursor: "pointer"
|
|
35
36
|
},
|
|
36
|
-
children: [/* @__PURE__ */
|
|
37
|
-
...
|
|
37
|
+
children: [/* @__PURE__ */ u("div", {
|
|
38
|
+
..._,
|
|
38
39
|
style: {
|
|
39
40
|
display: "inline-flex",
|
|
40
41
|
width: "100%",
|
|
41
42
|
minHeight: "46px",
|
|
42
43
|
height: "46px",
|
|
43
44
|
backgroundColor: "#FFF",
|
|
44
|
-
border: `1px solid ${
|
|
45
|
+
border: `1px solid ${E ? "red" : l.borderDark()}`,
|
|
45
46
|
boxSizing: "border-box",
|
|
46
47
|
borderRadius: "4px",
|
|
47
48
|
overflow: "hidden",
|
|
48
49
|
padding: "12px 21px",
|
|
49
50
|
margin: "0 4px",
|
|
50
51
|
minWidth: "178px",
|
|
51
|
-
visibility:
|
|
52
|
+
visibility: S ? "hidden" : "visible"
|
|
52
53
|
},
|
|
53
|
-
onClick: () =>
|
|
54
|
-
dangerouslySetInnerHTML: { __html:
|
|
55
|
-
}),
|
|
56
|
-
ref:
|
|
54
|
+
onClick: () => C(!0),
|
|
55
|
+
dangerouslySetInnerHTML: { __html: v || "<div> </div>" }
|
|
56
|
+
}), S && /* @__PURE__ */ d(n.Fragment, { children: [/* @__PURE__ */ u("div", {
|
|
57
|
+
ref: T,
|
|
57
58
|
className: "absolute z-50 bg-white shadow-lg rounded p-2",
|
|
58
59
|
style: { zIndex: 1 },
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
}),
|
|
60
|
+
children: /* @__PURE__ */ u(w, {})
|
|
61
|
+
}), f._tiptapContainerEl && s.createPortal(/* @__PURE__ */ u(e, {
|
|
61
62
|
deletable: !0,
|
|
62
63
|
toolbarOpts: { minWidth: "auto" },
|
|
63
64
|
autoWidth: !0,
|
|
@@ -67,18 +68,18 @@ var d = (c) => {
|
|
|
67
68
|
right: 0
|
|
68
69
|
},
|
|
69
70
|
onDelete: () => {
|
|
70
|
-
let { tr: e } =
|
|
71
|
-
e.delete(
|
|
71
|
+
let { tr: e } = f.state;
|
|
72
|
+
e.delete(x, x + p.nodeSize), t(f, !1), f.view.dispatch(e), C(!1), f.commands.focus();
|
|
72
73
|
},
|
|
73
74
|
showDone: !1
|
|
74
|
-
}),
|
|
75
|
+
}), f._tiptapContainerEl)] })]
|
|
75
76
|
});
|
|
76
77
|
};
|
|
77
|
-
|
|
78
|
+
f.propTypes = {
|
|
78
79
|
attributes: c.object,
|
|
79
80
|
error: c.any,
|
|
80
81
|
value: c.string,
|
|
81
82
|
isFocused: c.bool
|
|
82
83
|
};
|
|
83
84
|
//#endregion
|
|
84
|
-
export {
|
|
85
|
+
export { f as default };
|
|
@@ -6,74 +6,75 @@ import { NodeViewWrapper as s } from "@tiptap/react";
|
|
|
6
6
|
import { NodeSelection as c } from "prosemirror-state";
|
|
7
7
|
import l from "react-dom";
|
|
8
8
|
import u from "prop-types";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { color as d } from "@pie-lib/render-ui";
|
|
10
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
+
import { renderMath as m } from "@pie-element/shared-math-rendering-mathjax";
|
|
11
12
|
//#region src/components/respArea/InlineDropdown.tsx
|
|
12
|
-
var
|
|
13
|
-
let { editor:
|
|
13
|
+
var h = (u) => {
|
|
14
|
+
let { editor: h, node: g, getPos: _, options: v, selected: y } = u, { attrs: b } = g, { value: x, error: S } = b, C = x || "<div> </div>", w = _(), T = a(null), E = a(null), D = a(!1), O = a(null), k = () => h._holdInlineDropdownToolbarIndex != null && String(h._holdInlineDropdownToolbarIndex) === String(g.attrs.index), [A, j] = o(!1), [M, N] = o({
|
|
14
15
|
top: 0,
|
|
15
16
|
left: 0
|
|
16
|
-
}),
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
let { tr: e } =
|
|
17
|
+
}), P = () => {
|
|
18
|
+
k() || (j(!1), v.onInlineDropdownToolbarClose?.(h));
|
|
19
|
+
}, F = v.respAreaToolbar([g, w], h, P), I = () => {
|
|
20
|
+
let { tr: e } = h.state, t = e.doc.nodeAt(w);
|
|
20
21
|
if (!t) return;
|
|
21
22
|
let { selection: n } = e;
|
|
22
|
-
n.from ===
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
n.from === w && n.to === w + t.nodeSize || (e.setSelection(c.create(e.doc, w)), h.view.dispatch(e));
|
|
24
|
+
}, L = () => {
|
|
25
|
+
D.current || (v.onToolbarCloseRequest ? (D.current = !0, v.onToolbarCloseRequest([g, w], h, () => {
|
|
26
|
+
D.current = !1, delete h._holdInlineDropdownToolbarIndex, P();
|
|
26
27
|
}, () => {
|
|
27
|
-
|
|
28
|
-
})) :
|
|
28
|
+
D.current = !1, delete h._holdInlineDropdownToolbarIndex, j(!0), setTimeout(I, 0);
|
|
29
|
+
})) : P());
|
|
29
30
|
};
|
|
30
31
|
i(() => {
|
|
31
|
-
let { selection: e } =
|
|
32
|
-
|
|
32
|
+
let { selection: e } = h.state, t = e.from + g.nodeSize === e.to;
|
|
33
|
+
y ? t && j(!0) : A && L();
|
|
33
34
|
}, [
|
|
34
|
-
m,
|
|
35
35
|
h,
|
|
36
|
-
|
|
36
|
+
g,
|
|
37
|
+
y
|
|
37
38
|
]);
|
|
38
|
-
let
|
|
39
|
+
let R = (e) => e.clientX > document.documentElement.clientWidth || e.clientY > document.documentElement.clientHeight || e.target === document.documentElement;
|
|
39
40
|
return i(() => {
|
|
40
|
-
|
|
41
|
-
}, [
|
|
42
|
-
let e = document.body.getBoundingClientRect(), { from: t } =
|
|
43
|
-
|
|
41
|
+
O.current && typeof m == "function" && m(O.current);
|
|
42
|
+
}, [x]), i(() => {
|
|
43
|
+
let e = document.body.getBoundingClientRect(), { from: t } = h.state.selection, n = h.view.coordsAtPos(t);
|
|
44
|
+
N({
|
|
44
45
|
top: n.top + Math.abs(e.top) + 40,
|
|
45
46
|
left: n.left
|
|
46
47
|
});
|
|
47
48
|
let r = (e) => {
|
|
48
|
-
if (
|
|
49
|
+
if (R(e)) return;
|
|
49
50
|
let t = e.target.closest("[data-toolbar-for]");
|
|
50
|
-
!e.target.closest("[data-inline-dropdown-toolbar]") && (!t || t.dataset.toolbarFor !==
|
|
51
|
+
!e.target.closest("[data-inline-dropdown-toolbar]") && (!t || t.dataset.toolbarFor !== E.current?.instanceId) && !h._toolbarOpened && T.current && !T.current.contains(e.target) && !e.target.closest("[data-inline-node]") && L();
|
|
51
52
|
};
|
|
52
|
-
return
|
|
53
|
-
}, [
|
|
53
|
+
return A ? document.addEventListener("mousedown", r) : document.removeEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
|
|
54
|
+
}, [A, g]), /* @__PURE__ */ p(s, {
|
|
54
55
|
className: "inline-dropdown",
|
|
55
|
-
"data-selected":
|
|
56
|
+
"data-selected": y,
|
|
56
57
|
style: {
|
|
57
58
|
display: "inline-flex",
|
|
58
59
|
height: "50px",
|
|
59
60
|
cursor: "pointer"
|
|
60
61
|
},
|
|
61
|
-
children: [/* @__PURE__ */
|
|
62
|
-
ref:
|
|
62
|
+
children: [/* @__PURE__ */ p("div", {
|
|
63
|
+
ref: O,
|
|
63
64
|
style: {
|
|
64
65
|
display: "inline-flex",
|
|
65
66
|
minWidth: "178px",
|
|
66
67
|
height: "36px",
|
|
67
68
|
background: "#FFF",
|
|
68
|
-
border:
|
|
69
|
+
border: `1px solid ${d.borderDark()}`,
|
|
69
70
|
boxSizing: "border-box",
|
|
70
71
|
borderRadius: "3px",
|
|
71
72
|
margin: "0 2px",
|
|
72
73
|
position: "relative",
|
|
73
74
|
alignItems: "center"
|
|
74
75
|
},
|
|
75
|
-
onClick: () =>
|
|
76
|
-
children: [/* @__PURE__ */
|
|
76
|
+
onClick: () => j(!0),
|
|
77
|
+
children: [/* @__PURE__ */ f("div", {
|
|
77
78
|
style: {
|
|
78
79
|
flex: 1,
|
|
79
80
|
overflow: "hidden",
|
|
@@ -81,14 +82,14 @@ var m = (u) => {
|
|
|
81
82
|
whiteSpace: "nowrap",
|
|
82
83
|
textOverflow: "ellipsis"
|
|
83
84
|
},
|
|
84
|
-
children: /* @__PURE__ */
|
|
85
|
+
children: /* @__PURE__ */ f("span", {
|
|
85
86
|
style: {
|
|
86
87
|
display: "inline-block",
|
|
87
88
|
verticalAlign: "middle"
|
|
88
89
|
},
|
|
89
|
-
dangerouslySetInnerHTML: { __html:
|
|
90
|
+
dangerouslySetInnerHTML: { __html: C }
|
|
90
91
|
})
|
|
91
|
-
}), /* @__PURE__ */
|
|
92
|
+
}), /* @__PURE__ */ f(n, {
|
|
92
93
|
direction: "down",
|
|
93
94
|
style: {
|
|
94
95
|
position: "absolute",
|
|
@@ -96,12 +97,12 @@ var m = (u) => {
|
|
|
96
97
|
right: "5px"
|
|
97
98
|
}
|
|
98
99
|
})]
|
|
99
|
-
}),
|
|
100
|
-
ref:
|
|
101
|
-
children: /* @__PURE__ */
|
|
102
|
-
|
|
100
|
+
}), A && /* @__PURE__ */ p(r.Fragment, { children: [l.createPortal(/* @__PURE__ */ f("div", {
|
|
101
|
+
ref: T,
|
|
102
|
+
children: /* @__PURE__ */ f(F, { editorCallback: (e) => {
|
|
103
|
+
E.current = e;
|
|
103
104
|
} })
|
|
104
|
-
}),
|
|
105
|
+
}), h?._tiptapContainerEl || document.body), h._tiptapContainerEl && l.createPortal(/* @__PURE__ */ f(e, {
|
|
105
106
|
deletable: !0,
|
|
106
107
|
toolbarOpts: { minWidth: "auto" },
|
|
107
108
|
autoWidth: !0,
|
|
@@ -111,16 +112,16 @@ var m = (u) => {
|
|
|
111
112
|
right: 0
|
|
112
113
|
},
|
|
113
114
|
onDelete: () => {
|
|
114
|
-
let { tr: e } =
|
|
115
|
-
e.delete(
|
|
115
|
+
let { tr: e } = h.state;
|
|
116
|
+
e.delete(w, w + g.nodeSize), t(h, !1), delete h._holdInlineDropdownToolbarIndex, h.view.dispatch(e), j(!1), h.commands.focus();
|
|
116
117
|
},
|
|
117
118
|
showDone: !1
|
|
118
|
-
}),
|
|
119
|
+
}), h._tiptapContainerEl)] })]
|
|
119
120
|
});
|
|
120
121
|
};
|
|
121
|
-
|
|
122
|
+
h.propTypes = {
|
|
122
123
|
attributes: u.object,
|
|
123
124
|
selectedItem: u.oneOfType([u.string, u.object])
|
|
124
125
|
};
|
|
125
126
|
//#endregion
|
|
126
|
-
export {
|
|
127
|
+
export { h as default };
|
|
@@ -8,7 +8,7 @@ import { mq as o } from "@pie-lib/math-input";
|
|
|
8
8
|
//#region src/components/respArea/MathTemplated.tsx
|
|
9
9
|
var s = t("span")(() => ({
|
|
10
10
|
display: "inline-flex",
|
|
11
|
-
border: `1px solid ${r.
|
|
11
|
+
border: `1px solid ${r.borderDark()}`,
|
|
12
12
|
margin: "1px 5px",
|
|
13
13
|
cursor: "pointer",
|
|
14
14
|
alignItems: "center",
|
|
@@ -20,7 +20,7 @@ var s = t("span")(() => ({
|
|
|
20
20
|
background: r.backgroundDark(),
|
|
21
21
|
color: r.text(),
|
|
22
22
|
display: "inline-flex",
|
|
23
|
-
borderRight: `2px solid ${r.
|
|
23
|
+
borderRight: `2px solid ${r.borderDark()}`,
|
|
24
24
|
boxSizing: "border-box",
|
|
25
25
|
overflow: "hidden",
|
|
26
26
|
fontSize: "12px",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/editable-html-tip-tap",
|
|
3
|
-
"version": "3.0.5-next.
|
|
3
|
+
"version": "3.0.5-next.20261013192424",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"@dnd-kit/utilities": "3.2.2",
|
|
14
14
|
"@mui/icons-material": "^7.3.4",
|
|
15
15
|
"@mui/material": "^7.3.4",
|
|
16
|
-
"@pie-lib/drag": "5.0.5-next.
|
|
17
|
-
"@pie-lib/math-input": "9.0.5-next.
|
|
18
|
-
"@pie-lib/math-toolbar": "4.0.5-next.
|
|
19
|
-
"@pie-lib/render-ui": "8.0.5-next.
|
|
16
|
+
"@pie-lib/drag": "5.0.5-next.20261013192424",
|
|
17
|
+
"@pie-lib/math-input": "9.0.5-next.20261013192424",
|
|
18
|
+
"@pie-lib/math-toolbar": "4.0.5-next.20261013192424",
|
|
19
|
+
"@pie-lib/render-ui": "8.0.5-next.20261013192424",
|
|
20
20
|
"@pie-lib/translator": "5.0.2-next.20261006160832",
|
|
21
21
|
"@tiptap/core": "3.31.4",
|
|
22
22
|
"@tiptap/extension-character-count": "3.31.4",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@pie-element/shared-lodash": "0.1.3-next.20261012213240",
|
|
48
48
|
"clsx": "^2.1.1",
|
|
49
49
|
"prosemirror-state": "^1.4.4",
|
|
50
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.6-next.
|
|
50
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.6-next.20261013192424",
|
|
51
51
|
"@tiptap/extensions": "3.31.4",
|
|
52
52
|
"@tiptap/extension-list": "3.31.4",
|
|
53
53
|
"@tiptap/extension-bubble-menu": "3.31.4",
|