@flozy/editor 4.0.3 → 4.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +85 -13
- package/dist/Editor/DialogWrapper.js +4 -3
- package/dist/Editor/Editor.css +28 -2
- package/dist/Editor/Elements/AI/AIInput.js +31 -33
- package/dist/Editor/Elements/AI/CustomSelect.js +19 -12
- package/dist/Editor/Elements/AI/PopoverAIInput.js +124 -133
- package/dist/Editor/Elements/AI/Styles.js +2 -2
- package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +73 -0
- package/dist/Editor/Elements/AI/VoiceToText/index.js +184 -0
- package/dist/Editor/Elements/AI/VoiceToText/style.js +40 -0
- package/dist/Editor/Elements/AI/helper.js +5 -3
- package/dist/Editor/Elements/AppHeader/AppHeader.js +36 -23
- package/dist/Editor/Elements/Button/EditorButton.js +23 -16
- package/dist/Editor/Elements/Carousel/CarouselButton.js +2 -2
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +1 -1
- package/dist/Editor/Elements/Color Picker/Styles.js +1 -0
- package/dist/Editor/Elements/Embed/Image.js +15 -14
- package/dist/Editor/Elements/Embed/Video.js +12 -8
- package/dist/Editor/Elements/Emoji/EmojiButton.js +11 -7
- package/dist/Editor/Elements/Form/Form.js +43 -27
- package/dist/Editor/Elements/Form/FormField.js +21 -10
- package/dist/Editor/Elements/Form/Workflow/index.js +5 -2
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +437 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +206 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +23 -0
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +236 -0
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +44 -0
- package/dist/Editor/Elements/FreeGrid/Options/More.js +24 -0
- package/dist/Editor/Elements/FreeGrid/Options/SectionSettings.js +47 -0
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +19 -0
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +75 -0
- package/dist/Editor/Elements/FreeGrid/styles.js +214 -0
- package/dist/Editor/Elements/Grid/Grid.js +12 -8
- package/dist/Editor/Elements/Grid/GridItem.js +31 -21
- package/dist/Editor/Elements/Link/LinkPopup.js +69 -13
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
- package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -2
- package/dist/Editor/Elements/Signature/Signature.css +13 -6
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +2 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +186 -31
- package/dist/Editor/Elements/SimpleText/index.js +19 -7
- package/dist/Editor/Elements/SimpleText/style.js +44 -1
- package/dist/Editor/ErrorBoundary.js +30 -0
- package/dist/Editor/Styles/EditorStyles.js +28 -0
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +1 -1
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +2 -2
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +33 -5
- package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +12 -13
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +12 -13
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/CustomSelectTool.js +3 -0
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +59 -0
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +107 -40
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +57 -61
- package/dist/Editor/Toolbar/PopupTool/index.js +13 -3
- package/dist/Editor/Toolbar/Toolbar.js +7 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +15 -5
- package/dist/Editor/assets/svg/AIIcons.js +153 -1
- package/dist/Editor/common/EditorCmds.js +0 -3
- package/dist/Editor/common/EditorIcons.js +7 -7
- package/dist/Editor/common/Icon.js +39 -30
- package/dist/Editor/common/ImageList.js +16 -3
- package/dist/Editor/common/ImageSelector/ImageSelector.js +30 -9
- package/dist/Editor/common/ImageSelector/Styles.js +2 -1
- package/dist/Editor/common/LinkSettings/index.js +2 -1
- package/dist/Editor/common/LinkSettings/style.js +11 -8
- package/dist/Editor/common/MentionsPopup/Styles.js +1 -1
- package/dist/Editor/common/MentionsPopup/index.js +12 -8
- package/dist/Editor/common/RnD/ContextMenu/CMenus.js +142 -0
- package/dist/Editor/common/RnD/ContextMenu/index.js +38 -0
- package/dist/Editor/common/RnD/ContextMenu/styles.js +21 -0
- package/dist/Editor/common/RnD/DragInfo/index.js +31 -0
- package/dist/Editor/common/RnD/DragInfo/styles.js +15 -0
- package/dist/Editor/common/RnD/DragOver/index.js +55 -0
- package/dist/Editor/common/RnD/DragOver/styles.js +23 -0
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +102 -0
- package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +26 -0
- package/dist/Editor/common/RnD/ElementOptions/index.js +95 -0
- package/dist/Editor/common/RnD/ElementOptions/styles.js +41 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +153 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +36 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +60 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +9 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +48 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +30 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +17 -0
- package/dist/Editor/common/RnD/ElementSettings/index.js +17 -0
- package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +18 -0
- package/dist/Editor/common/RnD/ElementSettings/styles.js +94 -0
- package/dist/Editor/common/RnD/GuideLines/BoundaryLine.js +52 -0
- package/dist/Editor/common/RnD/GuideLines/index.js +33 -0
- package/dist/Editor/common/RnD/GuideLines/styles.js +62 -0
- package/dist/Editor/common/RnD/OptionsPopup/index.js +50 -0
- package/dist/Editor/common/RnD/OptionsPopup/style.js +36 -0
- package/dist/Editor/common/RnD/RnDCopy.js +23 -0
- package/dist/Editor/common/RnD/ShadowElement.js +34 -0
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +40 -0
- package/dist/Editor/common/RnD/SwitchViewport/styles.js +24 -0
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +63 -0
- package/dist/Editor/common/RnD/TransformHandles/CornerHandle.js +19 -0
- package/dist/Editor/common/RnD/TransformHandles/Icons/BottomRightIcon.js +13 -0
- package/dist/Editor/common/RnD/TransformHandles/SizeHandle.js +20 -0
- package/dist/Editor/common/RnD/TransformHandles/index.js +67 -0
- package/dist/Editor/common/RnD/Utils/alignmentDetection.js +26 -0
- package/dist/Editor/common/RnD/Utils/calculateDropItem.js +98 -0
- package/dist/Editor/common/RnD/Utils/collisionDetection.js +52 -0
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +181 -0
- package/dist/Editor/common/RnD/Utils/index.js +251 -0
- package/dist/Editor/common/RnD/VirtualElement/index.js +77 -0
- package/dist/Editor/common/RnD/VirtualElement/styles.js +27 -0
- package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +28 -0
- package/dist/Editor/common/RnD/index.js +567 -0
- package/dist/Editor/common/RnD/styles.js +4 -0
- package/dist/Editor/common/Section/index.js +21 -12
- package/dist/Editor/common/Section/styles.js +7 -4
- package/dist/Editor/common/Shorthands/elements.js +21 -9
- package/dist/Editor/common/StyleBuilder/boxStyle.js +30 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +18 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +18 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -2
- package/dist/Editor/common/StyleBuilder/index.js +6 -4
- package/dist/Editor/common/StyleBuilder/sectionStyle.js +13 -2
- package/dist/Editor/common/iconListV2.js +843 -0
- package/dist/Editor/commonStyle.js +6 -0
- package/dist/Editor/helper/RnD/focusOnNewItem.js +39 -0
- package/dist/Editor/helper/RnD/scrollToNewSection.js +24 -0
- package/dist/Editor/helper/breakpoint.js +5 -0
- package/dist/Editor/helper/index.js +139 -0
- package/dist/Editor/helper/theme.js +50 -1
- package/dist/Editor/hooks/useBreakpoints.js +34 -0
- package/dist/Editor/hooks/useMouseMove.js +36 -8
- package/dist/Editor/hooks/useWindowMessage.js +10 -7
- package/dist/Editor/hooks/withCommon.js +2 -1
- package/dist/Editor/hooks/withErrorHandling.js +14 -0
- package/dist/Editor/utils/RnD/RnDCtrlCmds.js +197 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +36 -4
- package/dist/Editor/utils/events.js +5 -0
- package/dist/Editor/utils/form.js +7 -2
- package/dist/Editor/utils/formfield.js +1 -1
- package/dist/Editor/utils/freegrid.js +91 -0
- package/dist/Editor/utils/helper.js +43 -0
- package/dist/Editor/utils/insertAppHeader.js +47 -40
- package/package.json +6 -2
@@ -0,0 +1,55 @@
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
2
|
+
import { Box, Paper, Popover } from "@mui/material";
|
3
|
+
import useDragOverStyle from "./styles";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
7
|
+
const DragOver = props => {
|
8
|
+
const ref = useRef();
|
9
|
+
const classes = useDragOverStyle();
|
10
|
+
const {
|
11
|
+
status,
|
12
|
+
hover_on,
|
13
|
+
path,
|
14
|
+
type
|
15
|
+
} = props;
|
16
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
17
|
+
const open = Boolean(anchorEl);
|
18
|
+
const isSectionHover = status && type === "parent";
|
19
|
+
const isContainerHover = hover_on.has(path) && type === "parent-container";
|
20
|
+
useEffect(() => {
|
21
|
+
if (ref?.current) {
|
22
|
+
const getBoundingClientRect = () => ref?.current?.getBoundingClientRect();
|
23
|
+
setAnchorEl({
|
24
|
+
getBoundingClientRect,
|
25
|
+
nodeType: 1
|
26
|
+
});
|
27
|
+
}
|
28
|
+
}, [ref?.current]);
|
29
|
+
const handleClose = () => {};
|
30
|
+
return isSectionHover || isContainerHover ? /*#__PURE__*/_jsxs(_Fragment, {
|
31
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
32
|
+
component: "div",
|
33
|
+
sx: classes.root,
|
34
|
+
ref: ref
|
35
|
+
}), /*#__PURE__*/_jsx(Popover, {
|
36
|
+
sx: classes.popper,
|
37
|
+
open: open,
|
38
|
+
anchorEl: anchorEl,
|
39
|
+
onClose: handleClose,
|
40
|
+
anchorOrigin: {
|
41
|
+
vertical: "top",
|
42
|
+
horizontal: "center"
|
43
|
+
},
|
44
|
+
transformOrigin: {
|
45
|
+
vertical: "top",
|
46
|
+
horizontal: "center"
|
47
|
+
},
|
48
|
+
children: /*#__PURE__*/_jsx(Paper, {
|
49
|
+
className: "papper-root",
|
50
|
+
children: isSectionHover ? "Attach to this Section" : "Attach to this Container"
|
51
|
+
})
|
52
|
+
})]
|
53
|
+
}) : null;
|
54
|
+
};
|
55
|
+
export default DragOver;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
const useDragOverStyle = () => ({
|
2
|
+
root: {
|
3
|
+
pointerEvents: "none",
|
4
|
+
position: "absolute",
|
5
|
+
left: 0,
|
6
|
+
top: 0,
|
7
|
+
width: "100%",
|
8
|
+
height: "100%",
|
9
|
+
outline: "2px solid #116dff"
|
10
|
+
},
|
11
|
+
popper: {
|
12
|
+
pointerEvents: "none",
|
13
|
+
zIndex: 1200,
|
14
|
+
"& .papper-root": {
|
15
|
+
padding: "8px 12px",
|
16
|
+
color: "#FFF",
|
17
|
+
fontSize: "14px",
|
18
|
+
left: "12px",
|
19
|
+
background: "#116dff"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
});
|
23
|
+
export default useDragOverStyle;
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import { Button, IconButton } from "@mui/material";
|
2
|
+
import CloseIcon from "@mui/icons-material/Close";
|
3
|
+
import AutoAwesomeIcon from "@mui/icons-material/AutoAwesome";
|
4
|
+
import SettingsIcon from "@mui/icons-material/Settings";
|
5
|
+
import EditIcon from "@mui/icons-material/Edit";
|
6
|
+
import DragIndicatorIcon from "@mui/icons-material/DragIndicator";
|
7
|
+
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
8
|
+
import AddIcon from "@mui/icons-material/Add";
|
9
|
+
import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
|
10
|
+
import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
|
11
|
+
import SaveIcon from "@mui/icons-material/Save";
|
12
|
+
import LinkIcon from "./Icons/LinkIcon";
|
13
|
+
import { GridAddSectionIcon, WorkflowIcon } from "../../iconslist";
|
14
|
+
const Actions = {
|
15
|
+
ai: {
|
16
|
+
type: "ai",
|
17
|
+
Button: IconButton,
|
18
|
+
Icon: AutoAwesomeIcon,
|
19
|
+
title: "Auto Generate using AI"
|
20
|
+
},
|
21
|
+
addSection: {
|
22
|
+
type: "addSection",
|
23
|
+
Button: Button,
|
24
|
+
Icon: null,
|
25
|
+
title: "Add Section"
|
26
|
+
},
|
27
|
+
addElement: {
|
28
|
+
type: "addElement",
|
29
|
+
Button: IconButton,
|
30
|
+
Icon: AddIcon,
|
31
|
+
title: "Add Element"
|
32
|
+
},
|
33
|
+
settings: {
|
34
|
+
type: "settings",
|
35
|
+
Button: IconButton,
|
36
|
+
Icon: SettingsIcon,
|
37
|
+
title: "Settings",
|
38
|
+
cb: "settings"
|
39
|
+
},
|
40
|
+
link: {
|
41
|
+
type: "link",
|
42
|
+
Button: IconButton,
|
43
|
+
Icon: LinkIcon,
|
44
|
+
title: "Link"
|
45
|
+
},
|
46
|
+
more: {
|
47
|
+
type: "more",
|
48
|
+
Button: IconButton,
|
49
|
+
Icon: MoreVertIcon,
|
50
|
+
title: "More",
|
51
|
+
cb: "more"
|
52
|
+
},
|
53
|
+
drag: {
|
54
|
+
type: 1,
|
55
|
+
Button: IconButton,
|
56
|
+
Icon: DragIndicatorIcon,
|
57
|
+
title: "Drag"
|
58
|
+
},
|
59
|
+
edit: {
|
60
|
+
type: 2,
|
61
|
+
Button: IconButton,
|
62
|
+
Icon: EditIcon,
|
63
|
+
title: "Edit"
|
64
|
+
},
|
65
|
+
close: {
|
66
|
+
type: 3,
|
67
|
+
Button: IconButton,
|
68
|
+
Icon: CloseIcon,
|
69
|
+
title: "close"
|
70
|
+
},
|
71
|
+
moveUp: {
|
72
|
+
type: "moveUp",
|
73
|
+
Button: IconButton,
|
74
|
+
Icon: ArrowUpwardIcon,
|
75
|
+
title: "Move Up"
|
76
|
+
},
|
77
|
+
moveDown: {
|
78
|
+
type: "moveDown",
|
79
|
+
Button: IconButton,
|
80
|
+
Icon: ArrowDownwardIcon,
|
81
|
+
title: "Move Down"
|
82
|
+
},
|
83
|
+
addFormField: {
|
84
|
+
type: "addFormField",
|
85
|
+
Button: IconButton,
|
86
|
+
Icon: GridAddSectionIcon,
|
87
|
+
title: "Add Form Field"
|
88
|
+
},
|
89
|
+
workFlow: {
|
90
|
+
type: "workFlow",
|
91
|
+
Button: IconButton,
|
92
|
+
Icon: WorkflowIcon,
|
93
|
+
title: "Workflow"
|
94
|
+
},
|
95
|
+
saveAsTemplate: {
|
96
|
+
type: "saveAsTemplate",
|
97
|
+
Button: IconButton,
|
98
|
+
Icon: SaveIcon,
|
99
|
+
title: "Save As Template"
|
100
|
+
}
|
101
|
+
};
|
102
|
+
export default Actions;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
3
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
4
|
+
const LinkIcon = () => {
|
5
|
+
return /*#__PURE__*/_jsxs("svg", {
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
7
|
+
width: "18",
|
8
|
+
height: "18",
|
9
|
+
viewBox: "0 0 18 18",
|
10
|
+
fill: "none",
|
11
|
+
children: [/*#__PURE__*/_jsx("path", {
|
12
|
+
d: "M10.1582 7.84185C9.54389 7.22778 8.71084 6.88281 7.84222 6.88281C6.97361 6.88281 6.14055 7.22778 5.52622 7.84185L3.20947 10.1578C2.59513 10.7722 2.25 11.6054 2.25 12.4742C2.25 13.343 2.59513 14.1763 3.20947 14.7906C3.82381 15.4049 4.65704 15.7501 5.52585 15.7501C6.39466 15.7501 7.22788 15.4049 7.84222 14.7906L9.00022 13.6326",
|
13
|
+
stroke: "#000000",
|
14
|
+
strokeWidth: "1.5",
|
15
|
+
strokeLinecap: "round",
|
16
|
+
strokeLinejoin: "round"
|
17
|
+
}), /*#__PURE__*/_jsx("path", {
|
18
|
+
d: "M7.8418 10.1582C8.45613 10.7723 9.28918 11.1173 10.1578 11.1173C11.0264 11.1173 11.8595 10.7723 12.4738 10.1582L14.7905 7.84222C15.4049 7.22788 15.75 6.39466 15.75 5.52585C15.75 4.65704 15.4049 3.82381 14.7905 3.20947C14.1762 2.59513 13.343 2.25 12.4742 2.25C11.6054 2.25 10.7721 2.59513 10.1578 3.20947L8.9998 4.36747",
|
19
|
+
stroke: "#000000",
|
20
|
+
strokeWidth: "1.5",
|
21
|
+
strokeLinecap: "round",
|
22
|
+
strokeLinejoin: "round"
|
23
|
+
})]
|
24
|
+
});
|
25
|
+
};
|
26
|
+
export default LinkIcon;
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Paper, Popper, Tooltip } from "@mui/material";
|
3
|
+
import Actions from "./Actions";
|
4
|
+
import useElementOptionsStyle from "./styles";
|
5
|
+
import OptionsPopup from "../OptionsPopup";
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
|
+
const ElementOptions = props => {
|
10
|
+
const {
|
11
|
+
open,
|
12
|
+
anchorEl,
|
13
|
+
enable,
|
14
|
+
handleAction,
|
15
|
+
actions,
|
16
|
+
actionsMap,
|
17
|
+
optionsProps,
|
18
|
+
selectedAction
|
19
|
+
} = props;
|
20
|
+
const classes = useElementOptionsStyle();
|
21
|
+
const [menu, setMenu] = useState({});
|
22
|
+
const openMenu = Boolean(menu.anchorEl);
|
23
|
+
const {
|
24
|
+
MenuComp,
|
25
|
+
menuProps
|
26
|
+
} = menu;
|
27
|
+
const isOpen = Boolean(anchorEl) && open;
|
28
|
+
const handleOptionClick = type => e => {
|
29
|
+
if (actionsMap[type]) {
|
30
|
+
const {
|
31
|
+
title,
|
32
|
+
placement,
|
33
|
+
Component,
|
34
|
+
props
|
35
|
+
} = actionsMap[type];
|
36
|
+
setMenu({
|
37
|
+
title,
|
38
|
+
type,
|
39
|
+
anchorEl: e.currentTarget,
|
40
|
+
placement,
|
41
|
+
isComponent: true,
|
42
|
+
MenuComp: Component,
|
43
|
+
menuProps: props
|
44
|
+
});
|
45
|
+
} else {
|
46
|
+
handleAction(type);
|
47
|
+
}
|
48
|
+
};
|
49
|
+
const renderAction = (action, index) => {
|
50
|
+
const {
|
51
|
+
Button,
|
52
|
+
Icon,
|
53
|
+
type,
|
54
|
+
title
|
55
|
+
} = Actions[action] || {};
|
56
|
+
return type ? /*#__PURE__*/_jsx(Tooltip, {
|
57
|
+
title: title,
|
58
|
+
arrow: true,
|
59
|
+
children: /*#__PURE__*/_jsx(Button, {
|
60
|
+
onClick: handleOptionClick(type),
|
61
|
+
className: enable === type || selectedAction === type ? "active" : "",
|
62
|
+
children: Icon ? /*#__PURE__*/_jsx(Icon, {}) : title
|
63
|
+
})
|
64
|
+
}, `actions_fgele_${type}_${index}`) : null;
|
65
|
+
};
|
66
|
+
const handleClose = () => {
|
67
|
+
setMenu({});
|
68
|
+
};
|
69
|
+
return isOpen ? /*#__PURE__*/_jsxs(_Fragment, {
|
70
|
+
children: [/*#__PURE__*/_jsx(Popper, {
|
71
|
+
open: open,
|
72
|
+
anchorEl: anchorEl,
|
73
|
+
placement: "top-start",
|
74
|
+
sx: classes.root,
|
75
|
+
...optionsProps,
|
76
|
+
contentEditable: false,
|
77
|
+
disablePortal: false,
|
78
|
+
children: /*#__PURE__*/_jsx(Paper, {
|
79
|
+
className: "papper-root",
|
80
|
+
children: actions.map(renderAction)
|
81
|
+
})
|
82
|
+
}), open && MenuComp ? /*#__PURE__*/_jsx(OptionsPopup, {
|
83
|
+
open: openMenu,
|
84
|
+
...menu,
|
85
|
+
handleClose: handleClose,
|
86
|
+
children: /*#__PURE__*/_jsx(MenuComp, {
|
87
|
+
...menuProps
|
88
|
+
})
|
89
|
+
}) : null]
|
90
|
+
}) : null;
|
91
|
+
};
|
92
|
+
ElementOptions.defaultProps = {
|
93
|
+
actions: []
|
94
|
+
};
|
95
|
+
export default ElementOptions;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
const useElementOptionsStyle = () => ({
|
2
|
+
root: {
|
3
|
+
zIndex: 1200,
|
4
|
+
"& .papper-root": {
|
5
|
+
background: "transparent",
|
6
|
+
boxShadow: "none"
|
7
|
+
},
|
8
|
+
"& .MuiButton-root": {
|
9
|
+
padding: "4px",
|
10
|
+
fontSize: "10px",
|
11
|
+
textTransform: "none",
|
12
|
+
marginRight: "6px",
|
13
|
+
background: "#FFF",
|
14
|
+
boxShadow: "1px 1px 3px rgba(0,0,0,0.3)",
|
15
|
+
"&.active,&:hover ": {
|
16
|
+
color: "#FFF",
|
17
|
+
background: "#1976d2"
|
18
|
+
}
|
19
|
+
},
|
20
|
+
"& .MuiIconButton-root": {
|
21
|
+
padding: "4px",
|
22
|
+
color: "#000",
|
23
|
+
background: "#FFF",
|
24
|
+
borderRadius: "50%",
|
25
|
+
marginRight: "6px",
|
26
|
+
boxShadow: "1px 1px 3px rgba(0,0,0,0.3)",
|
27
|
+
border: "1px solid transparent",
|
28
|
+
"& svg": {
|
29
|
+
width: "16px",
|
30
|
+
height: "16px"
|
31
|
+
},
|
32
|
+
"&.active,&:hover ": {
|
33
|
+
color: "#2563EB",
|
34
|
+
background: "#FFF",
|
35
|
+
border: "1px solid #2563EB",
|
36
|
+
boxShadow: "1px 1px 3px #2563EB"
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
});
|
41
|
+
export default useElementOptionsStyle;
|
@@ -0,0 +1,153 @@
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
|
+
import { Node, Transforms, Editor } from "slate";
|
3
|
+
import { ReactEditor } from "slate-react";
|
4
|
+
import LinkSettings from "../../../LinkSettings";
|
5
|
+
import { insertLink, removeLink } from "../../../../utils/link";
|
6
|
+
import { getBlockActive, isBlockActive, upateBlockActive } from "../../../../utils/SlateUtilityFunctions";
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
const Link = props => {
|
9
|
+
const {
|
10
|
+
onClose,
|
11
|
+
customProps,
|
12
|
+
editor,
|
13
|
+
path,
|
14
|
+
childType
|
15
|
+
} = props;
|
16
|
+
const pPath = path?.split("|")?.map(m => parseInt(m));
|
17
|
+
const element_path = [...pPath, 0];
|
18
|
+
const element = Node.get(editor, element_path);
|
19
|
+
const {
|
20
|
+
actionTrigger
|
21
|
+
} = element?.buttonLink || {};
|
22
|
+
const {
|
23
|
+
onClick
|
24
|
+
} = actionTrigger || {
|
25
|
+
options: []
|
26
|
+
};
|
27
|
+
const [blockProps, setBlockProps] = useState();
|
28
|
+
const [isActiveTextLink, setIsActiveTextLink] = useState(false);
|
29
|
+
useEffect(() => {
|
30
|
+
if (childType === "text") {
|
31
|
+
selectTextNode();
|
32
|
+
const p = getBlockActive(editor, "link")?.props || {};
|
33
|
+
const bp = {
|
34
|
+
name: Editor.string(editor, editor.selection),
|
35
|
+
navType: "webAddress",
|
36
|
+
navValue: p?.href,
|
37
|
+
openInNewTab: p?.target === "_blank"
|
38
|
+
};
|
39
|
+
setIsActiveTextLink(isBlockActive(editor, "link"));
|
40
|
+
setBlockProps(bp);
|
41
|
+
} else {
|
42
|
+
setBlockProps(getProps());
|
43
|
+
}
|
44
|
+
}, []);
|
45
|
+
const selectTextNode = () => {
|
46
|
+
try {
|
47
|
+
ReactEditor.focus(editor);
|
48
|
+
const range = Editor.range(editor, element_path);
|
49
|
+
Transforms.select(editor, range);
|
50
|
+
} catch (err) {
|
51
|
+
console.log(err);
|
52
|
+
}
|
53
|
+
};
|
54
|
+
const getProps = () => {
|
55
|
+
switch (childType) {
|
56
|
+
case "button":
|
57
|
+
return {
|
58
|
+
navType: element?.buttonLink?.linkType,
|
59
|
+
navValue: element?.url,
|
60
|
+
openInNewTab: element?.openInNewTab
|
61
|
+
};
|
62
|
+
case "image":
|
63
|
+
return {
|
64
|
+
navType: element?.linkType,
|
65
|
+
navValue: element?.webAddress,
|
66
|
+
openInNewTab: element?.isNewTab
|
67
|
+
};
|
68
|
+
default:
|
69
|
+
return {};
|
70
|
+
}
|
71
|
+
};
|
72
|
+
const getTransformedData = d => {
|
73
|
+
switch (childType) {
|
74
|
+
case "text":
|
75
|
+
selectTextNode();
|
76
|
+
return {
|
77
|
+
name: Editor.string(editor, editor.selection),
|
78
|
+
url: d?.navValue,
|
79
|
+
showInNewTab: d?.openInNewTab
|
80
|
+
};
|
81
|
+
case "image":
|
82
|
+
return {
|
83
|
+
linkType: d?.linkType,
|
84
|
+
webAddress: d?.navValue,
|
85
|
+
isNewTab: d?.openInNewTab
|
86
|
+
};
|
87
|
+
case "button":
|
88
|
+
return {
|
89
|
+
buttonLink: {
|
90
|
+
linkType: d?.linkType,
|
91
|
+
onClick
|
92
|
+
},
|
93
|
+
url: d?.navValue,
|
94
|
+
openInNewTab: d?.openInNewTab
|
95
|
+
};
|
96
|
+
default:
|
97
|
+
return {};
|
98
|
+
}
|
99
|
+
};
|
100
|
+
const updateTextLink = data => {
|
101
|
+
// remove link
|
102
|
+
if (!data?.url && isActiveTextLink) {
|
103
|
+
removeLink(editor);
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
const upData = isActiveTextLink ? {
|
107
|
+
href: data?.url,
|
108
|
+
target: data?.showInNewTab ? "_blank" : "_self",
|
109
|
+
name: data?.name
|
110
|
+
} : data;
|
111
|
+
if (isActiveTextLink) {
|
112
|
+
// update text link
|
113
|
+
upateBlockActive(editor, "link", upData);
|
114
|
+
} else {
|
115
|
+
insertLink(editor, upData);
|
116
|
+
}
|
117
|
+
};
|
118
|
+
const onSave = data => {
|
119
|
+
try {
|
120
|
+
const updateData = {
|
121
|
+
...data
|
122
|
+
};
|
123
|
+
delete updateData.children;
|
124
|
+
|
125
|
+
// for text we have defined method already
|
126
|
+
// to update leaf data
|
127
|
+
if (childType === "text") {
|
128
|
+
updateTextLink(data);
|
129
|
+
return;
|
130
|
+
}
|
131
|
+
Transforms.setNodes(editor, {
|
132
|
+
...updateData
|
133
|
+
}, {
|
134
|
+
at: element_path
|
135
|
+
});
|
136
|
+
} catch (err) {
|
137
|
+
console.log(err);
|
138
|
+
}
|
139
|
+
};
|
140
|
+
return blockProps?.navType !== undefined ? /*#__PURE__*/_jsx(LinkSettings, {
|
141
|
+
handleClose: onClose,
|
142
|
+
onSave: d => {
|
143
|
+
const upData = getTransformedData(d);
|
144
|
+
onSave({
|
145
|
+
...upData
|
146
|
+
});
|
147
|
+
onClose();
|
148
|
+
},
|
149
|
+
...(blockProps || {}),
|
150
|
+
customProps: customProps
|
151
|
+
}) : null;
|
152
|
+
};
|
153
|
+
export default Link;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Node } from "slate";
|
3
|
+
import { Dialog, DialogContent, DialogTitle, IconButton } from "@mui/material";
|
4
|
+
import SaveAsTemplate from "../../../StyleBuilder/fieldTypes/saveAsTemplate";
|
5
|
+
import { CloseIcon } from "../../../iconslist";
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
|
+
const SavePopup = props => {
|
9
|
+
const {
|
10
|
+
classes,
|
11
|
+
onClose,
|
12
|
+
elementProps
|
13
|
+
} = props;
|
14
|
+
return /*#__PURE__*/_jsxs(Dialog, {
|
15
|
+
open: true,
|
16
|
+
fullWidth: true,
|
17
|
+
sx: classes.dialog,
|
18
|
+
children: [/*#__PURE__*/_jsxs(DialogTitle, {
|
19
|
+
children: ["Save As Template", /*#__PURE__*/_jsx(IconButton, {
|
20
|
+
onClick: onClose,
|
21
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
22
|
+
})]
|
23
|
+
}), /*#__PURE__*/_jsx(DialogContent, {
|
24
|
+
children: /*#__PURE__*/_jsx(SaveAsTemplate, {
|
25
|
+
...props,
|
26
|
+
data: {
|
27
|
+
key: "saveAsTemplate"
|
28
|
+
},
|
29
|
+
saveText: "Save",
|
30
|
+
handleClose: onClose,
|
31
|
+
elementProps: elementProps
|
32
|
+
})
|
33
|
+
})]
|
34
|
+
});
|
35
|
+
};
|
36
|
+
export default SavePopup;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Paper, Popper, Tooltip, Typography, Box, Divider, IconButton } from "@mui/material";
|
3
|
+
import CloseIcon from "@mui/icons-material/Close";
|
4
|
+
import { settingsLabel } from "../settingsConstants";
|
5
|
+
import SettingsComponents from "../Settings";
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
9
|
+
const Settings = props => {
|
10
|
+
const {
|
11
|
+
path,
|
12
|
+
childType,
|
13
|
+
open,
|
14
|
+
anchorEl,
|
15
|
+
placement,
|
16
|
+
onClose,
|
17
|
+
editor,
|
18
|
+
classes,
|
19
|
+
customProps
|
20
|
+
} = props;
|
21
|
+
const title = settingsLabel[childType] || "Settings";
|
22
|
+
const Settings = SettingsComponents[childType];
|
23
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
24
|
+
children: /*#__PURE__*/_jsx(Popper, {
|
25
|
+
open: open,
|
26
|
+
anchorEl: anchorEl,
|
27
|
+
placement: placement,
|
28
|
+
sx: classes.root,
|
29
|
+
children: /*#__PURE__*/_jsxs(Paper, {
|
30
|
+
className: "papper-root",
|
31
|
+
children: [/*#__PURE__*/_jsxs(Typography, {
|
32
|
+
variant: "h6",
|
33
|
+
className: "item-wrapper title",
|
34
|
+
children: [title, /*#__PURE__*/_jsx(Box, {
|
35
|
+
component: "div",
|
36
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
37
|
+
title: "Close",
|
38
|
+
arrow: true,
|
39
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
40
|
+
className: "closeBtn",
|
41
|
+
onClick: onClose,
|
42
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
43
|
+
})
|
44
|
+
})
|
45
|
+
})]
|
46
|
+
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(Box, {
|
47
|
+
component: "div",
|
48
|
+
className: "item-wrapper",
|
49
|
+
children: Settings ? /*#__PURE__*/_jsx(Settings, {
|
50
|
+
editor: editor,
|
51
|
+
path: path,
|
52
|
+
customProps: customProps
|
53
|
+
}) : null
|
54
|
+
})]
|
55
|
+
})
|
56
|
+
})
|
57
|
+
});
|
58
|
+
};
|
59
|
+
Settings.defaultProps = {};
|
60
|
+
export default Settings;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Transforms, Node } from "slate";
|
3
|
+
import { Box } from "@mui/material";
|
4
|
+
import { StyleContent } from "../../../StyleBuilder";
|
5
|
+
import appHeaderStyle from "../../../StyleBuilder/appHeaderStyle";
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
const AppHeaderSettings = props => {
|
8
|
+
const {
|
9
|
+
editor,
|
10
|
+
path,
|
11
|
+
customProps
|
12
|
+
} = props;
|
13
|
+
const item_path = path?.split("|").map(m => parseInt(m));
|
14
|
+
const element_path = [...item_path, 0];
|
15
|
+
const element = Node.get(editor, element_path);
|
16
|
+
const onChange = data => {
|
17
|
+
const updated_props = {
|
18
|
+
...element,
|
19
|
+
...data,
|
20
|
+
field_type: data?.element
|
21
|
+
};
|
22
|
+
delete updated_props.children;
|
23
|
+
Transforms.setNodes(editor, {
|
24
|
+
...updated_props
|
25
|
+
}, {
|
26
|
+
at: element_path
|
27
|
+
});
|
28
|
+
};
|
29
|
+
const handleClose = () => {
|
30
|
+
console.log("close");
|
31
|
+
};
|
32
|
+
return /*#__PURE__*/_jsx(Box, {
|
33
|
+
component: "div",
|
34
|
+
className: "item-w",
|
35
|
+
children: appHeaderStyle?.map((m, i) => {
|
36
|
+
return /*#__PURE__*/_jsx(StyleContent, {
|
37
|
+
renderTabs: appHeaderStyle,
|
38
|
+
value: m.value,
|
39
|
+
element: element,
|
40
|
+
onChange: onChange,
|
41
|
+
customProps: customProps,
|
42
|
+
handleClose: handleClose
|
43
|
+
}, `tab_${m.value}_$${i}`);
|
44
|
+
})
|
45
|
+
});
|
46
|
+
};
|
47
|
+
export default AppHeaderSettings;
|