@pie-lib/editable-html-tip-tap 2.1.2-next.31 → 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 +12 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PIE_TOOLBAR__CLASS as e } from "../constants.js";
|
|
2
2
|
import { DoneButton as t } from "./common/done-button.js";
|
|
3
|
-
import n from "../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
3
|
+
import { clsx as n } from "../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
4
4
|
import { ToolbarIcon as r } from "./respArea/ToolbarIcon.js";
|
|
5
5
|
import { spanishConfig as i, specialConfig as a } from "./characters/characterUtils.js";
|
|
6
6
|
import o from "./icons/TextAlign.js";
|
|
@@ -13,44 +13,49 @@ import { styled as v, useTheme as y } from "@mui/material/styles";
|
|
|
13
13
|
import { NodeSelection as b } from "prosemirror-state";
|
|
14
14
|
import x from "@mui/icons-material/Delete";
|
|
15
15
|
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
16
|
-
import w from "@
|
|
17
|
-
import T from "@mui/icons-material/
|
|
18
|
-
import E from "@mui/icons-material/
|
|
19
|
-
import D from "@mui/icons-material/
|
|
20
|
-
import O from "@mui/icons-material/
|
|
21
|
-
import k from "@mui/icons-material/
|
|
22
|
-
import A from "@mui/icons-material/
|
|
23
|
-
import j from "@mui/icons-material/
|
|
24
|
-
import M from "@mui/icons-material/
|
|
25
|
-
import N from "@mui/icons-material/
|
|
26
|
-
import P from "@mui/icons-material/
|
|
27
|
-
import F from "@mui/icons-material/
|
|
28
|
-
import ee from "@mui/icons-material/
|
|
29
|
-
import I from "@mui/icons-material/
|
|
30
|
-
import L from "@mui/icons-material/
|
|
31
|
-
import R from "@mui/icons-material/
|
|
16
|
+
import { color as w } from "@pie-lib/render-ui";
|
|
17
|
+
import T from "@mui/icons-material/FormatBold";
|
|
18
|
+
import E from "@mui/icons-material/FormatItalic";
|
|
19
|
+
import D from "@mui/icons-material/FormatStrikethrough";
|
|
20
|
+
import O from "@mui/icons-material/Code";
|
|
21
|
+
import k from "@mui/icons-material/GridOn";
|
|
22
|
+
import A from "@mui/icons-material/FormatListBulleted";
|
|
23
|
+
import j from "@mui/icons-material/FormatListNumbered";
|
|
24
|
+
import M from "@mui/icons-material/FormatUnderlined";
|
|
25
|
+
import N from "@mui/icons-material/Functions";
|
|
26
|
+
import P from "@mui/icons-material/Image";
|
|
27
|
+
import F from "@mui/icons-material/Redo";
|
|
28
|
+
import ee from "@mui/icons-material/Undo";
|
|
29
|
+
import I from "@mui/icons-material/FormatQuote";
|
|
30
|
+
import L from "@mui/icons-material/Theaters";
|
|
31
|
+
import R from "@mui/icons-material/VolumeUp";
|
|
32
|
+
import z from "@mui/icons-material/BorderAll";
|
|
32
33
|
//#region src/components/MenuBar.tsx
|
|
33
|
-
var
|
|
34
|
+
var B = () => /* @__PURE__ */ S("svg", {
|
|
34
35
|
xmlns: "http://www.w3.org/2000/svg",
|
|
35
36
|
height: "24px",
|
|
36
37
|
viewBox: "0 0 24 24",
|
|
37
38
|
width: "24px",
|
|
38
39
|
fill: "none",
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
focusable: "false",
|
|
39
42
|
children: /* @__PURE__ */ S("path", {
|
|
40
43
|
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",
|
|
41
44
|
fill: "currentColor"
|
|
42
45
|
})
|
|
43
|
-
}),
|
|
46
|
+
}), V = () => /* @__PURE__ */ S("svg", {
|
|
44
47
|
xmlns: "http://www.w3.org/2000/svg",
|
|
45
48
|
height: "24px",
|
|
46
49
|
viewBox: "0 0 24 24",
|
|
47
50
|
width: "24px",
|
|
48
51
|
fill: "none",
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
focusable: "false",
|
|
49
54
|
children: /* @__PURE__ */ S("path", {
|
|
50
55
|
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",
|
|
51
56
|
fill: "currentColor"
|
|
52
57
|
})
|
|
53
|
-
}),
|
|
58
|
+
}), H = () => /* @__PURE__ */ S("svg", {
|
|
54
59
|
width: "30",
|
|
55
60
|
height: "28",
|
|
56
61
|
viewBox: "0 0 30 28",
|
|
@@ -60,12 +65,14 @@ var z = () => /* @__PURE__ */ S("svg", {
|
|
|
60
65
|
width: "20px",
|
|
61
66
|
height: "18px"
|
|
62
67
|
},
|
|
68
|
+
"aria-hidden": "true",
|
|
69
|
+
focusable: "false",
|
|
63
70
|
children: /* @__PURE__ */ S("path", {
|
|
64
71
|
d: "M27 4V24H29C29.5 24 30 24.5 30 25V27C30 27.5625 29.5 28 29 28H19C18.4375 28 18 27.5625 18 27V25C18 24.5 18.4375 24 19 24H21V16H9V24H11C11.5 24 12 24.5 12 25V27C12 27.5625 11.5 28 11 28H1C0.4375 28 0 27.5625 0 27V25C0 24.5 0.4375 24 1 24H3V4H1C0.4375 4 0 3.5625 0 3V1C0 0.5 0.4375 0 1 0H11C11.5 0 12 0.5 12 1V3C12 3.5625 11.5 4 11 4H9V12H21V4H19C18.4375 4 18 3.5625 18 3V1C18 0.5 18.4375 0 19 0H29C29.5 0 30 0.5 30 1V3C30 3.5625 29.5 4 29 4H27Z",
|
|
65
72
|
fill: "currentColor"
|
|
66
73
|
})
|
|
67
74
|
});
|
|
68
|
-
function
|
|
75
|
+
function U({ editor: v, classes: y, activePlugins: w, toolbarOpts: U, responseAreaProps: W, onChange: G, autoWidthToolbar: K }) {
|
|
69
76
|
let [q, J] = g(!1), Y = U ?? {}, X = _({
|
|
70
77
|
editor: v,
|
|
71
78
|
selector: (e) => {
|
|
@@ -78,6 +85,7 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
78
85
|
hideDefaultToolbar: r,
|
|
79
86
|
hasTextSelectionInTable: i,
|
|
80
87
|
isFocused: e.editor?.isFocused,
|
|
88
|
+
toolbarOpened: e.editor?._toolbarOpened ?? !1,
|
|
81
89
|
isBold: e.editor.isActive("bold") ?? !1,
|
|
82
90
|
canBold: e.editor.can().chain().toggleBold().run() ?? !1,
|
|
83
91
|
isTable: e.editor.isActive("table") ?? !1,
|
|
@@ -113,7 +121,7 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
113
121
|
[y.toolbarWithNoDone]: !0,
|
|
114
122
|
[y.toolbarTop]: Y.position === "top",
|
|
115
123
|
[y.toolbarRight]: Y.alignment === "right",
|
|
116
|
-
[y.focused]: Y.alwaysVisible || X.isFocused && !
|
|
124
|
+
[y.focused]: Y.alwaysVisible || X.isFocused && !X.toolbarOpened && !X.hideDefaultToolbar,
|
|
117
125
|
[y.autoWidth]: Z,
|
|
118
126
|
[y.fullWidth]: !Z,
|
|
119
127
|
[y.hidden]: Y.isHidden === !0
|
|
@@ -121,18 +129,20 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
121
129
|
e.preventDefault();
|
|
122
130
|
}, ne = h(() => [
|
|
123
131
|
{
|
|
124
|
-
icon: /* @__PURE__ */ S(
|
|
132
|
+
icon: /* @__PURE__ */ S(k, {}),
|
|
133
|
+
label: "Insert table",
|
|
125
134
|
onClick: (e) => e.chain().focus().insertTable({
|
|
126
135
|
rows: 2,
|
|
127
136
|
cols: 2,
|
|
128
137
|
withHeaderRow: !1
|
|
129
138
|
}).run(),
|
|
130
|
-
hidden: (e) => !
|
|
139
|
+
hidden: (e) => !w?.includes("table") || e.isTable,
|
|
131
140
|
isActive: (e) => e.isTable,
|
|
132
141
|
isDisabled: (e) => !e.canTable
|
|
133
142
|
},
|
|
134
143
|
{
|
|
135
144
|
icon: /* @__PURE__ */ S(l, {}),
|
|
145
|
+
label: "Add table row",
|
|
136
146
|
onClick: (e) => e.chain().focus().addRowAfter().run(),
|
|
137
147
|
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
138
148
|
isActive: (e) => e.isTable,
|
|
@@ -140,6 +150,7 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
140
150
|
},
|
|
141
151
|
{
|
|
142
152
|
icon: /* @__PURE__ */ S(d, {}),
|
|
153
|
+
label: "Remove table row",
|
|
143
154
|
onClick: (e) => e.chain().focus().deleteRow().run(),
|
|
144
155
|
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
145
156
|
isActive: (e) => e.isTable,
|
|
@@ -147,6 +158,7 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
147
158
|
},
|
|
148
159
|
{
|
|
149
160
|
icon: /* @__PURE__ */ S(c, {}),
|
|
161
|
+
label: "Add table column",
|
|
150
162
|
onClick: (e) => e.chain().focus().addColumnAfter().run(),
|
|
151
163
|
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
152
164
|
isActive: (e) => e.isTable,
|
|
@@ -154,6 +166,7 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
154
166
|
},
|
|
155
167
|
{
|
|
156
168
|
icon: /* @__PURE__ */ S(u, {}),
|
|
169
|
+
label: "Remove table column",
|
|
157
170
|
onClick: (e) => e.chain().focus().deleteColumn().run(),
|
|
158
171
|
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
159
172
|
isActive: (e) => e.isTable,
|
|
@@ -161,13 +174,16 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
161
174
|
},
|
|
162
175
|
{
|
|
163
176
|
icon: /* @__PURE__ */ S(f, {}),
|
|
177
|
+
label: "Remove table",
|
|
164
178
|
onClick: (e) => e.chain().focus().deleteTable().run(),
|
|
165
179
|
hidden: (e) => !(e.isTable && !e.hasTextSelectionInTable),
|
|
166
180
|
isActive: (e) => e.isTable,
|
|
167
181
|
isDisabled: (e) => !e.canTable
|
|
168
182
|
},
|
|
169
183
|
{
|
|
170
|
-
icon: /* @__PURE__ */ S(
|
|
184
|
+
icon: /* @__PURE__ */ S(z, {}),
|
|
185
|
+
label: "Table borders",
|
|
186
|
+
toggle: !0,
|
|
171
187
|
onClick: (e) => {
|
|
172
188
|
let t = e.getAttributes("table"), n = {
|
|
173
189
|
...t,
|
|
@@ -180,64 +196,81 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
180
196
|
isDisabled: (e) => !e.canTable
|
|
181
197
|
},
|
|
182
198
|
{
|
|
183
|
-
icon: /* @__PURE__ */ S(
|
|
199
|
+
icon: /* @__PURE__ */ S(T, {}),
|
|
200
|
+
label: "Bold",
|
|
201
|
+
toggle: !0,
|
|
184
202
|
onClick: (e) => e.chain().focus().toggleBold().run(),
|
|
185
|
-
hidden: () => !
|
|
203
|
+
hidden: () => !w?.includes("bold"),
|
|
186
204
|
isActive: (e) => e.isBold,
|
|
187
205
|
isDisabled: (e) => !e.canBold
|
|
188
206
|
},
|
|
189
207
|
{
|
|
190
|
-
icon: /* @__PURE__ */ S(
|
|
208
|
+
icon: /* @__PURE__ */ S(E, {}),
|
|
209
|
+
label: "Italic",
|
|
210
|
+
toggle: !0,
|
|
191
211
|
onClick: (e) => e.chain().focus().toggleItalic().run(),
|
|
192
|
-
hidden: () => !
|
|
212
|
+
hidden: () => !w?.includes("italic"),
|
|
193
213
|
isActive: (e) => e.isItalic,
|
|
194
214
|
isDisabled: (e) => !e.canItalic
|
|
195
215
|
},
|
|
196
216
|
{
|
|
197
|
-
icon: /* @__PURE__ */ S(
|
|
217
|
+
icon: /* @__PURE__ */ S(D, {}),
|
|
218
|
+
label: "Strikethrough",
|
|
219
|
+
toggle: !0,
|
|
198
220
|
onClick: (e) => e.chain().focus().toggleStrike().run(),
|
|
199
|
-
hidden: () => !
|
|
221
|
+
hidden: () => !w?.includes("strikethrough"),
|
|
200
222
|
isActive: (e) => e.isStrike,
|
|
201
223
|
isDisabled: (e) => !e.canStrike
|
|
202
224
|
},
|
|
203
225
|
{
|
|
204
|
-
icon: /* @__PURE__ */ S(
|
|
226
|
+
icon: /* @__PURE__ */ S(O, {}),
|
|
227
|
+
label: "Code",
|
|
228
|
+
toggle: !0,
|
|
205
229
|
onClick: (e) => e.chain().focus().toggleCode().run(),
|
|
206
|
-
hidden: () => !
|
|
230
|
+
hidden: () => !w?.includes("code"),
|
|
207
231
|
isActive: (e) => e.isCode,
|
|
208
232
|
isDisabled: (e) => !e.canCode
|
|
209
233
|
},
|
|
210
234
|
{
|
|
211
|
-
icon: /* @__PURE__ */ S(
|
|
235
|
+
icon: /* @__PURE__ */ S(M, {}),
|
|
236
|
+
label: "Underline",
|
|
237
|
+
toggle: !0,
|
|
212
238
|
onClick: (e) => e.chain().focus().toggleUnderline().run(),
|
|
213
|
-
hidden: () => !
|
|
239
|
+
hidden: () => !w?.includes("underline"),
|
|
214
240
|
isActive: (e) => e.isUnderline
|
|
215
241
|
},
|
|
216
242
|
{
|
|
217
|
-
icon: /* @__PURE__ */ S(
|
|
243
|
+
icon: /* @__PURE__ */ S(V, {}),
|
|
244
|
+
label: "Subscript",
|
|
245
|
+
toggle: !0,
|
|
218
246
|
onClick: (e) => e.chain().focus().toggleSubscript().run(),
|
|
219
|
-
hidden: () => !
|
|
247
|
+
hidden: () => !w?.includes("subscript"),
|
|
220
248
|
isActive: (e) => e.isSubScript
|
|
221
249
|
},
|
|
222
250
|
{
|
|
223
|
-
icon: /* @__PURE__ */ S(
|
|
251
|
+
icon: /* @__PURE__ */ S(B, {}),
|
|
252
|
+
label: "Superscript",
|
|
253
|
+
toggle: !0,
|
|
224
254
|
onClick: (e) => e.chain().focus().toggleSuperscript().run(),
|
|
225
|
-
hidden: () => !
|
|
255
|
+
hidden: () => !w?.includes("superscript"),
|
|
226
256
|
isActive: (e) => e.isSuperScript
|
|
227
257
|
},
|
|
228
258
|
{
|
|
229
|
-
icon: /* @__PURE__ */ S(
|
|
230
|
-
|
|
259
|
+
icon: /* @__PURE__ */ S(P, {}),
|
|
260
|
+
label: "Insert image",
|
|
261
|
+
hidden: () => !w?.includes("image"),
|
|
231
262
|
onClick: (e) => e.chain().focus().setImageUploadNode().run()
|
|
232
263
|
},
|
|
233
264
|
{
|
|
234
|
-
icon: /* @__PURE__ */ S(
|
|
235
|
-
|
|
265
|
+
icon: /* @__PURE__ */ S(L, {}),
|
|
266
|
+
label: "Insert video",
|
|
267
|
+
hidden: () => !w?.includes("video"),
|
|
236
268
|
onClick: (e) => e.chain().focus().insertMedia({ type: "video" }).run()
|
|
237
269
|
},
|
|
238
270
|
{
|
|
239
|
-
icon: /* @__PURE__ */ S(
|
|
240
|
-
|
|
271
|
+
icon: /* @__PURE__ */ S(R, {}),
|
|
272
|
+
label: "Insert audio",
|
|
273
|
+
hidden: () => !w?.includes("audio"),
|
|
241
274
|
onClick: (e) => e.chain().focus().insertMedia({
|
|
242
275
|
type: "audio",
|
|
243
276
|
tag: "audio"
|
|
@@ -245,66 +278,81 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
245
278
|
},
|
|
246
279
|
{
|
|
247
280
|
icon: /* @__PURE__ */ S(s, {}),
|
|
248
|
-
|
|
281
|
+
label: "CSS classes",
|
|
282
|
+
hidden: () => !w?.includes("css"),
|
|
249
283
|
onClick: (e) => e.commands.openCSSClassDialog()
|
|
250
284
|
},
|
|
251
285
|
{
|
|
252
|
-
icon: /* @__PURE__ */ S(
|
|
253
|
-
|
|
286
|
+
icon: /* @__PURE__ */ S(I, {}),
|
|
287
|
+
label: "Blockquote",
|
|
288
|
+
toggle: !0,
|
|
289
|
+
hidden: () => !w?.includes("blockquote"),
|
|
254
290
|
onClick: (e) => e.chain().focus().toggleBlockquote().run(),
|
|
255
291
|
isActive: (e) => e.isBlockquote
|
|
256
292
|
},
|
|
257
293
|
{
|
|
258
|
-
icon: /* @__PURE__ */ S(
|
|
259
|
-
|
|
294
|
+
icon: /* @__PURE__ */ S(H, {}),
|
|
295
|
+
label: "Heading",
|
|
296
|
+
toggle: !0,
|
|
297
|
+
hidden: () => !w?.includes("h3"),
|
|
260
298
|
onClick: (e) => e.chain().focus().toggleHeadingParagraph().run(),
|
|
261
299
|
isActive: (e) => e.isHeadingParagraph
|
|
262
300
|
},
|
|
263
301
|
{
|
|
264
|
-
icon: /* @__PURE__ */ S(
|
|
265
|
-
|
|
302
|
+
icon: /* @__PURE__ */ S(N, {}),
|
|
303
|
+
label: "Insert math",
|
|
304
|
+
hidden: () => !w?.includes("math"),
|
|
266
305
|
onClick: (e) => e.chain().focus().insertMath("").run()
|
|
267
306
|
},
|
|
268
307
|
{
|
|
269
308
|
icon: /* @__PURE__ */ S(p, { letter: "ñ" }),
|
|
270
|
-
|
|
309
|
+
label: "Spanish characters (ñ)",
|
|
310
|
+
hidden: () => !w?.includes("languageCharacters"),
|
|
271
311
|
onClick: () => J(i)
|
|
272
312
|
},
|
|
273
313
|
{
|
|
274
314
|
icon: /* @__PURE__ */ S(p, { letter: "€" }),
|
|
275
|
-
|
|
315
|
+
label: "Special characters (€)",
|
|
316
|
+
hidden: () => w?.filter((e) => e === "languageCharacters").length !== 2,
|
|
276
317
|
onClick: () => J(a)
|
|
277
318
|
},
|
|
278
319
|
{
|
|
279
320
|
icon: /* @__PURE__ */ S(o, { editor: v }),
|
|
280
|
-
|
|
321
|
+
label: "Text alignment",
|
|
322
|
+
hidden: () => !w?.includes("text-align"),
|
|
281
323
|
onClick: () => {}
|
|
282
324
|
},
|
|
283
325
|
{
|
|
284
|
-
icon: /* @__PURE__ */ S(
|
|
285
|
-
|
|
326
|
+
icon: /* @__PURE__ */ S(A, {}),
|
|
327
|
+
label: "Bulleted list",
|
|
328
|
+
toggle: !0,
|
|
329
|
+
hidden: () => !w?.includes("bulleted-list"),
|
|
286
330
|
onClick: (e) => e.chain().focus().toggleBulletList().run(),
|
|
287
331
|
isActive: (e) => e.isBulletList
|
|
288
332
|
},
|
|
289
333
|
{
|
|
290
|
-
icon: /* @__PURE__ */ S(
|
|
291
|
-
|
|
334
|
+
icon: /* @__PURE__ */ S(j, {}),
|
|
335
|
+
label: "Numbered list",
|
|
336
|
+
toggle: !0,
|
|
337
|
+
hidden: () => !w?.includes("numbered-list"),
|
|
292
338
|
onClick: (e) => e.chain().focus().toggleOrderedList().run(),
|
|
293
339
|
isActive: (e) => e.isOrderedList
|
|
294
340
|
},
|
|
295
341
|
{
|
|
296
|
-
icon: /* @__PURE__ */ S(
|
|
297
|
-
|
|
342
|
+
icon: /* @__PURE__ */ S(ee, {}),
|
|
343
|
+
label: "Undo",
|
|
344
|
+
hidden: () => !w?.includes("undo"),
|
|
298
345
|
onClick: (e) => e.chain().focus().undo().run(),
|
|
299
346
|
isDisabled: (e) => !e.canUndo
|
|
300
347
|
},
|
|
301
348
|
{
|
|
302
|
-
icon: /* @__PURE__ */ S(
|
|
303
|
-
|
|
349
|
+
icon: /* @__PURE__ */ S(F, {}),
|
|
350
|
+
label: "Redo",
|
|
351
|
+
hidden: () => !w?.includes("redo"),
|
|
304
352
|
onClick: (e) => e.chain().focus().redo().run(),
|
|
305
353
|
isDisabled: (e) => !e.canRedo
|
|
306
354
|
}
|
|
307
|
-
], [
|
|
355
|
+
], [w, v]), re = X.hideDefaultToolbar && X.currentNode?.type?.name === "drag_in_the_blank";
|
|
308
356
|
return /* @__PURE__ */ C("div", {
|
|
309
357
|
className: Q,
|
|
310
358
|
style: { ...$ },
|
|
@@ -322,6 +370,7 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
322
370
|
e.preventDefault(), v.chain().focus().deleteSelection().run(), G?.(v.getHTML());
|
|
323
371
|
},
|
|
324
372
|
"aria-label": "Delete response area",
|
|
373
|
+
title: "Delete response area",
|
|
325
374
|
children: /* @__PURE__ */ S(x, {})
|
|
326
375
|
})
|
|
327
376
|
})
|
|
@@ -335,7 +384,11 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
335
384
|
children: ne.filter((e) => !e.hidden?.(X)).map((e, t) => {
|
|
336
385
|
let r = e.isDisabled?.(X), i = e.isActive?.(X);
|
|
337
386
|
return /* @__PURE__ */ S("button", {
|
|
387
|
+
type: "button",
|
|
338
388
|
disabled: r,
|
|
389
|
+
"aria-label": e.label,
|
|
390
|
+
title: e.label,
|
|
391
|
+
"aria-pressed": e.toggle ? !!i : void 0,
|
|
339
392
|
onClick: (t) => {
|
|
340
393
|
t.preventDefault(), e.onClick(v);
|
|
341
394
|
},
|
|
@@ -344,7 +397,10 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
344
397
|
}, t);
|
|
345
398
|
})
|
|
346
399
|
}),
|
|
347
|
-
|
|
400
|
+
w?.includes("responseArea") && /* @__PURE__ */ S("button", {
|
|
401
|
+
type: "button",
|
|
402
|
+
"aria-label": "Insert response area",
|
|
403
|
+
title: "Insert response area",
|
|
348
404
|
onClick: () => {
|
|
349
405
|
v.chain().focus().insertResponseArea(W.type).run();
|
|
350
406
|
},
|
|
@@ -368,12 +424,12 @@ function H({ editor: v, classes: y, activePlugins: H, toolbarOpts: U, responseAr
|
|
|
368
424
|
]
|
|
369
425
|
});
|
|
370
426
|
}
|
|
371
|
-
var
|
|
427
|
+
var W = (e) => {
|
|
372
428
|
y();
|
|
373
429
|
let t = {
|
|
374
430
|
defaultToolbar: "defaultToolbar",
|
|
375
431
|
buttonsContainer: "buttonsContainer",
|
|
376
|
-
button: "
|
|
432
|
+
button: "toolbarButton",
|
|
377
433
|
active: "active",
|
|
378
434
|
disabled: "disabled",
|
|
379
435
|
isActive: "isActive",
|
|
@@ -389,11 +445,11 @@ var U = (e) => {
|
|
|
389
445
|
label: "label",
|
|
390
446
|
shared: "shared"
|
|
391
447
|
};
|
|
392
|
-
return /* @__PURE__ */ S(
|
|
448
|
+
return /* @__PURE__ */ S(G, { children: /* @__PURE__ */ S(U, {
|
|
393
449
|
...e,
|
|
394
450
|
classes: t
|
|
395
451
|
}) });
|
|
396
|
-
},
|
|
452
|
+
}, G = v("div")(() => ({
|
|
397
453
|
"& .defaultToolbar": {
|
|
398
454
|
display: "flex",
|
|
399
455
|
width: "100%",
|
|
@@ -404,21 +460,25 @@ var U = (e) => {
|
|
|
404
460
|
display: "flex",
|
|
405
461
|
width: "100%"
|
|
406
462
|
},
|
|
407
|
-
"& .
|
|
463
|
+
"& .toolbarButton": {
|
|
408
464
|
color: "grey",
|
|
409
465
|
display: "inline-flex",
|
|
410
466
|
padding: "2px",
|
|
411
467
|
background: "none",
|
|
412
468
|
border: "none",
|
|
413
469
|
cursor: "pointer",
|
|
414
|
-
"
|
|
415
|
-
|
|
470
|
+
"& svg": {
|
|
471
|
+
width: "24px",
|
|
472
|
+
height: "24px"
|
|
473
|
+
},
|
|
474
|
+
"&:hover": { color: w.text() },
|
|
475
|
+
"&:focus": { outline: `2px solid ${w.buttonFocusOutline()}` }
|
|
416
476
|
},
|
|
417
|
-
"& .active": { color:
|
|
477
|
+
"& .active": { color: w.text() },
|
|
418
478
|
"& .disabled": {
|
|
419
479
|
opacity: .7,
|
|
420
480
|
cursor: "not-allowed",
|
|
421
|
-
"& :hover": { color:
|
|
481
|
+
"& :hover": { color: w.disabled() }
|
|
422
482
|
},
|
|
423
483
|
"& .isActive": {
|
|
424
484
|
background: "var(--purple)",
|
|
@@ -459,4 +519,4 @@ var U = (e) => {
|
|
|
459
519
|
"& .shared": { display: "flex" }
|
|
460
520
|
}));
|
|
461
521
|
//#endregion
|
|
462
|
-
export {
|
|
522
|
+
export { W as default };
|
|
@@ -74,12 +74,12 @@ var u = o("div", { shouldForwardProp: (e) => !["noBorder", "error"].includes(e)
|
|
|
74
74
|
color: l.text(),
|
|
75
75
|
backgroundColor: l.background()
|
|
76
76
|
},
|
|
77
|
-
"& table:not([border=\"1\"]) tr": { borderTop:
|
|
77
|
+
"& table:not([border=\"1\"]) tr": { borderTop: `1px solid ${l.tableGridLight()}` },
|
|
78
78
|
"& td, th": {
|
|
79
79
|
padding: ".6em 1em",
|
|
80
80
|
textAlign: "center"
|
|
81
81
|
},
|
|
82
|
-
"& table:not([border=\"1\"]) td, th": { border:
|
|
82
|
+
"& table:not([border=\"1\"]) td, th": { border: `1px solid ${l.tableGridLight()}` },
|
|
83
83
|
...n && { border: `2px solid ${e.palette.error.main} !important` }
|
|
84
84
|
})), d = o("div", { shouldForwardProp: (e) => !["disableScrollbar", "highlightShape"].includes(e) })(({ theme: e, disableScrollbar: t, highlightShape: n }) => ({
|
|
85
85
|
position: "relative",
|
|
@@ -104,7 +104,20 @@ function p(o) {
|
|
|
104
104
|
}, [h, S]), n(() => {
|
|
105
105
|
if (o.adjustWidthForLimit) {
|
|
106
106
|
let e = document.createElement("p");
|
|
107
|
-
e.style.visibility = "hidden", e.style.position = "absolute", e.textContent = "W".repeat(o.charactersLimit)
|
|
107
|
+
e.style.visibility = "hidden", e.style.position = "absolute", e.style.whiteSpace = "nowrap", e.textContent = "W".repeat(o.charactersLimit);
|
|
108
|
+
let t = window.getComputedStyle(m.current);
|
|
109
|
+
[
|
|
110
|
+
"fontFamily",
|
|
111
|
+
"fontSize",
|
|
112
|
+
"fontWeight",
|
|
113
|
+
"fontStyle",
|
|
114
|
+
"letterSpacing",
|
|
115
|
+
"wordSpacing",
|
|
116
|
+
"textTransform",
|
|
117
|
+
"lineHeight"
|
|
118
|
+
].forEach((n) => {
|
|
119
|
+
e.style[n] = t[n];
|
|
120
|
+
}), document.body.appendChild(e), p(`${e.offsetWidth + 27}px`), e.remove();
|
|
108
121
|
}
|
|
109
122
|
}, [o.adjustWidthForLimit, o.charactersLimit]);
|
|
110
123
|
let j = r(() => ({
|
|
@@ -2,23 +2,28 @@ import e from "react";
|
|
|
2
2
|
import { styled as t } from "@mui/material/styles";
|
|
3
3
|
import n from "prop-types";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
import i from "
|
|
5
|
+
import { color as i } from "@pie-lib/render-ui";
|
|
6
|
+
import a from "debug";
|
|
6
7
|
//#region src/components/common/toolbar-buttons.tsx
|
|
7
|
-
var
|
|
8
|
+
var o = t("button", { shouldForwardProp: (e) => ![
|
|
8
9
|
"active",
|
|
9
10
|
"disabled",
|
|
10
11
|
"extraStyles"
|
|
11
|
-
].includes(e) })(({
|
|
12
|
-
color:
|
|
12
|
+
].includes(e) })(({ active: e, disabled: t }) => ({
|
|
13
|
+
color: e ? i.text() : i.disabled(),
|
|
13
14
|
display: "inline-flex",
|
|
14
15
|
padding: "2px",
|
|
15
16
|
background: "none",
|
|
16
17
|
border: "none",
|
|
17
|
-
cursor:
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
18
|
+
cursor: t ? "not-allowed" : "pointer",
|
|
19
|
+
"& svg": {
|
|
20
|
+
width: "24px",
|
|
21
|
+
height: "24px"
|
|
22
|
+
},
|
|
23
|
+
"&:hover": { color: t ? i.disabled() : i.text() },
|
|
24
|
+
"&:focus": { outline: `2px solid ${i.buttonFocusOutline()}` },
|
|
25
|
+
...t && { opacity: .7 }
|
|
26
|
+
})), s = a("pie-elements:editable-html:raw-button");
|
|
22
27
|
(class extends e.Component {
|
|
23
28
|
static propTypes = {
|
|
24
29
|
onClick: n.func.isRequired,
|
|
@@ -31,33 +36,33 @@ var a = t("button", { shouldForwardProp: (e) => ![
|
|
|
31
36
|
super(e);
|
|
32
37
|
}
|
|
33
38
|
onClick = (e) => {
|
|
34
|
-
|
|
39
|
+
s("[onClick]"), e.preventDefault();
|
|
35
40
|
let { onClick: t } = this.props;
|
|
36
41
|
t(e);
|
|
37
42
|
};
|
|
38
43
|
onKeyDown = (e) => {
|
|
39
44
|
if (e.key === "Enter" || e.key === " ") {
|
|
40
|
-
|
|
45
|
+
s("[onKeyDown]"), e.preventDefault();
|
|
41
46
|
let { onClick: t } = this.props;
|
|
42
47
|
t(e);
|
|
43
48
|
}
|
|
44
49
|
};
|
|
45
50
|
render() {
|
|
46
|
-
let { active: e, children: t, disabled: n, extraStyles: i, ariaLabel:
|
|
47
|
-
return /* @__PURE__ */ r(
|
|
51
|
+
let { active: e, children: t, disabled: n, extraStyles: i, ariaLabel: a } = this.props;
|
|
52
|
+
return /* @__PURE__ */ r(o, {
|
|
48
53
|
style: i,
|
|
49
54
|
active: e,
|
|
50
55
|
disabled: n,
|
|
51
56
|
onMouseDown: this.onClick,
|
|
52
57
|
onKeyDown: this.onKeyDown,
|
|
53
|
-
"aria-label":
|
|
58
|
+
"aria-label": a,
|
|
54
59
|
"aria-pressed": e,
|
|
55
60
|
tabIndex: 0,
|
|
56
61
|
children: t
|
|
57
62
|
});
|
|
58
63
|
}
|
|
59
64
|
});
|
|
60
|
-
var
|
|
65
|
+
var c = class extends e.Component {
|
|
61
66
|
static propTypes = {
|
|
62
67
|
onToggle: n.func.isRequired,
|
|
63
68
|
mark: n.string,
|
|
@@ -76,7 +81,7 @@ var s = class extends e.Component {
|
|
|
76
81
|
};
|
|
77
82
|
render() {
|
|
78
83
|
let { children: e, active: t, label: n } = this.props;
|
|
79
|
-
return /* @__PURE__ */ r(
|
|
84
|
+
return /* @__PURE__ */ r(o, {
|
|
80
85
|
active: t,
|
|
81
86
|
onMouseDown: this.onToggle,
|
|
82
87
|
"aria-pressed": t,
|
|
@@ -86,6 +91,6 @@ var s = class extends e.Component {
|
|
|
86
91
|
children: e
|
|
87
92
|
});
|
|
88
93
|
}
|
|
89
|
-
};
|
|
94
|
+
}, l = c;
|
|
90
95
|
//#endregion
|
|
91
|
-
export {
|
|
96
|
+
export { l as MarkButton, c as RawMarkButton };
|