@flozy/editor 11.0.7 → 11.0.8
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 +141 -28
- package/dist/Editor/DialogWrapper.js +31 -25
- package/dist/Editor/Editor.css +39 -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 +28 -22
- package/dist/Editor/Elements/Accordion/AccordionButton.js +12 -3
- 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/DataView/Layouts/DataTypes/Components/Select.js +134 -55
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SelectV1.js +7 -8
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +8 -3
- 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 +5 -0
- package/dist/Editor/Elements/Embed/Embed.js +36 -43
- package/dist/Editor/Elements/Embed/Image.js +236 -23
- package/dist/Editor/Elements/Embed/Video.js +245 -15
- package/dist/Editor/Elements/Form/Form.js +35 -10
- 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 +31 -74
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +9 -5
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +3 -1
- package/dist/Editor/Elements/FreeGrid/Options/More.js +7 -7
- package/dist/Editor/Elements/FreeGrid/helper.js +194 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +15 -0
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +2 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +13 -6
- package/dist/Editor/Elements/SimpleText/index.js +4 -1
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Table/Table.js +5 -4
- package/dist/Editor/Elements/Table/TableCell.js +10 -3
- package/dist/Editor/Elements/Title/title.js +10 -11
- package/dist/Editor/Elements/TopBanner/TopBanner.js +4 -2
- package/dist/Editor/Elements/TopBanner/TopBannerButton.js +5 -3
- 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 +33 -29
- 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 +25 -23
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +25 -7
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +167 -42
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +24 -8
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +70 -10
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +73 -14
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +439 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +7 -4
- package/dist/Editor/Toolbar/toolbarGroups.js +56 -10
- 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 +4 -0
- package/dist/Editor/common/Icon.js +28 -0
- package/dist/Editor/common/ImageSelector/ImageSelector.js +45 -7
- 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/MentionsPopup/index.js +9 -1
- 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 +9 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +20 -7
- package/dist/Editor/common/RnD/GuideLines/styles.js +1 -1
- 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 -11
- package/dist/Editor/common/RnD/Utils/index.js +3 -1
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +52 -63
- 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 +61 -14
- package/dist/Editor/common/Shorthands/elements.js +62 -4
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -0
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +1 -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/formStyle.js +19 -13
- 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 +67 -18
- 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/useTable.js +62 -1
- package/dist/Editor/hooks/useThemeValues.js +63 -0
- package/dist/Editor/plugins/withEmbeds.js +12 -1
- package/dist/Editor/plugins/withHTML.js +58 -3
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/service/fileupload.js +70 -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 +191 -40
- package/dist/Editor/utils/accordion.js +67 -39
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/draftToSlate.js +3 -2
- package/dist/Editor/utils/events.js +94 -89
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +100 -23
- 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
@@ -9,7 +9,8 @@ const TableSettings = props => {
|
|
9
9
|
const {
|
10
10
|
editor,
|
11
11
|
path,
|
12
|
-
customProps
|
12
|
+
customProps,
|
13
|
+
onClose
|
13
14
|
} = props;
|
14
15
|
const item_path = path?.split("|").map(m => parseInt(m));
|
15
16
|
const element_path = [...item_path, 0];
|
@@ -57,7 +58,7 @@ const TableSettings = props => {
|
|
57
58
|
}
|
58
59
|
};
|
59
60
|
const handleClose = () => {
|
60
|
-
|
61
|
+
onClose();
|
61
62
|
};
|
62
63
|
return /*#__PURE__*/_jsx(Box, {
|
63
64
|
component: "div",
|
@@ -3,17 +3,23 @@ import { Editor, Transforms } from "slate";
|
|
3
3
|
import TextFormat from "../../../../Toolbar/PopupTool/TextFormat";
|
4
4
|
import usePopupStyle from "../../../../Toolbar/PopupTool/PopupToolStyle";
|
5
5
|
import { ReactEditor } from "slate-react";
|
6
|
+
import { getListType } from "../../../../utils/SlateUtilityFunctions";
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
8
|
const TextSettings = props => {
|
8
9
|
const {
|
9
10
|
editor,
|
10
11
|
path,
|
11
12
|
theme,
|
13
|
+
onClose,
|
12
14
|
customProps
|
13
15
|
} = props;
|
14
16
|
const item_path = path.split("|").map(m => parseInt(m));
|
15
17
|
const element_path = [...item_path, 0];
|
16
18
|
const classes = usePopupStyle(theme);
|
19
|
+
const listType = getListType(editor);
|
20
|
+
const commonProps = {
|
21
|
+
listType
|
22
|
+
};
|
17
23
|
useEffect(() => {
|
18
24
|
try {
|
19
25
|
ReactEditor.focus(editor);
|
@@ -27,7 +33,9 @@ const TextSettings = props => {
|
|
27
33
|
return /*#__PURE__*/_jsx(TextFormat, {
|
28
34
|
classes: classes,
|
29
35
|
editor: editor,
|
30
|
-
customProps: customProps
|
36
|
+
customProps: customProps,
|
37
|
+
closeMainPopup: onClose,
|
38
|
+
commonProps: commonProps
|
31
39
|
});
|
32
40
|
};
|
33
41
|
export default TextSettings;
|
@@ -8,18 +8,31 @@ const VideoSettings = props => {
|
|
8
8
|
const {
|
9
9
|
editor,
|
10
10
|
path,
|
11
|
-
customProps
|
11
|
+
customProps,
|
12
|
+
onClose
|
12
13
|
} = props;
|
13
14
|
const item_path = path?.split("|").map(m => parseInt(m));
|
14
15
|
const element_path = [...item_path, 0];
|
15
16
|
const element = Node.get(editor, element_path);
|
16
17
|
const styleMaps = embedVideoStyle?.filter(f => !f?.hideOnFGS);
|
17
18
|
const onChange = data => {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
let updated_props = {};
|
20
|
+
if (data?.url?.embedURL) {
|
21
|
+
updated_props = {
|
22
|
+
url: data?.url?.embedURL
|
23
|
+
};
|
24
|
+
} else if (data?.url?.file) {
|
25
|
+
updated_props = {
|
26
|
+
isUpload: true,
|
27
|
+
fromFreeGrid: true,
|
28
|
+
file: data?.url?.file,
|
29
|
+
url: ""
|
30
|
+
};
|
31
|
+
} else {
|
32
|
+
updated_props = {
|
33
|
+
...data
|
34
|
+
};
|
35
|
+
}
|
23
36
|
delete updated_props.children;
|
24
37
|
Transforms.setNodes(editor, {
|
25
38
|
...updated_props
|
@@ -28,7 +41,7 @@ const VideoSettings = props => {
|
|
28
41
|
});
|
29
42
|
};
|
30
43
|
const handleClose = () => {
|
31
|
-
|
44
|
+
onClose();
|
32
45
|
};
|
33
46
|
return /*#__PURE__*/_jsx(Box, {
|
34
47
|
component: "div",
|
@@ -3,20 +3,29 @@ import PersonalVideoIcon from "@mui/icons-material/PersonalVideo";
|
|
3
3
|
import PhoneIphoneIcon from "@mui/icons-material/PhoneIphone";
|
4
4
|
import useSwitchViewport from "./styles";
|
5
5
|
import { useEffect } from "react";
|
6
|
+
import { useEditorContext } from "../../../hooks/useMouseMove";
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
9
|
const SwitchViewport = props => {
|
9
10
|
const {
|
10
11
|
breakpoint,
|
11
12
|
onChange,
|
12
|
-
translation
|
13
|
+
translation,
|
14
|
+
show
|
13
15
|
} = props;
|
14
16
|
const classes = useSwitchViewport();
|
17
|
+
const {
|
18
|
+
setSelectedElement
|
19
|
+
} = useEditorContext();
|
15
20
|
useEffect(() => {
|
16
|
-
|
21
|
+
// to reset selection on viewport changes - FS-6589
|
22
|
+
setSelectedElement({});
|
17
23
|
}, [breakpoint]);
|
18
24
|
return /*#__PURE__*/_jsxs(Box, {
|
19
25
|
sx: classes.root,
|
26
|
+
style: {
|
27
|
+
display: show ? "block" : "none"
|
28
|
+
},
|
20
29
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
21
30
|
title: translation("Desktop View"),
|
22
31
|
children: /*#__PURE__*/_jsx(IconButton, {
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { Experimental_CssVarsProvider as CssVarsProvider, experimental_extendTheme as extendTheme } from "@mui/material/styles";
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
3
|
+
function MainThemeProvider({
|
4
|
+
children,
|
5
|
+
userSelectedTheme,
|
6
|
+
theme = {}
|
7
|
+
}) {
|
8
|
+
const themeVars = extendTheme(userSelectedTheme?.theme?.cssVars || {});
|
9
|
+
return /*#__PURE__*/_jsx(CssVarsProvider, {
|
10
|
+
theme: {
|
11
|
+
...themeVars,
|
12
|
+
...theme
|
13
|
+
},
|
14
|
+
children: children
|
15
|
+
});
|
16
|
+
}
|
17
|
+
export default MainThemeProvider;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import { useTheme,
|
2
|
+
import { useTheme, createTheme, useMediaQuery } from "@mui/material";
|
3
3
|
import { isStimulator, STIMULATOR_MOCK } from "../../../hooks/useBreakpoints";
|
4
|
+
import MainThemeProvider from "./MainThemeProvider";
|
4
5
|
|
5
6
|
// Custom breakpoints functions
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
@@ -59,13 +60,15 @@ const extendedTheme = (prevTheme, isPrintMode) => createTheme({
|
|
59
60
|
} : getBreakPoints(prevTheme)
|
60
61
|
});
|
61
62
|
const ViewportStimulator = ({
|
62
|
-
children
|
63
|
+
children,
|
64
|
+
selectedTheme
|
63
65
|
}) => {
|
64
66
|
const theme = useTheme();
|
65
67
|
const isPrintMode = useMediaQuery("print");
|
66
68
|
const viewportTheme = extendedTheme(theme, isPrintMode);
|
67
|
-
return /*#__PURE__*/_jsx(
|
69
|
+
return /*#__PURE__*/_jsx(MainThemeProvider, {
|
68
70
|
theme: viewportTheme,
|
71
|
+
userSelectedTheme: selectedTheme,
|
69
72
|
children: children
|
70
73
|
});
|
71
74
|
};
|
@@ -2,6 +2,7 @@ import { Transforms, Node, Path, Editor } from "slate";
|
|
2
2
|
import { ReactEditor } from "slate-react";
|
3
3
|
import { getNode, handleNegativeInteger } from "../../../utils/helper";
|
4
4
|
import { handleBoxAlignment } from "../VirtualElement/helper";
|
5
|
+
import { convertToGridArea, findMaxYValue } from "../../../Elements/FreeGrid/helper";
|
5
6
|
export const ROW_HEIGHT = 50;
|
6
7
|
|
7
8
|
// const MARGIN_OF = {
|
@@ -22,18 +23,27 @@ export function updateRows() {}
|
|
22
23
|
export function updateCols() {}
|
23
24
|
const handleMoveNode = (editor, path, newPath, {
|
24
25
|
isEmpty
|
25
|
-
}, autoAlign) => {
|
26
|
+
}, autoAlign, moveToNode) => {
|
26
27
|
try {
|
27
28
|
let replaceNode = Node.get(editor, path);
|
29
|
+
let heightDiff = 0;
|
28
30
|
if (autoAlign) {
|
29
|
-
|
31
|
+
const y = findMaxYValue(moveToNode?.children);
|
32
|
+
const {
|
33
|
+
gridArea,
|
34
|
+
marginTop
|
35
|
+
} = convertToGridArea(y);
|
30
36
|
replaceNode = {
|
31
37
|
...replaceNode,
|
32
|
-
gridArea_xs:
|
33
|
-
|
34
|
-
|
38
|
+
gridArea_xs: gridArea,
|
39
|
+
marginTop_xs: marginTop + 12,
|
40
|
+
xs_updatedOn: new Date().getTime()
|
35
41
|
};
|
42
|
+
const newHeight = y + replaceNode?.height_xs + 12;
|
43
|
+
const diffH = newHeight - moveToNode?.height_xs;
|
44
|
+
heightDiff = diffH >= 0 ? diffH : 0;
|
36
45
|
}
|
46
|
+
let rPath;
|
37
47
|
if (isEmpty) {
|
38
48
|
const toPath = [...newPath, 0];
|
39
49
|
Transforms.insertNodes(editor, [{
|
@@ -44,7 +54,7 @@ const handleMoveNode = (editor, path, newPath, {
|
|
44
54
|
Transforms.removeNodes(editor, {
|
45
55
|
at: path
|
46
56
|
});
|
47
|
-
|
57
|
+
rPath = toPath;
|
48
58
|
} else {
|
49
59
|
Transforms.insertNodes(editor, [{
|
50
60
|
...replaceNode
|
@@ -54,8 +64,12 @@ const handleMoveNode = (editor, path, newPath, {
|
|
54
64
|
Transforms.removeNodes(editor, {
|
55
65
|
at: path
|
56
66
|
});
|
57
|
-
|
67
|
+
rPath = newPath;
|
58
68
|
}
|
69
|
+
return {
|
70
|
+
rPath,
|
71
|
+
heightDiff
|
72
|
+
};
|
59
73
|
} catch (err) {
|
60
74
|
console.log(err);
|
61
75
|
console.log("Drop Node error");
|
@@ -210,7 +224,7 @@ export function onDropItem(props, parentClass) {
|
|
210
224
|
at: moveTo,
|
211
225
|
match: n => n.type === "freegrid"
|
212
226
|
});
|
213
|
-
const [
|
227
|
+
const [, sectionPath] = sectionData || [];
|
214
228
|
if (needMove && isInsidePath(from, moveTo)) {
|
215
229
|
reRenderSectionPath = sectionPath;
|
216
230
|
} else {
|
@@ -244,12 +258,15 @@ export function onDropItem(props, parentClass) {
|
|
244
258
|
at: moveTo
|
245
259
|
});
|
246
260
|
}
|
247
|
-
const
|
261
|
+
const {
|
262
|
+
rPath,
|
263
|
+
heightDiff
|
264
|
+
} = handleMoveNode(editor, path, newPath, {
|
248
265
|
isEmpty
|
249
|
-
}, autoAlign);
|
266
|
+
}, autoAlign, toSectionNode) || {};
|
250
267
|
reRenderChildNodes(editor, reRenderSectionPath || moveTo);
|
251
268
|
if (autoAlign && !isBoxHeader) {
|
252
|
-
handleBoxAlignment(editor,
|
269
|
+
handleBoxAlignment(editor, sectionPath, heightDiff);
|
253
270
|
}
|
254
271
|
return {
|
255
272
|
updated_at: rPath
|
@@ -87,7 +87,9 @@ export function updatePositions(props, closestClass) {
|
|
87
87
|
newPath = [...newPath, toSectionNode?.children?.length];
|
88
88
|
}
|
89
89
|
newPath = newPath.map(m => parseInt(m));
|
90
|
-
const
|
90
|
+
const {
|
91
|
+
rPath
|
92
|
+
} = handleMoveNode(editor, path, newPath, {
|
91
93
|
isEmpty
|
92
94
|
});
|
93
95
|
// to update path index need to re-render items in parent sections
|
@@ -1,69 +1,45 @@
|
|
1
1
|
import { useEffect, useRef } from "react";
|
2
|
-
import { Path, Transforms } from "slate";
|
3
2
|
import { getNode } from "../../../utils/helper";
|
4
3
|
import { ROW_HEIGHT } from "../Utils/gridDropItem";
|
5
|
-
import {
|
4
|
+
import { getGridArea, getNodeValues, handleTextAlignment } from "./helper";
|
6
5
|
import { Box } from "@mui/material";
|
7
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
-
const
|
9
|
-
|
7
|
+
export const getElementOffset = (element, breakpoint) => {
|
8
|
+
const {
|
9
|
+
height,
|
10
|
+
gridArea,
|
11
|
+
marginTop
|
12
|
+
} = getNodeValues(element, breakpoint);
|
13
|
+
const [startRow] = getGridArea(gridArea);
|
14
|
+
const top = (startRow - 1) * ROW_HEIGHT + marginTop;
|
15
|
+
const bottom = top + height;
|
16
|
+
return {
|
17
|
+
top,
|
18
|
+
bottom
|
19
|
+
};
|
20
|
+
};
|
21
|
+
export const updateTextHeight = (editor, path, currHeight, updateBreakpoint) => {
|
22
|
+
if (!currHeight) {
|
10
23
|
return;
|
11
24
|
}
|
12
|
-
const
|
13
|
-
|
14
|
-
const gridItems = currentNode?.children || [];
|
15
|
-
const isNewlyAddedElement = gridItems.some(gridItem => !gridItem.gridArea_xs && gridItem.type !== "paragraph");
|
16
|
-
if (isNewlyAddedElement) {
|
25
|
+
const textItem = getNode(editor, path);
|
26
|
+
if (!textItem) {
|
17
27
|
return;
|
18
28
|
}
|
19
|
-
const textItemIndex = path[parentPath.length];
|
20
|
-
const textItem = gridItems.find((_, index) => textItemIndex === index);
|
21
29
|
const {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
} = textItem;
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
const
|
34
|
-
|
35
|
-
if (firstOverlappedRow) {
|
36
|
-
const moveRows = endRow - firstOverlappedRow;
|
37
|
-
moveOverlappedItems(editor, moveRows, gridItems, parentPath, textItemIndex, startRow);
|
38
|
-
containerExtraHeight += moveRows * ROW_HEIGHT;
|
39
|
-
}
|
40
|
-
|
41
|
-
// handle containers (box and section)
|
42
|
-
const containerData = handleContainers(editor, parentPath, containerExtraHeight);
|
43
|
-
containerData.forEach(container => {
|
44
|
-
const {
|
45
|
-
moveRows,
|
46
|
-
containerNode,
|
47
|
-
containerPath,
|
48
|
-
newHeight,
|
49
|
-
childIndex,
|
50
|
-
lastChildStartRow
|
51
|
-
} = container;
|
52
|
-
if (moveRows) {
|
53
|
-
moveOverlappedItems(editor, moveRows, containerNode?.children, containerPath, childIndex, lastChildStartRow);
|
54
|
-
}
|
55
|
-
Transforms.setNodes(editor, {
|
56
|
-
height_xs: newHeight,
|
57
|
-
xs_updatedOn: new Date().getTime()
|
58
|
-
}, {
|
59
|
-
at: containerPath
|
60
|
-
});
|
61
|
-
});
|
62
|
-
Transforms.setNodes(editor, {
|
63
|
-
height_xs: height
|
64
|
-
}, {
|
65
|
-
at: path
|
66
|
-
});
|
30
|
+
height,
|
31
|
+
gridArea,
|
32
|
+
type
|
33
|
+
} = getNodeValues(textItem, updateBreakpoint);
|
34
|
+
if (!gridArea && type !== "paragraph") {
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
const oldHeight = height;
|
38
|
+
const newHeight = currHeight;
|
39
|
+
const heightDiff = newHeight - oldHeight;
|
40
|
+
if (heightDiff !== 0) {
|
41
|
+
const textNode = [textItem, path];
|
42
|
+
handleTextAlignment(editor, textNode, heightDiff, updateBreakpoint);
|
67
43
|
}
|
68
44
|
};
|
69
45
|
function VirtualTextElement(props) {
|
@@ -71,7 +47,8 @@ function VirtualTextElement(props) {
|
|
71
47
|
dataSets,
|
72
48
|
getCurrentEle,
|
73
49
|
path,
|
74
|
-
editor
|
50
|
+
editor,
|
51
|
+
breakpoint
|
75
52
|
} = props;
|
76
53
|
const currElement = getCurrentEle();
|
77
54
|
const textRef = useRef(null);
|
@@ -83,9 +60,9 @@ function VirtualTextElement(props) {
|
|
83
60
|
height
|
84
61
|
} = entry.contentRect;
|
85
62
|
const currentText = currElement?.innerText;
|
86
|
-
const prevText = prevTextRef
|
63
|
+
const prevText = prevTextRef?.current;
|
87
64
|
if (currentText && currentText !== prevText) {
|
88
|
-
updateTextHeight(editor, path, height);
|
65
|
+
updateTextHeight(editor, path, height, breakpoint);
|
89
66
|
}
|
90
67
|
prevTextRef.current = currentText;
|
91
68
|
}
|
@@ -101,11 +78,12 @@ function VirtualTextElement(props) {
|
|
101
78
|
}
|
102
79
|
observer.disconnect();
|
103
80
|
};
|
104
|
-
}, [currElement?.innerText]);
|
81
|
+
}, [currElement?.innerText, breakpoint]);
|
82
|
+
const fontSize = `var(--fontSize_${breakpoint}) !important`;
|
105
83
|
return /*#__PURE__*/_jsx(Box, {
|
106
84
|
style: {
|
107
85
|
position: "fixed",
|
108
|
-
width: dataSets[
|
86
|
+
width: dataSets[`data-width-${breakpoint}`],
|
109
87
|
minHeight: "fit-content",
|
110
88
|
visibility: "hidden",
|
111
89
|
pointerEvents: "none",
|
@@ -115,13 +93,24 @@ function VirtualTextElement(props) {
|
|
115
93
|
ref: textRef,
|
116
94
|
sx: {
|
117
95
|
"& .leaf-item": {
|
118
|
-
fontSize:
|
96
|
+
fontSize: fontSize,
|
119
97
|
"& span": {
|
120
|
-
fontSize:
|
98
|
+
fontSize: fontSize
|
121
99
|
}
|
122
100
|
},
|
123
101
|
"& .editor-blocker": {
|
124
102
|
display: "none"
|
103
|
+
},
|
104
|
+
"& .fgi_type_text": {
|
105
|
+
"& .edt-headings": {
|
106
|
+
margin: "0px"
|
107
|
+
},
|
108
|
+
"& .edt-paragraphs": {
|
109
|
+
margin: "0px"
|
110
|
+
},
|
111
|
+
"& blockquote": {
|
112
|
+
margin: "0px !important"
|
113
|
+
}
|
125
114
|
}
|
126
115
|
},
|
127
116
|
dangerouslySetInnerHTML: {
|