@flozy/editor 4.0.2 → 4.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. package/dist/Editor/ChatEditor.js +14 -9
  2. package/dist/Editor/CommonEditor.js +185 -170
  3. package/dist/Editor/DialogWrapper.js +4 -3
  4. package/dist/Editor/Editor.css +5 -19
  5. package/dist/Editor/Elements/AI/PopoverAIInput.js +52 -41
  6. package/dist/Editor/Elements/Accordion/AccordionSummary.js +4 -15
  7. package/dist/Editor/Elements/AppHeader/AppHeader.js +39 -26
  8. package/dist/Editor/Elements/Button/EditorButton.js +33 -38
  9. package/dist/Editor/Elements/Carousel/CarouselButton.js +0 -1
  10. package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -59
  11. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  12. package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
  13. package/dist/Editor/Elements/Color Picker/Styles.js +1 -2
  14. package/dist/Editor/Elements/Embed/Image.js +15 -14
  15. package/dist/Editor/Elements/Embed/Video.js +12 -8
  16. package/dist/Editor/Elements/Emoji/EmojiButton.js +11 -7
  17. package/dist/Editor/Elements/Form/Form.js +43 -27
  18. package/dist/Editor/Elements/Form/FormField.js +21 -10
  19. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
  20. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
  21. package/dist/Editor/Elements/Form/Workflow/index.js +5 -2
  22. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +437 -0
  23. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +206 -0
  24. package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +23 -0
  25. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +236 -0
  26. package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +44 -0
  27. package/dist/Editor/Elements/FreeGrid/Options/More.js +24 -0
  28. package/dist/Editor/Elements/FreeGrid/Options/SectionSettings.js +47 -0
  29. package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +19 -0
  30. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +75 -0
  31. package/dist/Editor/Elements/FreeGrid/styles.js +214 -0
  32. package/dist/Editor/Elements/Grid/Grid.js +11 -9
  33. package/dist/Editor/Elements/Grid/GridItem.js +31 -23
  34. package/dist/Editor/Elements/Link/Link.js +1 -6
  35. package/dist/Editor/Elements/Link/LinkButton.js +2 -4
  36. package/dist/Editor/Elements/Link/LinkPopup.js +15 -18
  37. package/dist/Editor/Elements/NewLine/NewLineButton.js +0 -1
  38. package/dist/Editor/Elements/Signature/SignaturePopup.js +1 -1
  39. package/dist/Editor/Elements/SimpleText/index.js +18 -16
  40. package/dist/Editor/Elements/SimpleText/style.js +43 -0
  41. package/dist/Editor/ErrorBoundary.js +30 -0
  42. package/dist/Editor/MiniEditor.js +1 -3
  43. package/dist/Editor/Styles/EditorStyles.js +28 -0
  44. package/dist/Editor/Toolbar/Basic/index.js +2 -4
  45. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +2 -26
  46. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
  47. package/dist/Editor/Toolbar/FormatTools/TextSize.js +11 -5
  48. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +2 -3
  49. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +11 -4
  50. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +86 -213
  51. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
  52. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +14 -26
  53. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +2 -68
  54. package/dist/Editor/Toolbar/PopupTool/index.js +8 -0
  55. package/dist/Editor/Toolbar/Toolbar.js +7 -0
  56. package/dist/Editor/Toolbar/toolbarGroups.js +16 -48
  57. package/dist/Editor/common/ColorPickerButton.js +9 -25
  58. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  59. package/dist/Editor/common/EditorCmds.js +0 -3
  60. package/dist/Editor/common/Icon.js +16 -34
  61. package/dist/Editor/common/LinkSettings/NavComponents.js +2 -5
  62. package/dist/Editor/common/LinkSettings/index.js +1 -2
  63. package/dist/Editor/common/LinkSettings/navOptions.js +2 -7
  64. package/dist/Editor/common/MentionsPopup/index.js +12 -8
  65. package/dist/Editor/common/RnD/ContextMenu/CMenus.js +142 -0
  66. package/dist/Editor/common/RnD/ContextMenu/index.js +38 -0
  67. package/dist/Editor/common/RnD/ContextMenu/styles.js +21 -0
  68. package/dist/Editor/common/RnD/DragInfo/index.js +31 -0
  69. package/dist/Editor/common/RnD/DragInfo/styles.js +15 -0
  70. package/dist/Editor/common/RnD/DragOver/index.js +55 -0
  71. package/dist/Editor/common/RnD/DragOver/styles.js +23 -0
  72. package/dist/Editor/common/RnD/ElementOptions/Actions.js +102 -0
  73. package/dist/Editor/common/RnD/ElementOptions/Icons/LinkIcon.js +26 -0
  74. package/dist/Editor/common/RnD/ElementOptions/index.js +95 -0
  75. package/dist/Editor/common/RnD/ElementOptions/styles.js +41 -0
  76. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +153 -0
  77. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +36 -0
  78. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +60 -0
  79. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/index.js +9 -0
  80. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +47 -0
  81. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +47 -0
  82. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +47 -0
  83. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +48 -0
  84. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +47 -0
  85. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +30 -0
  86. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +47 -0
  87. package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +17 -0
  88. package/dist/Editor/common/RnD/ElementSettings/index.js +17 -0
  89. package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +18 -0
  90. package/dist/Editor/common/RnD/ElementSettings/styles.js +94 -0
  91. package/dist/Editor/common/RnD/GuideLines/BoundaryLine.js +52 -0
  92. package/dist/Editor/common/RnD/GuideLines/index.js +33 -0
  93. package/dist/Editor/common/RnD/GuideLines/styles.js +62 -0
  94. package/dist/Editor/common/RnD/OptionsPopup/index.js +50 -0
  95. package/dist/Editor/common/RnD/OptionsPopup/style.js +36 -0
  96. package/dist/Editor/common/RnD/RnDCopy.js +23 -0
  97. package/dist/Editor/common/RnD/ShadowElement.js +34 -0
  98. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +40 -0
  99. package/dist/Editor/common/RnD/SwitchViewport/styles.js +24 -0
  100. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +63 -0
  101. package/dist/Editor/common/RnD/TransformHandles/CornerHandle.js +19 -0
  102. package/dist/Editor/common/RnD/TransformHandles/Icons/BottomRightIcon.js +13 -0
  103. package/dist/Editor/common/RnD/TransformHandles/SizeHandle.js +20 -0
  104. package/dist/Editor/common/RnD/TransformHandles/index.js +67 -0
  105. package/dist/Editor/common/RnD/Utils/alignmentDetection.js +26 -0
  106. package/dist/Editor/common/RnD/Utils/calculateDropItem.js +98 -0
  107. package/dist/Editor/common/RnD/Utils/collisionDetection.js +52 -0
  108. package/dist/Editor/common/RnD/Utils/gridDropItem.js +181 -0
  109. package/dist/Editor/common/RnD/Utils/index.js +251 -0
  110. package/dist/Editor/common/RnD/VirtualElement/index.js +77 -0
  111. package/dist/Editor/common/RnD/VirtualElement/styles.js +27 -0
  112. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +28 -0
  113. package/dist/Editor/common/RnD/index.js +567 -0
  114. package/dist/Editor/common/RnD/styles.js +4 -0
  115. package/dist/Editor/common/Section/index.js +21 -12
  116. package/dist/Editor/common/Section/styles.js +7 -4
  117. package/dist/Editor/common/Shorthands/elements.js +12 -54
  118. package/dist/Editor/common/StyleBuilder/boxStyle.js +30 -0
  119. package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
  120. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +36 -44
  121. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +23 -33
  122. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
  123. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +7 -31
  124. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
  125. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +18 -5
  126. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -2
  127. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +4 -14
  128. package/dist/Editor/common/StyleBuilder/index.js +5 -3
  129. package/dist/Editor/common/StyleBuilder/sectionStyle.js +13 -2
  130. package/dist/Editor/helper/RnD/focusOnNewItem.js +39 -0
  131. package/dist/Editor/helper/RnD/scrollToNewSection.js +24 -0
  132. package/dist/Editor/helper/breakpoint.js +5 -0
  133. package/dist/Editor/helper/index.js +139 -0
  134. package/dist/Editor/helper/theme.js +48 -186
  135. package/dist/Editor/hooks/useBreakpoints.js +34 -0
  136. package/dist/Editor/hooks/useMouseMove.js +37 -12
  137. package/dist/Editor/hooks/withCommon.js +2 -1
  138. package/dist/Editor/hooks/withErrorHandling.js +14 -0
  139. package/dist/Editor/plugins/withEmbeds.js +1 -1
  140. package/dist/Editor/plugins/withHTML.js +1 -1
  141. package/dist/Editor/plugins/withTable.js +1 -1
  142. package/dist/Editor/theme/ThemeList.js +173 -50
  143. package/dist/Editor/utils/RnD/RnDCtrlCmds.js +197 -0
  144. package/dist/Editor/utils/SlateUtilityFunctions.js +60 -164
  145. package/dist/Editor/utils/button.js +17 -1
  146. package/dist/Editor/utils/events.js +5 -0
  147. package/dist/Editor/utils/font.js +37 -40
  148. package/dist/Editor/utils/form.js +7 -2
  149. package/dist/Editor/utils/formfield.js +1 -1
  150. package/dist/Editor/utils/freegrid.js +91 -0
  151. package/dist/Editor/utils/helper.js +44 -30
  152. package/dist/Editor/utils/insertAppHeader.js +47 -40
  153. package/package.json +5 -2
  154. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
  155. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  156. package/dist/Editor/common/CustomColorPicker/index.js +0 -106
  157. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  158. package/dist/Editor/common/CustomDialog/index.js +0 -94
  159. package/dist/Editor/common/CustomDialog/style.js +0 -67
  160. package/dist/Editor/common/CustomSelect.js +0 -33
  161. package/dist/Editor/hooks/useEditorTheme.js +0 -139
  162. package/dist/Editor/theme/index.js +0 -144
  163. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  164. package/dist/Editor/themeSettings/buttons/index.js +0 -290
  165. package/dist/Editor/themeSettings/buttons/style.js +0 -21
  166. package/dist/Editor/themeSettings/colorTheme/index.js +0 -290
  167. package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
  168. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -123
  169. package/dist/Editor/themeSettings/fonts/index.js +0 -213
  170. package/dist/Editor/themeSettings/fonts/style.js +0 -44
  171. package/dist/Editor/themeSettings/icons.js +0 -60
  172. package/dist/Editor/themeSettings/index.js +0 -320
  173. package/dist/Editor/themeSettings/style.js +0 -152
  174. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  175. package/dist/Editor/themeSettingsAI/index.js +0 -356
  176. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -190
  177. package/dist/Editor/themeSettingsAI/style.js +0 -247
@@ -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,9 @@
1
+ import Settings from "./Settings";
2
+ import Link from "./Link";
3
+ import SavePopup from "./SaveAsTemplate";
4
+ const OtherSettings = {
5
+ link: Link,
6
+ settings: Settings,
7
+ saveAsTemplate: SavePopup
8
+ };
9
+ export default OtherSettings;
@@ -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;
@@ -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 boxStyle from "../../../StyleBuilder/boxStyle";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const BoxSettings = 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];
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: boxStyle?.map((m, i) => {
36
+ return /*#__PURE__*/_jsx(StyleContent, {
37
+ renderTabs: boxStyle,
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 BoxSettings;
@@ -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 buttonStyle from "../../../StyleBuilder/buttonStyle";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const ButtonSettings = 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: buttonStyle?.map((m, i) => {
36
+ return /*#__PURE__*/_jsx(StyleContent, {
37
+ renderTabs: buttonStyle,
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 ButtonSettings;