@flozy/editor 3.9.4 → 3.9.5
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 +65 -44
- package/dist/Editor/CommonEditor.js +3 -2
- package/dist/Editor/Editor.css +12 -1
- package/dist/Editor/Elements/Accordion/Accordion.js +75 -8
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +3 -2
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +24 -64
- package/dist/Editor/Elements/Embed/Image.js +27 -19
- package/dist/Editor/Elements/Embed/Video.js +14 -10
- package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
- package/dist/Editor/Elements/Form/Form.js +1 -1
- package/dist/Editor/Elements/List/CheckList.js +2 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +5 -1
- package/dist/Editor/Elements/Table/Table.js +1 -1
- package/dist/Editor/Elements/Table/TableCell.js +1 -1
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +25 -1
- package/dist/Editor/common/ColorPickerButton.js +12 -4
- package/dist/Editor/common/EditorCmds.js +35 -0
- package/dist/Editor/common/MentionsPopup/MentionsListCard.js +6 -1
- package/dist/Editor/common/MentionsPopup/Styles.js +5 -2
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +9 -8
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +26 -20
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +18 -16
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +6 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +14 -3
- package/dist/Editor/helper/deserialize/index.js +14 -9
- package/dist/Editor/helper/index.js +22 -0
- package/dist/Editor/helper/theme.js +2 -1
- package/dist/Editor/hooks/useMouseMove.js +0 -1
- package/dist/Editor/plugins/withHTML.js +46 -4
- package/dist/Editor/plugins/withLayout.js +15 -10
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +2 -8
- package/dist/Editor/utils/draftToSlate.js +1 -1
- package/dist/Editor/utils/events.js +11 -4
- package/dist/Editor/utils/helper.js +43 -12
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useRef, useState, useEffect, useImperativeHandle, forwardRef } from "react";
|
|
2
2
|
import { Editable, Slate, ReactEditor } from 'slate-react';
|
|
3
|
-
import { createEditor, Transforms } from 'slate';
|
|
3
|
+
import { createEditor, Transforms, Editor } from 'slate';
|
|
4
4
|
import { useDebounce } from "use-debounce";
|
|
5
5
|
import withCommon from "./hooks/withCommon";
|
|
6
6
|
import { getBlock, getMarked } from "./utils/chatEditor/SlateUtilityFunctions";
|
|
@@ -31,7 +31,12 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
31
31
|
} = props;
|
|
32
32
|
const classes = usePopupStyle(theme);
|
|
33
33
|
const convertedContent = draftToSlate({
|
|
34
|
-
data: content
|
|
34
|
+
data: content && content?.length > 0 ? content : [{
|
|
35
|
+
type: 'paragraph',
|
|
36
|
+
children: [{
|
|
37
|
+
text: ''
|
|
38
|
+
}]
|
|
39
|
+
}]
|
|
35
40
|
});
|
|
36
41
|
const [isInteracted, setIsInteracted] = useState(false);
|
|
37
42
|
const [value, setValue] = useState(convertedContent);
|
|
@@ -47,10 +52,11 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
47
52
|
useImperativeHandle(ref, () => ({
|
|
48
53
|
emojiClick: emoji => {
|
|
49
54
|
if (editor) {
|
|
55
|
+
ReactEditor.focus(editor);
|
|
50
56
|
insertEmoji(editor, emoji?.native, editor.selection);
|
|
51
57
|
if (editor.selection) {
|
|
52
|
-
const path = editor.selection.anchor.path;
|
|
53
|
-
const offset = editor.selection.anchor.offset + emoji?.native.length;
|
|
58
|
+
// const path = editor.selection.anchor.path;
|
|
59
|
+
// const offset = editor.selection.anchor.offset + emoji?.native.length;
|
|
54
60
|
const position = {
|
|
55
61
|
anchor: {
|
|
56
62
|
path: [0],
|
|
@@ -67,45 +73,65 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
67
73
|
ReactEditor.focus(editor);
|
|
68
74
|
}
|
|
69
75
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
submitChat: () => {
|
|
77
|
+
const {
|
|
78
|
+
value: strVal,
|
|
79
|
+
...restVal
|
|
80
|
+
} = getOnSaveData(value);
|
|
81
|
+
onsubmit(false, {
|
|
82
|
+
strVal,
|
|
83
|
+
restVal
|
|
84
|
+
});
|
|
74
85
|
},
|
|
75
86
|
// Focus enable
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
enableFocus: () => {
|
|
88
|
+
if (editor) {
|
|
89
|
+
const position = {
|
|
90
|
+
anchor: {
|
|
91
|
+
path: [0],
|
|
92
|
+
offset: 0
|
|
93
|
+
},
|
|
94
|
+
focus: {
|
|
95
|
+
path: [0],
|
|
96
|
+
offset: 0
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
Transforms.select(editor, position);
|
|
100
|
+
ReactEditor.focus(editor);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
clearAll: (content = null, clear = true) => {
|
|
88
104
|
if (!editor) return;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
105
|
+
try {
|
|
106
|
+
if (clear) {
|
|
107
|
+
while (editor.children.length > 0) {
|
|
108
|
+
Transforms.removeNodes(editor, {
|
|
109
|
+
at: [0]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const newValue = draftToSlate({
|
|
114
|
+
data: content
|
|
92
115
|
});
|
|
116
|
+
setValue(newValue);
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
if (editor.children.length === 0) {
|
|
119
|
+
Transforms.insertNodes(editor, newValue);
|
|
120
|
+
}
|
|
121
|
+
Transforms.select(editor, Editor.end(editor, []));
|
|
122
|
+
ReactEditor.focus(editor);
|
|
123
|
+
}, 300);
|
|
124
|
+
} catch {
|
|
125
|
+
console.log("error:");
|
|
93
126
|
}
|
|
94
|
-
Transforms.insertNodes(editor, {
|
|
95
|
-
type: 'paragraph',
|
|
96
|
-
children: [{
|
|
97
|
-
text: ''
|
|
98
|
-
}]
|
|
99
|
-
});
|
|
100
|
-
ReactEditor.focus(editor);
|
|
101
127
|
}
|
|
102
128
|
}));
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
129
|
+
|
|
130
|
+
// useEffect(() => {
|
|
131
|
+
// setIsExternalUpdate(true);
|
|
132
|
+
// setValue(draftToSlate({ data: content }));
|
|
133
|
+
// }, [content]);
|
|
134
|
+
|
|
109
135
|
useEffect(() => {
|
|
110
136
|
if (JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
|
|
111
137
|
const {
|
|
@@ -168,14 +194,9 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
168
194
|
});
|
|
169
195
|
};
|
|
170
196
|
const handleEditorChange = newValue => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
} else {
|
|
175
|
-
setValue(newValue);
|
|
176
|
-
if (!isInteracted) {
|
|
177
|
-
setIsInteracted(true);
|
|
178
|
-
}
|
|
197
|
+
setValue(newValue);
|
|
198
|
+
if (!isInteracted) {
|
|
199
|
+
setIsInteracted(true);
|
|
179
200
|
}
|
|
180
201
|
};
|
|
181
202
|
const Element = props => {
|
|
@@ -29,7 +29,7 @@ import Section from "./common/Section";
|
|
|
29
29
|
import "animate.css";
|
|
30
30
|
import decorators from "./utils/Decorators";
|
|
31
31
|
import { getTRBLBreakPoints } from "./helper/theme";
|
|
32
|
-
import { handleInsertLastElement, outsideEditorClickLabel } from "./utils/helper";
|
|
32
|
+
import { handleInsertLastElement, onDeleteKey, outsideEditorClickLabel } from "./utils/helper";
|
|
33
33
|
import useWindowResize from "./hooks/useWindowResize";
|
|
34
34
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
|
35
35
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -319,7 +319,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
319
319
|
} else if (isCtrlKey) {
|
|
320
320
|
commands({
|
|
321
321
|
event,
|
|
322
|
-
editor
|
|
322
|
+
editor,
|
|
323
|
+
needLayout
|
|
323
324
|
});
|
|
324
325
|
} else if (event.key === "Tab") {
|
|
325
326
|
event.preventDefault();
|
package/dist/Editor/Editor.css
CHANGED
|
@@ -830,6 +830,17 @@ blockquote {
|
|
|
830
830
|
text-align: center;
|
|
831
831
|
}
|
|
832
832
|
|
|
833
|
+
.removeScroll::-webkit-outer-spin-button,
|
|
834
|
+
.removeScroll::-webkit-inner-spin-button {
|
|
835
|
+
-webkit-appearance: none;
|
|
836
|
+
margin: 0;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/* For Firefox */
|
|
840
|
+
.removeScroll {
|
|
841
|
+
-moz-appearance: textfield;
|
|
842
|
+
}
|
|
843
|
+
|
|
833
844
|
.borderInput:focus-visible {
|
|
834
845
|
outline: none !important;
|
|
835
846
|
}
|
|
@@ -879,7 +890,7 @@ blockquote {
|
|
|
879
890
|
}
|
|
880
891
|
|
|
881
892
|
.sliderInput {
|
|
882
|
-
width:
|
|
893
|
+
width: 30px;
|
|
883
894
|
padding: 2px 10px;
|
|
884
895
|
margin-left: 18px;
|
|
885
896
|
box-shadow: 0px 4px 16px 0px #0000000d;
|
|
@@ -9,6 +9,55 @@ 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
|
+
};
|
|
12
61
|
const Accordion = props => {
|
|
13
62
|
const {
|
|
14
63
|
attributes,
|
|
@@ -69,16 +118,34 @@ const Accordion = props => {
|
|
|
69
118
|
at: path
|
|
70
119
|
});
|
|
71
120
|
};
|
|
121
|
+
const setNodes = (data, path) => {
|
|
122
|
+
Transforms.setNodes(editor, data, {
|
|
123
|
+
at: path
|
|
124
|
+
});
|
|
125
|
+
};
|
|
72
126
|
const onSave = data => {
|
|
73
127
|
const updateData = {
|
|
74
128
|
...data
|
|
75
129
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
130
|
+
const {
|
|
131
|
+
accordionBtnStyle,
|
|
132
|
+
accordionTitleStyle
|
|
133
|
+
} = getAccordionData(updateData);
|
|
134
|
+
|
|
135
|
+
// applying accordion title style
|
|
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);
|
|
82
149
|
onClose();
|
|
83
150
|
};
|
|
84
151
|
const onClose = () => {
|
|
@@ -93,7 +160,7 @@ const Accordion = props => {
|
|
|
93
160
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
94
161
|
className: "accordion-title",
|
|
95
162
|
style: {
|
|
96
|
-
|
|
163
|
+
background: bgColor
|
|
97
164
|
},
|
|
98
165
|
onClick: onToggle,
|
|
99
166
|
children: [/*#__PURE__*/_jsx(Box, {
|
|
@@ -123,7 +190,7 @@ const Accordion = props => {
|
|
|
123
190
|
},
|
|
124
191
|
children: children[1]
|
|
125
192
|
}), !readOnly && /*#__PURE__*/_jsx(ToolBar, {}), openSetttings ? /*#__PURE__*/_jsx(AccordionBtnPopup, {
|
|
126
|
-
element: element,
|
|
193
|
+
element: getElementProps(element),
|
|
127
194
|
onSave: onSave,
|
|
128
195
|
onClose: onClose,
|
|
129
196
|
customProps: customProps
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
const AccordionBtnPopup = props => {
|
|
6
7
|
const {
|
|
@@ -10,12 +11,12 @@ const AccordionBtnPopup = props => {
|
|
|
10
11
|
customProps
|
|
11
12
|
} = props;
|
|
12
13
|
return /*#__PURE__*/_jsx(StyleBuilder, {
|
|
13
|
-
title: "Accordion
|
|
14
|
+
title: "Accordion Settings",
|
|
14
15
|
type: "accordionTitleBtnStyle",
|
|
15
16
|
element: element,
|
|
16
17
|
onSave: onSave,
|
|
17
18
|
onClose: onClose,
|
|
18
|
-
renderTabs: accordionTitleBtnStyle,
|
|
19
|
+
renderTabs: [...accordionTitleBtnStyle, ...accordionTitleStyle],
|
|
19
20
|
customProps: customProps
|
|
20
21
|
});
|
|
21
22
|
};
|
|
@@ -1,83 +1,43 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { IconButton, Tooltip } from "@mui/material";
|
|
6
|
-
import { GridSettingsIcon } from "../../common/iconslist";
|
|
7
|
-
import { useEditorSelection } from "../../hooks/useMouseMove";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { getBorderColor, getTextColor } from "../../helper";
|
|
3
|
+
import { Box } from "@mui/material";
|
|
4
|
+
import { getBreakPointsValue, getTRBLBreakPoints } from "../../helper/theme";
|
|
8
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
6
|
const AccordionSummary = props => {
|
|
11
7
|
const {
|
|
12
8
|
attributes,
|
|
13
9
|
children,
|
|
14
|
-
element
|
|
15
|
-
customProps
|
|
10
|
+
element
|
|
16
11
|
} = 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);
|
|
25
12
|
const {
|
|
26
13
|
textColor,
|
|
27
14
|
bgColor,
|
|
28
|
-
borderColor
|
|
15
|
+
borderColor,
|
|
16
|
+
borderRadius,
|
|
17
|
+
bannerSpacing
|
|
29
18
|
} = element;
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
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", {
|
|
19
|
+
const textStyles = getTextColor(textColor);
|
|
20
|
+
const borderStyle = getBorderColor(borderColor);
|
|
21
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
66
22
|
className: `accordion-summary-container`,
|
|
67
23
|
...attributes,
|
|
68
24
|
style: {
|
|
69
25
|
width: "100%",
|
|
70
26
|
position: "relative",
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
27
|
+
background: bgColor,
|
|
28
|
+
...borderStyle
|
|
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
|
|
74
38
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
onSave: onSave,
|
|
78
|
-
onClose: onClose,
|
|
79
|
-
customProps: customProps
|
|
80
|
-
}) : null]
|
|
39
|
+
component: "div",
|
|
40
|
+
children: children
|
|
81
41
|
});
|
|
82
42
|
};
|
|
83
43
|
export default AccordionSummary;
|
|
@@ -167,15 +167,19 @@ const Image = ({
|
|
|
167
167
|
onTouchEnd
|
|
168
168
|
} = handleLinkType(webAddress, linkType, readOnly, isNewTab);
|
|
169
169
|
const handleImageClick = () => {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
onClick
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
onTouchEnd
|
|
170
|
+
try {
|
|
171
|
+
Transforms.select(editor, {
|
|
172
|
+
anchor: Editor.start(editor, path),
|
|
173
|
+
focus: Editor.end(editor, path)
|
|
174
|
+
});
|
|
175
|
+
if (onClick) {
|
|
176
|
+
onClick();
|
|
177
|
+
}
|
|
178
|
+
if (onTouchEnd) {
|
|
179
|
+
onTouchEnd();
|
|
180
|
+
}
|
|
181
|
+
} catch (err) {
|
|
182
|
+
console.log(err);
|
|
179
183
|
}
|
|
180
184
|
};
|
|
181
185
|
useEffect(() => {
|
|
@@ -189,16 +193,20 @@ const Image = ({
|
|
|
189
193
|
setOpenSettings(true);
|
|
190
194
|
};
|
|
191
195
|
const onSave = data => {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
try {
|
|
197
|
+
const updateData = {
|
|
198
|
+
...data
|
|
199
|
+
};
|
|
200
|
+
delete updateData.children;
|
|
201
|
+
Transforms.setNodes(editor, {
|
|
202
|
+
...updateData
|
|
203
|
+
}, {
|
|
204
|
+
at: path
|
|
205
|
+
});
|
|
206
|
+
onClose();
|
|
207
|
+
} catch (err) {
|
|
208
|
+
console.log(err);
|
|
209
|
+
}
|
|
202
210
|
};
|
|
203
211
|
const onClose = () => {
|
|
204
212
|
setOpenSettings(false);
|
|
@@ -95,16 +95,20 @@ const Video = ({
|
|
|
95
95
|
setOpenSettings(true);
|
|
96
96
|
};
|
|
97
97
|
const onSave = data => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
98
|
+
try {
|
|
99
|
+
const updateData = {
|
|
100
|
+
...data
|
|
101
|
+
};
|
|
102
|
+
delete updateData.children;
|
|
103
|
+
Transforms.setNodes(editor, {
|
|
104
|
+
...updateData
|
|
105
|
+
}, {
|
|
106
|
+
at: path
|
|
107
|
+
});
|
|
108
|
+
onClose();
|
|
109
|
+
} catch (err) {
|
|
110
|
+
console.log(err);
|
|
111
|
+
}
|
|
108
112
|
};
|
|
109
113
|
const onClose = () => {
|
|
110
114
|
setOpenSettings(false);
|
|
@@ -4,12 +4,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
5
|
const EmojiPicker = props => {
|
|
6
6
|
const {
|
|
7
|
-
onEmojiSelect
|
|
7
|
+
onEmojiSelect,
|
|
8
|
+
onClose
|
|
8
9
|
} = props;
|
|
9
10
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
10
11
|
children: /*#__PURE__*/_jsx(Picker, {
|
|
11
12
|
data: data,
|
|
12
|
-
onEmojiSelect: onEmojiSelect
|
|
13
|
+
onEmojiSelect: onEmojiSelect,
|
|
14
|
+
onClickOutside: onClose
|
|
13
15
|
})
|
|
14
16
|
});
|
|
15
17
|
};
|
|
@@ -119,7 +119,7 @@ const Form = props => {
|
|
|
119
119
|
if (fieldData?.element === "email") {
|
|
120
120
|
rule.push(`isEmail`);
|
|
121
121
|
}
|
|
122
|
-
if (fieldData?.required
|
|
122
|
+
if (fieldData?.required && fieldData?.element === "email") {
|
|
123
123
|
validations.push({
|
|
124
124
|
name: pair[0],
|
|
125
125
|
value: pair[1],
|
|
@@ -68,7 +68,8 @@ const CheckList = ({
|
|
|
68
68
|
style: {
|
|
69
69
|
flex: 1,
|
|
70
70
|
opacity: checked ? 1 : 1,
|
|
71
|
-
textDecoration: !checked ? "none" : "none"
|
|
71
|
+
textDecoration: !checked ? "none" : "none",
|
|
72
|
+
width: '90%'
|
|
72
73
|
},
|
|
73
74
|
className: `checkbox-list content-editable ${isEmpty ? "empty" : ""}`,
|
|
74
75
|
placeholder: nestedCheckList ? "" : "Todo List",
|
|
@@ -11,7 +11,9 @@ const PageSettingsButton = props => {
|
|
|
11
11
|
const {
|
|
12
12
|
customProps,
|
|
13
13
|
icoBtnType,
|
|
14
|
-
from
|
|
14
|
+
from,
|
|
15
|
+
closePopper,
|
|
16
|
+
setToolTip
|
|
15
17
|
} = props;
|
|
16
18
|
const [openSetttings, setOpenSettings] = useState(false);
|
|
17
19
|
const editor = useSlateStatic();
|
|
@@ -38,6 +40,8 @@ const PageSettingsButton = props => {
|
|
|
38
40
|
}
|
|
39
41
|
};
|
|
40
42
|
const onClose = () => {
|
|
43
|
+
closePopper(true);
|
|
44
|
+
setToolTip(false);
|
|
41
45
|
setOpenSettings(false);
|
|
42
46
|
};
|
|
43
47
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
@@ -117,7 +117,7 @@ const TableCell = props => {
|
|
|
117
117
|
className: `editor-table-cell ${hasSelected ? "selection" : ""}`,
|
|
118
118
|
style: {
|
|
119
119
|
position: "relative",
|
|
120
|
-
|
|
120
|
+
background: bgColor || entireBgColor,
|
|
121
121
|
border: `3px solid ${cellBorderColor}`,
|
|
122
122
|
...(sizeProps || {})
|
|
123
123
|
},
|
|
@@ -9,6 +9,7 @@ import miniToolbarStyles from "./Styles";
|
|
|
9
9
|
import usePopupStyle from "../PopupTool/PopupToolStyle";
|
|
10
10
|
import PopperHeader from "../PopupTool/PopperHeader";
|
|
11
11
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
|
12
|
+
import PageSettingsButton from "../../Elements/PageSettings/PageSettingsButton";
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -47,12 +48,23 @@ const MiniToolbar = props => {
|
|
|
47
48
|
const {
|
|
48
49
|
popupType
|
|
49
50
|
} = useEditorContext();
|
|
51
|
+
const [toolTip, setToolTip] = useState(false);
|
|
52
|
+
const [data, setData] = useState(null);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (data) {
|
|
55
|
+
setToolTip(false);
|
|
56
|
+
setData(null);
|
|
57
|
+
}
|
|
58
|
+
}, [data]);
|
|
50
59
|
useEffect(() => {
|
|
51
60
|
if (popper) {
|
|
52
61
|
setPopper(null);
|
|
53
62
|
}
|
|
54
63
|
}, [editor.selection]);
|
|
55
64
|
const handleClick = type => e => {
|
|
65
|
+
if (type === "page-settings") {
|
|
66
|
+
setToolTip(true);
|
|
67
|
+
}
|
|
56
68
|
setPopper(type);
|
|
57
69
|
setAnchorEl(e.currentTarget);
|
|
58
70
|
};
|
|
@@ -66,6 +78,10 @@ const MiniToolbar = props => {
|
|
|
66
78
|
const onSearch = e => {
|
|
67
79
|
setSearch(e?.target?.value || "");
|
|
68
80
|
};
|
|
81
|
+
const closePopper = data => {
|
|
82
|
+
setData(data);
|
|
83
|
+
setToolTip("false");
|
|
84
|
+
};
|
|
69
85
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
70
86
|
children: [/*#__PURE__*/_jsx(Box, {
|
|
71
87
|
component: "div",
|
|
@@ -81,11 +97,19 @@ const MiniToolbar = props => {
|
|
|
81
97
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
82
98
|
arrow: true,
|
|
83
99
|
title: label,
|
|
100
|
+
disableHoverListener: toolTip,
|
|
84
101
|
children: /*#__PURE__*/_jsx(IconButton, {
|
|
85
102
|
className: type === popper ? "active" : "",
|
|
86
103
|
onClick: handleClick(type),
|
|
87
104
|
disabled: isDisabled,
|
|
88
|
-
children: /*#__PURE__*/_jsx(
|
|
105
|
+
children: type === "page-settings" ? /*#__PURE__*/_jsx(PageSettingsButton, {
|
|
106
|
+
from: "miniToolBar",
|
|
107
|
+
icoBtnType: "mini",
|
|
108
|
+
customProps: customProps,
|
|
109
|
+
editor: editor,
|
|
110
|
+
closePopper: closePopper,
|
|
111
|
+
setToolTip: setToolTip
|
|
112
|
+
}) : /*#__PURE__*/_jsx(Icon, {
|
|
89
113
|
from: "miniToolBar",
|
|
90
114
|
icoBtnType: "mini",
|
|
91
115
|
customProps: customProps,
|