@flozy/editor 11.0.5 → 11.0.7
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/Editor/ChatEditor.js +16 -17
- package/dist/Editor/CommonEditor.js +28 -141
- package/dist/Editor/DialogWrapper.js +25 -31
- package/dist/Editor/Editor.css +11 -39
- package/dist/Editor/Elements/AI/PopoverAIInput.js +3 -11
- package/dist/Editor/Elements/AI/Styles.js +0 -1
- package/dist/Editor/Elements/Accordion/Accordion.js +22 -28
- package/dist/Editor/Elements/Accordion/AccordionButton.js +3 -12
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/Attachments/Attachments.js +11 -153
- package/dist/Editor/Elements/Attachments/AttachmentsButton.js +3 -8
- package/dist/Editor/Elements/Button/EditorButton.js +7 -23
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -61
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +7 -10
- package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +454 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +55 -134
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SelectV1.js +8 -7
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +3 -8
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +1 -1
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +1 -1
- package/dist/Editor/Elements/Embed/Embed.css +0 -5
- package/dist/Editor/Elements/Embed/Embed.js +43 -36
- package/dist/Editor/Elements/Embed/Image.js +23 -236
- package/dist/Editor/Elements/Embed/Video.js +15 -245
- package/dist/Editor/Elements/Form/Form.js +10 -16
- package/dist/Editor/Elements/Form/FormField.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
- package/dist/Editor/Elements/Form/Workflow/constant.js +1 -25
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +74 -31
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +5 -9
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -3
- package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
- package/dist/Editor/Elements/FreeGrid/styles.js +0 -15
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -2
- package/dist/Editor/Elements/Signature/SignaturePopup.js +6 -13
- package/dist/Editor/Elements/SimpleText/index.js +1 -4
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Table/Table.js +4 -5
- package/dist/Editor/Elements/Table/TableCell.js +3 -10
- package/dist/Editor/Elements/Title/title.js +11 -10
- package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -4
- package/dist/Editor/Elements/TopBanner/TopBannerButton.js +3 -5
- package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
- package/dist/Editor/MiniEditor.js +1 -2
- package/dist/Editor/Styles/EditorStyles.js +5 -20
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +29 -33
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +2 -4
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +23 -25
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +7 -25
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +42 -167
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +8 -24
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +10 -70
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +14 -73
- package/dist/Editor/Toolbar/PopupTool/index.js +4 -7
- package/dist/Editor/Toolbar/toolbarGroups.js +10 -56
- package/dist/Editor/common/ColorPickerButton.js +16 -38
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +0 -4
- package/dist/Editor/common/Icon.js +0 -28
- package/dist/Editor/common/ImageSelector/ImageSelector.js +7 -45
- package/dist/Editor/common/ImageSelector/Options/Upload.js +11 -26
- package/dist/Editor/common/ImageSelector/Styles.js +9 -3
- package/dist/Editor/common/LinkSettings/NavComponents.js +2 -6
- package/dist/Editor/common/MentionsPopup/index.js +1 -9
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +2 -4
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +7 -20
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +1 -9
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +7 -20
- package/dist/Editor/common/RnD/GuideLines/styles.js +1 -1
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -11
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +11 -28
- package/dist/Editor/common/RnD/Utils/index.js +1 -3
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +63 -52
- package/dist/Editor/common/RnD/VirtualElement/helper.js +130 -320
- package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -22
- package/dist/Editor/common/RnD/index.js +14 -61
- package/dist/Editor/common/Shorthands/elements.js +4 -62
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +0 -4
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +0 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +2 -15
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +2 -12
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +8 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +10 -36
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +7 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +0 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -15
- package/dist/Editor/common/StyleBuilder/formStyle.js +13 -19
- package/dist/Editor/common/StyleBuilder/index.js +4 -8
- package/dist/Editor/common/Uploader.js +17 -125
- package/dist/Editor/common/iconslist.js +0 -21
- package/dist/Editor/commonStyle.js +18 -67
- package/dist/Editor/helper/index.js +2 -10
- package/dist/Editor/helper/theme.js +2 -203
- package/dist/Editor/hooks/useMouseMove.js +3 -9
- package/dist/Editor/hooks/useTable.js +1 -62
- package/dist/Editor/plugins/withEmbeds.js +1 -12
- package/dist/Editor/plugins/withHTML.js +3 -58
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/service/fileupload.js +0 -70
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/SlateUtilityFunctions.js +40 -191
- package/dist/Editor/utils/accordion.js +39 -67
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/draftToSlate.js +2 -3
- package/dist/Editor/utils/events.js +89 -94
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/helper.js +23 -100
- package/dist/Editor/utils/insertAppHeader.js +4 -8
- package/package.json +4 -4
- package/dist/Editor/Elements/Attachments/AttachmentStyles.js +0 -16
- package/dist/Editor/Elements/FreeGrid/helper.js +0 -194
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -439
- package/dist/Editor/assets/svg/BackIcon.js +0 -18
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -293
- package/dist/Editor/common/CustomColorPicker/index.js +0 -130
- package/dist/Editor/common/CustomColorPicker/style.js +0 -53
- package/dist/Editor/common/CustomDialog2/index.js +0 -94
- package/dist/Editor/common/CustomDialog2/style.js +0 -67
- package/dist/Editor/common/CustomSelect.js +0 -43
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
- package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +0 -115
- package/dist/Editor/common/UploaderWithProgress.js +0 -183
- package/dist/Editor/helper/textIndeces.js +0 -58
- package/dist/Editor/hooks/useEditorTheme.js +0 -153
- package/dist/Editor/hooks/useThemeValues.js +0 -63
- package/dist/Editor/theme/index.js +0 -149
- package/dist/Editor/themeSettings/ActiveTheme.js +0 -82
- package/dist/Editor/themeSettings/buttons/index.js +0 -300
- package/dist/Editor/themeSettings/buttons/style.js +0 -23
- package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
- package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
- package/dist/Editor/themeSettings/fonts/index.js +0 -240
- package/dist/Editor/themeSettings/fonts/style.js +0 -62
- package/dist/Editor/themeSettings/icons.js +0 -60
- package/dist/Editor/themeSettings/index.js +0 -380
- package/dist/Editor/themeSettings/style.js +0 -299
- package/dist/Editor/themeSettingsAI/icons.js +0 -96
- package/dist/Editor/themeSettingsAI/index.js +0 -355
- package/dist/Editor/themeSettingsAI/saveTheme.js +0 -202
- package/dist/Editor/themeSettingsAI/style.js +0 -332
@@ -1,14 +1,8 @@
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
2
|
-
import { Text } from "slate";
|
2
|
+
import { Editor, Text } from "slate";
|
3
3
|
import { useSlate } from "slate-react";
|
4
|
-
import { getNodeText
|
4
|
+
import { getNodeText } from "../../utils/helper";
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
|
-
const isEmptyTextNode = node => {
|
7
|
-
if (Text.isText(node)) {
|
8
|
-
return !node.text.trim();
|
9
|
-
}
|
10
|
-
return false;
|
11
|
-
};
|
12
6
|
const Title = props => {
|
13
7
|
const {
|
14
8
|
attributes,
|
@@ -37,8 +31,9 @@ const useDetectExitFromTitle = (titleNode, onSaveTitle) => {
|
|
37
31
|
if (!editor.selection) return;
|
38
32
|
|
39
33
|
// Get the current node where the cursor is
|
40
|
-
const [nodeEntry] =
|
41
|
-
at: editor.selection
|
34
|
+
const [nodeEntry] = Editor.nodes(editor, {
|
35
|
+
at: editor.selection,
|
36
|
+
match: n => n.type === "title"
|
42
37
|
});
|
43
38
|
if (nodeEntry) {
|
44
39
|
setWasInsideTitle(true); // User was inside the title
|
@@ -52,4 +47,10 @@ const useDetectExitFromTitle = (titleNode, onSaveTitle) => {
|
|
52
47
|
}
|
53
48
|
}, [editor.selection]);
|
54
49
|
return null;
|
50
|
+
};
|
51
|
+
const isEmptyTextNode = node => {
|
52
|
+
if (Text.isText(node)) {
|
53
|
+
return !node.text.trim();
|
54
|
+
}
|
55
|
+
return false;
|
55
56
|
};
|
@@ -28,9 +28,8 @@ export const TopBannerToolbar = props => {
|
|
28
28
|
}
|
29
29
|
};
|
30
30
|
const onSelectImage = img => {
|
31
|
-
const embedURL = typeof img === "string" ? img : img?.embedURL ? img?.embedURL : null;
|
32
31
|
updateTopBanner(editor, {
|
33
|
-
url:
|
32
|
+
url: img
|
34
33
|
});
|
35
34
|
handleClose();
|
36
35
|
};
|
@@ -57,8 +56,7 @@ export const TopBannerToolbar = props => {
|
|
57
56
|
open: open,
|
58
57
|
onClose: handleClose,
|
59
58
|
customProps: customProps,
|
60
|
-
onSelectImage: onSelectImage
|
61
|
-
disableProgress: true
|
59
|
+
onSelectImage: onSelectImage
|
62
60
|
})]
|
63
61
|
});
|
64
62
|
};
|
@@ -17,10 +17,9 @@ const TopBannerButton = props => {
|
|
17
17
|
translation
|
18
18
|
} = customProps;
|
19
19
|
const onSelectImage = url => {
|
20
|
-
|
21
|
-
if (embedURL) {
|
20
|
+
if (url) {
|
22
21
|
insertTopBanner(editor, {
|
23
|
-
url
|
22
|
+
url
|
24
23
|
});
|
25
24
|
}
|
26
25
|
setOpen(false);
|
@@ -43,8 +42,7 @@ const TopBannerButton = props => {
|
|
43
42
|
open: open,
|
44
43
|
onClose: handleClose,
|
45
44
|
customProps: customProps,
|
46
|
-
onSelectImage: onSelectImage
|
47
|
-
disableProgress: true
|
45
|
+
onSelectImage: onSelectImage
|
48
46
|
})]
|
49
47
|
});
|
50
48
|
};
|
@@ -34,8 +34,7 @@ const VariableButton = props => {
|
|
34
34
|
PaperProps: {
|
35
35
|
style: {
|
36
36
|
maxHeight: 300,
|
37
|
-
overflowY: "auto"
|
38
|
-
transformOrigin: 'top left'
|
37
|
+
overflowY: "auto"
|
39
38
|
},
|
40
39
|
sx: {
|
41
40
|
"&::-webkit-scrollbar-track": {
|
@@ -45,14 +44,6 @@ const VariableButton = props => {
|
|
45
44
|
borderRadius: "16px"
|
46
45
|
}
|
47
46
|
}
|
48
|
-
},
|
49
|
-
anchorOrigin: {
|
50
|
-
vertical: 'bottom',
|
51
|
-
horizontal: 'right'
|
52
|
-
},
|
53
|
-
transformOrigin: {
|
54
|
-
vertical: 'top',
|
55
|
-
horizontal: 'right'
|
56
47
|
}
|
57
48
|
},
|
58
49
|
children: [/*#__PURE__*/_jsx(MenuItem, {
|
@@ -45,13 +45,12 @@ const MiniEditor = props => {
|
|
45
45
|
const {
|
46
46
|
translationMock
|
47
47
|
} = otherProps;
|
48
|
-
const dummyTranslation = () => {};
|
49
48
|
const customProps = {
|
50
49
|
...(otherProps || {}),
|
51
50
|
readOnly: isReadOnly,
|
52
51
|
editorPlaceholder: miniEditorPlaceholder,
|
53
52
|
page_id: id,
|
54
|
-
translation: translation || translationMock
|
53
|
+
translation: translation || translationMock
|
55
54
|
};
|
56
55
|
const [mentions, setMentions] = useMentions({
|
57
56
|
editor,
|
@@ -136,11 +136,7 @@ const editorStyles = ({
|
|
136
136
|
},
|
137
137
|
"& .accordion-summary-collapse-btn": {
|
138
138
|
padding: "4px",
|
139
|
-
width:
|
140
|
-
"& svg:hover": {
|
141
|
-
background: theme?.palette?.editor?.tv_hover_bg,
|
142
|
-
borderRadius: "4px"
|
143
|
-
}
|
139
|
+
width: '5px'
|
144
140
|
},
|
145
141
|
"& .workflow-icon-btn": {
|
146
142
|
pointerEvents: "none",
|
@@ -222,17 +218,6 @@ const editorStyles = ({
|
|
222
218
|
borderRadius: "12px",
|
223
219
|
"& svg": {
|
224
220
|
marginRight: "8px"
|
225
|
-
},
|
226
|
-
"& .circularProgress-cls": {
|
227
|
-
"& svg": {
|
228
|
-
width: "15px !important",
|
229
|
-
height: "15px !important"
|
230
|
-
}
|
231
|
-
},
|
232
|
-
"& .uploadCancel": {
|
233
|
-
color: theme?.palette?.editor?.closeButtonSvgStroke,
|
234
|
-
width: "25px !important",
|
235
|
-
height: "25px !important"
|
236
221
|
}
|
237
222
|
},
|
238
223
|
"& .content-editable.empty": {
|
@@ -260,7 +245,7 @@ const editorStyles = ({
|
|
260
245
|
}
|
261
246
|
},
|
262
247
|
"& .section-tw": {
|
263
|
-
background:
|
248
|
+
background: 'transparent !important',
|
264
249
|
"& button": {
|
265
250
|
padding: "2px",
|
266
251
|
borderRadius: "0px",
|
@@ -309,8 +294,8 @@ const editorStyles = ({
|
|
309
294
|
}
|
310
295
|
},
|
311
296
|
"& ::selection": {
|
312
|
-
|
313
|
-
color:
|
297
|
+
background: 'rgba(35, 131, 226, 0.35)!important',
|
298
|
+
color: 'inherit'
|
314
299
|
},
|
315
300
|
"&.readOnlyContainer": {
|
316
301
|
"& .max-content": {
|
@@ -320,7 +305,7 @@ const editorStyles = ({
|
|
320
305
|
},
|
321
306
|
fullScreenWrapper: {
|
322
307
|
"& .editor-wrapper": {
|
323
|
-
paddingTop:
|
308
|
+
paddingTop: '20px'
|
324
309
|
},
|
325
310
|
"& .MuiDialog-paper, & .MuiPopover-paper": {
|
326
311
|
background: `${theme?.palette?.editor?.background} !important`
|
@@ -1,32 +1,8 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Select, MenuItem } from "@mui/material";
|
3
|
-
import { addMarkData, activeMark
|
4
|
-
import { toolbarGroups } from "../toolbarGroups.js";
|
3
|
+
import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
|
5
4
|
import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded";
|
6
|
-
import { googleFontList as defaultFonts } from "../../common/FontLoader/FontList.js";
|
7
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
-
const allTools = toolbarGroups.flat();
|
9
|
-
const fontWeight = allTools.find(f => f.format === "fontWeight");
|
10
|
-
export const getValue = (editor, format) => {
|
11
|
-
switch (format) {
|
12
|
-
case "fontFamily":
|
13
|
-
{
|
14
|
-
const style = getSelectedElementStyle("font-family", editor, format);
|
15
|
-
return style || defaultFonts[0];
|
16
|
-
}
|
17
|
-
case "fontWeight":
|
18
|
-
{
|
19
|
-
const {
|
20
|
-
options
|
21
|
-
} = fontWeight || {};
|
22
|
-
const fontWeightStyle = getSelectedElementStyle("font-weight", editor, format);
|
23
|
-
const selected = options?.find(o => o.value === fontWeightStyle || o.numVal === fontWeightStyle);
|
24
|
-
return selected?.value;
|
25
|
-
}
|
26
|
-
default:
|
27
|
-
return activeMark(editor, format);
|
28
|
-
}
|
29
|
-
};
|
30
6
|
const Dropdown = ({
|
31
7
|
classes,
|
32
8
|
editor,
|
@@ -34,7 +10,7 @@ const Dropdown = ({
|
|
34
10
|
options,
|
35
11
|
width
|
36
12
|
}) => {
|
37
|
-
const value = activeMark(editor, format
|
13
|
+
const value = activeMark(editor, format);
|
38
14
|
const changeMarkData = (event, format) => {
|
39
15
|
event.preventDefault();
|
40
16
|
const value = event.target.value;
|
@@ -44,7 +20,7 @@ const Dropdown = ({
|
|
44
20
|
});
|
45
21
|
};
|
46
22
|
return /*#__PURE__*/_jsx(Select, {
|
47
|
-
value: value
|
23
|
+
value: value,
|
48
24
|
className: "editor-dd",
|
49
25
|
onChange: e => changeMarkData(e, format),
|
50
26
|
MenuProps: {
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Autocomplete, TextField } from "@mui/material";
|
3
|
-
import { addMarkData } from "../../utils/SlateUtilityFunctions.js";
|
3
|
+
import { activeMark, addMarkData } from "../../utils/SlateUtilityFunctions.js";
|
4
4
|
import usePopupStyle from "../PopupTool/PopupToolStyle.js";
|
5
5
|
import { useEditorContext } from "../../hooks/useMouseMove.js";
|
6
|
-
import KeyboardArrowDownRoundedIcon from
|
7
|
-
import { getValue } from "./Dropdown.js";
|
6
|
+
import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
8
|
const FontFamilyAutocomplete = ({
|
10
9
|
editor,
|
@@ -15,7 +14,7 @@ const FontFamilyAutocomplete = ({
|
|
15
14
|
val = "",
|
16
15
|
webFont = false
|
17
16
|
}) => {
|
18
|
-
const markValue =
|
17
|
+
const markValue = activeMark(editor, format);
|
19
18
|
const value = !webFont ? markValue : val;
|
20
19
|
const changeMarkData = (event, newValue, format) => {
|
21
20
|
if (!webFont) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import Icon from "../../common/Icon";
|
3
3
|
import Button from "../../common/Button";
|
4
|
-
import { toggleMark,
|
4
|
+
import { toggleMark, isMarkActive } from "../../utils/SlateUtilityFunctions.js";
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
6
|
const MarkButton = ({
|
7
7
|
editor,
|
@@ -13,7 +13,7 @@ const MarkButton = ({
|
|
13
13
|
translation
|
14
14
|
} = customProps;
|
15
15
|
return /*#__PURE__*/_jsx(Button, {
|
16
|
-
active:
|
16
|
+
active: isMarkActive(editor, format),
|
17
17
|
format: format,
|
18
18
|
onMouseDown: e => {
|
19
19
|
e.preventDefault();
|
@@ -1,36 +1,27 @@
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
2
2
|
import { TextField, IconButton } from "@mui/material";
|
3
|
-
import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
|
4
|
-
import {
|
3
|
+
import { addMarkData, activeMark, isBlockActive } from "../../utils/SlateUtilityFunctions.js";
|
4
|
+
import { headingMap, sizeMap } from "../../utils/font.js";
|
5
|
+
import { getBreakPointsValue } from "../../helper/theme.js";
|
5
6
|
import useWindowResize from "../../hooks/useWindowResize.js";
|
6
7
|
import { BREAKPOINTS_DEVICES } from "../../helper/theme.js";
|
7
8
|
import { TextSizeDownArrow, TextSizeUpArrow } from "../../common/iconListV2.js";
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
11
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
11
|
-
const TextSize =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
fromMiniTextFormat,
|
18
|
-
setResizedSize,
|
19
|
-
resizedSize
|
20
|
-
} = props;
|
21
|
-
const [fontSize, setFontSize] = useState();
|
22
|
-
const sizeValue = fromMiniTextFormat ? resizedSize : fontSize;
|
23
|
-
const setSizeValue = fromMiniTextFormat ? setResizedSize : setFontSize;
|
24
|
-
const timerRef = useRef();
|
12
|
+
const TextSize = ({
|
13
|
+
classes,
|
14
|
+
editor,
|
15
|
+
format,
|
16
|
+
fullWidth
|
17
|
+
}) => {
|
25
18
|
const [size] = useWindowResize();
|
26
19
|
const val = activeMark(editor, format);
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
const value = getTextSizeVal(editor);
|
20
|
+
const value = getBreakPointsValue(val, size?.device);
|
21
|
+
const [fontSize, setFontSize] = useState();
|
22
|
+
const timerRef = useRef();
|
32
23
|
useEffect(() => {
|
33
|
-
|
24
|
+
setFontSize(getSizeVal());
|
34
25
|
}, [value]);
|
35
26
|
const updateMarkData = newVal => {
|
36
27
|
let upData = {
|
@@ -57,33 +48,38 @@ const TextSize = props => {
|
|
57
48
|
if (value) {
|
58
49
|
let inc = parseInt(value);
|
59
50
|
inc = inc > 200 ? 200 : inc;
|
60
|
-
setSizeValue(inc);
|
61
51
|
updateMarkData(inc);
|
62
52
|
} else {
|
63
|
-
|
53
|
+
setFontSize(null);
|
64
54
|
}
|
65
55
|
};
|
66
56
|
const getSizeVal = () => {
|
67
57
|
try {
|
68
|
-
|
58
|
+
let size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
|
59
|
+
Object.entries(headingMap).forEach(([format, value]) => {
|
60
|
+
if (isBlockActive(editor, format) && isNaN(parseInt(size))) {
|
61
|
+
size = value;
|
62
|
+
}
|
63
|
+
});
|
64
|
+
return parseInt(size);
|
69
65
|
} catch (err) {
|
70
66
|
return "";
|
71
67
|
}
|
72
68
|
};
|
69
|
+
const combinedOldVal = getSizeVal();
|
73
70
|
const onIncreaseSize = () => {
|
74
|
-
|
75
|
-
|
76
|
-
updateMarkData(
|
71
|
+
let inc = (combinedOldVal || 0) + 1;
|
72
|
+
inc = inc > 200 ? 200 : inc;
|
73
|
+
updateMarkData(inc);
|
77
74
|
};
|
78
75
|
const onDecreaseSize = () => {
|
79
|
-
const
|
80
|
-
|
81
|
-
updateMarkData(newValue);
|
76
|
+
const newVal = combinedOldVal - 1 < 0 ? 0 : combinedOldVal - 1;
|
77
|
+
updateMarkData(newVal);
|
82
78
|
};
|
83
79
|
const onChange = e => {
|
84
80
|
clearTimeout(timerRef.current);
|
85
81
|
const value = e.target.value;
|
86
|
-
|
82
|
+
setFontSize(value);
|
87
83
|
timerRef.current = setTimeout(() => {
|
88
84
|
onChangeSize(value);
|
89
85
|
}, 500);
|
@@ -91,7 +87,7 @@ const TextSize = props => {
|
|
91
87
|
return /*#__PURE__*/_jsx(_Fragment, {
|
92
88
|
children: /*#__PURE__*/_jsx(TextField, {
|
93
89
|
sx: classes?.textSize,
|
94
|
-
value:
|
90
|
+
value: fontSize,
|
95
91
|
onChange: onChange,
|
96
92
|
size: "small",
|
97
93
|
inputProps: {
|
@@ -12,8 +12,7 @@ function MiniColorPicker(props) {
|
|
12
12
|
classes,
|
13
13
|
id,
|
14
14
|
editor,
|
15
|
-
customProps
|
16
|
-
type
|
15
|
+
customProps
|
17
16
|
} = props;
|
18
17
|
const [openColorTool, setOpenColorTool] = useState(null);
|
19
18
|
const {
|
@@ -39,8 +38,7 @@ function MiniColorPicker(props) {
|
|
39
38
|
classes: classes,
|
40
39
|
forMiniTool: true,
|
41
40
|
openColorTool: openColorTool,
|
42
|
-
closeColorTool: () => setOpenColorTool(null)
|
43
|
-
type: type
|
41
|
+
closeColorTool: () => setOpenColorTool(null)
|
44
42
|
}, id)]
|
45
43
|
});
|
46
44
|
}
|
@@ -1,30 +1,25 @@
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
2
|
-
import { activeMark, addMarkData } from "../../../utils/SlateUtilityFunctions";
|
2
|
+
import { activeMark, addMarkData, isBlockActive } from "../../../utils/SlateUtilityFunctions";
|
3
3
|
import { Button, IconButton, Popover, TextField } from "@mui/material";
|
4
4
|
import DownArrowIcon from "../../../assets/svg/DownArrowIcon";
|
5
5
|
import useWindowResize from "../../../hooks/useWindowResize";
|
6
|
-
import { BREAKPOINTS_DEVICES, getBreakPointsValue
|
6
|
+
import { BREAKPOINTS_DEVICES, getBreakPointsValue } from "../../../helper/theme";
|
7
|
+
import { headingMap, sizeMap } from "../../../utils/font";
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
10
|
const fontSizeOptions = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 26, 32, 36, 40, 48, 64, 96, 128];
|
10
|
-
function SelectFontSize(
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
fromMiniTextFormat,
|
15
|
-
setResizedSize,
|
16
|
-
resizedSize
|
17
|
-
} = props;
|
11
|
+
function SelectFontSize({
|
12
|
+
editor,
|
13
|
+
classes
|
14
|
+
}) {
|
18
15
|
const format = "fontSize";
|
19
16
|
const [fontSize, setFontSize] = useState();
|
20
|
-
const sizeValue = fromMiniTextFormat ? resizedSize : fontSize;
|
21
|
-
const setSizeValue = fromMiniTextFormat ? setResizedSize : setFontSize;
|
22
17
|
const [anchorEl, setAnchorEl] = useState(null);
|
23
18
|
const open = Boolean(anchorEl);
|
24
19
|
const containerRef = useRef();
|
25
20
|
const [size] = useWindowResize();
|
26
21
|
const val = activeMark(editor, format);
|
27
|
-
const value =
|
22
|
+
const value = getBreakPointsValue(val, size?.device);
|
28
23
|
const timerRef = useRef();
|
29
24
|
const updateMarkData = newVal => {
|
30
25
|
let upData = {
|
@@ -51,28 +46,31 @@ function SelectFontSize(props) {
|
|
51
46
|
if (value) {
|
52
47
|
let inc = parseInt(value);
|
53
48
|
inc = inc > 200 ? 200 : inc;
|
54
|
-
setSizeValue(inc);
|
55
49
|
updateMarkData(inc);
|
56
50
|
} else {
|
57
|
-
|
51
|
+
setFontSize(null);
|
58
52
|
}
|
59
53
|
};
|
60
54
|
const getSizeVal = () => {
|
61
55
|
try {
|
62
|
-
|
56
|
+
let size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
|
57
|
+
Object.entries(headingMap).forEach(([format, value]) => {
|
58
|
+
if (isBlockActive(editor, format) && isNaN(parseInt(size))) {
|
59
|
+
size = value;
|
60
|
+
}
|
61
|
+
});
|
62
|
+
return isNaN(parseInt(size)) ? 14 : parseInt(size);
|
63
63
|
} catch (err) {
|
64
64
|
return "";
|
65
65
|
}
|
66
66
|
};
|
67
67
|
useEffect(() => {
|
68
|
-
|
69
|
-
setSizeValue(getSizeVal());
|
70
|
-
}
|
68
|
+
setFontSize(getSizeVal());
|
71
69
|
}, [value]);
|
72
70
|
const onChange = e => {
|
73
71
|
clearTimeout(timerRef.current);
|
74
72
|
const value = e.target.value;
|
75
|
-
|
73
|
+
setFontSize(value);
|
76
74
|
timerRef.current = setTimeout(() => {
|
77
75
|
onChangeSize(value);
|
78
76
|
}, 500);
|
@@ -85,7 +83,7 @@ function SelectFontSize(props) {
|
|
85
83
|
},
|
86
84
|
children: [/*#__PURE__*/_jsx(TextField, {
|
87
85
|
sx: classes?.miniFontSizeInput,
|
88
|
-
value:
|
86
|
+
value: fontSize,
|
89
87
|
onChange: onChange,
|
90
88
|
size: "small"
|
91
89
|
}), /*#__PURE__*/_jsx(IconButton, {
|
@@ -99,16 +97,16 @@ function SelectFontSize(props) {
|
|
99
97
|
anchorEl: anchorEl,
|
100
98
|
onClose: () => setAnchorEl(null),
|
101
99
|
anchorOrigin: {
|
102
|
-
vertical:
|
103
|
-
horizontal:
|
100
|
+
vertical: 'bottom',
|
101
|
+
horizontal: 'left'
|
104
102
|
},
|
105
103
|
sx: classes.customSelectPopoverWrapper,
|
106
104
|
children: fontSizeOptions.map((s, i) => {
|
107
105
|
return /*#__PURE__*/_jsx("div", {
|
108
106
|
children: /*#__PURE__*/_jsx(Button, {
|
109
|
-
className: `customSelectOptionLabel ${
|
107
|
+
className: `customSelectOptionLabel ${fontSize === s ? "selected" : ""}`,
|
110
108
|
onClick: () => {
|
111
|
-
|
109
|
+
setFontSize(s);
|
112
110
|
onChangeSize(s);
|
113
111
|
},
|
114
112
|
children: s
|
@@ -2,7 +2,7 @@ import { useMemo } from "react";
|
|
2
2
|
import { isBlockActive, toggleBlock } from "../../../utils/SlateUtilityFunctions";
|
3
3
|
import CustomSelectTool from "./CustomSelectTool";
|
4
4
|
import Icon from "../../../common/Icon";
|
5
|
-
import { insertAccordion
|
5
|
+
import { insertAccordion } from "../../../utils/accordion";
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
8
|
function Label({
|
@@ -16,8 +16,8 @@ function Label({
|
|
16
16
|
}), " ", label]
|
17
17
|
});
|
18
18
|
}
|
19
|
-
function getListOptions(translation
|
20
|
-
|
19
|
+
function getListOptions(translation) {
|
20
|
+
return [{
|
21
21
|
id: 15,
|
22
22
|
value: "orderedList",
|
23
23
|
type: "block",
|
@@ -53,8 +53,7 @@ function getListOptions(translation, listType) {
|
|
53
53
|
icon: "check-list-item"
|
54
54
|
}),
|
55
55
|
group: "list"
|
56
|
-
}
|
57
|
-
const accordion = [{
|
56
|
+
}, {
|
58
57
|
id: 30,
|
59
58
|
value: "accordion",
|
60
59
|
type: "accordion",
|
@@ -68,30 +67,17 @@ function getListOptions(translation, listType) {
|
|
68
67
|
icon: "accordion"
|
69
68
|
})
|
70
69
|
}];
|
71
|
-
let options = [];
|
72
|
-
if (listType === "accordion-summary") {
|
73
|
-
options = [...accordion];
|
74
|
-
} else if (listType === "list-item") {
|
75
|
-
options = [...list];
|
76
|
-
} else {
|
77
|
-
options = [...list, ...accordion];
|
78
|
-
}
|
79
|
-
return options;
|
80
70
|
}
|
81
71
|
function SelectList({
|
82
72
|
editor,
|
83
73
|
classes,
|
84
74
|
closeMainPopup,
|
85
|
-
customProps
|
86
|
-
commonProps
|
75
|
+
customProps
|
87
76
|
}) {
|
88
77
|
const {
|
89
78
|
translation
|
90
79
|
} = customProps;
|
91
|
-
const
|
92
|
-
listType
|
93
|
-
} = commonProps || {};
|
94
|
-
const listOptions = getListOptions(translation, listType);
|
80
|
+
const listOptions = getListOptions(translation);
|
95
81
|
const selectedList = useMemo(() => {
|
96
82
|
return listOptions.find(t => isBlockActive(editor, t.value));
|
97
83
|
}, [listOptions, isBlockActive, editor]);
|
@@ -99,11 +85,7 @@ function SelectList({
|
|
99
85
|
if (option.type === "block") {
|
100
86
|
toggleBlock(editor, format);
|
101
87
|
} else if (option.type === "accordion") {
|
102
|
-
|
103
|
-
toggleAccordion(editor);
|
104
|
-
} else {
|
105
|
-
insertAccordion(editor);
|
106
|
-
}
|
88
|
+
insertAccordion(editor);
|
107
89
|
}
|
108
90
|
closeMainPopup();
|
109
91
|
};
|