@flozy/editor 4.0.0 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +9 -14
- package/dist/Editor/CommonEditor.js +11 -7
- package/dist/Editor/Editor.css +36 -3
- package/dist/Editor/Elements/AI/AIInput.js +16 -12
- package/dist/Editor/Elements/AI/PopoverAIInput.js +7 -8
- package/dist/Editor/Elements/AI/Styles.js +0 -1
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +15 -4
- package/dist/Editor/Elements/Carousel/CarouselButton.js +2 -1
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +3 -1
- package/dist/Editor/Elements/Color Picker/Styles.js +1 -0
- package/dist/Editor/Elements/Link/LinkPopup.js +66 -14
- package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -1
- package/dist/Editor/Elements/Signature/Signature.css +13 -6
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +2 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +172 -32
- package/dist/Editor/Elements/SimpleText/index.js +11 -1
- package/dist/Editor/Elements/SimpleText/style.js +1 -1
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +1 -1
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +2 -2
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +32 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/CustomSelectTool.js +3 -0
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +59 -0
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +91 -19
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +56 -39
- package/dist/Editor/Toolbar/toolbarGroups.js +5 -5
- package/dist/Editor/common/EditorIcons.js +7 -7
- package/dist/Editor/common/Icon.js +25 -26
- package/dist/Editor/common/ImageList.js +16 -3
- package/dist/Editor/common/ImageSelector/ImageSelector.js +30 -9
- package/dist/Editor/common/ImageSelector/Styles.js +2 -1
- package/dist/Editor/common/MentionsPopup/Styles.js +1 -1
- package/dist/Editor/common/Shorthands/elements.js +9 -9
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +26 -20
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +18 -16
- package/dist/Editor/common/iconListV2.js +843 -0
- package/dist/Editor/commonStyle.js +6 -0
- package/dist/Editor/helper/theme.js +2 -1
- package/package.json +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
|
-
import { Dialog, DialogTitle, DialogContent, DialogActions, Button, IconButton, Grid, TextField, Typography, Tabs, Tab } from "@mui/material";
|
2
|
+
import { Dialog, DialogTitle, DialogContent, DialogActions, Button, IconButton, Grid, TextField, Typography, Tabs, Tab, InputAdornment } from "@mui/material";
|
3
3
|
import CloseIcon from "@mui/icons-material/Close";
|
4
4
|
import DatePicker from "react-datepicker";
|
5
5
|
import "react-datepicker/dist/react-datepicker.css";
|
@@ -9,6 +9,7 @@ import { DrawSignature, PencilIcon, TypeSignature, UploadSignature } from "../..
|
|
9
9
|
import useCommonStyle from "../../commonStyle";
|
10
10
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
11
11
|
import { validationMethods } from "../Form/FormElements/validations";
|
12
|
+
import { CalenderDownIconSignature, CalenderIconSignature } from "../../common/iconListV2";
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
14
15
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -135,7 +136,15 @@ const SignaturePopup = props => {
|
|
135
136
|
open: open,
|
136
137
|
onClose: handleClose,
|
137
138
|
fullWidth: true,
|
138
|
-
|
139
|
+
PaperProps: {
|
140
|
+
sx: {
|
141
|
+
borderRadius: '8px',
|
142
|
+
boxShadow: "0px 4px 10px 0px #00000029",
|
143
|
+
overflowY: tab === 0 ? "hidden" : "auto",
|
144
|
+
maxWidth: "560px",
|
145
|
+
...classes.signaturePopup
|
146
|
+
}
|
147
|
+
},
|
139
148
|
children: /*#__PURE__*/_jsx(Grid, {
|
140
149
|
container: true,
|
141
150
|
children: /*#__PURE__*/_jsxs(Grid, {
|
@@ -156,9 +165,13 @@ const SignaturePopup = props => {
|
|
156
165
|
item: true,
|
157
166
|
children: /*#__PURE__*/_jsx(Typography, {
|
158
167
|
variant: "h6",
|
159
|
-
className:
|
168
|
+
className: `${classes.popupTitle2}`,
|
160
169
|
color: "primary",
|
161
|
-
|
170
|
+
sx: {
|
171
|
+
fontWeight: 600,
|
172
|
+
color: "#000000"
|
173
|
+
},
|
174
|
+
children: "Signature"
|
162
175
|
})
|
163
176
|
}), /*#__PURE__*/_jsx(Grid, {
|
164
177
|
item: true,
|
@@ -198,24 +211,39 @@ const SignaturePopup = props => {
|
|
198
211
|
children: [/*#__PURE__*/_jsx(Tab, {
|
199
212
|
label: /*#__PURE__*/_jsxs(Grid, {
|
200
213
|
className: "dflex alignCenter",
|
201
|
-
children: [/*#__PURE__*/_jsx(DrawSignature, {
|
214
|
+
children: [/*#__PURE__*/_jsx(DrawSignature, {
|
215
|
+
fill: tab === 0 ? "#2563EB" : "#A2B0B9"
|
216
|
+
}), /*#__PURE__*/_jsx("span", {
|
202
217
|
className: "ml-1",
|
218
|
+
style: {
|
219
|
+
textTransform: "none"
|
220
|
+
},
|
203
221
|
children: "Draw Signature"
|
204
222
|
})]
|
205
223
|
})
|
206
224
|
}), /*#__PURE__*/_jsx(Tab, {
|
207
225
|
label: /*#__PURE__*/_jsxs(Grid, {
|
208
226
|
className: "dflex alignCenter",
|
209
|
-
children: [/*#__PURE__*/_jsx(TypeSignature, {
|
227
|
+
children: [/*#__PURE__*/_jsx(TypeSignature, {
|
228
|
+
fill: tab === 1 ? "#2563EB" : "#A2B0B9"
|
229
|
+
}), /*#__PURE__*/_jsx("span", {
|
210
230
|
className: "ml-1",
|
231
|
+
style: {
|
232
|
+
textTransform: "none"
|
233
|
+
},
|
211
234
|
children: "Type Signature"
|
212
235
|
})]
|
213
236
|
})
|
214
237
|
}), /*#__PURE__*/_jsx(Tab, {
|
215
238
|
label: /*#__PURE__*/_jsxs(Grid, {
|
216
239
|
className: "dflex alignCenter",
|
217
|
-
children: [/*#__PURE__*/_jsx(UploadSignature, {
|
240
|
+
children: [/*#__PURE__*/_jsx(UploadSignature, {
|
241
|
+
fill: tab === 2 ? "#2563EB" : "#A2B0B9"
|
242
|
+
}), /*#__PURE__*/_jsx("span", {
|
218
243
|
className: "ml-1",
|
244
|
+
style: {
|
245
|
+
textTransform: "none"
|
246
|
+
},
|
219
247
|
children: "Upload Signature"
|
220
248
|
})]
|
221
249
|
})
|
@@ -246,7 +274,9 @@ const SignaturePopup = props => {
|
|
246
274
|
xs: 6,
|
247
275
|
style: {
|
248
276
|
display: "flex",
|
249
|
-
alignItems: "center"
|
277
|
+
alignItems: "center",
|
278
|
+
fontSize: "14px",
|
279
|
+
fontFamily: '"Inter", sans-serif"'
|
250
280
|
},
|
251
281
|
children: [/*#__PURE__*/_jsx(Grid, {
|
252
282
|
style: {
|
@@ -254,6 +284,11 @@ const SignaturePopup = props => {
|
|
254
284
|
},
|
255
285
|
children: /*#__PURE__*/_jsx("label", {
|
256
286
|
htmlFor: "signedBy",
|
287
|
+
style: {
|
288
|
+
fontFamily: '"Inter", sans-serif',
|
289
|
+
fontWeight: 500,
|
290
|
+
fontSize: "14px"
|
291
|
+
},
|
257
292
|
children: "Name:"
|
258
293
|
})
|
259
294
|
}), /*#__PURE__*/_jsx(Grid, {
|
@@ -268,8 +303,22 @@ const SignaturePopup = props => {
|
|
268
303
|
size: "small",
|
269
304
|
onChange: onChange,
|
270
305
|
sx: {
|
271
|
-
'& .MuiOutlinedInput-root
|
272
|
-
|
306
|
+
'& .MuiOutlinedInput-root': {
|
307
|
+
borderRadius: '10px',
|
308
|
+
'& fieldset': {
|
309
|
+
borderColor: "1px solid #D8DDE1"
|
310
|
+
}
|
311
|
+
// '&:hover fieldset': {
|
312
|
+
// borderColor: 'yourHoverColor',
|
313
|
+
// },
|
314
|
+
// '&.Mui-focused fieldset': {
|
315
|
+
// borderColor: 'yourFocusedColor',
|
316
|
+
// },
|
317
|
+
},
|
318
|
+
|
319
|
+
'& .MuiInputBase-input::placeholder': {
|
320
|
+
fontFamily: '"Inter", sans-serif"',
|
321
|
+
fontSize: "14px"
|
273
322
|
}
|
274
323
|
}
|
275
324
|
})
|
@@ -285,8 +334,14 @@ const SignaturePopup = props => {
|
|
285
334
|
style: {
|
286
335
|
marginRight: "8px"
|
287
336
|
},
|
337
|
+
xs: 2,
|
288
338
|
children: /*#__PURE__*/_jsx("label", {
|
289
339
|
htmlFor: "signedOn",
|
340
|
+
style: {
|
341
|
+
fontFamily: '"Inter", sans-serif',
|
342
|
+
fontWeight: 500,
|
343
|
+
fontSize: "14px"
|
344
|
+
},
|
290
345
|
children: "Date:"
|
291
346
|
})
|
292
347
|
}), /*#__PURE__*/_jsx(Grid, {
|
@@ -296,39 +351,94 @@ const SignaturePopup = props => {
|
|
296
351
|
},
|
297
352
|
xs: 12,
|
298
353
|
children: /*#__PURE__*/_jsx(DatePicker, {
|
299
|
-
|
300
|
-
id: "signedOn",
|
301
|
-
name: "signedOn",
|
302
|
-
selected: signedData?.signedOn ? new Date(signedData?.signedOn) : new Date(),
|
303
|
-
value: signedData?.signedOn || "",
|
304
|
-
dateFormat: "MM/dd/yyyy",
|
354
|
+
selected: signedData.signedOn,
|
305
355
|
onChange: date => {
|
306
356
|
setSignedData({
|
307
357
|
...signedData,
|
308
|
-
signedOn: date
|
358
|
+
signedOn: date
|
309
359
|
});
|
310
|
-
}
|
360
|
+
},
|
361
|
+
dateFormat: "yyyy/MM/dd",
|
362
|
+
customInput: /*#__PURE__*/_jsx(TextField, {
|
363
|
+
fullWidth: true,
|
364
|
+
name: "signedOn",
|
365
|
+
placeholder: "Select Date",
|
366
|
+
size: "small",
|
367
|
+
InputProps: {
|
368
|
+
startAdornment: /*#__PURE__*/_jsx(InputAdornment, {
|
369
|
+
position: "start",
|
370
|
+
sx: {
|
371
|
+
padding: 0,
|
372
|
+
// Remove padding around the InputAdornment
|
373
|
+
margin: 0 // Remove any margins
|
374
|
+
},
|
375
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
376
|
+
children: /*#__PURE__*/_jsx(CalenderIconSignature, {})
|
377
|
+
})
|
378
|
+
}),
|
379
|
+
endAdornment: /*#__PURE__*/_jsx(InputAdornment, {
|
380
|
+
position: "end",
|
381
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
382
|
+
children: /*#__PURE__*/_jsx(CalenderDownIconSignature, {})
|
383
|
+
})
|
384
|
+
}),
|
385
|
+
sx: {
|
386
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
387
|
+
borderColor: "transparent" // Remove the internal border
|
388
|
+
},
|
389
|
+
|
390
|
+
"& .MuiInputBase-input": {
|
391
|
+
border: "none",
|
392
|
+
// Ensure no border inside the input field
|
393
|
+
padding: "4px 0",
|
394
|
+
// Adjust padding for consistency
|
395
|
+
boxShadow: "none !important",
|
396
|
+
color: "#778599 !important"
|
397
|
+
}
|
398
|
+
}
|
399
|
+
},
|
400
|
+
sx: {
|
401
|
+
"& .MuiOutlinedInput-root": {
|
402
|
+
borderRadius: "10px",
|
403
|
+
backgroundColor: "#fff",
|
404
|
+
padding: "0px !important",
|
405
|
+
"&:hover fieldset": {
|
406
|
+
borderColor: "#D8DDE1" // Keeps the border on hover only around the outer field
|
407
|
+
},
|
408
|
+
|
409
|
+
"& fieldset": {
|
410
|
+
borderColor: "#D8DDE1" // Keeps the outer border light
|
411
|
+
}
|
412
|
+
}
|
413
|
+
}
|
414
|
+
})
|
311
415
|
})
|
312
416
|
})]
|
313
417
|
}), /*#__PURE__*/_jsxs(Grid, {
|
314
418
|
item: true,
|
315
|
-
xs:
|
419
|
+
xs: 12,
|
316
420
|
style: {
|
317
421
|
display: "flex",
|
318
422
|
alignItems: "center"
|
319
423
|
},
|
320
424
|
children: [/*#__PURE__*/_jsx(Grid, {
|
321
425
|
style: {
|
322
|
-
marginRight: "8px"
|
323
|
-
minWidth: '44px'
|
426
|
+
marginRight: "8px"
|
324
427
|
},
|
428
|
+
xs: 1,
|
325
429
|
children: /*#__PURE__*/_jsx("label", {
|
326
430
|
htmlFor: "signedByEmail",
|
431
|
+
style: {
|
432
|
+
fontFamily: '"Inter", sans-serif',
|
433
|
+
fontWeight: 500,
|
434
|
+
fontSize: "14px"
|
435
|
+
},
|
327
436
|
children: "Email:"
|
328
437
|
})
|
329
438
|
}), /*#__PURE__*/_jsx(Grid, {
|
439
|
+
container: true,
|
330
440
|
item: true,
|
331
|
-
xs:
|
441
|
+
xs: 11,
|
332
442
|
children: /*#__PURE__*/_jsx(TextField, {
|
333
443
|
fullWidth: true,
|
334
444
|
id: "signedByEmail",
|
@@ -337,8 +447,22 @@ const SignaturePopup = props => {
|
|
337
447
|
size: "small",
|
338
448
|
onChange: onChange,
|
339
449
|
sx: {
|
340
|
-
'& .MuiOutlinedInput-root
|
341
|
-
|
450
|
+
'& .MuiOutlinedInput-root': {
|
451
|
+
borderRadius: '10px',
|
452
|
+
'& fieldset': {
|
453
|
+
borderColor: "1px solid #D8DDE1"
|
454
|
+
}
|
455
|
+
// '&:hover fieldset': {
|
456
|
+
// borderColor: 'yourHoverColor',
|
457
|
+
// },
|
458
|
+
// '&.Mui-focused fieldset': {
|
459
|
+
// borderColor: 'yourFocusedColor',
|
460
|
+
// },
|
461
|
+
},
|
462
|
+
|
463
|
+
'& .MuiInputBase-input::placeholder': {
|
464
|
+
fontFamily: '"Inter", sans-serif"',
|
465
|
+
fontSize: "14px"
|
342
466
|
}
|
343
467
|
},
|
344
468
|
defaultValue: defaultEmail || ""
|
@@ -358,14 +482,30 @@ const SignaturePopup = props => {
|
|
358
482
|
children: [/*#__PURE__*/_jsx(Grid, {
|
359
483
|
item: true,
|
360
484
|
sx: {
|
361
|
-
mr:
|
485
|
+
mr: 3
|
362
486
|
},
|
363
|
-
children: /*#__PURE__*/
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
487
|
+
children: /*#__PURE__*/_jsxs(Grid, {
|
488
|
+
container: true,
|
489
|
+
alignItems: "center",
|
490
|
+
sx: {
|
491
|
+
display: 'flex'
|
492
|
+
},
|
493
|
+
children: [/*#__PURE__*/_jsx("input", {
|
494
|
+
type: "color",
|
495
|
+
className: "brushcolorpic signColorPicker",
|
496
|
+
onChange: onBrushColor,
|
497
|
+
size: "4",
|
498
|
+
value: brush?.color
|
499
|
+
}), /*#__PURE__*/_jsx("span", {
|
500
|
+
style: {
|
501
|
+
marginLeft: "10px",
|
502
|
+
fontFamily: '"Inter", sans-serif',
|
503
|
+
fontSize: "14px",
|
504
|
+
fontWeight: 500,
|
505
|
+
color: "#333"
|
506
|
+
},
|
507
|
+
children: brush.color
|
508
|
+
})]
|
369
509
|
})
|
370
510
|
}), /*#__PURE__*/_jsx(Grid, {
|
371
511
|
item: true,
|
@@ -396,7 +536,7 @@ const SignaturePopup = props => {
|
|
396
536
|
children: [!readOnly ? /*#__PURE__*/_jsx(Button, {
|
397
537
|
onClick: handleClear,
|
398
538
|
className: "secondaryBtn",
|
399
|
-
children: "
|
539
|
+
children: "Clear"
|
400
540
|
}) : null, /*#__PURE__*/_jsx(Button, {
|
401
541
|
onClick: handleSave,
|
402
542
|
className: `primaryBtn ${isEmpty ? "disabled" : ""}`,
|
@@ -6,6 +6,7 @@ import { isTextSelected } from "../../utils/helper";
|
|
6
6
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
7
7
|
import SimpleTextStyle from "./style";
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
9
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
11
|
const SimpleText = props => {
|
11
12
|
const {
|
@@ -45,7 +46,16 @@ const SimpleText = props => {
|
|
45
46
|
sx: classes.root,
|
46
47
|
children: [children, openAI ? null : /*#__PURE__*/_jsx("span", {
|
47
48
|
className: "placeholder-simple-text",
|
48
|
-
children: isEmptyEditor ? editorPlaceholder || "Write Something..." : showPlaceHolder ? opacity && selected ?
|
49
|
+
children: isEmptyEditor ? editorPlaceholder || "Write Something..." : showPlaceHolder ? opacity && selected ? /*#__PURE__*/_jsxs(_Fragment, {
|
50
|
+
children: ["Type ", /*#__PURE__*/_jsx("span", {
|
51
|
+
style: {
|
52
|
+
backgroundColor: '#F2F6FA',
|
53
|
+
padding: "0px 2px",
|
54
|
+
borderRadius: "2px"
|
55
|
+
},
|
56
|
+
children: "/"
|
57
|
+
}), " to browse elements"]
|
58
|
+
}) : "" : ""
|
49
59
|
})]
|
50
60
|
});
|
51
61
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
2
2
|
import { useSlate } from "slate-react";
|
3
3
|
import { Box, Dialog, IconButton, Paper, Popper, Tooltip } from "@mui/material";
|
4
4
|
import MENU_OPTIONS from "./Options/Options";
|
@@ -18,6 +18,11 @@ const POPUP_TYPES = {
|
|
18
18
|
addElement: AddElements,
|
19
19
|
addTemplate: AddTemplates
|
20
20
|
};
|
21
|
+
const POPUP_OFFSETS = {
|
22
|
+
textFormat: [80, 5],
|
23
|
+
addElement: [60, 5],
|
24
|
+
addTemplate: [20, 5]
|
25
|
+
};
|
21
26
|
const FULLSCREEN_POPUP = {
|
22
27
|
addTemplate: true
|
23
28
|
};
|
@@ -44,6 +49,7 @@ const MiniToolbar = props => {
|
|
44
49
|
const {
|
45
50
|
hideTools
|
46
51
|
} = customProps;
|
52
|
+
const boxRef = useRef(null); // Add ref to get the Box element
|
47
53
|
const UPDATED_MENU_OPTIONS = MENU_OPTIONS.filter(f => (hideTools || [])?.indexOf(f.type) === -1);
|
48
54
|
const {
|
49
55
|
popupType
|
@@ -82,13 +88,29 @@ const MiniToolbar = props => {
|
|
82
88
|
};
|
83
89
|
const closePopper = data => {
|
84
90
|
setData(data);
|
85
|
-
setToolTip(
|
91
|
+
setToolTip(false);
|
92
|
+
};
|
93
|
+
|
94
|
+
// Calculate center of Box for Popper/Modal positioning
|
95
|
+
const getBoxCenter = () => {
|
96
|
+
if (boxRef.current) {
|
97
|
+
const rect = boxRef.current.getBoundingClientRect();
|
98
|
+
return {
|
99
|
+
top: rect.top + rect.height / 2,
|
100
|
+
left: rect.left + rect.width / 2
|
101
|
+
};
|
102
|
+
}
|
103
|
+
return {
|
104
|
+
top: 0,
|
105
|
+
left: 0
|
106
|
+
};
|
86
107
|
};
|
87
108
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
88
109
|
children: [/*#__PURE__*/_jsx(Box, {
|
89
110
|
component: "div",
|
90
111
|
className: "mini-tool-wrpr-ei",
|
91
112
|
sx: classes.root,
|
113
|
+
ref: boxRef,
|
92
114
|
children: UPDATED_MENU_OPTIONS.map(({
|
93
115
|
type,
|
94
116
|
label,
|
@@ -123,11 +145,18 @@ const MiniToolbar = props => {
|
|
123
145
|
}), /*#__PURE__*/_jsx(DialogComp, {
|
124
146
|
open: open,
|
125
147
|
onClose: onClose,
|
126
|
-
anchorEl: anchorEl
|
148
|
+
anchorEl: anchorEl || getBoxCenter() // Positioning at center of Box
|
149
|
+
,
|
127
150
|
placement: "top",
|
128
151
|
sx: popupStyles.popupWrapper,
|
129
152
|
className: `tools-drawer ${fullScreen ? "fullscreen" : ""}`,
|
130
153
|
fullScreen: fullScreen,
|
154
|
+
modifiers: [{
|
155
|
+
name: "offset",
|
156
|
+
options: {
|
157
|
+
offset: POPUP_OFFSETS[popper] || [0, 10] // Add some space between anchor and popper
|
158
|
+
}
|
159
|
+
}],
|
131
160
|
children: PopupComponent ? /*#__PURE__*/_jsxs(Paper, {
|
132
161
|
className: "papper-wrpr",
|
133
162
|
style: {
|
@@ -19,6 +19,9 @@ const CustomSelectTool = ({
|
|
19
19
|
e.preventDefault();
|
20
20
|
setAnchorEl(e.currentTarget);
|
21
21
|
},
|
22
|
+
style: {
|
23
|
+
margin: "0px"
|
24
|
+
},
|
22
25
|
children: [selected?.label || selected?.title, " ", /*#__PURE__*/_jsx(DownArrowIcon, {})]
|
23
26
|
}), /*#__PURE__*/_jsx(Popover, {
|
24
27
|
open: open,
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import { useMemo } from "react";
|
2
|
+
import { activeMark, toggleMark } from "../../../utils/SlateUtilityFunctions";
|
3
|
+
import CustomSelectTool from "./CustomSelectTool";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
6
|
+
function Label({
|
7
|
+
label,
|
8
|
+
type
|
9
|
+
}) {
|
10
|
+
return /*#__PURE__*/_jsxs("span", {
|
11
|
+
children: [/*#__PURE__*/_jsx("strong", {
|
12
|
+
children: label
|
13
|
+
}), " ", type]
|
14
|
+
});
|
15
|
+
}
|
16
|
+
const superSubscriptOptions = [{
|
17
|
+
id: 9,
|
18
|
+
format: "superscript",
|
19
|
+
type: "mark",
|
20
|
+
title: /*#__PURE__*/_jsx(Label, {
|
21
|
+
label: "X²",
|
22
|
+
type: "Superscript"
|
23
|
+
}),
|
24
|
+
label: "X²",
|
25
|
+
group: "superSubscript",
|
26
|
+
value: "superscript"
|
27
|
+
}, {
|
28
|
+
id: 10,
|
29
|
+
format: "subscript",
|
30
|
+
type: "mark",
|
31
|
+
title: /*#__PURE__*/_jsx(Label, {
|
32
|
+
label: "X₂",
|
33
|
+
type: "Subscript"
|
34
|
+
}),
|
35
|
+
label: "X₂",
|
36
|
+
group: "superSubscript",
|
37
|
+
value: "subscript"
|
38
|
+
}];
|
39
|
+
function SelectSuperSubscript({
|
40
|
+
editor,
|
41
|
+
classes,
|
42
|
+
closeMainPopup
|
43
|
+
}) {
|
44
|
+
const selectedMark = useMemo(() => {
|
45
|
+
return superSubscriptOptions.find(option => activeMark(editor, option.format));
|
46
|
+
}, [editor]);
|
47
|
+
const onChange = format => {
|
48
|
+
toggleMark(editor, format);
|
49
|
+
closeMainPopup();
|
50
|
+
};
|
51
|
+
return /*#__PURE__*/_jsx(CustomSelectTool, {
|
52
|
+
options: superSubscriptOptions,
|
53
|
+
editor: editor,
|
54
|
+
onChange: onChange,
|
55
|
+
value: selectedMark?.value || "superscript",
|
56
|
+
classes: classes
|
57
|
+
});
|
58
|
+
}
|
59
|
+
export default SelectSuperSubscript;
|