@flozy/editor 3.8.9 → 3.9.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +55 -45
- package/dist/Editor/CommonEditor.js +175 -168
- package/dist/Editor/DialogWrapper.js +3 -4
- package/dist/Editor/Editor.css +7 -4
- package/dist/Editor/Elements/AI/AIInput.js +17 -18
- package/dist/Editor/Elements/AI/CustomSelect.js +19 -12
- package/dist/Editor/Elements/AI/PopoverAIInput.js +58 -74
- package/dist/Editor/Elements/AI/Styles.js +2 -1
- package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +73 -0
- package/dist/Editor/Elements/AI/VoiceToText/index.js +177 -0
- package/dist/Editor/Elements/AI/VoiceToText/style.js +40 -0
- package/dist/Editor/Elements/AppHeader/AppHeader.js +49 -40
- package/dist/Editor/Elements/Button/EditorButton.js +38 -33
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -17
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +2 -1
- package/dist/Editor/Elements/Embed/Image.js +14 -15
- package/dist/Editor/Elements/Embed/Video.js +8 -12
- package/dist/Editor/Elements/Emoji/EmojiButton.js +7 -11
- package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
- package/dist/Editor/Elements/Form/Form.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -3
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
- package/dist/Editor/Elements/Grid/Grid.js +34 -14
- package/dist/Editor/Elements/Grid/GridItem.js +23 -31
- package/dist/Editor/Elements/Link/Link.js +6 -1
- package/dist/Editor/Elements/Link/LinkButton.js +4 -2
- package/dist/Editor/Elements/Link/LinkPopup.js +10 -3
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +8 -4
- package/dist/Editor/Elements/Redo/RedoButton.js +14 -0
- package/dist/Editor/Elements/Signature/SignaturePopup.js +14 -3
- package/dist/Editor/Elements/SimpleText/index.js +8 -9
- package/dist/Editor/Elements/SimpleText/style.js +0 -37
- package/dist/Editor/Elements/Table/Styles.js +23 -1
- package/dist/Editor/Elements/Table/Table.js +2 -1
- package/dist/Editor/Elements/Table/TableCell.js +69 -7
- package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +1 -0
- package/dist/Editor/Elements/Undo/UndoButton.js +14 -0
- package/dist/Editor/MiniEditor.js +3 -1
- package/dist/Editor/Styles/EditorStyles.js +1 -24
- package/dist/Editor/Toolbar/Basic/index.js +4 -2
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +26 -2
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +29 -18
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +29 -3
- package/dist/Editor/Toolbar/Mini/Options/Options.js +10 -0
- package/dist/Editor/Toolbar/Mini/Styles.js +7 -0
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +4 -11
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +213 -86
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +22 -16
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +52 -8
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +7 -25
- package/dist/Editor/Toolbar/Toolbar.js +0 -7
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -11
- package/dist/Editor/assets/svg/AIIcons.js +153 -1
- package/dist/Editor/assets/svg/AddTemplateIcon.js +13 -10
- package/dist/Editor/assets/svg/RedoIcon.js +27 -0
- package/dist/Editor/assets/svg/SettingsIcon.js +28 -0
- package/dist/Editor/assets/svg/TextIcon.js +8 -5
- package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
- package/dist/Editor/assets/svg/UndoIcon.js +27 -0
- package/dist/Editor/common/ColorPickerButton.js +25 -9
- package/dist/Editor/common/CustomColorPicker/index.js +106 -0
- package/dist/Editor/common/CustomColorPicker/style.js +53 -0
- package/dist/Editor/common/CustomDialog/index.js +94 -0
- package/dist/Editor/common/CustomDialog/style.js +67 -0
- package/dist/Editor/common/CustomSelect.js +33 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +56 -47
- package/dist/Editor/common/Icon.js +41 -8
- package/dist/Editor/common/LinkSettings/NavComponents.js +5 -2
- package/dist/Editor/common/LinkSettings/index.js +4 -2
- package/dist/Editor/common/LinkSettings/navOptions.js +7 -2
- package/dist/Editor/common/LinkSettings/style.js +11 -8
- package/dist/Editor/common/MentionsPopup/MentionsListCard.js +6 -1
- package/dist/Editor/common/MentionsPopup/index.js +8 -12
- package/dist/Editor/common/Section/index.js +69 -28
- package/dist/Editor/common/Section/styles.js +12 -6
- package/dist/Editor/common/Shorthands/elements.js +54 -12
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +19 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +31 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +14 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +2 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +14 -4
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/common/StyleBuilder/sectionStyle.js +2 -13
- package/dist/Editor/common/iconslist.js +0 -31
- package/dist/Editor/helper/index.js +0 -139
- package/dist/Editor/helper/theme.js +185 -48
- package/dist/Editor/hooks/useEditorTheme.js +139 -0
- package/dist/Editor/hooks/useMouseMove.js +12 -37
- package/dist/Editor/hooks/useWindowMessage.js +10 -7
- package/dist/Editor/hooks/withCommon.js +1 -2
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +1 -1
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +50 -173
- package/dist/Editor/theme/index.js +144 -0
- package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
- package/dist/Editor/themeSettings/buttons/index.js +290 -0
- package/dist/Editor/themeSettings/buttons/style.js +21 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +290 -0
- package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +123 -0
- package/dist/Editor/themeSettings/fonts/index.js +213 -0
- package/dist/Editor/themeSettings/fonts/style.js +44 -0
- package/dist/Editor/themeSettings/icons.js +60 -0
- package/dist/Editor/themeSettings/index.js +320 -0
- package/dist/Editor/themeSettings/style.js +152 -0
- package/dist/Editor/themeSettingsAI/icons.js +96 -0
- package/dist/Editor/themeSettingsAI/index.js +356 -0
- package/dist/Editor/themeSettingsAI/saveTheme.js +190 -0
- package/dist/Editor/themeSettingsAI/style.js +247 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +163 -47
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/draftToSlate.js +1 -1
- package/dist/Editor/utils/events.js +54 -7
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +31 -31
- package/dist/Editor/utils/table.js +51 -43
- package/package.json +4 -6
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +0 -391
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +0 -193
- package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +0 -23
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +0 -184
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +0 -36
- package/dist/Editor/Elements/FreeGrid/Options/More.js +0 -24
- package/dist/Editor/Elements/FreeGrid/Options/SectionSettings.js +0 -47
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +0 -11
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +0 -75
- package/dist/Editor/Elements/FreeGrid/styles.js +0 -159
- package/dist/Editor/ErrorBoundary.js +0 -30
- package/dist/Editor/common/RnD/ContextMenu/CMenus.js +0 -105
- package/dist/Editor/common/RnD/ContextMenu/index.js +0 -38
- package/dist/Editor/common/RnD/ContextMenu/styles.js +0 -21
- package/dist/Editor/common/RnD/DragInfo/index.js +0 -31
- package/dist/Editor/common/RnD/DragInfo/styles.js +0 -15
- package/dist/Editor/common/RnD/DragOver/index.js +0 -46
- package/dist/Editor/common/RnD/DragOver/styles.js +0 -23
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +0 -82
- package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +0 -26
- package/dist/Editor/common/RnD/ElementOptions/index.js +0 -93
- package/dist/Editor/common/RnD/ElementOptions/styles.js +0 -41
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +0 -153
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +0 -58
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +0 -7
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +0 -46
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +0 -46
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +0 -46
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +0 -30
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +0 -46
- package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +0 -13
- package/dist/Editor/common/RnD/ElementSettings/index.js +0 -17
- package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +0 -14
- package/dist/Editor/common/RnD/ElementSettings/styles.js +0 -76
- package/dist/Editor/common/RnD/GuideLines/BoundaryLine.js +0 -52
- package/dist/Editor/common/RnD/GuideLines/index.js +0 -33
- package/dist/Editor/common/RnD/GuideLines/styles.js +0 -60
- package/dist/Editor/common/RnD/OptionsPopup/index.js +0 -50
- package/dist/Editor/common/RnD/OptionsPopup/style.js +0 -36
- package/dist/Editor/common/RnD/RnDCopy.js +0 -23
- package/dist/Editor/common/RnD/ShadowElement.js +0 -34
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +0 -40
- package/dist/Editor/common/RnD/SwitchViewport/styles.js +0 -24
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +0 -63
- package/dist/Editor/common/RnD/TransformHandles/CornerHandle.js +0 -19
- package/dist/Editor/common/RnD/TransformHandles/Icons/BottomRightIcon.js +0 -13
- package/dist/Editor/common/RnD/TransformHandles/SizeHandle.js +0 -18
- package/dist/Editor/common/RnD/TransformHandles/index.js +0 -62
- package/dist/Editor/common/RnD/Utils/alignmentDetection.js +0 -26
- package/dist/Editor/common/RnD/Utils/calculateDropItem.js +0 -98
- package/dist/Editor/common/RnD/Utils/collisionDetection.js +0 -52
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +0 -148
- package/dist/Editor/common/RnD/Utils/index.js +0 -251
- package/dist/Editor/common/RnD/VirtualElement/index.js +0 -76
- package/dist/Editor/common/RnD/VirtualElement/styles.js +0 -27
- package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +0 -28
- package/dist/Editor/common/RnD/index.js +0 -503
- package/dist/Editor/common/RnD/styles.js +0 -4
- package/dist/Editor/common/StyleBuilder/boxStyle.js +0 -30
- package/dist/Editor/helper/RnD/focusOnNewItem.js +0 -39
- package/dist/Editor/helper/RnD/scrollToNewSection.js +0 -24
- package/dist/Editor/helper/breakpoint.js +0 -5
- package/dist/Editor/hooks/useBreakpoints.js +0 -34
- package/dist/Editor/hooks/withErrorHandling.js +0 -14
- package/dist/Editor/utils/RnD/RnDCtrlCmds.js +0 -168
- package/dist/Editor/utils/freegrid.js +0 -49
@@ -1,4 +1,4 @@
|
|
1
|
-
const TableStyles =
|
1
|
+
const TableStyles = themeType => ({
|
2
2
|
tableToolBar: {
|
3
3
|
position: "absolute",
|
4
4
|
top: "-34px",
|
@@ -61,6 +61,28 @@ const TableStyles = () => ({
|
|
61
61
|
"&:hover": {
|
62
62
|
background: "#ccc"
|
63
63
|
}
|
64
|
+
},
|
65
|
+
deleteCellsPopUp: {
|
66
|
+
backgroundColor: themeType === "dark" ? "#292C32" : "#FFFFFF",
|
67
|
+
borderRadius: "7px !important",
|
68
|
+
border: themeType === "dark" ? "1px solid #5B5E64" : "1px solid #E4E8EB",
|
69
|
+
zIndex: 100,
|
70
|
+
minWidth: "186px !important"
|
71
|
+
},
|
72
|
+
menuItemPopUp: {
|
73
|
+
padding: "5px 7px !important",
|
74
|
+
margin: "6px !important",
|
75
|
+
borderRadius: 1,
|
76
|
+
userSelect: "none",
|
77
|
+
color: themeType === "dark" ? "#2563EB" : "#0F172A",
|
78
|
+
"&:hover": {
|
79
|
+
// backgroundColor: "rgba(0, 123, 255, 0.1)",
|
80
|
+
backgroundColor: themeType === "dark" ? "#2563EB" : "#E9F3FE"
|
81
|
+
},
|
82
|
+
"&.Mui-selected": {
|
83
|
+
backgroundColor: themeType === "dark" ? "#2563EB" : "#E9F3FE",
|
84
|
+
color: themeType === "dark" ? "#F6F6F6" : "#0F172A"
|
85
|
+
}
|
64
86
|
}
|
65
87
|
});
|
66
88
|
export default TableStyles;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
2
|
import { Transforms } from "slate";
|
3
3
|
import { useSelected, useSlateStatic } from "slate-react";
|
4
|
-
import { Box, IconButton, Tooltip, Table as TableComp, TableBody } from "@mui/material";
|
4
|
+
import { Box, IconButton, Tooltip, Table as TableComp, TableBody, Popper, Typography } from "@mui/material";
|
5
5
|
import AlignHorizontalLeftIcon from "@mui/icons-material/AlignHorizontalLeft";
|
6
6
|
import AlignHorizontalRightIcon from "@mui/icons-material/AlignHorizontalRight";
|
7
7
|
import AlignVerticalTopIcon from "@mui/icons-material/AlignVerticalTop";
|
@@ -15,6 +15,7 @@ import { TableUtil } from "../../utils/table";
|
|
15
15
|
import TablePopup from "./TablePopup";
|
16
16
|
import { useEditorSelection } from "../../hooks/useMouseMove";
|
17
17
|
import TableStyles from "./Styles";
|
18
|
+
import useClickOutside from "../../hooks/useClickOutside";
|
18
19
|
import "./table.css";
|
19
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
20
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
2
|
-
import { Editor, Element } from "slate";
|
3
|
-
import { Box } from "@mui/material";
|
2
|
+
import { Editor, Element, Transforms } from "slate";
|
3
|
+
import { Box, MenuItem, Popper, Typography } from "@mui/material";
|
4
4
|
import { useSlateStatic, ReactEditor } from "slate-react";
|
5
5
|
import useTableResize from "../../utils/customHooks/useTableResize";
|
6
6
|
import { TableUtil } from "../../utils/table";
|
7
7
|
import TableStyles from "./Styles";
|
8
8
|
import { useEditorSelection } from "../../hooks/useMouseMove";
|
9
|
+
import useClickOutside from "../../hooks/useClickOutside";
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
10
11
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
11
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -28,7 +29,8 @@ const Resizer = ({
|
|
28
29
|
});
|
29
30
|
};
|
30
31
|
const TableCell = props => {
|
31
|
-
const
|
32
|
+
const themeType = localStorage.getItem("themeType");
|
33
|
+
const classes = TableStyles(themeType);
|
32
34
|
const {
|
33
35
|
element,
|
34
36
|
attributes,
|
@@ -69,6 +71,42 @@ const TableCell = props => {
|
|
69
71
|
const tableDOM = table.getDOMNode(path, true);
|
70
72
|
const isCellSelected = table.isCellSelected(editor.selection);
|
71
73
|
const hasSelected = (isCellSelected || [])?.findIndex(f => f.join(",") === path.join(",")) > -1;
|
74
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
75
|
+
const open = Boolean(anchorEl);
|
76
|
+
const popperOptions = [{
|
77
|
+
value: "Delete Row"
|
78
|
+
}, {
|
79
|
+
value: "Delete Column"
|
80
|
+
}];
|
81
|
+
const onRightClick = e => {
|
82
|
+
e.preventDefault();
|
83
|
+
if (hasSelected) {
|
84
|
+
setAnchorEl(e.currentTarget);
|
85
|
+
}
|
86
|
+
};
|
87
|
+
const closePoper = () => {
|
88
|
+
setAnchorEl(null);
|
89
|
+
};
|
90
|
+
const handleMenuItemClick = value => {
|
91
|
+
Transforms.select(editor, editor.selection);
|
92
|
+
switch (value) {
|
93
|
+
case "Delete Row":
|
94
|
+
table.deleteRow();
|
95
|
+
break;
|
96
|
+
case "Delete Column":
|
97
|
+
table.deleteColumn();
|
98
|
+
break;
|
99
|
+
default:
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
// closePoper();
|
103
|
+
};
|
104
|
+
|
105
|
+
// Use the useClickOutside hook
|
106
|
+
const popperRef = useClickOutside({
|
107
|
+
onClickOutside: closePoper,
|
108
|
+
refCount: 1
|
109
|
+
})[0];
|
72
110
|
useEffect(() => {
|
73
111
|
if (tableDOM) {
|
74
112
|
const {
|
@@ -89,7 +127,7 @@ const TableCell = props => {
|
|
89
127
|
cellWidth: parentWidth / columns
|
90
128
|
});
|
91
129
|
}
|
92
|
-
}, [tableDOM]);
|
130
|
+
}, [tableDOM, anchorEl]);
|
93
131
|
useEffect(() => {
|
94
132
|
if (editor && element && tableSize) {
|
95
133
|
const dom = ReactEditor.toDOMNode(editor, element);
|
@@ -99,14 +137,37 @@ const TableCell = props => {
|
|
99
137
|
height: 100
|
100
138
|
});
|
101
139
|
}
|
102
|
-
}, [tableSize]);
|
140
|
+
}, [tableSize, anchorEl]);
|
103
141
|
useEffect(() => {
|
104
142
|
if (!resizing && tableProps) {
|
105
143
|
table.updateTableStyle({
|
106
144
|
"col.size": size
|
107
145
|
}, tableProps);
|
108
146
|
}
|
109
|
-
}, [resizing]);
|
147
|
+
}, [resizing, anchorEl]);
|
148
|
+
const poperForDeltion = () => {
|
149
|
+
return /*#__PURE__*/_jsx(Popper, {
|
150
|
+
open: open,
|
151
|
+
anchorEl: anchorEl,
|
152
|
+
placement: "bottom-start",
|
153
|
+
disablePortal: true,
|
154
|
+
ref: popperRef,
|
155
|
+
sx: classes.deleteCellsPopUp,
|
156
|
+
children: popperOptions.map(option => /*#__PURE__*/_jsx(MenuItem, {
|
157
|
+
value: option.value,
|
158
|
+
onClick: () => handleMenuItemClick(option.value),
|
159
|
+
contentEditable: false,
|
160
|
+
sx: classes.menuItemPopUp,
|
161
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
162
|
+
sx: {
|
163
|
+
fontSize: "12px",
|
164
|
+
userSelect: "none"
|
165
|
+
},
|
166
|
+
children: option.value
|
167
|
+
})
|
168
|
+
}, option.value))
|
169
|
+
});
|
170
|
+
};
|
110
171
|
const sizeProps = isHeader ? {
|
111
172
|
width: size?.width || tableSize?.cellWidth
|
112
173
|
} : {};
|
@@ -121,6 +182,7 @@ const TableCell = props => {
|
|
121
182
|
border: `3px solid ${cellBorderColor}`,
|
122
183
|
...(sizeProps || {})
|
123
184
|
},
|
185
|
+
onContextMenu: onRightClick,
|
124
186
|
children: [children, isHeader && !readOnly && tableSize?.height && !showTool ? /*#__PURE__*/_jsx(Resizer, {
|
125
187
|
classes: classes,
|
126
188
|
onMouseDown: onMouseDown,
|
@@ -128,7 +190,7 @@ const TableCell = props => {
|
|
128
190
|
}) : null, hasSelected && !readOnly ? /*#__PURE__*/_jsx("div", {
|
129
191
|
className: "selection-area-tc",
|
130
192
|
contentEditable: false
|
131
|
-
}) : null]
|
193
|
+
}) : null, poperForDeltion()]
|
132
194
|
});
|
133
195
|
};
|
134
196
|
export default TableCell;
|
@@ -8,6 +8,7 @@ import { ReactEditor } from "slate-react";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
10
|
const TableContextMenu = props => {
|
11
|
+
console.log("Table context menu :", props);
|
11
12
|
const {
|
12
13
|
editor
|
13
14
|
} = props;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { useSlateStatic } from "slate-react";
|
3
|
+
import UndoIcon from "../../assets/svg/UndoIcon";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
const UndoButton = () => {
|
6
|
+
const editor = useSlateStatic();
|
7
|
+
const onUndo = () => {
|
8
|
+
editor?.undo();
|
9
|
+
};
|
10
|
+
return /*#__PURE__*/_jsx(UndoIcon, {
|
11
|
+
onClick: onUndo
|
12
|
+
});
|
13
|
+
};
|
14
|
+
export default UndoButton;
|
@@ -23,7 +23,8 @@ const MiniEditor = props => {
|
|
23
23
|
miniEditorPlaceholder,
|
24
24
|
className,
|
25
25
|
otherProps,
|
26
|
-
onSave
|
26
|
+
onSave,
|
27
|
+
theme
|
27
28
|
} = props;
|
28
29
|
const {
|
29
30
|
CHARACTERS = []
|
@@ -132,6 +133,7 @@ const MiniEditor = props => {
|
|
132
133
|
editor: editor,
|
133
134
|
initialValue: content,
|
134
135
|
onChange: onChange,
|
136
|
+
theme: theme,
|
135
137
|
children: [/*#__PURE__*/_jsx(BasicToolbar, {
|
136
138
|
...props
|
137
139
|
}), /*#__PURE__*/_jsx(Editable, {
|
@@ -29,28 +29,6 @@ const editorStyles = ({
|
|
29
29
|
"& .MuiOutlinedInput-input": {
|
30
30
|
color: theme?.palette?.editor?.textColor || "black"
|
31
31
|
}
|
32
|
-
},
|
33
|
-
"&.stimulate-xs": {
|
34
|
-
":before": {
|
35
|
-
content: '" "',
|
36
|
-
position: "absolute",
|
37
|
-
top: 0,
|
38
|
-
left: 0,
|
39
|
-
width: "calc(50% - 162px)",
|
40
|
-
height: "100%",
|
41
|
-
pointerEvents: "none",
|
42
|
-
backgroundColor: "#FFF"
|
43
|
-
},
|
44
|
-
":after": {
|
45
|
-
content: '" "',
|
46
|
-
position: "absolute",
|
47
|
-
top: 0,
|
48
|
-
right: 0,
|
49
|
-
width: "calc(50% - 160px)",
|
50
|
-
height: "100%",
|
51
|
-
pointerEvents: "none",
|
52
|
-
backgroundColor: "#FFF"
|
53
|
-
}
|
54
32
|
}
|
55
33
|
},
|
56
34
|
slateWrapper: {
|
@@ -82,7 +60,7 @@ const editorStyles = ({
|
|
82
60
|
display: "flex",
|
83
61
|
flex: 1,
|
84
62
|
flexDirection: "column",
|
85
|
-
paddingBottom: "
|
63
|
+
paddingBottom: "25px !important"
|
86
64
|
},
|
87
65
|
"& .scroll-area": {
|
88
66
|
display: "flex",
|
@@ -265,7 +243,6 @@ const editorStyles = ({
|
|
265
243
|
}
|
266
244
|
},
|
267
245
|
"&.hideScroll": {
|
268
|
-
overflowAnchor: "none",
|
269
246
|
"&::-webkit-scrollbar-track": {
|
270
247
|
background: "none !important"
|
271
248
|
},
|
@@ -25,7 +25,8 @@ const BasicToolbar = props => {
|
|
25
25
|
hideTextColor = false,
|
26
26
|
hideResetIcon = true,
|
27
27
|
onResetClick = () => {}
|
28
|
-
}
|
28
|
+
},
|
29
|
+
theme
|
29
30
|
} = props;
|
30
31
|
// state
|
31
32
|
const [activeColor, setActiveColor] = useState("#000000");
|
@@ -65,7 +66,8 @@ const BasicToolbar = props => {
|
|
65
66
|
item: true,
|
66
67
|
children: /*#__PURE__*/_jsx(LinkButton, {
|
67
68
|
active: isBlockActive(editor, link.format),
|
68
|
-
editor: editor
|
69
|
+
editor: editor,
|
70
|
+
theme: theme
|
69
71
|
}, link.id)
|
70
72
|
}), !hideTextColor && /*#__PURE__*/_jsx(Grid, {
|
71
73
|
item: true,
|
@@ -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
4
|
import { fontFamilyMap } from "../../utils/font";
|
5
|
+
import { toolbarGroups } from "../toolbarGroups.js";
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
const allTools = toolbarGroups.flat();
|
8
|
+
const fontWeight = allTools.find(f => f.format === "fontWeight");
|
9
|
+
const getValue = (editor, format) => {
|
10
|
+
switch (format) {
|
11
|
+
case "fontFamily":
|
12
|
+
{
|
13
|
+
const style = getSelectedElementStyle("font-family", editor);
|
14
|
+
const val = Object.entries(fontFamilyMap).find(([key, value]) => value === style)?.[0];
|
15
|
+
return val || fontFamilyMap.PoppinsRegular;
|
16
|
+
}
|
17
|
+
case "fontWeight":
|
18
|
+
{
|
19
|
+
const {
|
20
|
+
options
|
21
|
+
} = fontWeight || {};
|
22
|
+
const fontWeightStyle = getSelectedElementStyle("font-weight", editor);
|
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 =
|
37
|
+
const value = getValue(editor, format);
|
14
38
|
const changeMarkData = (event, format) => {
|
15
39
|
event.preventDefault();
|
16
40
|
const value = event.target.value;
|
@@ -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,
|
@@ -9,7 +9,7 @@ const MarkButton = ({
|
|
9
9
|
title
|
10
10
|
}) => {
|
11
11
|
return /*#__PURE__*/_jsx(Button, {
|
12
|
-
active:
|
12
|
+
active: isMarkBtnActive(editor, format),
|
13
13
|
format: format,
|
14
14
|
onMouseDown: e => {
|
15
15
|
e.preventDefault();
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import React from "react";
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
2
2
|
import { TextField, IconButton } from "@mui/material";
|
3
|
-
import { addMarkData, activeMark
|
4
|
-
import { headingMap, sizeMap } from "../../utils/font.js";
|
3
|
+
import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
|
5
4
|
import { TextMinusIcon, TextPlusIcon } from "../../common/iconslist.js";
|
6
|
-
import { getBreakPointsValue } from "../../helper/theme.js";
|
5
|
+
import { getBreakPointsValue, getTextSizeVal } from "../../helper/theme.js";
|
7
6
|
import useWindowResize from "../../hooks/useWindowResize.js";
|
8
7
|
import { BREAKPOINTS_DEVICES } from "../../helper/theme.js";
|
9
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
@@ -17,7 +16,13 @@ const TextSize = ({
|
|
17
16
|
}) => {
|
18
17
|
const [size] = useWindowResize();
|
19
18
|
const val = activeMark(editor, format);
|
20
|
-
const
|
19
|
+
const noFontSize = val === "normal" || typeof val === "object" && !Object.keys(val)?.length;
|
20
|
+
const value = noFontSize ? getTextSizeVal(editor) : getBreakPointsValue(val, size?.device);
|
21
|
+
const [fontSize, setFontSize] = useState();
|
22
|
+
const timerRef = useRef();
|
23
|
+
useEffect(() => {
|
24
|
+
setFontSize(getSizeVal());
|
25
|
+
}, [value]);
|
21
26
|
const updateMarkData = newVal => {
|
22
27
|
let upData = {
|
23
28
|
...getBreakPointsValue(val),
|
@@ -39,20 +44,18 @@ const TextSize = ({
|
|
39
44
|
}
|
40
45
|
});
|
41
46
|
};
|
42
|
-
const onChangeSize =
|
43
|
-
|
44
|
-
|
45
|
-
|
47
|
+
const onChangeSize = value => {
|
48
|
+
if (value) {
|
49
|
+
let inc = parseInt(value);
|
50
|
+
inc = inc > 200 ? 200 : inc;
|
51
|
+
updateMarkData(inc);
|
52
|
+
} else {
|
53
|
+
setFontSize(null);
|
54
|
+
}
|
46
55
|
};
|
47
56
|
const getSizeVal = () => {
|
48
57
|
try {
|
49
|
-
|
50
|
-
Object.entries(headingMap).forEach(([format, value]) => {
|
51
|
-
if (isBlockActive(editor, format) && isNaN(parseInt(size))) {
|
52
|
-
size = value;
|
53
|
-
}
|
54
|
-
});
|
55
|
-
return parseInt(size);
|
58
|
+
return parseInt(value);
|
56
59
|
} catch (err) {
|
57
60
|
return "";
|
58
61
|
}
|
@@ -67,11 +70,19 @@ const TextSize = ({
|
|
67
70
|
const newVal = combinedOldVal - 1 < 0 ? 0 : combinedOldVal - 1;
|
68
71
|
updateMarkData(newVal);
|
69
72
|
};
|
73
|
+
const onChange = e => {
|
74
|
+
clearTimeout(timerRef.current);
|
75
|
+
const value = e.target.value;
|
76
|
+
setFontSize(value);
|
77
|
+
timerRef.current = setTimeout(() => {
|
78
|
+
onChangeSize(value);
|
79
|
+
}, 500);
|
80
|
+
};
|
70
81
|
return /*#__PURE__*/_jsx(_Fragment, {
|
71
82
|
children: /*#__PURE__*/_jsx(TextField, {
|
72
83
|
sx: classes?.textSize,
|
73
|
-
value:
|
74
|
-
onChange:
|
84
|
+
value: fontSize,
|
85
|
+
onChange: onChange,
|
75
86
|
size: "small",
|
76
87
|
inputProps: {
|
77
88
|
style: {
|
@@ -9,6 +9,7 @@ import miniToolbarStyles from "./Styles";
|
|
9
9
|
import usePopupStyle from "../PopupTool/PopupToolStyle";
|
10
10
|
import PopperHeader from "../PopupTool/PopperHeader";
|
11
11
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
12
|
+
import PageSettingsButton from "../../Elements/PageSettings/PageSettingsButton";
|
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";
|
@@ -47,12 +48,25 @@ const MiniToolbar = props => {
|
|
47
48
|
const {
|
48
49
|
popupType
|
49
50
|
} = useEditorContext();
|
51
|
+
const canUndo = editor.history.undos.length > 0;
|
52
|
+
const canRedo = editor.history.redos.length > 0;
|
53
|
+
const [toolTip, setToolTip] = useState(false);
|
54
|
+
const [data, setData] = useState(null);
|
55
|
+
useEffect(() => {
|
56
|
+
if (data) {
|
57
|
+
setToolTip(false);
|
58
|
+
setData(null);
|
59
|
+
}
|
60
|
+
}, [data]);
|
50
61
|
useEffect(() => {
|
51
62
|
if (popper) {
|
52
63
|
setPopper(null);
|
53
64
|
}
|
54
65
|
}, [editor.selection]);
|
55
66
|
const handleClick = type => e => {
|
67
|
+
if (type === "page-settings") {
|
68
|
+
setToolTip(true);
|
69
|
+
}
|
56
70
|
setPopper(type);
|
57
71
|
setAnchorEl(e.currentTarget);
|
58
72
|
};
|
@@ -66,6 +80,10 @@ const MiniToolbar = props => {
|
|
66
80
|
const onSearch = e => {
|
67
81
|
setSearch(e?.target?.value || "");
|
68
82
|
};
|
83
|
+
const closePopper = data => {
|
84
|
+
setData(data);
|
85
|
+
setToolTip("false");
|
86
|
+
};
|
69
87
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
70
88
|
children: [/*#__PURE__*/_jsx(Box, {
|
71
89
|
component: "div",
|
@@ -76,16 +94,24 @@ const MiniToolbar = props => {
|
|
76
94
|
label,
|
77
95
|
icon: Icon
|
78
96
|
}) => {
|
79
|
-
const isDisabled = popupType === type; // for textFormat type
|
97
|
+
const isDisabled = popupType === type || type === "undo" ? !canUndo : type === "redo" ? !canRedo : false; // for textFormat type
|
80
98
|
|
81
99
|
return /*#__PURE__*/_jsx(Tooltip, {
|
82
100
|
arrow: true,
|
83
101
|
title: label,
|
102
|
+
disableHoverListener: toolTip,
|
84
103
|
children: /*#__PURE__*/_jsx(IconButton, {
|
85
|
-
className: type === popper ? "active" : ""
|
104
|
+
className: `${type === popper ? "active" : ""} ${type === "undo" && !canUndo || type === "redo" && !canRedo ? "disabled" : ""}`,
|
86
105
|
onClick: handleClick(type),
|
87
106
|
disabled: isDisabled,
|
88
|
-
children: /*#__PURE__*/_jsx(
|
107
|
+
children: type === "page-settings" ? /*#__PURE__*/_jsx(PageSettingsButton, {
|
108
|
+
from: "miniToolBar",
|
109
|
+
icoBtnType: "mini",
|
110
|
+
customProps: customProps,
|
111
|
+
editor: editor,
|
112
|
+
closePopper: closePopper,
|
113
|
+
setToolTip: setToolTip
|
114
|
+
}) : /*#__PURE__*/_jsx(Icon, {
|
89
115
|
from: "miniToolBar",
|
90
116
|
icoBtnType: "mini",
|
91
117
|
customProps: customProps,
|
@@ -2,6 +2,8 @@ import TextIcon from "../../../assets/svg/TextIcon";
|
|
2
2
|
import AddElementIcon from "../../../assets/svg/AddElementIcon";
|
3
3
|
import AddTemplateIcon from "../../../assets/svg/AddTemplateIcon";
|
4
4
|
import PageSettingsButton from "../../../Elements/PageSettings/PageSettingsButton";
|
5
|
+
import UndoButton from "../../../Elements/Undo/UndoButton";
|
6
|
+
import RedoButton from "../../../Elements/Redo/RedoButton";
|
5
7
|
const MENU_OPTIONS = [{
|
6
8
|
type: "textFormat",
|
7
9
|
icon: TextIcon,
|
@@ -18,5 +20,13 @@ const MENU_OPTIONS = [{
|
|
18
20
|
type: "page-settings",
|
19
21
|
icon: PageSettingsButton,
|
20
22
|
label: "Page Settings"
|
23
|
+
}, {
|
24
|
+
type: "undo",
|
25
|
+
icon: UndoButton,
|
26
|
+
label: "Undo"
|
27
|
+
}, {
|
28
|
+
type: "redo",
|
29
|
+
icon: RedoButton,
|
30
|
+
label: "Redo"
|
21
31
|
}];
|
22
32
|
export default MENU_OPTIONS;
|
@@ -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 parseInt(size);
|
55
|
+
return parseInt(value);
|
63
56
|
} catch (err) {
|
64
57
|
return "";
|
65
58
|
}
|