@pie-lib/editable-html-tip-tap 3.0.1-next.20261004235022 → 3.0.1-next.20261005000911
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.
|
@@ -5,34 +5,34 @@ import { ToolbarIcon as r } from "./respArea/ToolbarIcon.js";
|
|
|
5
5
|
import { spanishConfig as i, specialConfig as a } from "./characters/characterUtils.js";
|
|
6
6
|
import ee from "./icons/TextAlign.js";
|
|
7
7
|
import te from "./icons/CssIcon.js";
|
|
8
|
-
import { AddColumn as ne, AddRow as
|
|
9
|
-
import { CharacterIcon as c, CharacterPicker as
|
|
10
|
-
import { useLayoutEffect as
|
|
11
|
-
import { useEditorState as
|
|
12
|
-
import { styled as
|
|
13
|
-
import { NodeSelection as
|
|
14
|
-
import
|
|
8
|
+
import { AddColumn as ne, AddRow as o, RemoveColumn as s, RemoveRow as re, RemoveTable as ie } from "./icons/TableIcons.js";
|
|
9
|
+
import { CharacterIcon as c, CharacterPicker as ae } from "./CharacterPicker.js";
|
|
10
|
+
import { useLayoutEffect as l, useMemo as u, useRef as d, useState as oe } from "react";
|
|
11
|
+
import { useEditorState as f } from "@tiptap/react";
|
|
12
|
+
import { styled as p, useTheme as m } from "@mui/material/styles";
|
|
13
|
+
import { NodeSelection as h } from "prosemirror-state";
|
|
14
|
+
import g from "@mui/icons-material/Delete";
|
|
15
|
+
import _ from "@pie-lib/translator";
|
|
15
16
|
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
16
17
|
import { color as b } from "@pie-lib/render-ui";
|
|
17
|
-
import x from "@
|
|
18
|
-
import S from "@mui/icons-material/
|
|
19
|
-
import C from "@mui/icons-material/
|
|
20
|
-
import w from "@mui/icons-material/
|
|
21
|
-
import T from "@mui/icons-material/
|
|
22
|
-
import E from "@mui/icons-material/
|
|
23
|
-
import D from "@mui/icons-material/
|
|
24
|
-
import O from "@mui/icons-material/
|
|
25
|
-
import k from "@mui/icons-material/
|
|
26
|
-
import A from "@mui/icons-material/
|
|
27
|
-
import j from "@mui/icons-material/
|
|
28
|
-
import M from "@mui/icons-material/
|
|
29
|
-
import N from "@mui/icons-material/
|
|
30
|
-
import P from "@mui/icons-material/
|
|
31
|
-
import F from "@mui/icons-material/
|
|
32
|
-
import
|
|
33
|
-
import I from "@mui/icons-material/BorderAll";
|
|
18
|
+
import x from "@mui/icons-material/FormatBold";
|
|
19
|
+
import S from "@mui/icons-material/FormatItalic";
|
|
20
|
+
import C from "@mui/icons-material/FormatStrikethrough";
|
|
21
|
+
import w from "@mui/icons-material/Code";
|
|
22
|
+
import T from "@mui/icons-material/GridOn";
|
|
23
|
+
import E from "@mui/icons-material/FormatListBulleted";
|
|
24
|
+
import D from "@mui/icons-material/FormatListNumbered";
|
|
25
|
+
import O from "@mui/icons-material/FormatUnderlined";
|
|
26
|
+
import k from "@mui/icons-material/Functions";
|
|
27
|
+
import A from "@mui/icons-material/Image";
|
|
28
|
+
import j from "@mui/icons-material/Redo";
|
|
29
|
+
import M from "@mui/icons-material/Undo";
|
|
30
|
+
import N from "@mui/icons-material/FormatQuote";
|
|
31
|
+
import P from "@mui/icons-material/Theaters";
|
|
32
|
+
import F from "@mui/icons-material/VolumeUp";
|
|
33
|
+
import se from "@mui/icons-material/BorderAll";
|
|
34
34
|
//#region src/components/MenuBar.tsx
|
|
35
|
-
var { translator:
|
|
35
|
+
var { translator: I } = _, L = () => /* @__PURE__ */ v("svg", {
|
|
36
36
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37
37
|
height: "24px",
|
|
38
38
|
viewBox: "0 0 24 24",
|
|
@@ -44,7 +44,7 @@ var { translator: L } = x, R = () => /* @__PURE__ */ v("svg", {
|
|
|
44
44
|
d: "M22,7h-2v1h3v1h-4V7c0-0.55,0.45-1,1-1h2V5h-3V4h3c0.55,0,1,0.45,1,1v1C23,6.55,22.55,7,22,7z M5.88,20h2.66l3.4-5.42h0.12 l3.4,5.42h2.66l-4.65-7.27L17.81,6h-2.68l-3.07,4.99h-0.12L8.85,6H6.19l4.32,6.73L5.88,20z",
|
|
45
45
|
fill: "currentColor"
|
|
46
46
|
})
|
|
47
|
-
}),
|
|
47
|
+
}), R = () => /* @__PURE__ */ v("svg", {
|
|
48
48
|
xmlns: "http://www.w3.org/2000/svg",
|
|
49
49
|
height: "24px",
|
|
50
50
|
viewBox: "0 0 24 24",
|
|
@@ -56,7 +56,7 @@ var { translator: L } = x, R = () => /* @__PURE__ */ v("svg", {
|
|
|
56
56
|
d: "M22,18h-2v1h3v1h-4v-2c0-0.55,0.45-1,1-1h2v-1h-3v-1h3c0.55,0,1,0.45,1,1v1C23,17.55,22.55,18,22,18z M5.88,18h2.66 l3.4-5.42h0.12l3.4,5.42h2.66l-4.65-7.27L17.81,4h-2.68l-3.07,4.99h-0.12L8.85,4H6.19l4.32,6.73L5.88,18z",
|
|
57
57
|
fill: "currentColor"
|
|
58
58
|
})
|
|
59
|
-
}),
|
|
59
|
+
}), z = () => /* @__PURE__ */ v("svg", {
|
|
60
60
|
width: "30",
|
|
61
61
|
height: "28",
|
|
62
62
|
viewBox: "0 0 30 28",
|
|
@@ -73,13 +73,13 @@ var { translator: L } = x, R = () => /* @__PURE__ */ v("svg", {
|
|
|
73
73
|
fill: "currentColor"
|
|
74
74
|
})
|
|
75
75
|
});
|
|
76
|
-
function
|
|
77
|
-
let [
|
|
78
|
-
editor:
|
|
76
|
+
function B({ editor: p, classes: m, activePlugins: _, toolbarOpts: b, responseAreaProps: B, onChange: V, autoWidthToolbar: H, hasFocus: U, language: W }) {
|
|
77
|
+
let [G, K] = oe(!1), q = d(null), J = b ?? {}, Y = f({
|
|
78
|
+
editor: p,
|
|
79
79
|
selector: (e) => {
|
|
80
80
|
let { selection: t } = e.editor?.state || {}, n;
|
|
81
81
|
if (!e.editor?.commandManager) return {};
|
|
82
|
-
t instanceof
|
|
82
|
+
t instanceof h && (n = t.node);
|
|
83
83
|
let r = e.editor?.isActive("math") || e.editor?.isActive("explicit_constructed_response") || e.editor?.isActive("imageUploadNode") || e.editor?.isActive("drag_in_the_blank"), i = t && t.empty === !1 && e.editor.isActive("table");
|
|
84
84
|
return {
|
|
85
85
|
currentNode: n,
|
|
@@ -117,44 +117,44 @@ function V({ editor: m, classes: h, activePlugins: b, toolbarOpts: x, responseAr
|
|
|
117
117
|
canRedo: e.editor.can().chain().redo().run() ?? !1
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
}),
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}, [
|
|
124
|
-
let
|
|
125
|
-
[
|
|
126
|
-
[
|
|
127
|
-
[
|
|
128
|
-
[
|
|
129
|
-
[
|
|
130
|
-
[
|
|
131
|
-
[
|
|
132
|
-
}),
|
|
120
|
+
}), X = !!H, Z = Y.hideDefaultToolbar && Y.currentNode?.type?.name === "drag_in_the_blank", Q = J.alwaysVisible || U && !Y.toolbarOpened && (!Y.hideDefaultToolbar || Z);
|
|
121
|
+
l(() => {
|
|
122
|
+
q.current?.toggleAttribute("inert", !Q);
|
|
123
|
+
}, [Q]);
|
|
124
|
+
let ce = n(m.toolbar, e, {
|
|
125
|
+
[m.toolbarWithNoDone]: !0,
|
|
126
|
+
[m.toolbarTop]: J.position === "top",
|
|
127
|
+
[m.toolbarRight]: J.alignment === "right",
|
|
128
|
+
[m.focused]: Q,
|
|
129
|
+
[m.autoWidth]: X,
|
|
130
|
+
[m.fullWidth]: !X,
|
|
131
|
+
[m.hidden]: J.isHidden === !0
|
|
132
|
+
}), le = J.minWidth === void 0 ? {} : { minWidth: J.minWidth }, ue = (e) => {
|
|
133
133
|
e.preventDefault();
|
|
134
|
-
},
|
|
134
|
+
}, $ = (e) => I.t(`editableHtml.buttons.${e}`, { lng: W }), de = u(() => [
|
|
135
135
|
{
|
|
136
|
-
icon: /* @__PURE__ */ v(
|
|
137
|
-
label: "
|
|
136
|
+
icon: /* @__PURE__ */ v(T, {}),
|
|
137
|
+
label: $("insertTable"),
|
|
138
138
|
onClick: (e) => e.chain().focus().insertTable({
|
|
139
139
|
rows: 2,
|
|
140
140
|
cols: 2,
|
|
141
141
|
withHeaderRow: !1
|
|
142
142
|
}).run(),
|
|
143
|
-
hidden: (e) => !
|
|
143
|
+
hidden: (e) => !_?.includes("table") || e.isTable,
|
|
144
144
|
isActive: (e) => e.isTable,
|
|
145
145
|
isDisabled: (e) => !e.canTable
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
|
-
icon: /* @__PURE__ */ v(
|
|
149
|
-
label: "
|
|
148
|
+
icon: /* @__PURE__ */ v(o, {}),
|
|
149
|
+
label: $("addTableRow"),
|
|
150
150
|
onClick: (e) => e.chain().focus().addRowAfter().run(),
|
|
151
151
|
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
152
152
|
isActive: (e) => e.isTable,
|
|
153
153
|
isDisabled: (e) => !e.canTable
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
|
-
icon: /* @__PURE__ */ v(
|
|
157
|
-
label: "
|
|
156
|
+
icon: /* @__PURE__ */ v(re, {}),
|
|
157
|
+
label: $("removeTableRow"),
|
|
158
158
|
onClick: (e) => e.chain().focus().deleteRow().run(),
|
|
159
159
|
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
160
160
|
isActive: (e) => e.isTable,
|
|
@@ -162,31 +162,31 @@ function V({ editor: m, classes: h, activePlugins: b, toolbarOpts: x, responseAr
|
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
164
|
icon: /* @__PURE__ */ v(ne, {}),
|
|
165
|
-
label: "
|
|
165
|
+
label: $("addTableColumn"),
|
|
166
166
|
onClick: (e) => e.chain().focus().addColumnAfter().run(),
|
|
167
167
|
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
168
168
|
isActive: (e) => e.isTable,
|
|
169
169
|
isDisabled: (e) => !e.canTable
|
|
170
170
|
},
|
|
171
171
|
{
|
|
172
|
-
icon: /* @__PURE__ */ v(
|
|
173
|
-
label: "
|
|
172
|
+
icon: /* @__PURE__ */ v(s, {}),
|
|
173
|
+
label: $("removeTableColumn"),
|
|
174
174
|
onClick: (e) => e.chain().focus().deleteColumn().run(),
|
|
175
175
|
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
176
176
|
isActive: (e) => e.isTable,
|
|
177
177
|
isDisabled: (e) => !e.canTable
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
|
-
icon: /* @__PURE__ */ v(
|
|
181
|
-
label: "
|
|
180
|
+
icon: /* @__PURE__ */ v(ie, {}),
|
|
181
|
+
label: $("removeTable"),
|
|
182
182
|
onClick: (e) => e.chain().focus().deleteTable().run(),
|
|
183
183
|
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
184
184
|
isActive: (e) => e.isTable,
|
|
185
185
|
isDisabled: (e) => !e.canTable
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
|
-
icon: /* @__PURE__ */ v(
|
|
189
|
-
label: "
|
|
188
|
+
icon: /* @__PURE__ */ v(se, {}),
|
|
189
|
+
label: $("tableBorders"),
|
|
190
190
|
toggle: !0,
|
|
191
191
|
onClick: (e) => {
|
|
192
192
|
let t = e.getAttributes("table"), n = {
|
|
@@ -200,81 +200,81 @@ function V({ editor: m, classes: h, activePlugins: b, toolbarOpts: x, responseAr
|
|
|
200
200
|
isDisabled: (e) => !e.canTable
|
|
201
201
|
},
|
|
202
202
|
{
|
|
203
|
-
icon: /* @__PURE__ */ v(
|
|
204
|
-
label: "
|
|
203
|
+
icon: /* @__PURE__ */ v(x, {}),
|
|
204
|
+
label: $("bold"),
|
|
205
205
|
toggle: !0,
|
|
206
206
|
onClick: (e) => e.chain().focus().toggleBold().run(),
|
|
207
|
-
hidden: () => !
|
|
207
|
+
hidden: () => !_?.includes("bold"),
|
|
208
208
|
isActive: (e) => e.isBold,
|
|
209
209
|
isDisabled: (e) => !e.canBold
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
|
-
icon: /* @__PURE__ */ v(
|
|
213
|
-
label: "
|
|
212
|
+
icon: /* @__PURE__ */ v(S, {}),
|
|
213
|
+
label: $("italic"),
|
|
214
214
|
toggle: !0,
|
|
215
215
|
onClick: (e) => e.chain().focus().toggleItalic().run(),
|
|
216
|
-
hidden: () => !
|
|
216
|
+
hidden: () => !_?.includes("italic"),
|
|
217
217
|
isActive: (e) => e.isItalic,
|
|
218
218
|
isDisabled: (e) => !e.canItalic
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
|
-
icon: /* @__PURE__ */ v(
|
|
222
|
-
label: "
|
|
221
|
+
icon: /* @__PURE__ */ v(C, {}),
|
|
222
|
+
label: $("strikethrough"),
|
|
223
223
|
toggle: !0,
|
|
224
224
|
onClick: (e) => e.chain().focus().toggleStrike().run(),
|
|
225
|
-
hidden: () => !
|
|
225
|
+
hidden: () => !_?.includes("strikethrough"),
|
|
226
226
|
isActive: (e) => e.isStrike,
|
|
227
227
|
isDisabled: (e) => !e.canStrike
|
|
228
228
|
},
|
|
229
229
|
{
|
|
230
|
-
icon: /* @__PURE__ */ v(
|
|
231
|
-
label: "
|
|
230
|
+
icon: /* @__PURE__ */ v(w, {}),
|
|
231
|
+
label: $("code"),
|
|
232
232
|
toggle: !0,
|
|
233
233
|
onClick: (e) => e.chain().focus().toggleCode().run(),
|
|
234
|
-
hidden: () => !
|
|
234
|
+
hidden: () => !_?.includes("code"),
|
|
235
235
|
isActive: (e) => e.isCode,
|
|
236
236
|
isDisabled: (e) => !e.canCode
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
|
-
icon: /* @__PURE__ */ v(
|
|
240
|
-
label: "
|
|
239
|
+
icon: /* @__PURE__ */ v(O, {}),
|
|
240
|
+
label: $("underline"),
|
|
241
241
|
toggle: !0,
|
|
242
242
|
onClick: (e) => e.chain().focus().toggleUnderline().run(),
|
|
243
|
-
hidden: () => !
|
|
243
|
+
hidden: () => !_?.includes("underline"),
|
|
244
244
|
isActive: (e) => e.isUnderline
|
|
245
245
|
},
|
|
246
246
|
{
|
|
247
|
-
icon: /* @__PURE__ */ v(
|
|
248
|
-
label: "
|
|
247
|
+
icon: /* @__PURE__ */ v(R, {}),
|
|
248
|
+
label: $("subscript"),
|
|
249
249
|
toggle: !0,
|
|
250
250
|
onClick: (e) => e.chain().focus().toggleSubscript().run(),
|
|
251
|
-
hidden: () => !
|
|
251
|
+
hidden: () => !_?.includes("subscript"),
|
|
252
252
|
isActive: (e) => e.isSubScript
|
|
253
253
|
},
|
|
254
254
|
{
|
|
255
|
-
icon: /* @__PURE__ */ v(
|
|
256
|
-
label: "
|
|
255
|
+
icon: /* @__PURE__ */ v(L, {}),
|
|
256
|
+
label: $("superscript"),
|
|
257
257
|
toggle: !0,
|
|
258
258
|
onClick: (e) => e.chain().focus().toggleSuperscript().run(),
|
|
259
|
-
hidden: () => !
|
|
259
|
+
hidden: () => !_?.includes("superscript"),
|
|
260
260
|
isActive: (e) => e.isSuperScript
|
|
261
261
|
},
|
|
262
262
|
{
|
|
263
|
-
icon: /* @__PURE__ */ v(
|
|
264
|
-
label: "
|
|
265
|
-
hidden: () => !
|
|
263
|
+
icon: /* @__PURE__ */ v(A, {}),
|
|
264
|
+
label: $("insertImage"),
|
|
265
|
+
hidden: () => !_?.includes("image"),
|
|
266
266
|
onClick: (e) => e.chain().focus().setImageUploadNode().run()
|
|
267
267
|
},
|
|
268
268
|
{
|
|
269
|
-
icon: /* @__PURE__ */ v(
|
|
270
|
-
label: "
|
|
271
|
-
hidden: () => !
|
|
269
|
+
icon: /* @__PURE__ */ v(P, {}),
|
|
270
|
+
label: $("insertVideo"),
|
|
271
|
+
hidden: () => !_?.includes("video"),
|
|
272
272
|
onClick: (e) => e.chain().focus().insertMedia({ type: "video" }).run()
|
|
273
273
|
},
|
|
274
274
|
{
|
|
275
|
-
icon: /* @__PURE__ */ v(
|
|
276
|
-
label: "
|
|
277
|
-
hidden: () => !
|
|
275
|
+
icon: /* @__PURE__ */ v(F, {}),
|
|
276
|
+
label: $("insertAudio"),
|
|
277
|
+
hidden: () => !_?.includes("audio"),
|
|
278
278
|
onClick: (e) => e.chain().focus().insertMedia({
|
|
279
279
|
type: "audio",
|
|
280
280
|
tag: "audio"
|
|
@@ -282,116 +282,120 @@ function V({ editor: m, classes: h, activePlugins: b, toolbarOpts: x, responseAr
|
|
|
282
282
|
},
|
|
283
283
|
{
|
|
284
284
|
icon: /* @__PURE__ */ v(te, {}),
|
|
285
|
-
label: "
|
|
286
|
-
hidden: () => !
|
|
285
|
+
label: $("cssClasses"),
|
|
286
|
+
hidden: () => !_?.includes("css"),
|
|
287
287
|
onClick: (e) => e.commands.openCSSClassDialog()
|
|
288
288
|
},
|
|
289
289
|
{
|
|
290
|
-
icon: /* @__PURE__ */ v(
|
|
291
|
-
label: "
|
|
290
|
+
icon: /* @__PURE__ */ v(N, {}),
|
|
291
|
+
label: $("blockquote"),
|
|
292
292
|
toggle: !0,
|
|
293
|
-
hidden: () => !
|
|
293
|
+
hidden: () => !_?.includes("blockquote"),
|
|
294
294
|
onClick: (e) => e.chain().focus().toggleBlockquote().run(),
|
|
295
295
|
isActive: (e) => e.isBlockquote
|
|
296
296
|
},
|
|
297
297
|
{
|
|
298
|
-
icon: /* @__PURE__ */ v(
|
|
299
|
-
label: "
|
|
298
|
+
icon: /* @__PURE__ */ v(z, {}),
|
|
299
|
+
label: $("heading"),
|
|
300
300
|
toggle: !0,
|
|
301
|
-
hidden: () => !
|
|
301
|
+
hidden: () => !_?.includes("h3"),
|
|
302
302
|
onClick: (e) => e.chain().focus().toggleHeadingParagraph().run(),
|
|
303
303
|
isActive: (e) => e.isHeadingParagraph
|
|
304
304
|
},
|
|
305
305
|
{
|
|
306
|
-
icon: /* @__PURE__ */ v(
|
|
307
|
-
label: "
|
|
308
|
-
hidden: () => !
|
|
306
|
+
icon: /* @__PURE__ */ v(k, {}),
|
|
307
|
+
label: $("insertMath"),
|
|
308
|
+
hidden: () => !_?.includes("math"),
|
|
309
309
|
onClick: (e) => e.chain().focus().insertMath("").run()
|
|
310
310
|
},
|
|
311
311
|
{
|
|
312
312
|
icon: /* @__PURE__ */ v(c, { letter: "ñ" }),
|
|
313
|
-
label: "
|
|
314
|
-
hidden: () => !
|
|
315
|
-
onClick: () =>
|
|
313
|
+
label: $("spanishCharacters"),
|
|
314
|
+
hidden: () => !_?.includes("languageCharacters"),
|
|
315
|
+
onClick: () => K(i)
|
|
316
316
|
},
|
|
317
317
|
{
|
|
318
318
|
icon: /* @__PURE__ */ v(c, { letter: "€" }),
|
|
319
|
-
label: "
|
|
320
|
-
hidden: () =>
|
|
321
|
-
onClick: () =>
|
|
319
|
+
label: $("specialCharacters"),
|
|
320
|
+
hidden: () => _?.filter((e) => e === "languageCharacters").length !== 2,
|
|
321
|
+
onClick: () => K(a)
|
|
322
322
|
},
|
|
323
323
|
{
|
|
324
|
-
icon: /* @__PURE__ */ v(ee, { editor:
|
|
325
|
-
label: "
|
|
326
|
-
hidden: () => !
|
|
324
|
+
icon: /* @__PURE__ */ v(ee, { editor: p }),
|
|
325
|
+
label: $("textAlignment"),
|
|
326
|
+
hidden: () => !_?.includes("text-align"),
|
|
327
327
|
onClick: () => {}
|
|
328
328
|
},
|
|
329
329
|
{
|
|
330
|
-
icon: /* @__PURE__ */ v(
|
|
331
|
-
label: "
|
|
330
|
+
icon: /* @__PURE__ */ v(E, {}),
|
|
331
|
+
label: $("bulletedList"),
|
|
332
332
|
toggle: !0,
|
|
333
|
-
hidden: () => !
|
|
333
|
+
hidden: () => !_?.includes("bulleted-list"),
|
|
334
334
|
onClick: (e) => e.chain().focus().toggleBulletList().run(),
|
|
335
335
|
isActive: (e) => e.isBulletList
|
|
336
336
|
},
|
|
337
337
|
{
|
|
338
|
-
icon: /* @__PURE__ */ v(
|
|
339
|
-
label: "
|
|
338
|
+
icon: /* @__PURE__ */ v(D, {}),
|
|
339
|
+
label: $("numberedList"),
|
|
340
340
|
toggle: !0,
|
|
341
|
-
hidden: () => !
|
|
341
|
+
hidden: () => !_?.includes("numbered-list"),
|
|
342
342
|
onClick: (e) => e.chain().focus().toggleOrderedList().run(),
|
|
343
343
|
isActive: (e) => e.isOrderedList
|
|
344
344
|
},
|
|
345
345
|
{
|
|
346
|
-
icon: /* @__PURE__ */ v(
|
|
347
|
-
label: "
|
|
348
|
-
hidden: () => !
|
|
346
|
+
icon: /* @__PURE__ */ v(M, {}),
|
|
347
|
+
label: I.t("common:undo", { lng: W }),
|
|
348
|
+
hidden: () => !_?.includes("undo"),
|
|
349
349
|
onClick: (e) => e.chain().focus().undo().run(),
|
|
350
350
|
isDisabled: (e) => !e.canUndo
|
|
351
351
|
},
|
|
352
352
|
{
|
|
353
|
-
icon: /* @__PURE__ */ v(
|
|
354
|
-
label: "
|
|
355
|
-
hidden: () => !
|
|
353
|
+
icon: /* @__PURE__ */ v(j, {}),
|
|
354
|
+
label: I.t("graphing.redo", { lng: W }),
|
|
355
|
+
hidden: () => !_?.includes("redo"),
|
|
356
356
|
onClick: (e) => e.chain().focus().redo().run(),
|
|
357
357
|
isDisabled: (e) => !e.canRedo
|
|
358
358
|
}
|
|
359
|
-
], [
|
|
359
|
+
], [
|
|
360
|
+
_,
|
|
361
|
+
p,
|
|
362
|
+
W
|
|
363
|
+
]);
|
|
360
364
|
return /* @__PURE__ */ y("div", {
|
|
361
|
-
ref:
|
|
362
|
-
className:
|
|
363
|
-
style: { ...
|
|
364
|
-
onMouseDown:
|
|
365
|
+
ref: q,
|
|
366
|
+
className: ce,
|
|
367
|
+
style: { ...le },
|
|
368
|
+
onMouseDown: ue,
|
|
365
369
|
children: [
|
|
366
|
-
|
|
367
|
-
className:
|
|
370
|
+
Z && /* @__PURE__ */ v("div", {
|
|
371
|
+
className: m.defaultToolbar,
|
|
368
372
|
role: "toolbar",
|
|
369
373
|
tabIndex: -1,
|
|
370
|
-
"aria-label":
|
|
374
|
+
"aria-label": I.t("editableHtml.responseAreaToolbar", { lng: W }),
|
|
371
375
|
children: /* @__PURE__ */ v("div", {
|
|
372
|
-
className:
|
|
376
|
+
className: m.buttonsContainer,
|
|
373
377
|
children: /* @__PURE__ */ v("button", {
|
|
374
378
|
type: "button",
|
|
375
|
-
className:
|
|
379
|
+
className: m.button,
|
|
376
380
|
onClick: (e) => {
|
|
377
|
-
e.preventDefault(),
|
|
381
|
+
e.preventDefault(), p.chain().focus().deleteSelection().run(), V?.(p.getHTML());
|
|
378
382
|
},
|
|
379
383
|
"aria-label": "Delete response area",
|
|
380
384
|
title: "Delete response area",
|
|
381
|
-
children: /* @__PURE__ */ v(
|
|
385
|
+
children: /* @__PURE__ */ v(g, {})
|
|
382
386
|
})
|
|
383
387
|
})
|
|
384
388
|
}),
|
|
385
|
-
!
|
|
386
|
-
className:
|
|
389
|
+
!Y.hideDefaultToolbar && /* @__PURE__ */ y("div", {
|
|
390
|
+
className: m.defaultToolbar,
|
|
387
391
|
role: "toolbar",
|
|
388
392
|
tabIndex: -1,
|
|
389
|
-
"aria-label":
|
|
393
|
+
"aria-label": I.t("editableHtml.toolbar", { lng: W }),
|
|
390
394
|
children: [
|
|
391
395
|
/* @__PURE__ */ v("div", {
|
|
392
|
-
className:
|
|
393
|
-
children:
|
|
394
|
-
let r = e.isDisabled?.(
|
|
396
|
+
className: m.buttonsContainer,
|
|
397
|
+
children: de.filter((e) => !e.hidden?.(Y)).map((e, t) => {
|
|
398
|
+
let r = e.isDisabled?.(Y), i = e.isActive?.(Y);
|
|
395
399
|
return /* @__PURE__ */ v("button", {
|
|
396
400
|
type: "button",
|
|
397
401
|
disabled: r,
|
|
@@ -399,42 +403,45 @@ function V({ editor: m, classes: h, activePlugins: b, toolbarOpts: x, responseAr
|
|
|
399
403
|
title: e.label,
|
|
400
404
|
"aria-pressed": e.toggle ? !!i : void 0,
|
|
401
405
|
onClick: (t) => {
|
|
402
|
-
t.preventDefault(), e.onClick(
|
|
406
|
+
t.preventDefault(), e.onClick(p);
|
|
403
407
|
},
|
|
404
|
-
className: n(
|
|
408
|
+
className: n(m.button, { [m.active]: i }),
|
|
405
409
|
children: e.icon
|
|
406
410
|
}, t);
|
|
407
411
|
})
|
|
408
412
|
}),
|
|
409
|
-
|
|
413
|
+
_?.includes("responseArea") && /* @__PURE__ */ v("button", {
|
|
410
414
|
type: "button",
|
|
411
415
|
"aria-label": "Insert response area",
|
|
412
416
|
title: "Insert response area",
|
|
413
417
|
onClick: () => {
|
|
414
|
-
|
|
418
|
+
p.chain().focus().insertResponseArea(B.type).run();
|
|
415
419
|
},
|
|
416
|
-
className:
|
|
420
|
+
className: m.button,
|
|
417
421
|
children: /* @__PURE__ */ v(r, {})
|
|
418
422
|
}),
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
423
|
+
J.showDone && /* @__PURE__ */ v(t, {
|
|
424
|
+
language: W,
|
|
425
|
+
onClick: () => {
|
|
426
|
+
V?.(p.getHTML()), p.commands.blur();
|
|
427
|
+
}
|
|
428
|
+
})
|
|
422
429
|
]
|
|
423
430
|
}),
|
|
424
|
-
|
|
425
|
-
editor:
|
|
431
|
+
G && /* @__PURE__ */ v(ae, {
|
|
432
|
+
editor: p,
|
|
426
433
|
opts: {
|
|
427
|
-
...
|
|
434
|
+
...G,
|
|
428
435
|
renderPopOver: (e, t) => console.log("Show popover", t),
|
|
429
436
|
closePopOver: () => console.log("Close popover")
|
|
430
437
|
},
|
|
431
|
-
onClose: () =>
|
|
438
|
+
onClose: () => K(!1)
|
|
432
439
|
})
|
|
433
440
|
]
|
|
434
441
|
});
|
|
435
442
|
}
|
|
436
|
-
var
|
|
437
|
-
|
|
443
|
+
var V = (e) => {
|
|
444
|
+
m();
|
|
438
445
|
let t = {
|
|
439
446
|
defaultToolbar: "defaultToolbar",
|
|
440
447
|
buttonsContainer: "buttonsContainer",
|
|
@@ -454,11 +461,11 @@ var H = (e) => {
|
|
|
454
461
|
label: "label",
|
|
455
462
|
shared: "shared"
|
|
456
463
|
};
|
|
457
|
-
return /* @__PURE__ */ v(
|
|
464
|
+
return /* @__PURE__ */ v(H, { children: /* @__PURE__ */ v(B, {
|
|
458
465
|
...e,
|
|
459
466
|
classes: t
|
|
460
467
|
}) });
|
|
461
|
-
},
|
|
468
|
+
}, H = p("div")(() => ({
|
|
462
469
|
height: 0,
|
|
463
470
|
overflow: "visible",
|
|
464
471
|
"& .defaultToolbar": {
|
|
@@ -537,4 +544,4 @@ var H = (e) => {
|
|
|
537
544
|
"& .shared": { display: "flex" }
|
|
538
545
|
}));
|
|
539
546
|
//#endregion
|
|
540
|
-
export {
|
|
547
|
+
export { V as default };
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
export declare const RawDoneButton: {
|
|
4
|
-
({ onClick, doneButtonRef }: {
|
|
4
|
+
({ onClick, doneButtonRef, language }: {
|
|
5
5
|
onClick: any;
|
|
6
6
|
doneButtonRef: any;
|
|
7
|
+
language: any;
|
|
7
8
|
}): React.JSX.Element;
|
|
8
9
|
propTypes: {
|
|
9
10
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
11
|
doneButtonRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
+
/** The item language, which the button's name follows. */
|
|
13
|
+
language: PropTypes.Requireable<string>;
|
|
11
14
|
};
|
|
12
15
|
};
|
|
13
16
|
export declare const DoneButton: {
|
|
14
|
-
({ onClick, doneButtonRef }: {
|
|
17
|
+
({ onClick, doneButtonRef, language }: {
|
|
15
18
|
onClick: any;
|
|
16
19
|
doneButtonRef: any;
|
|
20
|
+
language: any;
|
|
17
21
|
}): React.JSX.Element;
|
|
18
22
|
propTypes: {
|
|
19
23
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
24
|
doneButtonRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
+
/** The item language, which the button's name follows. */
|
|
26
|
+
language: PropTypes.Requireable<string>;
|
|
21
27
|
};
|
|
22
28
|
};
|
|
@@ -3,24 +3,26 @@ import { styled as e } from "@mui/material/styles";
|
|
|
3
3
|
import t from "prop-types";
|
|
4
4
|
import n from "@mui/material/IconButton";
|
|
5
5
|
import r from "@mui/icons-material/Check";
|
|
6
|
-
import
|
|
6
|
+
import i from "@pie-lib/translator";
|
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
8
|
//#region src/components/common/done-button.tsx
|
|
8
|
-
var
|
|
9
|
+
var { translator: o } = i, s = e(n)({
|
|
9
10
|
verticalAlign: "top",
|
|
10
11
|
width: "28px",
|
|
11
12
|
height: "28px",
|
|
12
13
|
color: "var(--editable-html-toolbar-check, #388E3C)",
|
|
13
14
|
padding: "4px"
|
|
14
|
-
}),
|
|
15
|
-
"aria-label": "
|
|
15
|
+
}), c = ({ onClick: e, doneButtonRef: t, language: n }) => /* @__PURE__ */ a(s, {
|
|
16
|
+
"aria-label": o.t("editableHtml.buttons.done", { lng: n }),
|
|
16
17
|
buttonRef: t,
|
|
17
18
|
onClick: e,
|
|
18
|
-
children: /* @__PURE__ */
|
|
19
|
+
children: /* @__PURE__ */ a(r, {})
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
+
c.propTypes = {
|
|
21
22
|
onClick: t.func,
|
|
22
|
-
doneButtonRef: t.func
|
|
23
|
+
doneButtonRef: t.func,
|
|
24
|
+
language: t.string
|
|
23
25
|
};
|
|
24
|
-
var
|
|
26
|
+
var l = c;
|
|
25
27
|
//#endregion
|
|
26
|
-
export {
|
|
28
|
+
export { l as DoneButton, c as RawDoneButton };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/editable-html-tip-tap",
|
|
3
|
-
"version": "3.0.1-next.
|
|
3
|
+
"version": "3.0.1-next.20261005000911",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,11 +13,11 @@
|
|
|
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.1-next.
|
|
17
|
-
"@pie-lib/math-input": "9.0.1-next.
|
|
18
|
-
"@pie-lib/math-toolbar": "4.0.1-next.
|
|
19
|
-
"@pie-lib/render-ui": "8.0.1-next.
|
|
20
|
-
"@pie-lib/translator": "5.0.1-next.
|
|
16
|
+
"@pie-lib/drag": "5.0.1-next.20261005000911",
|
|
17
|
+
"@pie-lib/math-input": "9.0.1-next.20261005000911",
|
|
18
|
+
"@pie-lib/math-toolbar": "4.0.1-next.20261005000911",
|
|
19
|
+
"@pie-lib/render-ui": "8.0.1-next.20261005000911",
|
|
20
|
+
"@pie-lib/translator": "5.0.1-next.20261005000911",
|
|
21
21
|
"@tiptap/core": "3.31.3",
|
|
22
22
|
"@tiptap/extension-character-count": "3.31.3",
|
|
23
23
|
"@tiptap/extension-color": "3.31.3",
|