@flozy/editor 3.9.1 → 3.9.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +45 -55
- package/dist/Editor/CommonEditor.js +111 -180
- package/dist/Editor/Editor.css +0 -7
- package/dist/Editor/Elements/AI/AIInput.js +18 -17
- package/dist/Editor/Elements/AI/CustomSelect.js +12 -19
- package/dist/Editor/Elements/AI/PopoverAIInput.js +28 -23
- package/dist/Editor/Elements/AI/Styles.js +1 -2
- package/dist/Editor/Elements/Accordion/Accordion.js +7 -74
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +2 -3
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +60 -4
- package/dist/Editor/Elements/AppHeader/AppHeader.js +4 -26
- package/dist/Editor/Elements/Button/EditorButton.js +16 -28
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +17 -60
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +1 -2
- package/dist/Editor/Elements/Embed/Image.js +19 -27
- package/dist/Editor/Elements/Embed/Video.js +10 -14
- package/dist/Editor/Elements/Emoji/EmojiPicker.js +2 -4
- package/dist/Editor/Elements/Form/Form.js +1 -1
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +3 -12
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +1 -2
- package/dist/Editor/Elements/Grid/Grid.js +3 -27
- package/dist/Editor/Elements/Grid/GridItem.js +1 -3
- package/dist/Editor/Elements/Link/Link.js +1 -6
- package/dist/Editor/Elements/Link/LinkButton.js +2 -4
- package/dist/Editor/Elements/Link/LinkPopup.js +3 -10
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +4 -8
- package/dist/Editor/Elements/Signature/SignaturePopup.js +3 -14
- package/dist/Editor/Elements/Table/Styles.js +1 -23
- package/dist/Editor/Elements/Table/Table.js +2 -3
- package/dist/Editor/Elements/Table/TableCell.js +8 -70
- package/dist/Editor/Elements/TableContextMenu/TableContextMenu.js +0 -1
- package/dist/Editor/MiniEditor.js +1 -3
- package/dist/Editor/Styles/EditorStyles.js +1 -1
- package/dist/Editor/Toolbar/Basic/index.js +2 -4
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +2 -26
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +18 -29
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +3 -29
- package/dist/Editor/Toolbar/Mini/Options/Options.js +0 -10
- package/dist/Editor/Toolbar/Mini/Styles.js +0 -7
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +11 -4
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +86 -213
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +1 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +16 -22
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +7 -52
- package/dist/Editor/Toolbar/PopupTool/index.js +17 -7
- package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
- package/dist/Editor/assets/svg/AIIcons.js +1 -153
- package/dist/Editor/assets/svg/AddTemplateIcon.js +10 -13
- package/dist/Editor/assets/svg/TextIcon.js +5 -8
- package/dist/Editor/common/ColorPickerButton.js +9 -25
- package/dist/Editor/common/DnD/DragHandleButton.js +47 -56
- package/dist/Editor/common/Icon.js +3 -43
- package/dist/Editor/common/LinkSettings/NavComponents.js +2 -5
- package/dist/Editor/common/LinkSettings/index.js +2 -4
- package/dist/Editor/common/LinkSettings/navOptions.js +2 -7
- package/dist/Editor/common/LinkSettings/style.js +8 -11
- package/dist/Editor/common/MentionsPopup/MentionsListCard.js +1 -6
- package/dist/Editor/common/MentionsPopup/Styles.js +2 -5
- package/dist/Editor/common/Section/index.js +7 -57
- package/dist/Editor/common/Section/styles.js +0 -11
- package/dist/Editor/common/Shorthands/elements.js +0 -54
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +7 -7
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +3 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +7 -15
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +7 -31
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +3 -14
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +4 -14
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/common/iconslist.js +31 -0
- package/dist/Editor/helper/deserialize/index.js +9 -14
- package/dist/Editor/helper/theme.js +4 -190
- package/dist/Editor/hooks/useMouseMove.js +2 -4
- package/dist/Editor/hooks/useWindowMessage.js +7 -10
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +5 -47
- package/dist/Editor/plugins/withLayout.js +10 -15
- package/dist/Editor/plugins/withTable.js +2 -2
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/SlateUtilityFunctions.js +25 -161
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/draftToSlate.js +1 -1
- package/dist/Editor/utils/events.js +6 -65
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/helper.js +14 -74
- package/dist/Editor/utils/table.js +43 -51
- package/package.json +3 -4
- package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +0 -73
- package/dist/Editor/Elements/AI/VoiceToText/index.js +0 -177
- package/dist/Editor/Elements/AI/VoiceToText/style.js +0 -40
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +0 -28
- package/dist/Editor/Elements/Redo/RedoButton.js +0 -14
- package/dist/Editor/Elements/Undo/UndoButton.js +0 -14
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
- package/dist/Editor/assets/svg/RedoIcon.js +0 -27
- package/dist/Editor/assets/svg/SettingsIcon.js +0 -28
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
- package/dist/Editor/assets/svg/UndoIcon.js +0 -27
- package/dist/Editor/common/CustomColorPicker/index.js +0 -106
- package/dist/Editor/common/CustomColorPicker/style.js +0 -53
- package/dist/Editor/common/CustomDialog/index.js +0 -94
- package/dist/Editor/common/CustomDialog/style.js +0 -67
- package/dist/Editor/common/CustomSelect.js +0 -33
- package/dist/Editor/common/EditorCmds.js +0 -35
- package/dist/Editor/hooks/useEditorTheme.js +0 -139
- package/dist/Editor/theme/index.js +0 -144
- package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
- package/dist/Editor/themeSettings/buttons/index.js +0 -290
- package/dist/Editor/themeSettings/buttons/style.js +0 -21
- package/dist/Editor/themeSettings/colorTheme/index.js +0 -290
- package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -123
- package/dist/Editor/themeSettings/fonts/index.js +0 -213
- package/dist/Editor/themeSettings/fonts/style.js +0 -44
- package/dist/Editor/themeSettings/icons.js +0 -60
- package/dist/Editor/themeSettings/index.js +0 -320
- package/dist/Editor/themeSettings/style.js +0 -152
- package/dist/Editor/themeSettingsAI/icons.js +0 -96
- package/dist/Editor/themeSettingsAI/index.js +0 -356
- package/dist/Editor/themeSettingsAI/saveTheme.js +0 -190
- package/dist/Editor/themeSettingsAI/style.js +0 -247
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Box, Button, IconButton,
|
1
|
+
import { Box, Button, IconButton, Popover, Typography } from "@mui/material";
|
2
2
|
import React, { useRef, useState } from "react";
|
3
3
|
import { FaChevronRight } from "react-icons/fa";
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
@@ -49,17 +49,9 @@ function DisplayOption({
|
|
49
49
|
} = option;
|
50
50
|
const [open, setOpen] = useState(false);
|
51
51
|
const optionRef = useRef();
|
52
|
-
const openOptions = e => {
|
53
|
-
if (option.options?.length && !open) {
|
54
|
-
setOpen(e.currentTarget);
|
55
|
-
return;
|
56
|
-
}
|
57
|
-
};
|
58
52
|
return /*#__PURE__*/_jsxs(Box, {
|
59
53
|
sx: classes.optionWrapper,
|
60
54
|
ref: optionRef,
|
61
|
-
onMouseEnter: openOptions,
|
62
|
-
onMouseLeave: () => setOpen(null),
|
63
55
|
children: [/*#__PURE__*/_jsxs(Button, {
|
64
56
|
sx: classes.optionBtn,
|
65
57
|
onClick: e => {
|
@@ -67,7 +59,7 @@ function DisplayOption({
|
|
67
59
|
|
68
60
|
// is having child options
|
69
61
|
if (option.options?.length) {
|
70
|
-
|
62
|
+
setOpen(e.currentTarget);
|
71
63
|
return;
|
72
64
|
}
|
73
65
|
setOpen(null);
|
@@ -85,24 +77,25 @@ function DisplayOption({
|
|
85
77
|
size: 12
|
86
78
|
})
|
87
79
|
})]
|
88
|
-
}), /*#__PURE__*/_jsx(
|
80
|
+
}), /*#__PURE__*/_jsx(Popover, {
|
89
81
|
open: open && option.options,
|
90
82
|
anchorEl: open,
|
91
83
|
sx: {
|
92
84
|
zIndex: 9001,
|
93
85
|
background: "transparent"
|
94
86
|
},
|
87
|
+
anchorOrigin: {
|
88
|
+
vertical: "top",
|
89
|
+
horizontal: "right"
|
90
|
+
},
|
95
91
|
onClose: () => {
|
96
92
|
setOpen(null);
|
97
93
|
},
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
classes: classes,
|
104
|
-
show: open
|
105
|
-
})
|
94
|
+
children: /*#__PURE__*/_jsx(CustomSelect, {
|
95
|
+
options: option.options,
|
96
|
+
onSend: onSend,
|
97
|
+
classes: classes,
|
98
|
+
show: open
|
106
99
|
})
|
107
100
|
})]
|
108
101
|
});
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
2
2
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
3
3
|
import Styles from "./Styles";
|
4
|
-
import { Fade, Paper, Popper } from "@mui/material";
|
4
|
+
import { Box, Fade, Paper, Popper } from "@mui/material";
|
5
5
|
import AIInput from "./AIInput";
|
6
6
|
import { ReactEditor, useSlate } from "slate-react";
|
7
7
|
import { Editor, Node, Path, Transforms } from "slate";
|
8
|
+
import useWindowResize from "../../hooks/useWindowResize";
|
8
9
|
import { MODES } from "./helper";
|
9
10
|
import { getSelectedText } from "../../utils/helper";
|
10
|
-
import { VoiceToText } from "./VoiceToText";
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
13
13
|
const scrollToAIInput = () => {
|
@@ -101,8 +101,7 @@ const updateAnchorEl = (setAnchorEl, editor) => {
|
|
101
101
|
// selected text as caret
|
102
102
|
caret = selection.getRangeAt(0);
|
103
103
|
} else {
|
104
|
-
|
105
|
-
caret = domElement?.commonAncestorContainer?.parentElement;
|
104
|
+
caret = ReactEditor.toDOMRange(editor, getNextLine(editor).at);
|
106
105
|
}
|
107
106
|
const getBoundingClientRect = () => {
|
108
107
|
const editorContainer = document.querySelector("#slate-wrapper-scroll-container")?.getBoundingClientRect();
|
@@ -148,6 +147,7 @@ function PopoverAIInput({
|
|
148
147
|
const targetRef = useRef();
|
149
148
|
const classes = Styles();
|
150
149
|
const editor = useSlate();
|
150
|
+
const [size] = useWindowResize();
|
151
151
|
const onClickOutside = () => {
|
152
152
|
setAnchorEl(null);
|
153
153
|
setOpenAI("");
|
@@ -178,11 +178,6 @@ function PopoverAIInput({
|
|
178
178
|
onClickOutside();
|
179
179
|
return;
|
180
180
|
}
|
181
|
-
if (type === "speech_to_text") {
|
182
|
-
Transforms.insertText(editor, option.text);
|
183
|
-
onClickOutside();
|
184
|
-
return;
|
185
|
-
}
|
186
181
|
if (type === "try_again") {
|
187
182
|
// resetting the previous option and try again
|
188
183
|
option = selectedOption;
|
@@ -193,7 +188,7 @@ function PopoverAIInput({
|
|
193
188
|
setLoading(true);
|
194
189
|
const payload = {
|
195
190
|
mode: option.mode || 0,
|
196
|
-
query:
|
191
|
+
query: inputValue
|
197
192
|
};
|
198
193
|
if (option.mode === MODES.translate || option.mode === MODES.rephraseTone) {
|
199
194
|
payload.textOptionInput = type;
|
@@ -268,7 +263,21 @@ function PopoverAIInput({
|
|
268
263
|
setInputValue(e.target.value);
|
269
264
|
};
|
270
265
|
return /*#__PURE__*/_jsxs("div", {
|
271
|
-
children: [/*#__PURE__*/_jsx(
|
266
|
+
children: [size.device === "xs" && openAI ? /*#__PURE__*/_jsx(Box, {
|
267
|
+
component: "div",
|
268
|
+
sx: classes.mobileAIInputWrapper,
|
269
|
+
ref: targetRef,
|
270
|
+
children: /*#__PURE__*/_jsx(AIInput, {
|
271
|
+
loading: loading,
|
272
|
+
onSend: onSend,
|
273
|
+
generatedText: generatedText,
|
274
|
+
anchorEl: anchorEl,
|
275
|
+
openAI: openAI,
|
276
|
+
inputValue: inputValue,
|
277
|
+
onInputChange: onInputChange,
|
278
|
+
onClickOutside: onClickOutside
|
279
|
+
})
|
280
|
+
}) : /*#__PURE__*/_jsx(Popper, {
|
272
281
|
open: Boolean(openAI),
|
273
282
|
anchorEl: anchorEl,
|
274
283
|
transition: true,
|
@@ -287,19 +296,15 @@ function PopoverAIInput({
|
|
287
296
|
sx: getSelectedText(editor) ? {
|
288
297
|
marginTop: "6px"
|
289
298
|
} : {},
|
290
|
-
children: /*#__PURE__*/_jsx(
|
291
|
-
|
299
|
+
children: /*#__PURE__*/_jsx(AIInput, {
|
300
|
+
loading: loading,
|
292
301
|
onSend: onSend,
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
inputValue: inputValue,
|
300
|
-
onInputChange: onInputChange,
|
301
|
-
onClickOutside: onClickOutside
|
302
|
-
})
|
302
|
+
generatedText: generatedText,
|
303
|
+
anchorEl: anchorEl,
|
304
|
+
openAI: openAI,
|
305
|
+
inputValue: inputValue,
|
306
|
+
onInputChange: onInputChange,
|
307
|
+
onClickOutside: onClickOutside
|
303
308
|
})
|
304
309
|
})
|
305
310
|
})
|
@@ -9,55 +9,6 @@ import Icon from "../../common/Icon";
|
|
9
9
|
import { useEditorSelection } from "../../hooks/useMouseMove";
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
12
|
-
const accordionBtnStyleKeys = {
|
13
|
-
accordionTextColor: "textColor",
|
14
|
-
accordionBgColor: "bgColor",
|
15
|
-
accordionBorderColor: "borderColor"
|
16
|
-
};
|
17
|
-
const getAccordionData = updateData => {
|
18
|
-
const accordionBtnStyle = {}; // accordion btn style will come under type: accordion node
|
19
|
-
const accordionTitleStyle = {}; // accordion title style will come under type: accordion-summary node
|
20
|
-
|
21
|
-
Object.entries(updateData).forEach(([key, value]) => {
|
22
|
-
const accordionBtnStyleKey = accordionBtnStyleKeys[key];
|
23
|
-
if (accordionBtnStyleKey) {
|
24
|
-
// converting accordion button elementProp keys to node keys e.g: accordionTextColor -> textColor
|
25
|
-
accordionBtnStyle[accordionBtnStyleKey] = value;
|
26
|
-
return;
|
27
|
-
}
|
28
|
-
accordionTitleStyle[key] = value;
|
29
|
-
});
|
30
|
-
return {
|
31
|
-
accordionBtnStyle,
|
32
|
-
accordionTitleStyle
|
33
|
-
};
|
34
|
-
};
|
35
|
-
const convertAccordionBtnStyleKeys = (data = {}) => {
|
36
|
-
const style = {
|
37
|
-
...data
|
38
|
-
};
|
39
|
-
Object.entries(accordionBtnStyleKeys).forEach(([key, value]) => {
|
40
|
-
const val = data[value];
|
41
|
-
if (val) {
|
42
|
-
// deleting the existing style key in node e.g: textColor
|
43
|
-
delete style[value];
|
44
|
-
|
45
|
-
// convertint into new key in element props e.g: accordionTextColor
|
46
|
-
style[key] = val;
|
47
|
-
}
|
48
|
-
});
|
49
|
-
return style;
|
50
|
-
};
|
51
|
-
const getElementProps = element => {
|
52
|
-
const accordionSummary = element.children?.find(c => c.type === "accordion-summary");
|
53
|
-
|
54
|
-
// joining accordion title and button styles
|
55
|
-
const elementProps = {
|
56
|
-
...accordionSummary,
|
57
|
-
...convertAccordionBtnStyleKeys(element)
|
58
|
-
};
|
59
|
-
return elementProps;
|
60
|
-
};
|
61
12
|
const Accordion = props => {
|
62
13
|
const {
|
63
14
|
attributes,
|
@@ -118,34 +69,16 @@ const Accordion = props => {
|
|
118
69
|
at: path
|
119
70
|
});
|
120
71
|
};
|
121
|
-
const setNodes = (data, path) => {
|
122
|
-
Transforms.setNodes(editor, data, {
|
123
|
-
at: path
|
124
|
-
});
|
125
|
-
};
|
126
72
|
const onSave = data => {
|
127
73
|
const updateData = {
|
128
74
|
...data
|
129
75
|
};
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
}
|
134
|
-
|
135
|
-
|
136
|
-
const accordionSummary = data.children?.find(c => c.type === "accordion-summary");
|
137
|
-
const accordionSummaryPath = ReactEditor.findPath(editor, accordionSummary);
|
138
|
-
setNodes({
|
139
|
-
...accordionTitleStyle,
|
140
|
-
type: "accordion-summary",
|
141
|
-
children: accordionSummary.children
|
142
|
-
}, accordionSummaryPath);
|
143
|
-
|
144
|
-
// applying accordion button style
|
145
|
-
delete accordionBtnStyle.children;
|
146
|
-
setNodes({
|
147
|
-
...accordionBtnStyle
|
148
|
-
}, path);
|
76
|
+
delete updateData.children;
|
77
|
+
Transforms.setNodes(editor, {
|
78
|
+
...updateData
|
79
|
+
}, {
|
80
|
+
at: path
|
81
|
+
});
|
149
82
|
onClose();
|
150
83
|
};
|
151
84
|
const onClose = () => {
|
@@ -190,7 +123,7 @@ const Accordion = props => {
|
|
190
123
|
},
|
191
124
|
children: children[1]
|
192
125
|
}), !readOnly && /*#__PURE__*/_jsx(ToolBar, {}), openSetttings ? /*#__PURE__*/_jsx(AccordionBtnPopup, {
|
193
|
-
element:
|
126
|
+
element: element,
|
194
127
|
onSave: onSave,
|
195
128
|
onClose: onClose,
|
196
129
|
customProps: customProps
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import StyleBuilder from "../../common/StyleBuilder";
|
3
3
|
import accordionTitleBtnStyle from "../../common/StyleBuilder/accordionTitleBtnStyle";
|
4
|
-
import accordionTitleStyle from "../../common/StyleBuilder/accordionTitleStyle";
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
5
|
const AccordionBtnPopup = props => {
|
7
6
|
const {
|
@@ -11,12 +10,12 @@ const AccordionBtnPopup = props => {
|
|
11
10
|
customProps
|
12
11
|
} = props;
|
13
12
|
return /*#__PURE__*/_jsx(StyleBuilder, {
|
14
|
-
title: "Accordion
|
13
|
+
title: "Accordion Collapse Button",
|
15
14
|
type: "accordionTitleBtnStyle",
|
16
15
|
element: element,
|
17
16
|
onSave: onSave,
|
18
17
|
onClose: onClose,
|
19
|
-
renderTabs:
|
18
|
+
renderTabs: accordionTitleBtnStyle,
|
20
19
|
customProps: customProps
|
21
20
|
});
|
22
21
|
};
|
@@ -1,17 +1,68 @@
|
|
1
|
-
import React from "react";
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Transforms } from "slate";
|
3
|
+
import { useSelected, useSlateStatic, ReactEditor } from "slate-react";
|
4
|
+
import AccordionTitlePopup from "./AccordionTitlePopup";
|
5
|
+
import { IconButton, Tooltip } from "@mui/material";
|
6
|
+
import { GridSettingsIcon } from "../../common/iconslist";
|
7
|
+
import { useEditorSelection } from "../../hooks/useMouseMove";
|
2
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
3
10
|
const AccordionSummary = props => {
|
4
11
|
const {
|
5
12
|
attributes,
|
6
13
|
children,
|
7
|
-
element
|
14
|
+
element,
|
15
|
+
customProps
|
8
16
|
} = props;
|
17
|
+
const {
|
18
|
+
readOnly
|
19
|
+
} = customProps;
|
20
|
+
const [openSetttings, setOpenSettings] = useState(false);
|
21
|
+
const editor = useSlateStatic();
|
22
|
+
const [showTool] = useEditorSelection(editor);
|
23
|
+
const selected = useSelected();
|
24
|
+
const path = ReactEditor.findPath(editor, element);
|
9
25
|
const {
|
10
26
|
textColor,
|
11
27
|
bgColor,
|
12
28
|
borderColor
|
13
29
|
} = element;
|
14
|
-
|
30
|
+
const ToolBar = () => {
|
31
|
+
return selected && !showTool ? /*#__PURE__*/_jsx("div", {
|
32
|
+
className: "element-toolbar hr",
|
33
|
+
contentEditable: false,
|
34
|
+
style: {
|
35
|
+
top: "-42px"
|
36
|
+
},
|
37
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
38
|
+
title: "Settings",
|
39
|
+
arrow: true,
|
40
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
41
|
+
onClick: onSettings,
|
42
|
+
children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
|
43
|
+
})
|
44
|
+
})
|
45
|
+
}) : null;
|
46
|
+
};
|
47
|
+
const onSettings = () => {
|
48
|
+
setOpenSettings(true);
|
49
|
+
};
|
50
|
+
const onSave = data => {
|
51
|
+
const updateData = {
|
52
|
+
...data
|
53
|
+
};
|
54
|
+
delete updateData.children;
|
55
|
+
Transforms.setNodes(editor, {
|
56
|
+
...updateData
|
57
|
+
}, {
|
58
|
+
at: path
|
59
|
+
});
|
60
|
+
onClose();
|
61
|
+
};
|
62
|
+
const onClose = () => {
|
63
|
+
setOpenSettings(false);
|
64
|
+
};
|
65
|
+
return /*#__PURE__*/_jsxs("div", {
|
15
66
|
className: `accordion-summary-container`,
|
16
67
|
...attributes,
|
17
68
|
style: {
|
@@ -21,7 +72,12 @@ const AccordionSummary = props => {
|
|
21
72
|
border: `1px solid ${borderColor}`,
|
22
73
|
color: textColor
|
23
74
|
},
|
24
|
-
children: children
|
75
|
+
children: [children, !readOnly && /*#__PURE__*/_jsx(ToolBar, {}), openSetttings ? /*#__PURE__*/_jsx(AccordionTitlePopup, {
|
76
|
+
element: element,
|
77
|
+
onSave: onSave,
|
78
|
+
onClose: onClose,
|
79
|
+
customProps: customProps
|
80
|
+
}) : null]
|
25
81
|
});
|
26
82
|
};
|
27
83
|
export default AccordionSummary;
|
@@ -62,11 +62,6 @@ function AppHeader(props) {
|
|
62
62
|
const handleDrawerToggle = () => {
|
63
63
|
setMobileOpen(prevState => !prevState);
|
64
64
|
};
|
65
|
-
const closeDrawer = () => {
|
66
|
-
if (mobileOpen) {
|
67
|
-
handleDrawerToggle();
|
68
|
-
}
|
69
|
-
};
|
70
65
|
const onSettings = e => {
|
71
66
|
if (!readOnly) {
|
72
67
|
e.stopPropagation();
|
@@ -153,27 +148,10 @@ function AppHeader(props) {
|
|
153
148
|
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(List, {
|
154
149
|
children: menus.map((item, i) => {
|
155
150
|
const buttonProps = handleLinkType(item.url, item.linkType, true, item.target === "_blank");
|
156
|
-
const onTouchEnd = e => {
|
157
|
-
if (buttonProps?.onTouchEnd) {
|
158
|
-
buttonProps?.onTouchEnd(e);
|
159
|
-
closeDrawer();
|
160
|
-
}
|
161
|
-
};
|
162
|
-
const onClick = e => {
|
163
|
-
if (buttonProps?.onClick) {
|
164
|
-
buttonProps?.onClick(e);
|
165
|
-
closeDrawer();
|
166
|
-
}
|
167
|
-
};
|
168
|
-
const props = {
|
169
|
-
...buttonProps,
|
170
|
-
onTouchEnd,
|
171
|
-
onClick
|
172
|
-
};
|
173
151
|
return /*#__PURE__*/_jsx(ListItem, {
|
174
152
|
disablePadding: true,
|
175
153
|
children: /*#__PURE__*/_jsx(ListItemButton, {
|
176
|
-
...
|
154
|
+
...buttonProps,
|
177
155
|
sx: {
|
178
156
|
textAlign: "center"
|
179
157
|
},
|
@@ -251,7 +229,7 @@ function AppHeader(props) {
|
|
251
229
|
style: {
|
252
230
|
display: "inline-flex",
|
253
231
|
alignItems: "center",
|
254
|
-
color: textColor
|
232
|
+
color: textColor,
|
255
233
|
fontSize: logoFontSize,
|
256
234
|
fontFamily: titleFontFamily,
|
257
235
|
justifyContent: isLogoRight ? "end" : "start"
|
@@ -299,7 +277,7 @@ function AppHeader(props) {
|
|
299
277
|
fontFamily: fontFamily,
|
300
278
|
textTransform: "none",
|
301
279
|
fontSize: fontSize || "16px",
|
302
|
-
color: textColor || "#
|
280
|
+
color: textColor || "#FFF",
|
303
281
|
background: bgColor || "none",
|
304
282
|
"& .m-settings": {
|
305
283
|
display: "none",
|
@@ -314,7 +292,7 @@ function AppHeader(props) {
|
|
314
292
|
background: "#FFF"
|
315
293
|
},
|
316
294
|
"&:hover": {
|
317
|
-
color: textColorHover || textColor || "#
|
295
|
+
color: textColorHover || textColor || "#FFF",
|
318
296
|
background: bgColorHover || bgColor || "none",
|
319
297
|
"& .m-settings": {
|
320
298
|
display: "block"
|
@@ -13,9 +13,6 @@ import { WorkflowIcon } from "../../common/iconslist";
|
|
13
13
|
import { getTRBLBreakPoints, getBreakPointsValue } from "../../helper/theme";
|
14
14
|
import { handleLinkType, windowVar } from "../../utils/helper";
|
15
15
|
import LinkSettings from "../../common/LinkSettings";
|
16
|
-
import { useEditorTheme } from "../../hooks/useEditorTheme";
|
17
|
-
import { getTheme } from "../../theme";
|
18
|
-
import { fontFamilyMap } from "../../utils/font";
|
19
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
20
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
21
18
|
const EditorButton = props => {
|
@@ -33,12 +30,6 @@ const EditorButton = props => {
|
|
33
30
|
const path = ReactEditor.findPath(editor, element);
|
34
31
|
const [edit, setEdit] = useState(false);
|
35
32
|
const [openNav, setOpenNav] = useState(false);
|
36
|
-
const {
|
37
|
-
theme
|
38
|
-
} = useEditorTheme();
|
39
|
-
const {
|
40
|
-
buttonTheme
|
41
|
-
} = getTheme(theme);
|
42
33
|
const {
|
43
34
|
label,
|
44
35
|
bgColor,
|
@@ -52,7 +43,7 @@ const EditorButton = props => {
|
|
52
43
|
fontFamily,
|
53
44
|
textColorHover,
|
54
45
|
bgColorHover,
|
55
|
-
|
46
|
+
buttonIcon,
|
56
47
|
iconPosition = "start",
|
57
48
|
borderStyle,
|
58
49
|
borderWidth,
|
@@ -71,15 +62,13 @@ const EditorButton = props => {
|
|
71
62
|
} = actionTrigger || {
|
72
63
|
options: []
|
73
64
|
};
|
74
|
-
const isTrigger = linkType === "
|
65
|
+
const isTrigger = linkType === "actionTrigger";
|
75
66
|
const refURl = isTrigger ? buttonLink?.url : url;
|
76
|
-
const buttonIcon = element?.buttonIcon || buttonTheme?.buttonIcon;
|
77
67
|
const BtnIcon = buttonIcon ? buttonIcon : null;
|
78
68
|
windowVar.lastButtonProps = element;
|
79
69
|
const handleTrigger = async () => {
|
80
70
|
if (metadata?.buttonLink?.handler) {
|
81
|
-
|
82
|
-
metadata.buttonLink.handler(response);
|
71
|
+
metadata.buttonLink.handler("click");
|
83
72
|
} else if (redirectOnURLResult) {
|
84
73
|
// call api and redirect based on api result
|
85
74
|
const apiResult = await actionButtonRedirect({}, {
|
@@ -197,9 +186,20 @@ const EditorButton = props => {
|
|
197
186
|
children: [/*#__PURE__*/_jsxs(Box, {
|
198
187
|
sx: {
|
199
188
|
textDecoration: "none",
|
189
|
+
background: bgColor || "rgb(30, 75, 122)",
|
200
190
|
borderBlockStyle: "solid",
|
191
|
+
borderColor: borderColor || "transparent",
|
201
192
|
borderWidth: borderWidth !== undefined ? borderWidth : borderColor ? "1px" : "0px",
|
193
|
+
borderRadius: {
|
194
|
+
...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
|
195
|
+
},
|
202
196
|
borderStyle: borderStyle || "solid",
|
197
|
+
padding: {
|
198
|
+
...getTRBLBreakPoints(bannerSpacing)
|
199
|
+
},
|
200
|
+
color: `${textColor || "#FFFFFF"}`,
|
201
|
+
fontSize: textSize || "inherit",
|
202
|
+
fontFamily: fontFamily || "PoppinsRegular",
|
203
203
|
display: "inline-flex",
|
204
204
|
alignItems: "center",
|
205
205
|
position: "relative",
|
@@ -207,26 +207,14 @@ const EditorButton = props => {
|
|
207
207
|
display: "none"
|
208
208
|
},
|
209
209
|
"&:hover": {
|
210
|
-
color: `${textColorHover || textColor}`,
|
211
|
-
background: bgColorHover || bgColor,
|
210
|
+
color: `${textColorHover || textColor || "#FFFFFF"}`,
|
211
|
+
background: bgColorHover || bgColor || "rgb(30, 75, 122)",
|
212
212
|
"& .element-toolbar": {
|
213
213
|
display: "flex"
|
214
214
|
}
|
215
|
-
},
|
216
|
-
color: `${textColor} !important`,
|
217
|
-
fontSize: `${textSize}px !important`,
|
218
|
-
fontFamily: `${fontFamilyMap[fontFamily] || ""} !important`,
|
219
|
-
background: `${bgColor} !important`,
|
220
|
-
borderColor: `${borderColor} !important`,
|
221
|
-
borderRadius: {
|
222
|
-
...getBreakPointsValue(borderRadius || buttonTheme?.borderRadius || {}, null, "overrideBorderRadius", true)
|
223
|
-
},
|
224
|
-
padding: {
|
225
|
-
...getTRBLBreakPoints(bannerSpacing || buttonTheme?.bannerSpacing || {})
|
226
215
|
}
|
227
216
|
},
|
228
217
|
...buttonProps,
|
229
|
-
className: "button theme-element",
|
230
218
|
children: [BtnIcon && iconPosition === "start" && /*#__PURE__*/_jsx(MUIIcon, {
|
231
219
|
iconName: buttonIcon,
|
232
220
|
style: {
|