@flozy/editor 4.9.5 → 4.9.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +25 -34
- package/dist/Editor/Editor.css +4 -4
- package/dist/Editor/Elements/AI/AIInput.js +0 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +1 -1
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +2 -0
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +2 -0
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +108 -11
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +2 -0
- package/dist/Editor/common/ColorPickerButton.js +3 -2
- package/dist/Editor/common/MentionsPopup/Styles.js +1 -7
- package/dist/Editor/common/RnD/index.js +1 -1
- package/dist/Editor/commonStyle.js +6 -2
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +14 -0
- package/dist/Editor/utils/events.js +0 -1
- package/dist/Editor/utils/serializeToText.js +2 -0
- package/package.json +1 -1
@@ -1,9 +1,8 @@
|
|
1
1
|
import React, { useCallback, useMemo, useRef, useState, useEffect, useImperativeHandle, forwardRef } from "react";
|
2
2
|
import { Editable, Slate, ReactEditor } from 'slate-react';
|
3
3
|
import { createEditor, Transforms, Editor } from 'slate';
|
4
|
-
import { useDebounce } from "use-debounce";
|
5
4
|
import withCommon from "./hooks/withCommon";
|
6
|
-
import { getBlock, getMarked } from "./utils/chatEditor/SlateUtilityFunctions";
|
5
|
+
import { getBlock, getMarked, serializeMentions } from "./utils/chatEditor/SlateUtilityFunctions";
|
7
6
|
import MiniTextFormat from "./Toolbar/PopupTool/MiniTextFormat";
|
8
7
|
import { commands, mentionsEvent } from "./utils/events";
|
9
8
|
import { insertEmoji } from "./utils/emoji";
|
@@ -15,6 +14,7 @@ import Shorthands from "./common/Shorthands";
|
|
15
14
|
import usePopupStyle from "./Toolbar/PopupTool/PopupToolStyle";
|
16
15
|
import { EditorProvider } from "./hooks/useMouseMove";
|
17
16
|
import decorators from "./utils/Decorators";
|
17
|
+
import { useDebouncedCallback } from "use-debounce";
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
19
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
20
20
|
const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
@@ -42,8 +42,18 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
42
42
|
});
|
43
43
|
const [isInteracted, setIsInteracted] = useState(false);
|
44
44
|
const [value, setValue] = useState(convertedContent);
|
45
|
-
const
|
46
|
-
const
|
45
|
+
const debouncedValue = useRef(value);
|
46
|
+
const debounced = useDebouncedCallback(
|
47
|
+
// function
|
48
|
+
value => {
|
49
|
+
const {
|
50
|
+
value: strVal,
|
51
|
+
...restVal
|
52
|
+
} = getOnSaveData(value);
|
53
|
+
onSave(strVal, restVal);
|
54
|
+
},
|
55
|
+
// delay in ms
|
56
|
+
500);
|
47
57
|
const editor = useMemo(() => {
|
48
58
|
return withCommon(createEditor(), {
|
49
59
|
needLayout,
|
@@ -63,7 +73,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
63
73
|
const {
|
64
74
|
value: strVal,
|
65
75
|
...restVal
|
66
|
-
} = getOnSaveData(
|
76
|
+
} = getOnSaveData(debouncedValue?.current);
|
67
77
|
onsubmit(false, {
|
68
78
|
strVal,
|
69
79
|
restVal
|
@@ -99,7 +109,8 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
99
109
|
const newValue = draftToSlate({
|
100
110
|
data: content
|
101
111
|
});
|
102
|
-
|
112
|
+
debounced(newValue);
|
113
|
+
|
103
114
|
// setTimeout(() => {
|
104
115
|
if (editor.children.length === 0) {
|
105
116
|
Transforms.insertNodes(editor, newValue);
|
@@ -112,27 +123,14 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
112
123
|
}
|
113
124
|
}
|
114
125
|
}));
|
115
|
-
|
116
|
-
// useEffect(() => {
|
117
|
-
// setIsExternalUpdate(true);
|
118
|
-
// setValue(draftToSlate({ data: content }));
|
119
|
-
// }, [content]);
|
120
|
-
|
121
|
-
useEffect(() => {
|
122
|
-
if (JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
|
123
|
-
const {
|
124
|
-
value: strVal,
|
125
|
-
...restVal
|
126
|
-
} = getOnSaveData(deboundedValue);
|
127
|
-
onSave(strVal, restVal);
|
128
|
-
}
|
129
|
-
}, [deboundedValue]);
|
130
126
|
const getOnSaveData = val => {
|
131
127
|
const text = serializeToText(val);
|
128
|
+
const mentions = serializeMentions(val);
|
132
129
|
const title = val?.find(f => f.type === "title");
|
133
130
|
return {
|
134
131
|
value: JSON.stringify(val),
|
135
132
|
text: text,
|
133
|
+
mentions: mentions,
|
136
134
|
title: serializeToText(title?.children) || "Untitled"
|
137
135
|
};
|
138
136
|
};
|
@@ -180,15 +178,8 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
180
178
|
});
|
181
179
|
};
|
182
180
|
const handleEditorChange = newValue => {
|
183
|
-
|
184
|
-
|
185
|
-
const {
|
186
|
-
value: strVal,
|
187
|
-
...restVal
|
188
|
-
} = getOnSaveData(newValue);
|
189
|
-
onSave(strVal, restVal);
|
190
|
-
}
|
191
|
-
setValue(newValue);
|
181
|
+
debounced(newValue);
|
182
|
+
debouncedValue.current = newValue;
|
192
183
|
if (!isInteracted) {
|
193
184
|
setIsInteracted(true);
|
194
185
|
}
|
@@ -228,7 +219,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
228
219
|
editor
|
229
220
|
});
|
230
221
|
} else if (event.key === "Enter" && !isMobile) {
|
231
|
-
const isEmpty =
|
222
|
+
const isEmpty = debouncedValue?.current.length === 1 && debouncedValue?.current[0].type === 'paragraph' && debouncedValue?.current[0].children.length === 1 && debouncedValue?.current[0].children[0].text === '';
|
232
223
|
if (isEmpty) {
|
233
224
|
event.preventDefault();
|
234
225
|
return;
|
@@ -237,7 +228,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
237
228
|
const {
|
238
229
|
value: strVal,
|
239
230
|
...restVal
|
240
|
-
} = getOnSaveData(
|
231
|
+
} = getOnSaveData(debouncedValue?.current);
|
241
232
|
onsubmit(false, {
|
242
233
|
strVal,
|
243
234
|
restVal
|
@@ -251,7 +242,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
251
242
|
const {
|
252
243
|
value: strVal,
|
253
244
|
...restVal
|
254
|
-
} = getOnSaveData(
|
245
|
+
} = getOnSaveData(debouncedValue?.current);
|
255
246
|
onBlur({
|
256
247
|
strVal,
|
257
248
|
restVal
|
@@ -272,7 +263,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
272
263
|
editor: editor,
|
273
264
|
children: /*#__PURE__*/_jsxs(Slate, {
|
274
265
|
editor: editor,
|
275
|
-
initialValue:
|
266
|
+
initialValue: debouncedValue?.current,
|
276
267
|
onChange: handleEditorChange,
|
277
268
|
children: [toolBar && /*#__PURE__*/_jsx(MiniTextFormat, {
|
278
269
|
classes: classes,
|
package/dist/Editor/Editor.css
CHANGED
@@ -399,7 +399,7 @@ blockquote {
|
|
399
399
|
align-items: center;
|
400
400
|
border-width: 0px, 0px, 0px, 0px;
|
401
401
|
border-style: solid;
|
402
|
-
border-color: #
|
402
|
+
border-color: #2563EB66;
|
403
403
|
justify-content: center;
|
404
404
|
flex-direction: column;
|
405
405
|
width: 100%;
|
@@ -492,9 +492,9 @@ blockquote {
|
|
492
492
|
|
493
493
|
.MuiButton-root.primaryBtn.disabled,
|
494
494
|
.MuiButton-root.secondaryBtn.disabled {
|
495
|
-
background: #eee
|
496
|
-
color: #ccc
|
497
|
-
border: 1px solid #ccc
|
495
|
+
background: #eee;
|
496
|
+
color: #ccc;
|
497
|
+
border: 1px solid #ccc;
|
498
498
|
}
|
499
499
|
|
500
500
|
.MuiButton-root.secondaryBtn {
|
@@ -71,7 +71,6 @@ function AIInput({
|
|
71
71
|
}, [openAI]);
|
72
72
|
const isSendBtnDisabled = !inputValue || loading;
|
73
73
|
const props = getProps(openAI, generatedText) || {};
|
74
|
-
const fromToolBar = openAI === "fromToolBar";
|
75
74
|
const handleSendBtnClick = () => {
|
76
75
|
if (isSendBtnDisabled) {
|
77
76
|
return;
|
@@ -516,7 +516,7 @@ const SignaturePopup = props => {
|
|
516
516
|
children: "Delete"
|
517
517
|
}) : null, /*#__PURE__*/_jsx(Button, {
|
518
518
|
onClick: handleSave,
|
519
|
-
className: `primaryBtn actionBtn ${isEmpty ? "disabled" : ""}`,
|
519
|
+
className: `primaryBtn actionBtn ${isEmpty ? "disabled disabledSaveBtn" : ""}`,
|
520
520
|
disabled: isEmpty,
|
521
521
|
children: "Save"
|
522
522
|
})]
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
2
2
|
import { Select, MenuItem } from "@mui/material";
|
3
3
|
import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions.js";
|
4
4
|
import { fontFamilyMap } from "../../utils/font";
|
5
|
+
import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
7
|
const Dropdown = ({
|
7
8
|
classes,
|
@@ -29,6 +30,7 @@ const Dropdown = ({
|
|
29
30
|
}
|
30
31
|
},
|
31
32
|
sx: classes.textFormatSelect,
|
33
|
+
IconComponent: KeyboardArrowDownRoundedIcon,
|
32
34
|
children: options.map((item, index) => /*#__PURE__*/_jsx(MenuItem
|
33
35
|
// style={{ fontFamily: item.text }}
|
34
36
|
, {
|
@@ -3,6 +3,7 @@ import { Autocomplete, TextField } from "@mui/material";
|
|
3
3
|
import { activeMark, addMarkData } from "../../utils/SlateUtilityFunctions.js";
|
4
4
|
import usePopupStyle from "../PopupTool/PopupToolStyle.js";
|
5
5
|
import { useEditorContext } from "../../hooks/useMouseMove.js";
|
6
|
+
import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
8
|
const FontFamilyAutocomplete = ({
|
8
9
|
editor,
|
@@ -57,6 +58,7 @@ const FontFamilyAutocomplete = ({
|
|
57
58
|
children: option
|
58
59
|
});
|
59
60
|
},
|
61
|
+
popupIcon: /*#__PURE__*/_jsx(KeyboardArrowDownRoundedIcon, {}),
|
60
62
|
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
61
63
|
sx: {
|
62
64
|
"& .MuiInputBase-root.MuiOutlinedInput-root": {
|
@@ -96,8 +96,29 @@ const usePopupStyle = theme => ({
|
|
96
96
|
width: "100%",
|
97
97
|
maxHeight: "fit-content"
|
98
98
|
},
|
99
|
+
"& .MuiTab-root": {
|
100
|
+
textTransform: "capitalize",
|
101
|
+
color: "#64748B",
|
102
|
+
borderBottom: `1.5px solid ${theme?.palette?.editor?.deviderBgColor}`
|
103
|
+
},
|
104
|
+
"& .Mui-selected": {
|
105
|
+
color: `${theme?.palette?.editor?.textColor} !important`,
|
106
|
+
fontWeight: "700 !important"
|
107
|
+
},
|
108
|
+
"& .MuiTabs-indicator": {
|
109
|
+
background: "#2563EB"
|
110
|
+
},
|
111
|
+
"& .MuiTabScrollButton-horizontal": {
|
112
|
+
borderBottom: "unset !important"
|
113
|
+
},
|
99
114
|
"@media only screen and (max-width: 599px)": {
|
100
115
|
width: "330px"
|
116
|
+
},
|
117
|
+
"& .MuiCardContent-root": {
|
118
|
+
color: theme?.palette?.editor?.textColor,
|
119
|
+
fontFamily: "Inter, sans-serif",
|
120
|
+
fontSize: "12px",
|
121
|
+
fontWeight: "500"
|
101
122
|
}
|
102
123
|
},
|
103
124
|
"& .headerContainer": {},
|
@@ -122,6 +143,38 @@ const usePopupStyle = theme => ({
|
|
122
143
|
fill: theme?.palette?.type === "dark" ? "none" : ""
|
123
144
|
}
|
124
145
|
},
|
146
|
+
"& .signatureElementIcon": {
|
147
|
+
"& path": {
|
148
|
+
fill: `${theme?.palette?.editor?.closeButtonSvgStroke}`
|
149
|
+
}
|
150
|
+
},
|
151
|
+
"& .commonSvgStyle": {
|
152
|
+
"& path": {
|
153
|
+
stroke: `${theme?.palette?.editor?.closeButtonSvgStroke}`
|
154
|
+
}
|
155
|
+
},
|
156
|
+
"& .commonSvgStyle2": {
|
157
|
+
"& path": {
|
158
|
+
stroke: `${theme?.palette?.editor?.closeButtonSvgStroke}`
|
159
|
+
}
|
160
|
+
},
|
161
|
+
"& .colorBoxElementIcon": {
|
162
|
+
"& path": {
|
163
|
+
stroke: `${theme?.palette?.editor?.closeButtonSvgStroke}`,
|
164
|
+
fill: "none"
|
165
|
+
}
|
166
|
+
},
|
167
|
+
"& .gridElementIcon": {
|
168
|
+
"& path": {
|
169
|
+
stroke: `${theme?.palette?.editor?.closeButtonSvgStroke}`,
|
170
|
+
fill: `${theme?.palette?.editor?.closeButtonSvgStroke}`
|
171
|
+
}
|
172
|
+
},
|
173
|
+
"& .newLineElementIcon": {
|
174
|
+
"& path": {
|
175
|
+
fill: `${theme?.palette?.editor?.closeButtonSvgStroke}`
|
176
|
+
}
|
177
|
+
},
|
125
178
|
"&:hover": {
|
126
179
|
backgroundColor: `${theme?.palette?.editor?.menuOptionSelectedOption} !important`,
|
127
180
|
"& .signatureElementIcon": {
|
@@ -194,6 +247,11 @@ const usePopupStyle = theme => ({
|
|
194
247
|
},
|
195
248
|
"@media only screen and (max-width: 599px)": {
|
196
249
|
width: "330px"
|
250
|
+
},
|
251
|
+
"& .textFormatMUIIcon": {
|
252
|
+
"& svg": {
|
253
|
+
color: theme?.palette?.editor?.closeButtonSvgStroke
|
254
|
+
}
|
197
255
|
}
|
198
256
|
},
|
199
257
|
textFormatLabel: {
|
@@ -290,9 +348,10 @@ const usePopupStyle = theme => ({
|
|
290
348
|
autoCompleteaFontFamily: {
|
291
349
|
"& .MuiOutlinedInput-root": {
|
292
350
|
borderRadius: "8px",
|
293
|
-
backgroundColor: `${theme?.palette?.editor?.inputFieldBgColor}
|
351
|
+
backgroundColor: `${theme?.palette?.editor?.inputFieldBgColor}`,
|
294
352
|
fontSize: "14px",
|
295
|
-
height: "36px"
|
353
|
+
height: "36px",
|
354
|
+
paddingLeft: "15px !important"
|
296
355
|
},
|
297
356
|
"& .MuiOutlinedInput-notchedOutline": {
|
298
357
|
border: `1px solid ${theme?.palette?.editor?.inputFieldBorder} !important`
|
@@ -470,7 +529,8 @@ const usePopupStyle = theme => ({
|
|
470
529
|
},
|
471
530
|
"& .colorPicker": {
|
472
531
|
background: theme?.palette?.editor?.inputFieldBgColor,
|
473
|
-
borderRadius: "0px 7px 7px 0px"
|
532
|
+
borderRadius: "0px 7px 7px 0px",
|
533
|
+
padding: "0px"
|
474
534
|
},
|
475
535
|
"& .vl": {
|
476
536
|
background: theme?.palette?.editor?.borderColor,
|
@@ -511,7 +571,8 @@ const usePopupStyle = theme => ({
|
|
511
571
|
},
|
512
572
|
"& .colorPicker": {
|
513
573
|
background: theme?.palette?.editor?.inputFieldBgColor,
|
514
|
-
borderRadius: "0px 7px 7px 0px"
|
574
|
+
borderRadius: "0px 7px 7px 0px",
|
575
|
+
padding: "0px"
|
515
576
|
},
|
516
577
|
"& .vl": {
|
517
578
|
background: theme?.palette?.editor?.borderColor,
|
@@ -696,8 +757,11 @@ const usePopupStyle = theme => ({
|
|
696
757
|
}
|
697
758
|
},
|
698
759
|
"& .default-color-panel": {
|
760
|
+
gridTemplateColumns: "repeat(auto-fill, 24px)",
|
699
761
|
"& .default-color-panel_item": {
|
700
|
-
borderRadius: "50%"
|
762
|
+
borderRadius: "50%",
|
763
|
+
width: "16px",
|
764
|
+
height: "16px"
|
701
765
|
}
|
702
766
|
}
|
703
767
|
},
|
@@ -818,17 +882,18 @@ const usePopupStyle = theme => ({
|
|
818
882
|
"& .MuiPopover-paper": {
|
819
883
|
maxHeight: "140px",
|
820
884
|
// minWidth: "130px",
|
821
|
-
border: "1px solid #E4E8EB",
|
822
|
-
background: `${theme?.palette?.editor?.
|
885
|
+
// border: "1px solid #E4E8EB",
|
886
|
+
background: `${theme?.palette?.editor?.textWeightPopUpBackground} !important`,
|
823
887
|
overflowY: "scroll",
|
824
|
-
padding: "
|
888
|
+
padding: "3px 12px 8px 2px",
|
889
|
+
borderRadius: "8px",
|
825
890
|
"@media only screen and (max-width: 600px)": {
|
826
891
|
marginTop: "-40px"
|
827
892
|
}
|
828
893
|
},
|
829
894
|
"& .customSelectOptionLabel": {
|
830
895
|
color: theme?.palette?.editor?.textColor || "black",
|
831
|
-
margin: "
|
896
|
+
margin: "6px 6px 0px 6px",
|
832
897
|
width: "100%",
|
833
898
|
justifyContent: "start",
|
834
899
|
paddingRight: "20px",
|
@@ -841,8 +906,40 @@ const usePopupStyle = theme => ({
|
|
841
906
|
background: `${theme?.palette?.action?.selected} !important`
|
842
907
|
},
|
843
908
|
"&.selected": {
|
844
|
-
color:
|
845
|
-
background:
|
909
|
+
color: `${theme?.palette?.editor?.menuOptionTextColor} !important`,
|
910
|
+
background: `${theme?.palette?.editor?.menuOptionSelectedOption} !important`,
|
911
|
+
"& .orderedListIcon": {
|
912
|
+
"& path": {
|
913
|
+
stroke: `${theme?.palette?.editor?.menuOptionsSelectedTextColor}`
|
914
|
+
},
|
915
|
+
"& text": {
|
916
|
+
fill: `${theme?.palette?.editor?.menuOptionsSelectedTextColor}`
|
917
|
+
}
|
918
|
+
},
|
919
|
+
"& .bulletedListTextIcon": {
|
920
|
+
"& path": {
|
921
|
+
fill: `${theme?.palette?.editor?.menuOptionsSelectedTextColor}`,
|
922
|
+
stroke: `${theme?.palette?.editor?.menuOptionsSelectedTextColor}`
|
923
|
+
},
|
924
|
+
"& circle": {
|
925
|
+
fill: `${theme?.palette?.editor?.menuOptionsSelectedTextColor}`
|
926
|
+
}
|
927
|
+
},
|
928
|
+
"& .checkedListTextIcon": {
|
929
|
+
"& path": {
|
930
|
+
stroke: `${theme?.palette?.editor?.menuOptionsSelectedTextColor}`
|
931
|
+
}
|
932
|
+
},
|
933
|
+
"& .accordianIconSvgTextFormat": {
|
934
|
+
"& path": {
|
935
|
+
stroke: `${theme?.palette?.editor?.menuOptionsSelectedTextColor} !important`
|
936
|
+
}
|
937
|
+
},
|
938
|
+
"& .textAlignIconSameStyles": {
|
939
|
+
"& path": {
|
940
|
+
fill: `${theme?.palette?.editor?.menuOptionsSelectedTextColor}`
|
941
|
+
}
|
942
|
+
}
|
846
943
|
}
|
847
944
|
},
|
848
945
|
"& .menuOptions": {
|
@@ -125,6 +125,7 @@ const TextFormat = props => {
|
|
125
125
|
item: true,
|
126
126
|
xs: 12,
|
127
127
|
sx: classes.textFormatField,
|
128
|
+
className: "textFormatMUIIcon",
|
128
129
|
children: /*#__PURE__*/_jsx(FontFamilyAutocomplete, {
|
129
130
|
classes: classes,
|
130
131
|
...fontFamilies,
|
@@ -147,6 +148,7 @@ const TextFormat = props => {
|
|
147
148
|
item: true,
|
148
149
|
xs: 12,
|
149
150
|
sx: classes.textFormatField3,
|
151
|
+
className: "textFormatMUIIcon",
|
150
152
|
children: /*#__PURE__*/_jsx(Dropdown, {
|
151
153
|
classes: classes,
|
152
154
|
...fontWeight,
|
@@ -43,9 +43,10 @@ const ColorPickerButton = props => {
|
|
43
43
|
background: value,
|
44
44
|
height: "22px",
|
45
45
|
minWidth: "22px",
|
46
|
-
borderRadius: "26px"
|
47
|
-
border: "2px solid #E7E7E7"
|
46
|
+
borderRadius: "26px"
|
47
|
+
// border: "2px solid #E7E7E7",
|
48
48
|
},
|
49
|
+
|
49
50
|
onClick: handleColorPicker
|
50
51
|
}), /*#__PURE__*/_jsx(Popover, {
|
51
52
|
open: open,
|
@@ -123,13 +123,7 @@ const usePopupStyles = theme => ({
|
|
123
123
|
"& path": {
|
124
124
|
stroke: `${theme?.palette?.editor?.menuOptionsSelectedTextColor} !important`
|
125
125
|
}
|
126
|
-
},
|
127
|
-
"& .commonSvgStyle2": {
|
128
|
-
background: "red !important"
|
129
126
|
}
|
130
|
-
},
|
131
|
-
"& .renderComp": {
|
132
|
-
backgroundColor: "red !important"
|
133
127
|
}
|
134
128
|
},
|
135
129
|
"&:hover": {
|
@@ -162,7 +156,7 @@ const usePopupStyles = theme => ({
|
|
162
156
|
marginBottom: "10px",
|
163
157
|
fontSize: "14px",
|
164
158
|
fontWeight: "bold",
|
165
|
-
borderBottom:
|
159
|
+
borderBottom: `1px solid ${theme?.palette?.editor?.deviderBgColor}`
|
166
160
|
},
|
167
161
|
listItem: {
|
168
162
|
cursor: "pointer",
|
@@ -14,7 +14,7 @@ import BoundaryLine from "./GuideLines/BoundaryLine";
|
|
14
14
|
import ContextMenu from "./ContextMenu";
|
15
15
|
import VirtualElement from "./VirtualElement";
|
16
16
|
import { ItemTypes } from "./ElementSettings/settingsConstants";
|
17
|
-
import {
|
17
|
+
import { clearSelection } from "../../helper";
|
18
18
|
import { selectText } from "../../utils/helper";
|
19
19
|
import { removeSign } from "./ElementSettings/OtherSettings";
|
20
20
|
import useDragging from "../../hooks/useDragging";
|
@@ -134,8 +134,7 @@ const useCommonStyle = theme => ({
|
|
134
134
|
}
|
135
135
|
},
|
136
136
|
"& .active ": {
|
137
|
-
border: `1px solid #2563EB !important
|
138
|
-
background: `${theme?.palette?.editor?.signaturePopUpTabButtonSelectedBg} !important`
|
137
|
+
border: `1px solid #2563EB !important`
|
139
138
|
}
|
140
139
|
},
|
141
140
|
"& .MuiTab-root": {
|
@@ -181,6 +180,11 @@ const useCommonStyle = theme => ({
|
|
181
180
|
border: `1px solid ${theme?.palette?.editor?.closeButtonBorder} !important`
|
182
181
|
}
|
183
182
|
}
|
183
|
+
},
|
184
|
+
"& .disabledSaveBtn": {
|
185
|
+
background: "#2563EB33 !important",
|
186
|
+
color: theme?.palette?.type === "dark" && "#FFFFFF33 !important",
|
187
|
+
border: "1px solid #2563EB33 !important"
|
184
188
|
}
|
185
189
|
},
|
186
190
|
popupTitle2: {
|
@@ -15,6 +15,20 @@ const LIST_FORMAT_TYPE = {
|
|
15
15
|
unorderedList: "list-item"
|
16
16
|
};
|
17
17
|
const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree"];
|
18
|
+
export const serializeMentions = node => {
|
19
|
+
try {
|
20
|
+
if (node?.type === 'mention') {
|
21
|
+
return [node.character];
|
22
|
+
}
|
23
|
+
let children = Array.isArray(node) ? node : node?.children;
|
24
|
+
children = children && Array.isArray(children) ? children : [];
|
25
|
+
let mentions = children.map(child => serializeMentions(child)).flat();
|
26
|
+
return mentions.filter(Boolean);
|
27
|
+
} catch (err) {
|
28
|
+
console.log(err);
|
29
|
+
return [];
|
30
|
+
}
|
31
|
+
};
|
18
32
|
export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
19
33
|
const isActive = isBlockActive(editor, format);
|
20
34
|
const isList = list_types.includes(format);
|
@@ -5,7 +5,6 @@ import { insertAccordion } from "./accordion";
|
|
5
5
|
import { isListItem } from "./helper";
|
6
6
|
import RnDCtrlCmds from "./RnD/RnDCtrlCmds";
|
7
7
|
import EDITORCMDS from "../common/EditorCmds";
|
8
|
-
import { ReactEditor } from "slate-react";
|
9
8
|
const HOTKEYS = {
|
10
9
|
b: "bold",
|
11
10
|
i: "italic",
|
@@ -2,6 +2,8 @@ export const serializeToText = node => {
|
|
2
2
|
try {
|
3
3
|
if (!node?.type && node?.text) {
|
4
4
|
return node?.text;
|
5
|
+
} else if (node?.type === 'mention') {
|
6
|
+
return '@' + node?.character?.name || '';
|
5
7
|
}
|
6
8
|
let n = Array.isArray(node) ? node : node?.children;
|
7
9
|
n = n && Array.isArray(n) ? n : n ? [n] : [];
|