@flozy/editor 3.9.9 → 4.0.1
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 +28 -17
- package/dist/Editor/CommonEditor.js +109 -177
- package/dist/Editor/Editor.css +12 -8
- package/dist/Editor/Elements/AI/AIInput.js +24 -18
- package/dist/Editor/Elements/AI/CustomSelect.js +12 -19
- package/dist/Editor/Elements/AI/PopoverAIInput.js +89 -66
- package/dist/Editor/Elements/AI/Styles.js +1 -2
- package/dist/Editor/Elements/AI/helper.js +3 -5
- package/dist/Editor/Elements/Accordion/Accordion.js +1 -1
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +21 -5
- 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/Emoji/EmojiPicker.js +4 -2
- 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/List/CheckList.js +2 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +3 -3
- package/dist/Editor/Elements/Signature/SignaturePopup.js +5 -20
- package/dist/Editor/Elements/Table/Styles.js +1 -23
- package/dist/Editor/Elements/Table/Table.js +1 -2
- package/dist/Editor/Elements/Table/TableCell.js +7 -69
- 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 +2 -4
- package/dist/Editor/Toolbar/Mini/Options/Options.js +0 -10
- package/dist/Editor/Toolbar/Mini/Styles.js +0 -7
- package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +13 -12
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +13 -12
- 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 +33 -40
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +7 -52
- package/dist/Editor/Toolbar/PopupTool/index.js +5 -4
- 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 +18 -26
- 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/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 +2 -1
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +2 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +29 -33
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +25 -31
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +7 -29
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +4 -13
- 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/index.js +22 -0
- package/dist/Editor/helper/theme.js +4 -189
- package/dist/Editor/hooks/useMouseMove.js +1 -4
- package/dist/Editor/hooks/useWindowMessage.js +7 -10
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +1 -1
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/SlateUtilityFunctions.js +27 -169
- package/dist/Editor/utils/button.js +17 -1
- package/dist/Editor/utils/events.js +2 -54
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/helper.js +2 -31
- 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 -184
- 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/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,26 +1,20 @@
|
|
|
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
|
-
import { Node, Transforms } from "slate";
|
|
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
|
-
import deserialize from "../../helper/deserialize";
|
|
12
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const scrollToAIInput =
|
|
13
|
+
const scrollToAIInput = () => {
|
|
15
14
|
try {
|
|
16
15
|
setTimeout(() => {
|
|
17
16
|
const slateWrapper = document.getElementById("slate-wrapper-scroll-container");
|
|
18
|
-
|
|
19
|
-
if (getSelectedText(editor)) {
|
|
20
|
-
selectionRect = window.getSelection().getRangeAt(0).getBoundingClientRect();
|
|
21
|
-
} else {
|
|
22
|
-
selectionRect = ReactEditor.toDOMRange(editor, getNextLine(editor).at).getBoundingClientRect();
|
|
23
|
-
}
|
|
17
|
+
const selectionRect = window.getSelection().getRangeAt(0).getBoundingClientRect();
|
|
24
18
|
const halfOfWrapper = slateWrapper.clientHeight / 2;
|
|
25
19
|
const selectionScollTop = selectionRect.y + selectionRect.height;
|
|
26
20
|
if (selectionScollTop > halfOfWrapper) {
|
|
@@ -35,19 +29,26 @@ const scrollToAIInput = editor => {
|
|
|
35
29
|
console.log(err);
|
|
36
30
|
}
|
|
37
31
|
};
|
|
38
|
-
const insertText = (editor, text, options) => {
|
|
39
|
-
const parsed = new DOMParser().parseFromString(text, "text/html");
|
|
40
|
-
const fragment = deserialize(parsed.body);
|
|
41
|
-
Transforms.insertFragment(editor, fragment, options);
|
|
42
|
-
};
|
|
43
32
|
const insertAtNextLine = (editor, text) => {
|
|
44
33
|
const nextLine = getNextLine(editor);
|
|
45
|
-
|
|
34
|
+
Transforms.splitNodes(editor, {
|
|
46
35
|
at: nextLine.at
|
|
47
36
|
});
|
|
48
|
-
Transforms.
|
|
37
|
+
Transforms.insertNodes(editor, {
|
|
38
|
+
type: "paragraph",
|
|
39
|
+
children: [{
|
|
40
|
+
text
|
|
41
|
+
}]
|
|
42
|
+
}, {
|
|
49
43
|
at: nextLine.at
|
|
50
44
|
});
|
|
45
|
+
const currentPath = Path.parent(nextLine.at.focus.path);
|
|
46
|
+
const nextPath = Path.next(currentPath);
|
|
47
|
+
ReactEditor.focus(editor);
|
|
48
|
+
Transforms.select(editor, {
|
|
49
|
+
anchor: Editor.start(editor, nextPath),
|
|
50
|
+
focus: Editor.end(editor, nextPath)
|
|
51
|
+
});
|
|
51
52
|
};
|
|
52
53
|
const getNextLine = editor => {
|
|
53
54
|
const {
|
|
@@ -100,14 +101,8 @@ const updateAnchorEl = (setAnchorEl, editor) => {
|
|
|
100
101
|
// selected text as caret
|
|
101
102
|
caret = selection.getRangeAt(0);
|
|
102
103
|
} else {
|
|
103
|
-
|
|
104
|
-
const {
|
|
105
|
-
textContent,
|
|
106
|
-
parentElement
|
|
107
|
-
} = domElement?.commonAncestorContainer || {};
|
|
108
|
-
caret = textContent ? domElement : parentElement; // in mobile, if textContent in not available, it is pointing some <br> tag (getBoundingClientRect not working correctly for <br>), to avoid that, we are pointing the parent element as caret
|
|
104
|
+
caret = ReactEditor.toDOMRange(editor, getNextLine(editor).at);
|
|
109
105
|
}
|
|
110
|
-
|
|
111
106
|
const getBoundingClientRect = () => {
|
|
112
107
|
const editorContainer = document.querySelector("#slate-wrapper-scroll-container")?.getBoundingClientRect();
|
|
113
108
|
const editorEle = document.querySelector(".ed-section-inner")?.getBoundingClientRect();
|
|
@@ -152,6 +147,7 @@ function PopoverAIInput({
|
|
|
152
147
|
const targetRef = useRef();
|
|
153
148
|
const classes = Styles();
|
|
154
149
|
const editor = useSlate();
|
|
150
|
+
const [size] = useWindowResize();
|
|
155
151
|
const onClickOutside = () => {
|
|
156
152
|
setAnchorEl(null);
|
|
157
153
|
setOpenAI("");
|
|
@@ -167,8 +163,8 @@ function PopoverAIInput({
|
|
|
167
163
|
updateAnchorEl(setAnchorEl, editor);
|
|
168
164
|
}, [openAI, editor.selection]);
|
|
169
165
|
useEffect(() => {
|
|
170
|
-
if (openAI) {
|
|
171
|
-
scrollToAIInput(
|
|
166
|
+
if (openAI === "fromToolBar") {
|
|
167
|
+
scrollToAIInput();
|
|
172
168
|
}
|
|
173
169
|
}, [openAI]);
|
|
174
170
|
const onSend = async (type, option) => {
|
|
@@ -176,35 +172,12 @@ function PopoverAIInput({
|
|
|
176
172
|
onClickOutside();
|
|
177
173
|
return;
|
|
178
174
|
}
|
|
179
|
-
if (type === "done") {
|
|
180
|
-
// Get the current selection point
|
|
181
|
-
const {
|
|
182
|
-
anchor
|
|
183
|
-
} = editor.selection;
|
|
184
|
-
const {
|
|
185
|
-
path
|
|
186
|
-
} = anchor;
|
|
187
|
-
const {
|
|
188
|
-
text: selectText
|
|
189
|
-
} = Node.get(editor, path);
|
|
190
|
-
if (selectText?.length) {
|
|
191
|
-
insertAtNextLine(editor, generatedText);
|
|
192
|
-
} else {
|
|
193
|
-
insertText(editor, generatedText);
|
|
194
|
-
}
|
|
195
|
-
onClickOutside();
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
175
|
if (type === "replace_selection") {
|
|
199
176
|
// replace generated text
|
|
200
|
-
insertText(editor, generatedText);
|
|
177
|
+
Transforms.insertText(editor, generatedText);
|
|
201
178
|
onClickOutside();
|
|
202
179
|
return;
|
|
203
180
|
}
|
|
204
|
-
if (type === "speech_to_text") {
|
|
205
|
-
setGeneratedText(option.text);
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
181
|
if (type === "try_again") {
|
|
209
182
|
// resetting the previous option and try again
|
|
210
183
|
option = selectedOption;
|
|
@@ -215,7 +188,7 @@ function PopoverAIInput({
|
|
|
215
188
|
setLoading(true);
|
|
216
189
|
const payload = {
|
|
217
190
|
mode: option.mode || 0,
|
|
218
|
-
query:
|
|
191
|
+
query: inputValue
|
|
219
192
|
};
|
|
220
193
|
if (option.mode === MODES.translate || option.mode === MODES.rephraseTone) {
|
|
221
194
|
payload.textOptionInput = type;
|
|
@@ -241,7 +214,47 @@ function PopoverAIInput({
|
|
|
241
214
|
}
|
|
242
215
|
return;
|
|
243
216
|
}
|
|
244
|
-
|
|
217
|
+
|
|
218
|
+
// Get the current selection point
|
|
219
|
+
const {
|
|
220
|
+
anchor
|
|
221
|
+
} = editor.selection;
|
|
222
|
+
const {
|
|
223
|
+
path
|
|
224
|
+
} = anchor;
|
|
225
|
+
const {
|
|
226
|
+
text: selectText
|
|
227
|
+
} = Node.get(editor, path);
|
|
228
|
+
const insertInNewLine = option.isSendBtn && selectText?.length || type === "continue_writing";
|
|
229
|
+
if (insertInNewLine) {
|
|
230
|
+
if (getSelectedText(editor)) {
|
|
231
|
+
const currentPath = Path.parent(editor.selection.focus.path);
|
|
232
|
+
const nextPath = Path.next(currentPath);
|
|
233
|
+
Transforms.insertNodes(editor, {
|
|
234
|
+
type: "paragraph",
|
|
235
|
+
children: [{
|
|
236
|
+
text
|
|
237
|
+
}]
|
|
238
|
+
}, {
|
|
239
|
+
at: nextPath,
|
|
240
|
+
select: true
|
|
241
|
+
});
|
|
242
|
+
} else {
|
|
243
|
+
insertAtNextLine(editor, text);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
Transforms.insertText(editor, text);
|
|
248
|
+
}
|
|
249
|
+
const range = {
|
|
250
|
+
...editor.selection,
|
|
251
|
+
anchor: {
|
|
252
|
+
...anchor,
|
|
253
|
+
offset: openAI === "fromToolBar" ? anchor.offset : 0
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
ReactEditor.focus(editor);
|
|
257
|
+
Transforms.select(editor, range);
|
|
245
258
|
|
|
246
259
|
// scrollToAIInput();
|
|
247
260
|
};
|
|
@@ -250,7 +263,21 @@ function PopoverAIInput({
|
|
|
250
263
|
setInputValue(e.target.value);
|
|
251
264
|
};
|
|
252
265
|
return /*#__PURE__*/_jsxs("div", {
|
|
253
|
-
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, {
|
|
254
281
|
open: Boolean(openAI),
|
|
255
282
|
anchorEl: anchorEl,
|
|
256
283
|
transition: true,
|
|
@@ -269,19 +296,15 @@ function PopoverAIInput({
|
|
|
269
296
|
sx: getSelectedText(editor) ? {
|
|
270
297
|
marginTop: "6px"
|
|
271
298
|
} : {},
|
|
272
|
-
children: /*#__PURE__*/_jsx(
|
|
273
|
-
|
|
299
|
+
children: /*#__PURE__*/_jsx(AIInput, {
|
|
300
|
+
loading: loading,
|
|
274
301
|
onSend: onSend,
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
inputValue: inputValue,
|
|
282
|
-
onInputChange: onInputChange,
|
|
283
|
-
onClickOutside: onClickOutside
|
|
284
|
-
})
|
|
302
|
+
generatedText: generatedText,
|
|
303
|
+
anchorEl: anchorEl,
|
|
304
|
+
openAI: openAI,
|
|
305
|
+
inputValue: inputValue,
|
|
306
|
+
onInputChange: onInputChange,
|
|
307
|
+
onClickOutside: onClickOutside
|
|
285
308
|
})
|
|
286
309
|
})
|
|
287
310
|
})
|
|
@@ -47,12 +47,10 @@ export const newContentOptions = [{
|
|
|
47
47
|
groupLabel: "",
|
|
48
48
|
options: [
|
|
49
49
|
// improveWriting,
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
value: "done",
|
|
53
|
-
Icon: CheckIcon,
|
|
50
|
+
...commonOptions.map(o => ({
|
|
51
|
+
...o,
|
|
54
52
|
replace: true
|
|
55
|
-
},
|
|
53
|
+
})), {
|
|
56
54
|
label: "Close",
|
|
57
55
|
value: "close",
|
|
58
56
|
Icon: CloseIcon,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { getBorderColor, getTextColor } from "../../helper";
|
|
3
|
+
import { Box } from "@mui/material";
|
|
4
|
+
import { getBreakPointsValue, getTRBLBreakPoints } from "../../helper/theme";
|
|
2
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
6
|
const AccordionSummary = props => {
|
|
4
7
|
const {
|
|
@@ -9,18 +12,31 @@ const AccordionSummary = props => {
|
|
|
9
12
|
const {
|
|
10
13
|
textColor,
|
|
11
14
|
bgColor,
|
|
12
|
-
borderColor
|
|
15
|
+
borderColor,
|
|
16
|
+
borderRadius,
|
|
17
|
+
bannerSpacing
|
|
13
18
|
} = element;
|
|
14
|
-
|
|
19
|
+
const textStyles = getTextColor(textColor);
|
|
20
|
+
const borderStyle = getBorderColor(borderColor);
|
|
21
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
15
22
|
className: `accordion-summary-container`,
|
|
16
23
|
...attributes,
|
|
17
24
|
style: {
|
|
18
25
|
width: "100%",
|
|
19
26
|
position: "relative",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
color: textColor
|
|
27
|
+
background: bgColor,
|
|
28
|
+
...borderStyle
|
|
23
29
|
},
|
|
30
|
+
sx: {
|
|
31
|
+
borderRadius: {
|
|
32
|
+
...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
|
|
33
|
+
},
|
|
34
|
+
padding: {
|
|
35
|
+
...getTRBLBreakPoints(bannerSpacing)
|
|
36
|
+
},
|
|
37
|
+
'& span[data-slate-string="true"]': textStyles
|
|
38
|
+
},
|
|
39
|
+
component: "div",
|
|
24
40
|
children: children
|
|
25
41
|
});
|
|
26
42
|
};
|
|
@@ -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: {
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { Box, IconButton, Popover
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Box, IconButton, Popover } from "@mui/material";
|
|
3
3
|
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
4
4
|
import Button from "../../common/Button";
|
|
5
5
|
import { colors } from "./defaultColors";
|
|
6
6
|
import ColorPicker from "./colorPicker.svg";
|
|
7
|
-
import { ThemeContext } from "../../CommonEditor";
|
|
8
|
-
import { useSlateStatic } from "slate-react";
|
|
9
|
-
import { Transforms } from "slate";
|
|
10
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
9
|
let c = [];
|
|
14
10
|
const ColorChunks = (recentColors = []) => [...recentColors, ...colors].reduce((a, b, i) => {
|
|
15
11
|
if (i % 7 === 0) {
|
|
@@ -35,7 +31,9 @@ const SingleColorButton = ({
|
|
|
35
31
|
style: {
|
|
36
32
|
width: "100%",
|
|
37
33
|
display: "flex",
|
|
38
|
-
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
padding: padding || "8px",
|
|
36
|
+
justifyContent: "center"
|
|
39
37
|
},
|
|
40
38
|
children: [crs.map(m => /*#__PURE__*/_jsx(Button, {
|
|
41
39
|
onClick: handleSelect(m),
|
|
@@ -111,17 +109,11 @@ const ColorButtons = props => {
|
|
|
111
109
|
forMiniTool,
|
|
112
110
|
openColorTool,
|
|
113
111
|
onClose,
|
|
114
|
-
onColorPickerClick
|
|
115
|
-
disableEditTheme
|
|
112
|
+
onColorPickerClick
|
|
116
113
|
} = props;
|
|
117
114
|
const [row1, ...restRows] = ColorChunks([]);
|
|
118
115
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
119
116
|
const open = Boolean(anchorEl);
|
|
120
|
-
const theme = useTheme();
|
|
121
|
-
const editor = useSlateStatic();
|
|
122
|
-
const {
|
|
123
|
-
setOpenTheme
|
|
124
|
-
} = useContext(ThemeContext);
|
|
125
117
|
const handleMore = e => {
|
|
126
118
|
setAnchorEl(e.currentTarget);
|
|
127
119
|
};
|
|
@@ -134,7 +126,6 @@ const ColorButtons = props => {
|
|
|
134
126
|
const handleSelect = color => () => {
|
|
135
127
|
onSelect(color);
|
|
136
128
|
};
|
|
137
|
-
const colorVars = theme?.vars?.colors || {};
|
|
138
129
|
return /*#__PURE__*/_jsxs(Box, {
|
|
139
130
|
component: "span",
|
|
140
131
|
sx: classes.colorButtons,
|
|
@@ -151,7 +142,7 @@ const ColorButtons = props => {
|
|
|
151
142
|
activeColor: activeColor
|
|
152
143
|
}, `si_btn_row1_${m}_${i}`);
|
|
153
144
|
})
|
|
154
|
-
}), /*#__PURE__*/
|
|
145
|
+
}), /*#__PURE__*/_jsxs(Popover, {
|
|
155
146
|
open: open || openColorTool,
|
|
156
147
|
anchorEl: anchorEl || openColorTool,
|
|
157
148
|
onClose: handleClose,
|
|
@@ -165,39 +156,9 @@ const ColorButtons = props => {
|
|
|
165
156
|
},
|
|
166
157
|
sx: classes.colorPopper,
|
|
167
158
|
className: "colorPopper",
|
|
168
|
-
children: /*#__PURE__*/
|
|
159
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
169
160
|
sx: classes.colorButtonsInner,
|
|
170
|
-
children:
|
|
171
|
-
children: [/*#__PURE__*/_jsxs(Box, {
|
|
172
|
-
component: "div",
|
|
173
|
-
className: "singleColorTitleWrapper",
|
|
174
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
|
175
|
-
variant: "subtitle2",
|
|
176
|
-
children: "Theme colour"
|
|
177
|
-
}), disableEditTheme ? null : /*#__PURE__*/_jsx("div", {
|
|
178
|
-
className: "editBtn",
|
|
179
|
-
onClick: () => {
|
|
180
|
-
Transforms.deselect(editor, {
|
|
181
|
-
at: editor.selection
|
|
182
|
-
});
|
|
183
|
-
setOpenTheme("editThemeColor");
|
|
184
|
-
},
|
|
185
|
-
children: "Edit"
|
|
186
|
-
})]
|
|
187
|
-
}), /*#__PURE__*/_jsx(SingleColorButton, {
|
|
188
|
-
crs: Object.values(colorVars),
|
|
189
|
-
handleSelect: handleSelect,
|
|
190
|
-
classes: classes,
|
|
191
|
-
activeColor: activeColor
|
|
192
|
-
})]
|
|
193
|
-
}) : null, /*#__PURE__*/_jsx(Box, {
|
|
194
|
-
component: "div",
|
|
195
|
-
className: "singleColorTitleWrapper",
|
|
196
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
197
|
-
variant: "subtitle2",
|
|
198
|
-
children: "Custom colour"
|
|
199
|
-
})
|
|
200
|
-
}), restRows.map((m, i) => {
|
|
161
|
+
children: restRows.map((m, i) => {
|
|
201
162
|
return /*#__PURE__*/_jsx(SingleColorButton, {
|
|
202
163
|
id: `p2_${id}`,
|
|
203
164
|
crs: m,
|
|
@@ -206,18 +167,14 @@ const ColorButtons = props => {
|
|
|
206
167
|
classes: classes,
|
|
207
168
|
activeColor: activeColor
|
|
208
169
|
}, `si_btn_${m}_${i}`);
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
alt: "color wheel"
|
|
218
|
-
})
|
|
219
|
-
}) : null]
|
|
220
|
-
})
|
|
170
|
+
})
|
|
171
|
+
}), forMiniTool ? /*#__PURE__*/_jsx(IconButton, {
|
|
172
|
+
onClick: onColorPickerClick,
|
|
173
|
+
children: /*#__PURE__*/_jsx("img", {
|
|
174
|
+
src: ColorPicker,
|
|
175
|
+
alt: "color wheel"
|
|
176
|
+
})
|
|
177
|
+
}) : null]
|
|
221
178
|
})]
|
|
222
179
|
});
|
|
223
180
|
};
|
|
@@ -60,28 +60,4 @@
|
|
|
60
60
|
padding: 0 15px !important;
|
|
61
61
|
width: 60px !important;
|
|
62
62
|
flex-shrink: 0;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
.singleColorTitleWrapper {
|
|
67
|
-
display: flex;
|
|
68
|
-
justify-content: space-between;
|
|
69
|
-
align-items: center;
|
|
70
|
-
padding: 10px;
|
|
71
|
-
width: 100%;
|
|
72
|
-
border-bottom: 1px solid #DCE4EC;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.singleColorTitleWrapper .MuiTypography-root {
|
|
76
|
-
font-weight: 600;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.singleColorTitleWrapper .editBtn {
|
|
80
|
-
text-transform: none;
|
|
81
|
-
color: #2563EB;
|
|
82
|
-
text-decoration: underline;
|
|
83
|
-
padding: 0px;
|
|
84
|
-
min-width: unset;
|
|
85
|
-
cursor: pointer;
|
|
86
|
-
font-size: 14px;
|
|
87
|
-
}
|
|
63
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { ReactEditor } from "slate-react";
|
|
3
3
|
import { Transforms } from "slate";
|
|
4
|
+
import ColorPickerTool from "react-gcolor-picker";
|
|
4
5
|
import { IconButton, Tooltip, Box, Popover } from "@mui/material";
|
|
5
6
|
import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions";
|
|
6
7
|
import ColorButtons from "./ColorButtons";
|
|
@@ -8,7 +9,6 @@ import ColorPickerStyles from "./Styles";
|
|
|
8
9
|
import colorWheel from "./colorWheel.png";
|
|
9
10
|
import "./ColorPicker.css";
|
|
10
11
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
|
11
|
-
import CustomColorPicker from "../../common/CustomColorPicker";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -95,10 +95,10 @@ const ColorPicker = props => {
|
|
|
95
95
|
horizontal: "top"
|
|
96
96
|
},
|
|
97
97
|
sx: classes.colorPickerPopup,
|
|
98
|
-
children: /*#__PURE__*/_jsx(
|
|
98
|
+
children: /*#__PURE__*/_jsx(ColorPickerTool, {
|
|
99
99
|
gradient: true,
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
value: activeColor,
|
|
101
|
+
onChange: handleFormSubmit
|
|
102
102
|
})
|
|
103
103
|
})]
|
|
104
104
|
});
|