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