@flozy/editor 10.7.0 → 10.7.1
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 +17 -16
- package/dist/Editor/CommonEditor.js +126 -15
- package/dist/Editor/DialogWrapper.js +31 -25
- package/dist/Editor/Editor.css +45 -11
- package/dist/Editor/Elements/AI/PopoverAIInput.js +11 -3
- package/dist/Editor/Elements/AI/Styles.js +1 -0
- package/dist/Editor/Elements/Accordion/Accordion.js +25 -17
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/Attachments/AttachmentStyles.js +16 -0
- package/dist/Editor/Elements/Attachments/Attachments.js +153 -11
- package/dist/Editor/Elements/Attachments/AttachmentsButton.js +8 -3
- package/dist/Editor/Elements/Button/EditorButton.js +23 -7
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +61 -14
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +10 -7
- package/dist/Editor/Elements/Color Picker/Styles.js +15 -13
- package/dist/Editor/Elements/Embed/Embed.js +36 -43
- package/dist/Editor/Elements/Embed/Image.js +240 -23
- package/dist/Editor/Elements/Embed/Video.js +246 -15
- package/dist/Editor/Elements/Form/FormField.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/Styles.js +24 -22
- package/dist/Editor/Elements/Form/Workflow/constant.js +25 -1
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +39 -33
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +7 -4
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -0
- package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
- package/dist/Editor/Elements/FreeGrid/helper.js +115 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +9 -0
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +2 -1
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Table/Table.js +3 -3
- package/dist/Editor/Elements/Title/title.js +6 -6
- package/dist/Editor/Elements/Variables/VariableButton.js +10 -1
- package/dist/Editor/MiniEditor.js +2 -1
- package/dist/Editor/Styles/EditorStyles.js +20 -5
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +27 -3
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -3
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +10 -13
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +6 -13
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +7 -4
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +69 -9
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +58 -10
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +5 -2
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/BackIcon.js +18 -0
- package/dist/Editor/assets/svg/ThemeIcons.js +293 -0
- package/dist/Editor/common/ColorPickerButton.js +38 -16
- package/dist/Editor/common/CustomColorPicker/index.js +130 -0
- package/dist/Editor/common/CustomColorPicker/style.js +53 -0
- package/dist/Editor/common/CustomDialog2/index.js +94 -0
- package/dist/Editor/common/CustomDialog2/style.js +67 -0
- package/dist/Editor/common/CustomSelect.js +43 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +3 -0
- package/dist/Editor/common/Icon.js +28 -0
- package/dist/Editor/common/ImageSelector/ImageSelector.js +46 -8
- package/dist/Editor/common/ImageSelector/Options/Upload.js +26 -11
- package/dist/Editor/common/ImageSelector/Styles.js +3 -9
- package/dist/Editor/common/LinkSettings/NavComponents.js +6 -2
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +2 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +20 -7
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +3 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +3 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +20 -7
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +11 -2
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +17 -0
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +6 -3
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +28 -18
- package/dist/Editor/common/RnD/Utils/index.js +3 -1
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +45 -58
- package/dist/Editor/common/RnD/VirtualElement/helper.js +320 -130
- package/dist/Editor/common/RnD/VirtualElement/styles.js +22 -0
- package/dist/Editor/common/RnD/index.js +48 -13
- package/dist/Editor/common/Shorthands/elements.js +54 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +15 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +12 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +16 -8
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +36 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/embedUpload.js +115 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +16 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +15 -7
- package/dist/Editor/common/StyleBuilder/index.js +8 -4
- package/dist/Editor/common/Uploader.js +125 -17
- package/dist/Editor/common/UploaderWithProgress.js +183 -0
- package/dist/Editor/common/iconslist.js +21 -0
- package/dist/Editor/commonStyle.js +107 -64
- package/dist/Editor/helper/index.js +10 -2
- package/dist/Editor/helper/textIndeces.js +58 -0
- package/dist/Editor/helper/theme.js +203 -2
- package/dist/Editor/hooks/useEditorTheme.js +153 -0
- package/dist/Editor/hooks/useMouseMove.js +9 -3
- package/dist/Editor/hooks/useThemeValues.js +63 -0
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +7 -3
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/service/fileupload.js +53 -0
- package/dist/Editor/theme/ThemeList.js +50 -173
- package/dist/Editor/theme/index.js +149 -0
- package/dist/Editor/themeSettings/ActiveTheme.js +82 -0
- package/dist/Editor/themeSettings/buttons/index.js +300 -0
- package/dist/Editor/themeSettings/buttons/style.js +23 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +310 -0
- package/dist/Editor/themeSettings/colorTheme/style.js +81 -0
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +121 -0
- package/dist/Editor/themeSettings/fonts/index.js +240 -0
- package/dist/Editor/themeSettings/fonts/style.js +62 -0
- package/dist/Editor/themeSettings/icons.js +60 -0
- package/dist/Editor/themeSettings/index.js +380 -0
- package/dist/Editor/themeSettings/style.js +299 -0
- package/dist/Editor/themeSettingsAI/icons.js +96 -0
- package/dist/Editor/themeSettingsAI/index.js +355 -0
- package/dist/Editor/themeSettingsAI/saveTheme.js +202 -0
- package/dist/Editor/themeSettingsAI/style.js +332 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +231 -25
- package/dist/Editor/utils/accordion.js +62 -34
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +97 -21
- package/dist/Editor/utils/insertAppHeader.js +8 -4
- package/package.json +4 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -454
@@ -5,8 +5,8 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
const More = props => {
|
6
6
|
const {
|
7
7
|
handleClick,
|
8
|
-
|
9
|
-
|
8
|
+
translation,
|
9
|
+
breakpoint
|
10
10
|
} = props;
|
11
11
|
return /*#__PURE__*/_jsx(Box, {
|
12
12
|
children: /*#__PURE__*/_jsxs(List, {
|
@@ -19,15 +19,15 @@ const More = props => {
|
|
19
19
|
className: "item-wrapper",
|
20
20
|
onClick: handleClick("duplicateSection"),
|
21
21
|
children: translation?.translation("Duplicate Section")
|
22
|
-
}), /*#__PURE__*/_jsx(ListItemButton, {
|
23
|
-
className: "item-wrapper",
|
24
|
-
onClick: handleClick("deleteSection"),
|
25
|
-
children: "Delete Section"
|
26
22
|
}), breakpoint === "xs" ? /*#__PURE__*/_jsx(ListItemButton, {
|
27
23
|
className: "item-wrapper",
|
28
24
|
onClick: handleClick("forceAutoAlignment"),
|
29
25
|
children: "Force Auto Alignment"
|
30
|
-
}) : null
|
26
|
+
}) : null, /*#__PURE__*/_jsx(ListItemButton, {
|
27
|
+
className: "item-wrapper",
|
28
|
+
onClick: handleClick("deleteSection"),
|
29
|
+
children: "Delete Section"
|
30
|
+
})]
|
31
31
|
})
|
32
32
|
});
|
33
33
|
};
|
@@ -0,0 +1,115 @@
|
|
1
|
+
import { ROW_HEIGHT } from "../../common/RnD/Utils/gridDropItem";
|
2
|
+
import { getElementOffset } from "../../common/RnD/VirtualElement/VirtualTextElement";
|
3
|
+
import { RND_ITEMS } from "../../helper";
|
4
|
+
export const ELEMENT_CASE = {
|
5
|
+
ADD_TEXT: "addText",
|
6
|
+
ADD_BUTTON: "addButton",
|
7
|
+
ADD_SIGNATURE: "addSignature",
|
8
|
+
ADD_IMAGE: "addImage",
|
9
|
+
ADD_VIDEO: "addVideo",
|
10
|
+
ADD_TABLE: "addTable",
|
11
|
+
ADD_CODE: "addCode",
|
12
|
+
ADD_BOX: "addBox",
|
13
|
+
ADD_FORM: "addForm",
|
14
|
+
ADD_APP_HEADER: "addAppHeader",
|
15
|
+
ADD_DIVIDER: "addDivider"
|
16
|
+
};
|
17
|
+
const commonXsValues = {
|
18
|
+
top_xs: 0,
|
19
|
+
marginTop_xs: 12,
|
20
|
+
left_xs: 24,
|
21
|
+
width_xs: 272,
|
22
|
+
xs_updatedOn: new Date().getTime()
|
23
|
+
};
|
24
|
+
const elementXsValues = {
|
25
|
+
[ELEMENT_CASE.ADD_TEXT]: {
|
26
|
+
...commonXsValues,
|
27
|
+
height_xs: 50
|
28
|
+
},
|
29
|
+
[ELEMENT_CASE.ADD_BUTTON]: {
|
30
|
+
...commonXsValues,
|
31
|
+
height_xs: 50
|
32
|
+
},
|
33
|
+
[ELEMENT_CASE.ADD_SIGNATURE]: {
|
34
|
+
...commonXsValues,
|
35
|
+
height_xs: 173
|
36
|
+
},
|
37
|
+
[ELEMENT_CASE.ADD_IMAGE]: {
|
38
|
+
...commonXsValues,
|
39
|
+
height_xs: 80
|
40
|
+
},
|
41
|
+
[ELEMENT_CASE.ADD_VIDEO]: {
|
42
|
+
...commonXsValues,
|
43
|
+
height_xs: 300
|
44
|
+
},
|
45
|
+
[ELEMENT_CASE.ADD_TABLE]: {
|
46
|
+
...commonXsValues,
|
47
|
+
height_xs: 165
|
48
|
+
},
|
49
|
+
[ELEMENT_CASE.ADD_CODE]: {
|
50
|
+
...commonXsValues,
|
51
|
+
height: 300
|
52
|
+
},
|
53
|
+
[ELEMENT_CASE.ADD_BOX]: {
|
54
|
+
...commonXsValues,
|
55
|
+
height_xs: 300
|
56
|
+
},
|
57
|
+
[ELEMENT_CASE.ADD_FORM]: {
|
58
|
+
...commonXsValues,
|
59
|
+
height_xs: 80
|
60
|
+
},
|
61
|
+
[ELEMENT_CASE.ADD_APP_HEADER]: {
|
62
|
+
...commonXsValues,
|
63
|
+
height_xs: 80
|
64
|
+
},
|
65
|
+
[ELEMENT_CASE.ADD_DIVIDER]: {
|
66
|
+
...commonXsValues,
|
67
|
+
height_xs: 24
|
68
|
+
}
|
69
|
+
};
|
70
|
+
export const findMaxYValue = (sectionItems, breakpoint) => {
|
71
|
+
let maxY = 0;
|
72
|
+
sectionItems.forEach(item => {
|
73
|
+
const isHidden = breakpoint === "xs" && item.children.some(c => c.xsHidden);
|
74
|
+
if (item?.type && RND_ITEMS.includes(item.type) && !isHidden) {
|
75
|
+
const {
|
76
|
+
bottom
|
77
|
+
} = getElementOffset(item, breakpoint === "lg" ? "lg" : "xs");
|
78
|
+
maxY = Math.max(maxY, bottom);
|
79
|
+
}
|
80
|
+
});
|
81
|
+
return maxY;
|
82
|
+
};
|
83
|
+
export const convertToGridArea = y => {
|
84
|
+
// Calculate grid position
|
85
|
+
const row = Math.floor(y / ROW_HEIGHT) + 1;
|
86
|
+
|
87
|
+
// to calculate difference inside the grid
|
88
|
+
const marginTop = Math.abs((row - 1) * ROW_HEIGHT - y);
|
89
|
+
|
90
|
+
// Update grid area
|
91
|
+
const gridArea = `${row} / 1 / ${row + 1} / 2`;
|
92
|
+
return {
|
93
|
+
gridArea,
|
94
|
+
marginTop
|
95
|
+
};
|
96
|
+
};
|
97
|
+
export const getNewElementXsValues = (type, sectionItems) => {
|
98
|
+
const values = elementXsValues[type] || {};
|
99
|
+
const y = sectionItems?.length ? findMaxYValue(sectionItems) : 0;
|
100
|
+
const {
|
101
|
+
gridArea,
|
102
|
+
marginTop
|
103
|
+
} = convertToGridArea(y);
|
104
|
+
const BUFFER_MARGIN_TOP = 12;
|
105
|
+
const xsVal = {
|
106
|
+
...values,
|
107
|
+
gridArea_xs: gridArea,
|
108
|
+
marginTop_xs: marginTop + BUFFER_MARGIN_TOP
|
109
|
+
};
|
110
|
+
const sectionHeightXs = y + values?.height_xs + BUFFER_MARGIN_TOP + 12;
|
111
|
+
return {
|
112
|
+
xsVal,
|
113
|
+
sectionHeightXs
|
114
|
+
};
|
115
|
+
};
|
@@ -247,6 +247,9 @@ const useFreeGridStyles = ({
|
|
247
247
|
},
|
248
248
|
"& > .simple-text": {
|
249
249
|
display: "none"
|
250
|
+
},
|
251
|
+
"& > .edt-paragraphs": {
|
252
|
+
display: "none"
|
250
253
|
}
|
251
254
|
},
|
252
255
|
"& .fgi_type_form": {
|
@@ -350,6 +353,12 @@ const useFreeGridStyles = ({
|
|
350
353
|
"& .fgi_type_text": {
|
351
354
|
"& .edt-headings": {
|
352
355
|
margin: "0px"
|
356
|
+
},
|
357
|
+
"& .edt-paragraphs": {
|
358
|
+
margin: "0px"
|
359
|
+
},
|
360
|
+
"& blockquote": {
|
361
|
+
margin: "0px !important"
|
353
362
|
}
|
354
363
|
},
|
355
364
|
/** element toolbar hide */
|
@@ -292,7 +292,7 @@ const GridItem = props => {
|
|
292
292
|
...getBRProps,
|
293
293
|
display: "flex",
|
294
294
|
flexDirection: flexDirection || "column",
|
295
|
-
background: bgColor
|
295
|
+
background: bgColor,
|
296
296
|
borderColor: getBorderColor(),
|
297
297
|
borderWidth: borderWidth || "1px",
|
298
298
|
borderStyle: borderStyle || "solid",
|
@@ -35,8 +35,8 @@ const SimpleTextStyle = ({
|
|
35
35
|
height: "24px",
|
36
36
|
overflow: "hidden",
|
37
37
|
fontSize: "14px",
|
38
|
-
display:
|
39
|
-
alignItems:
|
38
|
+
display: "inline-flex",
|
39
|
+
alignItems: "center",
|
40
40
|
"& .bg-pad-sl": {
|
41
41
|
padding: "2px 4px 2px 4px",
|
42
42
|
background: "transparent",
|
@@ -307,7 +307,7 @@ const Table = props => {
|
|
307
307
|
onScroll: handleScroll,
|
308
308
|
onMouseOver: onMouseOver,
|
309
309
|
onMouseLeave: onMouseLeave,
|
310
|
-
className:
|
310
|
+
className: "custom-scroll",
|
311
311
|
children: [/*#__PURE__*/_jsx(TableComp, {
|
312
312
|
className: readOnly ? "readOnly" : "",
|
313
313
|
sx: {
|
@@ -345,8 +345,8 @@ const Table = props => {
|
|
345
345
|
handleAction: handleAction,
|
346
346
|
exandTools: exandTools,
|
347
347
|
openSetttings: openSetttings,
|
348
|
-
|
349
|
-
|
348
|
+
hideTools: hideTools,
|
349
|
+
translation: translation
|
350
350
|
}), /*#__PURE__*/_jsx(MoreTableSettings, {
|
351
351
|
exandTools: exandTools,
|
352
352
|
handleAction: handleAction,
|
@@ -3,6 +3,12 @@ import { Editor, Text } from "slate";
|
|
3
3
|
import { useSlate } from "slate-react";
|
4
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
|
+
};
|
6
12
|
const Title = props => {
|
7
13
|
const {
|
8
14
|
attributes,
|
@@ -47,10 +53,4 @@ const useDetectExitFromTitle = (titleNode, onSaveTitle) => {
|
|
47
53
|
}
|
48
54
|
}, [editor.selection]);
|
49
55
|
return null;
|
50
|
-
};
|
51
|
-
const isEmptyTextNode = node => {
|
52
|
-
if (Text.isText(node)) {
|
53
|
-
return !node.text.trim();
|
54
|
-
}
|
55
|
-
return false;
|
56
56
|
};
|
@@ -34,7 +34,8 @@ const VariableButton = props => {
|
|
34
34
|
PaperProps: {
|
35
35
|
style: {
|
36
36
|
maxHeight: 300,
|
37
|
-
overflowY: "auto"
|
37
|
+
overflowY: "auto",
|
38
|
+
transformOrigin: 'top left'
|
38
39
|
},
|
39
40
|
sx: {
|
40
41
|
"&::-webkit-scrollbar-track": {
|
@@ -44,6 +45,14 @@ const VariableButton = props => {
|
|
44
45
|
borderRadius: "16px"
|
45
46
|
}
|
46
47
|
}
|
48
|
+
},
|
49
|
+
anchorOrigin: {
|
50
|
+
vertical: 'bottom',
|
51
|
+
horizontal: 'right'
|
52
|
+
},
|
53
|
+
transformOrigin: {
|
54
|
+
vertical: 'top',
|
55
|
+
horizontal: 'right'
|
47
56
|
}
|
48
57
|
},
|
49
58
|
children: [/*#__PURE__*/_jsx(MenuItem, {
|
@@ -45,12 +45,13 @@ const MiniEditor = props => {
|
|
45
45
|
const {
|
46
46
|
translationMock
|
47
47
|
} = otherProps;
|
48
|
+
const dummyTranslation = () => {};
|
48
49
|
const customProps = {
|
49
50
|
...(otherProps || {}),
|
50
51
|
readOnly: isReadOnly,
|
51
52
|
editorPlaceholder: miniEditorPlaceholder,
|
52
53
|
page_id: id,
|
53
|
-
translation: translation || translationMock
|
54
|
+
translation: translation || translationMock || dummyTranslation
|
54
55
|
};
|
55
56
|
const [mentions, setMentions] = useMentions({
|
56
57
|
editor,
|
@@ -133,7 +133,11 @@ const editorStyles = ({
|
|
133
133
|
},
|
134
134
|
"& .accordion-summary-collapse-btn": {
|
135
135
|
padding: "4px",
|
136
|
-
width:
|
136
|
+
width: "5px",
|
137
|
+
"& svg:hover": {
|
138
|
+
background: theme?.palette?.editor?.tv_hover_bg,
|
139
|
+
borderRadius: "4px"
|
140
|
+
}
|
137
141
|
},
|
138
142
|
"& .workflow-icon-btn": {
|
139
143
|
pointerEvents: "none",
|
@@ -215,6 +219,17 @@ const editorStyles = ({
|
|
215
219
|
borderRadius: "12px",
|
216
220
|
"& svg": {
|
217
221
|
marginRight: "8px"
|
222
|
+
},
|
223
|
+
"& .circularProgress-cls": {
|
224
|
+
"& svg": {
|
225
|
+
width: "15px !important",
|
226
|
+
height: "15px !important"
|
227
|
+
}
|
228
|
+
},
|
229
|
+
"& .uploadCancel": {
|
230
|
+
color: theme?.palette?.editor?.closeButtonSvgStroke,
|
231
|
+
width: "25px !important",
|
232
|
+
height: "25px !important"
|
218
233
|
}
|
219
234
|
},
|
220
235
|
"& .content-editable.empty": {
|
@@ -242,7 +257,7 @@ const editorStyles = ({
|
|
242
257
|
}
|
243
258
|
},
|
244
259
|
"& .section-tw": {
|
245
|
-
background:
|
260
|
+
background: "transparent !important",
|
246
261
|
"& button": {
|
247
262
|
padding: "2px",
|
248
263
|
borderRadius: "0px",
|
@@ -291,8 +306,8 @@ const editorStyles = ({
|
|
291
306
|
}
|
292
307
|
},
|
293
308
|
"& ::selection": {
|
294
|
-
background: 'rgba(35, 131, 226, 0.35)!important',
|
295
|
-
color:
|
309
|
+
// background: 'rgba(35, 131, 226, 0.35)!important',
|
310
|
+
color: "inherit"
|
296
311
|
},
|
297
312
|
"&.readOnlyContainer": {
|
298
313
|
"& .max-content": {
|
@@ -302,7 +317,7 @@ const editorStyles = ({
|
|
302
317
|
},
|
303
318
|
fullScreenWrapper: {
|
304
319
|
"& .editor-wrapper": {
|
305
|
-
paddingTop:
|
320
|
+
paddingTop: "20px"
|
306
321
|
},
|
307
322
|
"& .MuiDialog-paper, & .MuiPopover-paper": {
|
308
323
|
background: `${theme?.palette?.editor?.background} !important`
|
@@ -1,8 +1,32 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Select, MenuItem } from "@mui/material";
|
3
|
-
import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
|
3
|
+
import { addMarkData, activeMark, getSelectedElementStyle } from "../../utils/SlateUtilityFunctions.js";
|
4
|
+
import { toolbarGroups } from "../toolbarGroups.js";
|
4
5
|
import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded";
|
6
|
+
import { googleFontList as defaultFonts } from "../../common/FontLoader/FontList.js";
|
5
7
|
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
|
+
};
|
6
30
|
const Dropdown = ({
|
7
31
|
classes,
|
8
32
|
editor,
|
@@ -10,7 +34,7 @@ const Dropdown = ({
|
|
10
34
|
options,
|
11
35
|
width
|
12
36
|
}) => {
|
13
|
-
const value = activeMark(editor, format);
|
37
|
+
const value = activeMark(editor, format, true) || getValue(editor, format);
|
14
38
|
const changeMarkData = (event, format) => {
|
15
39
|
event.preventDefault();
|
16
40
|
const value = event.target.value;
|
@@ -20,7 +44,7 @@ const Dropdown = ({
|
|
20
44
|
});
|
21
45
|
};
|
22
46
|
return /*#__PURE__*/_jsx(Select, {
|
23
|
-
value: value,
|
47
|
+
value: value || options?.[0]?.value,
|
24
48
|
className: "editor-dd",
|
25
49
|
onChange: e => changeMarkData(e, format),
|
26
50
|
MenuProps: {
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Autocomplete, TextField } from "@mui/material";
|
3
|
-
import {
|
3
|
+
import { 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
|
6
|
+
import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded";
|
7
|
+
import { getValue } from "./Dropdown.js";
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
9
|
const FontFamilyAutocomplete = ({
|
9
10
|
editor,
|
@@ -14,7 +15,7 @@ const FontFamilyAutocomplete = ({
|
|
14
15
|
val = "",
|
15
16
|
webFont = false
|
16
17
|
}) => {
|
17
|
-
const markValue =
|
18
|
+
const markValue = getValue(editor, format);
|
18
19
|
const value = !webFont ? markValue : val;
|
19
20
|
const changeMarkData = (event, newValue, format) => {
|
20
21
|
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, isMarkBtnActive } 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: isMarkBtnActive(editor, format),
|
17
17
|
format: format,
|
18
18
|
onMouseDown: e => {
|
19
19
|
e.preventDefault();
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
2
2
|
import { TextField, IconButton } from "@mui/material";
|
3
|
-
import { addMarkData, activeMark
|
4
|
-
import {
|
5
|
-
import { getBreakPointsValue } from "../../helper/theme.js";
|
3
|
+
import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
|
4
|
+
import { getBreakPointsValue, getTextSizeVal } from "../../helper/theme.js";
|
6
5
|
import useWindowResize from "../../hooks/useWindowResize.js";
|
7
6
|
import { BREAKPOINTS_DEVICES } from "../../helper/theme.js";
|
8
7
|
import { TextSizeDownArrow, TextSizeUpArrow } from "../../common/iconListV2.js";
|
@@ -15,11 +14,15 @@ const TextSize = ({
|
|
15
14
|
format,
|
16
15
|
fullWidth
|
17
16
|
}) => {
|
18
|
-
const [size] = useWindowResize();
|
19
|
-
const val = activeMark(editor, format);
|
20
|
-
const value = getBreakPointsValue(val, size?.device);
|
21
17
|
const [fontSize, setFontSize] = useState();
|
22
18
|
const timerRef = useRef();
|
19
|
+
const [size] = useWindowResize();
|
20
|
+
const val = activeMark(editor, format);
|
21
|
+
|
22
|
+
// const noFontSize =
|
23
|
+
// val === "normal" || (typeof val === "object" && !Object.keys(val)?.length);
|
24
|
+
|
25
|
+
const value = getTextSizeVal(editor);
|
23
26
|
useEffect(() => {
|
24
27
|
setFontSize(getSizeVal());
|
25
28
|
}, [value]);
|
@@ -55,13 +58,7 @@ const TextSize = ({
|
|
55
58
|
};
|
56
59
|
const getSizeVal = () => {
|
57
60
|
try {
|
58
|
-
|
59
|
-
Object.entries(headingMap).forEach(([format, value]) => {
|
60
|
-
if (isBlockActive(editor, format) && isNaN(parseInt(size))) {
|
61
|
-
size = value;
|
62
|
-
}
|
63
|
-
});
|
64
|
-
return parseInt(size);
|
61
|
+
return parseInt(value);
|
65
62
|
} catch (err) {
|
66
63
|
return "";
|
67
64
|
}
|
@@ -12,7 +12,8 @@ function MiniColorPicker(props) {
|
|
12
12
|
classes,
|
13
13
|
id,
|
14
14
|
editor,
|
15
|
-
customProps
|
15
|
+
customProps,
|
16
|
+
type
|
16
17
|
} = props;
|
17
18
|
const [openColorTool, setOpenColorTool] = useState(null);
|
18
19
|
const {
|
@@ -38,7 +39,8 @@ function MiniColorPicker(props) {
|
|
38
39
|
classes: classes,
|
39
40
|
forMiniTool: true,
|
40
41
|
openColorTool: openColorTool,
|
41
|
-
closeColorTool: () => setOpenColorTool(null)
|
42
|
+
closeColorTool: () => setOpenColorTool(null),
|
43
|
+
type: type
|
42
44
|
}, id)]
|
43
45
|
});
|
44
46
|
}
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
2
|
-
import { activeMark, addMarkData
|
2
|
+
import { activeMark, addMarkData } 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 } from "../../../helper/theme";
|
7
|
-
import { headingMap, sizeMap } from "../../../utils/font";
|
6
|
+
import { BREAKPOINTS_DEVICES, getBreakPointsValue, getTextSizeVal } from "../../../helper/theme";
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
9
|
const fontSizeOptions = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 26, 32, 36, 40, 48, 64, 96, 128];
|
@@ -19,7 +18,7 @@ function SelectFontSize({
|
|
19
18
|
const containerRef = useRef();
|
20
19
|
const [size] = useWindowResize();
|
21
20
|
const val = activeMark(editor, format);
|
22
|
-
const value =
|
21
|
+
const value = getTextSizeVal(editor);
|
23
22
|
const timerRef = useRef();
|
24
23
|
const updateMarkData = newVal => {
|
25
24
|
let upData = {
|
@@ -53,13 +52,7 @@ function SelectFontSize({
|
|
53
52
|
};
|
54
53
|
const getSizeVal = () => {
|
55
54
|
try {
|
56
|
-
|
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);
|
55
|
+
return parseInt(value);
|
63
56
|
} catch (err) {
|
64
57
|
return "";
|
65
58
|
}
|
@@ -97,8 +90,8 @@ function SelectFontSize({
|
|
97
90
|
anchorEl: anchorEl,
|
98
91
|
onClose: () => setAnchorEl(null),
|
99
92
|
anchorOrigin: {
|
100
|
-
vertical:
|
101
|
-
horizontal:
|
93
|
+
vertical: "bottom",
|
94
|
+
horizontal: "left"
|
102
95
|
},
|
103
96
|
sx: classes.customSelectPopoverWrapper,
|
104
97
|
children: fontSizeOptions.map((s, i) => {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useMemo } from "react";
|
2
|
-
import { isBlockActive, toggleBlock } from "../../../utils/SlateUtilityFunctions";
|
2
|
+
import { isBlockActive, isListActive, toggleBlock } from "../../../utils/SlateUtilityFunctions";
|
3
3
|
import CustomSelectTool from "./CustomSelectTool";
|
4
4
|
import Icon from "../../../common/Icon";
|
5
5
|
import { insertAccordion } from "../../../utils/accordion";
|
@@ -79,7 +79,9 @@ function SelectList({
|
|
79
79
|
} = customProps;
|
80
80
|
const listOptions = getListOptions(translation);
|
81
81
|
const selectedList = useMemo(() => {
|
82
|
-
|
82
|
+
const listActive = isListActive(editor);
|
83
|
+
let selected = listOptions.find(t => listActive === t.value);
|
84
|
+
return selected;
|
83
85
|
}, [listOptions, isBlockActive, editor]);
|
84
86
|
const onChange = (format, option) => {
|
85
87
|
if (option.type === "block") {
|