@flozy/editor 4.7.1 → 4.7.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +1 -3
- package/dist/Editor/Elements/AI/AIInput.js +4 -5
- package/dist/Editor/Elements/AI/PopoverAIInput.js +78 -62
- package/dist/Editor/Elements/AI/Styles.js +1 -0
- package/dist/Editor/Elements/Embed/Embed.js +8 -1
- package/dist/Editor/Styles/EditorStyles.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/index.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +15 -12
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +0 -1
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +1 -1
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -3
- package/dist/Editor/common/Shorthands/elements.js +3 -1
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +4 -4
- package/dist/Editor/common/iconslist.js +31 -31
- package/dist/Editor/plugins/withCustomDeleteBackward.js +25 -0
- package/dist/Editor/utils/Decorators/highlightSelection.js +22 -0
- package/dist/Editor/utils/Decorators/index.js +3 -2
- package/dist/Editor/utils/SlateUtilityFunctions.js +9 -0
- package/dist/Editor/utils/embed.js +6 -3
- package/dist/Editor/utils/helper.js +1 -1
- package/package.json +1 -1
@@ -534,7 +534,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
534
534
|
readOnly: isReadOnly,
|
535
535
|
renderElement: renderElement,
|
536
536
|
renderLeaf: renderLeaf,
|
537
|
-
decorate: decorators,
|
537
|
+
decorate: d => decorators(d, editor),
|
538
538
|
onKeyDown: onKeyDown,
|
539
539
|
onSelect: () => handleCursorScroll(editorWrapper.current)
|
540
540
|
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
@@ -584,8 +584,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
584
584
|
}), htmlAction.showInput && /*#__PURE__*/_jsx(CodeToText, {
|
585
585
|
...htmlAction,
|
586
586
|
handleCodeToText: handleCodeToText
|
587
|
-
}), /*#__PURE__*/_jsx(FontLoader, {
|
588
|
-
...props
|
589
587
|
})]
|
590
588
|
}, id)
|
591
589
|
})
|
@@ -90,6 +90,7 @@ function AIInput({
|
|
90
90
|
children: [/*#__PURE__*/_jsxs(Box, {
|
91
91
|
component: "div",
|
92
92
|
sx: classes.aiContainer,
|
93
|
+
ref: refs[0],
|
93
94
|
children: [generatedText ? /*#__PURE__*/_jsx(Typography, {
|
94
95
|
sx: classes.generatedText,
|
95
96
|
style: {
|
@@ -104,7 +105,6 @@ function AIInput({
|
|
104
105
|
onSubmit: e => {
|
105
106
|
e.preventDefault();
|
106
107
|
},
|
107
|
-
ref: refs[0],
|
108
108
|
children: [/*#__PURE__*/_jsx("div", {
|
109
109
|
className: "icon-container icons-elements",
|
110
110
|
ref: inputWrapperRef,
|
@@ -116,22 +116,21 @@ function AIInput({
|
|
116
116
|
children: /*#__PURE__*/_jsx(WaveLoading, {})
|
117
117
|
}) : /*#__PURE__*/_jsx(TextareaAutosize, {
|
118
118
|
className: "ai-input",
|
119
|
-
placeholder:
|
119
|
+
placeholder: "Ask AI to write anything...",
|
120
120
|
ref: inputRef,
|
121
121
|
value: inputValue,
|
122
122
|
onChange: onInputChange,
|
123
|
-
disabled: fromToolBar,
|
124
123
|
onKeyDown: event => {
|
125
124
|
if (event.key === "Enter" && !event.shiftKey) {
|
126
125
|
event.preventDefault();
|
127
126
|
handleSendBtnClick();
|
128
127
|
}
|
129
128
|
}
|
130
|
-
}),
|
129
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
131
130
|
component: "div",
|
132
131
|
style: classes.sendIconContainer,
|
133
132
|
className: "icons-elements",
|
134
|
-
children: [
|
133
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
135
134
|
disabled: loading,
|
136
135
|
onClick: () => startRecording(),
|
137
136
|
children: /*#__PURE__*/_jsx(ChatMicIcon, {})
|
@@ -40,9 +40,11 @@ const scrollToAIInput = editor => {
|
|
40
40
|
}, 200);
|
41
41
|
};
|
42
42
|
const insertText = (editor, text, options) => {
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
if (text?.length) {
|
44
|
+
const parsed = new DOMParser().parseFromString(text, "text/html");
|
45
|
+
const fragment = deserialize(parsed.body);
|
46
|
+
Transforms.insertFragment(editor, fragment, options);
|
47
|
+
}
|
46
48
|
};
|
47
49
|
const insertAtNextLine = (editor, text) => {
|
48
50
|
const nextLine = getNextLine(editor);
|
@@ -199,81 +201,95 @@ function PopoverAIInput({
|
|
199
201
|
useEffect(() => {
|
200
202
|
selectedEleRef.current = selectedElement;
|
201
203
|
}, [selectedElement]);
|
202
|
-
const
|
203
|
-
|
204
|
-
onClickOutside();
|
205
|
-
return;
|
206
|
-
}
|
207
|
-
if (type === "done") {
|
208
|
-
// Get the current selection point
|
209
|
-
const {
|
210
|
-
anchor
|
211
|
-
} = editor.selection;
|
212
|
-
const {
|
213
|
-
path
|
214
|
-
} = anchor;
|
215
|
-
const {
|
216
|
-
text: selectText
|
217
|
-
} = Node.get(editor, path);
|
218
|
-
if (selectText?.length) {
|
219
|
-
insertAtNextLine(editor, generatedText);
|
220
|
-
} else {
|
221
|
-
insertText(editor, generatedText);
|
222
|
-
}
|
223
|
-
onClickOutside();
|
224
|
-
return;
|
225
|
-
}
|
226
|
-
if (type === "replace_selection") {
|
227
|
-
// replace generated text
|
228
|
-
insertText(editor, generatedText);
|
229
|
-
onClickOutside();
|
230
|
-
return;
|
231
|
-
}
|
232
|
-
if (type === "speech_to_text") {
|
233
|
-
setGeneratedText(option.text);
|
234
|
-
return;
|
235
|
-
}
|
236
|
-
if (type === "try_again") {
|
237
|
-
// resetting the previous option and try again
|
238
|
-
option = selectedOption;
|
239
|
-
type = selectedOption.value;
|
240
|
-
} else {
|
241
|
-
setSelectedOption(option);
|
242
|
-
}
|
243
|
-
setLoading(true);
|
244
|
-
const payload = {
|
204
|
+
const framePayload = (type, option) => {
|
205
|
+
let payload = {
|
245
206
|
mode: option.mode || 0,
|
246
207
|
query: option?.inputValue || inputValue
|
247
208
|
};
|
248
209
|
if (option.mode === MODES.translate || option.mode === MODES.rephraseTone) {
|
249
210
|
payload.textOptionInput = type;
|
250
211
|
}
|
212
|
+
const selectedText = getSelectedText(editor);
|
213
|
+
const textData = generatedText || selectedText;
|
251
214
|
if (option.mode) {
|
252
|
-
payload.textData =
|
215
|
+
payload.textData = textData;
|
216
|
+
} else if (selectedText && Number(payload.mode) === 0) {
|
217
|
+
payload.query = `${selectedText} \n ${payload.query}`;
|
253
218
|
}
|
254
|
-
const
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
} = result || {};
|
260
|
-
if (!text) {
|
261
|
-
onClickOutside();
|
262
|
-
return;
|
219
|
+
const tryAgain = type === "try_again";
|
220
|
+
if (tryAgain) {
|
221
|
+
// resetting previous payload
|
222
|
+
const prevPayload = selectedOption?.payload || {};
|
223
|
+
payload = prevPayload;
|
263
224
|
}
|
264
|
-
|
225
|
+
return payload;
|
226
|
+
};
|
227
|
+
const onSend = async (type, option) => {
|
228
|
+
try {
|
229
|
+
if (type === "close") {
|
230
|
+
onClickOutside();
|
231
|
+
return;
|
232
|
+
}
|
233
|
+
if (type === "done") {
|
234
|
+
// Get the current selection point
|
235
|
+
const {
|
236
|
+
anchor
|
237
|
+
} = editor.selection;
|
238
|
+
const {
|
239
|
+
path
|
240
|
+
} = anchor;
|
241
|
+
const {
|
242
|
+
text: selectText
|
243
|
+
} = Node.get(editor, path);
|
244
|
+
if (selectText?.length) {
|
245
|
+
insertAtNextLine(editor, generatedText);
|
246
|
+
} else {
|
247
|
+
insertText(editor, generatedText);
|
248
|
+
}
|
249
|
+
onClickOutside();
|
250
|
+
return;
|
251
|
+
}
|
252
|
+
if (type === "replace_selection") {
|
253
|
+
// replace generated text
|
254
|
+
insertText(editor, generatedText);
|
255
|
+
onClickOutside();
|
256
|
+
return;
|
257
|
+
}
|
258
|
+
setLoading(true);
|
259
|
+
const payload = framePayload(type, option);
|
260
|
+
setSelectedOption({
|
261
|
+
...option,
|
262
|
+
payload
|
263
|
+
});
|
264
|
+
const result = await services("infinityAI", payload);
|
265
|
+
setLoading(false);
|
266
|
+
setInputValue("");
|
267
|
+
let {
|
268
|
+
data: text
|
269
|
+
} = result || {};
|
270
|
+
if (!text) {
|
271
|
+
onClickOutside();
|
272
|
+
return;
|
273
|
+
}
|
274
|
+
|
275
|
+
// if (!option.replace) {
|
265
276
|
if (type === "continue_writing") {
|
266
277
|
setGeneratedText(generatedText + text);
|
267
278
|
} else {
|
268
279
|
setGeneratedText(text);
|
269
280
|
}
|
270
|
-
return;
|
271
|
-
}
|
272
|
-
insertText(editor, text);
|
273
281
|
|
274
|
-
|
275
|
-
|
282
|
+
// return;
|
283
|
+
// }
|
276
284
|
|
285
|
+
// ** we are not using this insertText right now, AI returned response will not insert into the editor immediately, so option.replace will be false always
|
286
|
+
// insertText(editor, text);
|
287
|
+
|
288
|
+
// scrollToAIInput();
|
289
|
+
} catch (err) {
|
290
|
+
console.error("Error on sending/inserting text", err);
|
291
|
+
}
|
292
|
+
};
|
277
293
|
const onInputChange = e => {
|
278
294
|
setInputValue(e.target.value);
|
279
295
|
};
|
@@ -58,8 +58,15 @@ const Embed = ({
|
|
58
58
|
url: img
|
59
59
|
};
|
60
60
|
setFormData(fd);
|
61
|
+
let extProps = {};
|
62
|
+
if (format === "video") {
|
63
|
+
extProps = {
|
64
|
+
aspectRatio: "16 / 9"
|
65
|
+
};
|
66
|
+
}
|
61
67
|
handleFormSubmit({
|
62
|
-
...fd
|
68
|
+
...fd,
|
69
|
+
...extProps
|
63
70
|
});
|
64
71
|
};
|
65
72
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
@@ -13,6 +13,7 @@ import PopperHeader from "../PopperHeader";
|
|
13
13
|
import MiniColorPicker from "./MiniColorPicker";
|
14
14
|
import SelectAlignment from "./SelectAlignment";
|
15
15
|
import SelectFontSize from "./SelectFontSize";
|
16
|
+
import InfinityAITool from "./InfinityAITool";
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
17
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
18
19
|
const DEFAULT_COLOR = {
|
@@ -26,7 +27,8 @@ const MiniTextFormat = props => {
|
|
26
27
|
const {
|
27
28
|
classes,
|
28
29
|
editor,
|
29
|
-
closeMainPopup
|
30
|
+
closeMainPopup,
|
31
|
+
customProps
|
30
32
|
} = props;
|
31
33
|
const [anchorEl, setAnchorEl] = useState(null);
|
32
34
|
const open = Boolean(anchorEl);
|
@@ -48,7 +50,7 @@ const MiniTextFormat = props => {
|
|
48
50
|
xs: 12,
|
49
51
|
children: /*#__PURE__*/_jsxs("div", {
|
50
52
|
className: "toolWrapper",
|
51
|
-
children: [/*#__PURE__*/_jsx(SelectTypography, {
|
53
|
+
children: [customProps?.hideTools?.includes("infinityAI") ? null : /*#__PURE__*/_jsx(InfinityAITool, {}), /*#__PURE__*/_jsx(SelectTypography, {
|
52
54
|
classes: classes,
|
53
55
|
editor: editor,
|
54
56
|
closeMainPopup: closeMainPopup
|
@@ -111,8 +111,8 @@ const PopupTool = props => {
|
|
111
111
|
open: open,
|
112
112
|
anchorEl: anchorEl,
|
113
113
|
transition: true,
|
114
|
-
placement: "auto-end",
|
115
114
|
sx: classes.popupWrapper,
|
115
|
+
placement: "top-start",
|
116
116
|
children: ({
|
117
117
|
TransitionProps
|
118
118
|
}) => /*#__PURE__*/_jsx(Fade, {
|
@@ -5,6 +5,7 @@ import LinkSettings from "../../../LinkSettings";
|
|
5
5
|
import { insertLink, removeLink } from "../../../../utils/link";
|
6
6
|
import { getBlockActive, isBlockActive, upateBlockActive } from "../../../../utils/SlateUtilityFunctions";
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
8
9
|
const Link = props => {
|
9
10
|
const {
|
10
11
|
onClose,
|
@@ -138,18 +139,20 @@ const Link = props => {
|
|
138
139
|
console.log(err);
|
139
140
|
}
|
140
141
|
};
|
141
|
-
return /*#__PURE__*/_jsx(
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
142
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
143
|
+
children: blockProps ? /*#__PURE__*/_jsx(LinkSettings, {
|
144
|
+
handleClose: onClose,
|
145
|
+
onSave: d => {
|
146
|
+
const upData = getTransformedData(d);
|
147
|
+
onSave({
|
148
|
+
...upData
|
149
|
+
});
|
150
|
+
onClose();
|
151
|
+
},
|
152
|
+
...(blockProps || {}),
|
153
|
+
customProps: customProps,
|
154
|
+
theme: theme
|
155
|
+
}) : null
|
153
156
|
});
|
154
157
|
};
|
155
158
|
export default Link;
|
@@ -123,8 +123,8 @@ export function onDropItem(props, parentClass) {
|
|
123
123
|
dragOver,
|
124
124
|
parentPath,
|
125
125
|
path,
|
126
|
-
diffX,
|
127
|
-
x: cx,
|
126
|
+
// diffX,
|
127
|
+
// x: cx,
|
128
128
|
breakpoint
|
129
129
|
// calX,
|
130
130
|
} = props;
|
@@ -134,7 +134,9 @@ export function onDropItem(props, parentClass) {
|
|
134
134
|
let newPath = [];
|
135
135
|
newPath = moveTo;
|
136
136
|
const cCalx = isContainerElement(editor, moveTo, props);
|
137
|
-
const posX = parseInt(
|
137
|
+
// const posX = parseInt(
|
138
|
+
// cx - window.innerWidth / 2 + MARGIN_OF[breakpoint] - diffX
|
139
|
+
// );
|
138
140
|
const toSectionNode = Node.get(editor, newPath);
|
139
141
|
const addToSectionDOM = ReactEditor.toDOMNode(editor, toSectionNode);
|
140
142
|
const rect = addToSectionDOM.getBoundingClientRect();
|
@@ -107,7 +107,9 @@ const ELEMENTS_LIST = [{
|
|
107
107
|
icon: /*#__PURE__*/_jsx(Icon, {
|
108
108
|
icon: "video"
|
109
109
|
}),
|
110
|
-
onInsert: editor => insertDefaultEmbed(editor, "video"
|
110
|
+
onInsert: editor => insertDefaultEmbed(editor, "video", "", {
|
111
|
+
aspectRatio: "16 / 9"
|
112
|
+
})
|
111
113
|
}, {
|
112
114
|
name: "Embed",
|
113
115
|
desc: "",
|
@@ -16,14 +16,14 @@ const embedVideoStyle = [{
|
|
16
16
|
key: "aspectRatio",
|
17
17
|
type: "textOptions",
|
18
18
|
options: [{
|
19
|
-
text: "
|
20
|
-
value: ""
|
21
|
-
}, {
|
22
|
-
text: "16:9",
|
19
|
+
text: "16:9 (Default)",
|
23
20
|
value: "16 / 9"
|
24
21
|
}, {
|
25
22
|
text: "9:16",
|
26
23
|
value: "9 / 16"
|
24
|
+
}, {
|
25
|
+
text: "Custom",
|
26
|
+
value: ""
|
27
27
|
}],
|
28
28
|
renderOption: option => {
|
29
29
|
return /*#__PURE__*/_jsx("span", {
|
@@ -2140,37 +2140,7 @@ export const InfinityIcon = () => /*#__PURE__*/_jsxs("svg", {
|
|
2140
2140
|
viewBox: "0 0 22 14",
|
2141
2141
|
fill: "none",
|
2142
2142
|
xmlns: "http://www.w3.org/2000/svg",
|
2143
|
-
children: [/*#__PURE__*/
|
2144
|
-
d: "M0.915756 6.95902C1.12067 5.41363 1.86206 4.92055 2.20714 4.86719C2.08975 5.03795 1.83787 5.44564 1.76957 5.71032C1.68419 6.04118 1.63082 6.95902 2.20714 7.8662C2.78347 8.77337 3.81871 9.29633 4.81127 9.60583C5.60531 9.85344 6.3588 9.80861 6.63628 9.75525C6.89243 9.76592 6.67063 10.0044 5.73978 10.3422C4.71521 10.7158 3.59459 10.8118 2.66607 10.2889C1.73755 9.76592 0.659613 8.89077 0.915756 6.95902Z",
|
2145
|
-
fill: "url(#paint0_linear_3_7)"
|
2146
|
-
}), /*#__PURE__*/_jsx("path", {
|
2147
|
-
d: "M0.915756 6.95902C1.12067 5.41363 1.86206 4.92055 2.20714 4.86719C2.08975 5.03795 1.83787 5.44564 1.76957 5.71032C1.68419 6.04118 1.63082 6.95902 2.20714 7.86619C2.46246 8.26809 2.80785 8.59457 3.1997 8.8605C3.37046 8.9548 3.4345 9.01884 3.4345 9.01884C3.16768 9.0722 2.75145 9.13624 2.20714 9.01884C1.66284 8.90144 1.13988 8.59193 0.930734 8.12234C0.868272 7.78378 0.857446 7.39878 0.915756 6.95902Z",
|
2148
|
-
fill: "url(#paint1_linear_3_7)"
|
2149
|
-
}), /*#__PURE__*/_jsx("path", {
|
2150
|
-
d: "M2.15304 9.10612C1.64075 8.44442 1.13537 7.33708 1.77573 5.71484C1.63699 6.18444 1.83445 7.07297 2.01589 7.52122C2.19732 7.96947 2.89531 8.8014 4.05821 9.35159C5.05076 9.82119 6.23709 9.82119 6.79562 9.7785C6.50746 9.91368 5.69208 10.1862 4.73581 10.1947C3.54047 10.2054 2.74003 9.69312 2.15304 9.10612Z",
|
2151
|
-
fill: "url(#paint2_linear_3_7)"
|
2152
|
-
}), /*#__PURE__*/_jsx("path", {
|
2153
|
-
d: "M16.4362 12.7797C18.4637 12.4072 19.9581 11.4316 21.144 9.00646C20.8404 9.27254 20.1806 9.908 19.6785 10.2241C19.0509 10.6192 17.887 11.0693 17.4547 11.5271C16.6737 12.2487 15.4362 12.6472 14.9104 12.7027C14.3846 12.7582 14.6598 13.0473 16.4362 12.7797Z",
|
2154
|
-
fill: "url(#paint3_linear_3_7)"
|
2155
|
-
}), /*#__PURE__*/_jsx("path", {
|
2156
|
-
d: "M2.48878 3.38168C0.992124 4.16676 0.598877 5.99203 0.70329 7.17193C0.807704 8.35183 1.11378 8.54174 1.05295 8.43731C0.854563 7.0486 1.11051 5.49084 2.22774 5.08363C3.34498 4.67641 4.43089 5.58482 5.38106 6.50366C6.33123 7.42251 8.16893 9.05138 8.87895 9.7614C9.58897 10.4714 12.3107 12.7602 14.3781 12.8751C16.2993 12.9818 17.3539 11.9667 18.151 10.9726C18.6301 10.3751 19.0072 8.91564 18.8192 9.09315C18.6313 9.27065 18.1196 9.75096 17.159 10.012C16.1984 10.273 14.9454 10.1477 13.8595 9.81361C12.7736 9.47948 11.364 8.50842 10.4765 7.69399C9.58897 6.87956 7.43803 4.71818 6.44609 3.97684C5.45415 3.2355 3.92934 2.62603 2.48878 3.38168Z",
|
2157
|
-
fill: "url(#paint4_linear_3_7)"
|
2158
|
-
}), /*#__PURE__*/_jsx("path", {
|
2159
|
-
d: "M6.45603 3.95461C5.46409 3.21327 3.91876 2.5659 2.49872 3.35945C1.47193 3.95461 1.20045 4.64584 1.35708 4.46834C1.5137 4.29083 2.63093 2.78726 4.46863 3.7792C6.30632 4.77114 8.20667 7.35018 9.72068 8.77022C11.2347 10.1903 12.2754 11.0256 13.8695 11.4954C15.4635 11.9653 17.4927 11.6583 18.1609 10.9504C18.6401 10.3528 19.0171 8.89341 18.8292 9.07092C18.6412 9.24842 18.1296 9.72873 17.169 9.98976C16.2083 10.2508 14.9554 10.1255 13.8695 9.79138C12.7836 9.45725 11.374 8.48619 10.4864 7.67176C9.59891 6.85733 7.44797 4.69595 6.45603 3.95461Z",
|
2160
|
-
fill: "url(#paint5_linear_3_7)"
|
2161
|
-
}), /*#__PURE__*/_jsx("path", {
|
2162
|
-
d: "M17.9698 11.1279C17.8237 11.2845 19.0573 10.8051 20.2477 9.87581C20.6099 9.593 20.7786 9.48856 21.0188 9.21708C21.2432 8.96331 21.699 7.3072 21.699 6.5241C21.6573 4.937 21.2393 3.94621 21.1456 3.74576C21.0187 3.47416 20.977 3.35945 21.0188 4.16344C21.0605 4.96743 20.9561 6.05334 20.5071 6.99307C19.9328 7.9328 19.5778 8.18338 18.9618 8.83075C18.826 8.97693 18.8783 9.24843 18.7634 9.593C18.6381 10.0002 18.116 10.9712 17.9698 11.1279Z",
|
2163
|
-
fill: "url(#paint6_linear_3_7)"
|
2164
|
-
}), /*#__PURE__*/_jsx("path", {
|
2165
|
-
d: "M3.44581 9.00993C3.27874 9.06005 3.70684 9.34419 4.91804 9.72008C5.40879 9.82449 6.45294 10.1167 6.92281 9.78272C7.58062 9.47317 9.08419 8.04944 9.72112 7.40207C10.2571 6.89044 11.5713 5.72935 12.5403 5.17804C13.7515 4.48891 15.5579 3.68491 16.9362 4.1339C18.3144 4.58288 18.8574 6.31616 18.8783 7.04706C18.8992 7.77797 18.8783 8.7177 18.8783 8.95785C18.8748 9.0205 18.943 9.05809 19.2437 8.70725C19.6196 8.26871 20.0686 8.04944 20.6429 6.71294C20.8622 6.16302 21.227 4.63509 21.0814 3.78933C20.9556 3.05843 20.6528 2.67209 20.079 2.02472C19.5052 1.37735 18.2309 0.448066 16.696 0.437625C15.1611 0.427183 13.9603 1.07455 13.3025 1.3878C12.1957 1.89943 10.3894 3.26726 9.41832 4.23831C8.43682 5.13628 7.44488 6.13866 6.82884 6.75471C6.336 7.24754 5.60022 7.96243 5.29394 8.25827C4.67789 8.73858 3.68596 8.93789 3.44581 9.00993Z",
|
2166
|
-
fill: "url(#paint7_linear_3_7)"
|
2167
|
-
}), /*#__PURE__*/_jsx("path", {
|
2168
|
-
d: "M6.93299 9.79053C6.50698 9.991 5.41897 9.8323 4.92822 9.72788C5.11809 9.65819 5.74215 9.30791 6.71947 8.46434C7.94112 7.40988 9.69528 5.78076 11.2719 4.78895C13.1618 3.62995 14.9672 3.09756 16.9463 4.1417C15.5681 3.69272 13.7617 4.49671 12.5505 5.18585C11.5815 5.73715 10.2673 6.89824 9.7313 7.40988C9.09437 8.05724 7.5908 9.48097 6.93299 9.79053Z",
|
2169
|
-
fill: "url(#paint8_linear_3_7)"
|
2170
|
-
}), /*#__PURE__*/_jsx("path", {
|
2171
|
-
d: "M19.2123 2.0471C18.3519 1.23685 16.682 1.20831 15.9546 1.29532L20.4235 4.72012C20.4235 4.72012 20.2878 3.05993 19.2123 2.0471Z",
|
2172
|
-
fill: "url(#paint9_linear_3_7)"
|
2173
|
-
}), /*#__PURE__*/_jsxs("defs", {
|
2143
|
+
children: [/*#__PURE__*/_jsxs("defs", {
|
2174
2144
|
children: [/*#__PURE__*/_jsxs("linearGradient", {
|
2175
2145
|
id: "paint0_linear_3_7",
|
2176
2146
|
x1: "5.86156",
|
@@ -2310,6 +2280,36 @@ export const InfinityIcon = () => /*#__PURE__*/_jsxs("svg", {
|
|
2310
2280
|
stopOpacity: "0"
|
2311
2281
|
})]
|
2312
2282
|
})]
|
2283
|
+
}), /*#__PURE__*/_jsx("path", {
|
2284
|
+
d: "M0.915756 6.95902C1.12067 5.41363 1.86206 4.92055 2.20714 4.86719C2.08975 5.03795 1.83787 5.44564 1.76957 5.71032C1.68419 6.04118 1.63082 6.95902 2.20714 7.8662C2.78347 8.77337 3.81871 9.29633 4.81127 9.60583C5.60531 9.85344 6.3588 9.80861 6.63628 9.75525C6.89243 9.76592 6.67063 10.0044 5.73978 10.3422C4.71521 10.7158 3.59459 10.8118 2.66607 10.2889C1.73755 9.76592 0.659613 8.89077 0.915756 6.95902Z",
|
2285
|
+
fill: "url(#paint0_linear_3_7)"
|
2286
|
+
}), /*#__PURE__*/_jsx("path", {
|
2287
|
+
d: "M0.915756 6.95902C1.12067 5.41363 1.86206 4.92055 2.20714 4.86719C2.08975 5.03795 1.83787 5.44564 1.76957 5.71032C1.68419 6.04118 1.63082 6.95902 2.20714 7.86619C2.46246 8.26809 2.80785 8.59457 3.1997 8.8605C3.37046 8.9548 3.4345 9.01884 3.4345 9.01884C3.16768 9.0722 2.75145 9.13624 2.20714 9.01884C1.66284 8.90144 1.13988 8.59193 0.930734 8.12234C0.868272 7.78378 0.857446 7.39878 0.915756 6.95902Z",
|
2288
|
+
fill: "url(#paint1_linear_3_7)"
|
2289
|
+
}), /*#__PURE__*/_jsx("path", {
|
2290
|
+
d: "M2.15304 9.10612C1.64075 8.44442 1.13537 7.33708 1.77573 5.71484C1.63699 6.18444 1.83445 7.07297 2.01589 7.52122C2.19732 7.96947 2.89531 8.8014 4.05821 9.35159C5.05076 9.82119 6.23709 9.82119 6.79562 9.7785C6.50746 9.91368 5.69208 10.1862 4.73581 10.1947C3.54047 10.2054 2.74003 9.69312 2.15304 9.10612Z",
|
2291
|
+
fill: "url(#paint2_linear_3_7)"
|
2292
|
+
}), /*#__PURE__*/_jsx("path", {
|
2293
|
+
d: "M16.4362 12.7797C18.4637 12.4072 19.9581 11.4316 21.144 9.00646C20.8404 9.27254 20.1806 9.908 19.6785 10.2241C19.0509 10.6192 17.887 11.0693 17.4547 11.5271C16.6737 12.2487 15.4362 12.6472 14.9104 12.7027C14.3846 12.7582 14.6598 13.0473 16.4362 12.7797Z",
|
2294
|
+
fill: "url(#paint3_linear_3_7)"
|
2295
|
+
}), /*#__PURE__*/_jsx("path", {
|
2296
|
+
d: "M2.48878 3.38168C0.992124 4.16676 0.598877 5.99203 0.70329 7.17193C0.807704 8.35183 1.11378 8.54174 1.05295 8.43731C0.854563 7.0486 1.11051 5.49084 2.22774 5.08363C3.34498 4.67641 4.43089 5.58482 5.38106 6.50366C6.33123 7.42251 8.16893 9.05138 8.87895 9.7614C9.58897 10.4714 12.3107 12.7602 14.3781 12.8751C16.2993 12.9818 17.3539 11.9667 18.151 10.9726C18.6301 10.3751 19.0072 8.91564 18.8192 9.09315C18.6313 9.27065 18.1196 9.75096 17.159 10.012C16.1984 10.273 14.9454 10.1477 13.8595 9.81361C12.7736 9.47948 11.364 8.50842 10.4765 7.69399C9.58897 6.87956 7.43803 4.71818 6.44609 3.97684C5.45415 3.2355 3.92934 2.62603 2.48878 3.38168Z",
|
2297
|
+
fill: "url(#paint4_linear_3_7)"
|
2298
|
+
}), /*#__PURE__*/_jsx("path", {
|
2299
|
+
d: "M6.45603 3.95461C5.46409 3.21327 3.91876 2.5659 2.49872 3.35945C1.47193 3.95461 1.20045 4.64584 1.35708 4.46834C1.5137 4.29083 2.63093 2.78726 4.46863 3.7792C6.30632 4.77114 8.20667 7.35018 9.72068 8.77022C11.2347 10.1903 12.2754 11.0256 13.8695 11.4954C15.4635 11.9653 17.4927 11.6583 18.1609 10.9504C18.6401 10.3528 19.0171 8.89341 18.8292 9.07092C18.6412 9.24842 18.1296 9.72873 17.169 9.98976C16.2083 10.2508 14.9554 10.1255 13.8695 9.79138C12.7836 9.45725 11.374 8.48619 10.4864 7.67176C9.59891 6.85733 7.44797 4.69595 6.45603 3.95461Z",
|
2300
|
+
fill: "url(#paint5_linear_3_7)"
|
2301
|
+
}), /*#__PURE__*/_jsx("path", {
|
2302
|
+
d: "M17.9698 11.1279C17.8237 11.2845 19.0573 10.8051 20.2477 9.87581C20.6099 9.593 20.7786 9.48856 21.0188 9.21708C21.2432 8.96331 21.699 7.3072 21.699 6.5241C21.6573 4.937 21.2393 3.94621 21.1456 3.74576C21.0187 3.47416 20.977 3.35945 21.0188 4.16344C21.0605 4.96743 20.9561 6.05334 20.5071 6.99307C19.9328 7.9328 19.5778 8.18338 18.9618 8.83075C18.826 8.97693 18.8783 9.24843 18.7634 9.593C18.6381 10.0002 18.116 10.9712 17.9698 11.1279Z",
|
2303
|
+
fill: "url(#paint6_linear_3_7)"
|
2304
|
+
}), /*#__PURE__*/_jsx("path", {
|
2305
|
+
d: "M3.44581 9.00993C3.27874 9.06005 3.70684 9.34419 4.91804 9.72008C5.40879 9.82449 6.45294 10.1167 6.92281 9.78272C7.58062 9.47317 9.08419 8.04944 9.72112 7.40207C10.2571 6.89044 11.5713 5.72935 12.5403 5.17804C13.7515 4.48891 15.5579 3.68491 16.9362 4.1339C18.3144 4.58288 18.8574 6.31616 18.8783 7.04706C18.8992 7.77797 18.8783 8.7177 18.8783 8.95785C18.8748 9.0205 18.943 9.05809 19.2437 8.70725C19.6196 8.26871 20.0686 8.04944 20.6429 6.71294C20.8622 6.16302 21.227 4.63509 21.0814 3.78933C20.9556 3.05843 20.6528 2.67209 20.079 2.02472C19.5052 1.37735 18.2309 0.448066 16.696 0.437625C15.1611 0.427183 13.9603 1.07455 13.3025 1.3878C12.1957 1.89943 10.3894 3.26726 9.41832 4.23831C8.43682 5.13628 7.44488 6.13866 6.82884 6.75471C6.336 7.24754 5.60022 7.96243 5.29394 8.25827C4.67789 8.73858 3.68596 8.93789 3.44581 9.00993Z",
|
2306
|
+
fill: "url(#paint7_linear_3_7)"
|
2307
|
+
}), /*#__PURE__*/_jsx("path", {
|
2308
|
+
d: "M6.93299 9.79053C6.50698 9.991 5.41897 9.8323 4.92822 9.72788C5.11809 9.65819 5.74215 9.30791 6.71947 8.46434C7.94112 7.40988 9.69528 5.78076 11.2719 4.78895C13.1618 3.62995 14.9672 3.09756 16.9463 4.1417C15.5681 3.69272 13.7617 4.49671 12.5505 5.18585C11.5815 5.73715 10.2673 6.89824 9.7313 7.40988C9.09437 8.05724 7.5908 9.48097 6.93299 9.79053Z",
|
2309
|
+
fill: "url(#paint8_linear_3_7)"
|
2310
|
+
}), /*#__PURE__*/_jsx("path", {
|
2311
|
+
d: "M19.2123 2.0471C18.3519 1.23685 16.682 1.20831 15.9546 1.29532L20.4235 4.72012C20.4235 4.72012 20.2878 3.05993 19.2123 2.0471Z",
|
2312
|
+
fill: "url(#paint9_linear_3_7)"
|
2313
2313
|
})]
|
2314
2314
|
});
|
2315
2315
|
export const ResetIcon = () => /*#__PURE__*/_jsxs("svg", {
|
@@ -1,4 +1,16 @@
|
|
1
1
|
import { Editor, Node, Path, Transforms } from "slate";
|
2
|
+
const getCurrentNodeType = editor => {
|
3
|
+
if (editor.selection) {
|
4
|
+
// Get the current node at the selection
|
5
|
+
const [node] = Editor.nodes(editor, {
|
6
|
+
match: n => Editor.isBlock(editor, n)
|
7
|
+
});
|
8
|
+
|
9
|
+
// Return the node's type if it exists
|
10
|
+
return node ? node[0].type : null;
|
11
|
+
}
|
12
|
+
return null;
|
13
|
+
};
|
2
14
|
const isNodeTextEmpty = node => {
|
3
15
|
const nodeText = Node.string(node);
|
4
16
|
return nodeText.trim() === "";
|
@@ -14,6 +26,19 @@ const withCustomDeleteBackward = editor => {
|
|
14
26
|
selection
|
15
27
|
} = editor;
|
16
28
|
if (selection) {
|
29
|
+
// get the current node
|
30
|
+
const [freeGridItemNode] = Editor.nodes(editor, {
|
31
|
+
match: n => n.type === "freegridItem" // Adjust based on your list item type
|
32
|
+
});
|
33
|
+
|
34
|
+
// if it is freegrid
|
35
|
+
if (freeGridItemNode && freeGridItemNode[0]) {
|
36
|
+
const hasText = Node.string(freeGridItemNode[0]);
|
37
|
+
if (!hasText) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
17
42
|
// Check if current node is a list item and is the last one
|
18
43
|
const [node] = Editor.nodes(editor, {
|
19
44
|
match: n => n.type === "list-item" // Adjust based on your list item type
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { Editor, Range, Text } from "slate";
|
2
|
+
const highlightSelection = ([node, path], editor = {}) => {
|
3
|
+
if (Text.isText(node) && editor?.selection) {
|
4
|
+
const intersection = Range.intersection(editor.selection, Editor.range(editor, path));
|
5
|
+
if (!intersection) {
|
6
|
+
return [];
|
7
|
+
}
|
8
|
+
|
9
|
+
// Avoid applying highlight if the range only includes line breaks
|
10
|
+
const rangeText = Editor.string(editor, intersection);
|
11
|
+
if (!rangeText.trim()) {
|
12
|
+
return [];
|
13
|
+
}
|
14
|
+
const range = {
|
15
|
+
highlight: true,
|
16
|
+
...intersection
|
17
|
+
};
|
18
|
+
return [range];
|
19
|
+
}
|
20
|
+
return [];
|
21
|
+
};
|
22
|
+
export default highlightSelection;
|
@@ -1,5 +1,6 @@
|
|
1
|
+
import highlightSelection from "./highlightSelection";
|
1
2
|
import link from "./link";
|
2
|
-
const decorators = d => {
|
3
|
-
return [...link(d)];
|
3
|
+
const decorators = (d, editor) => {
|
4
|
+
return [...link(d, editor), ...highlightSelection(d, editor)];
|
4
5
|
};
|
5
6
|
export default decorators;
|
@@ -242,6 +242,15 @@ export const getMarked = (leaf, children, theme) => {
|
|
242
242
|
})
|
243
243
|
});
|
244
244
|
}
|
245
|
+
if (leaf.highlight) {
|
246
|
+
children = /*#__PURE__*/_jsx("span", {
|
247
|
+
style: {
|
248
|
+
background: "#EAEBFE",
|
249
|
+
color: "inherit"
|
250
|
+
},
|
251
|
+
children: children
|
252
|
+
});
|
253
|
+
}
|
245
254
|
if (leaf.decoration === "link") {
|
246
255
|
children = /*#__PURE__*/_jsx("a", {
|
247
256
|
style: {
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
|
-
export const insertDefaultEmbed = (editor, type, defaultURL = "") => {
|
3
|
+
export const insertDefaultEmbed = (editor, type, defaultURL = "", extProps = {}) => {
|
4
4
|
try {
|
5
5
|
const url = defaultURL ? defaultURL : type === "image" ? "" : "";
|
6
6
|
insertEmbed(editor, {
|
7
7
|
url,
|
8
|
-
images: []
|
8
|
+
images: [],
|
9
|
+
...extProps
|
9
10
|
}, type);
|
10
11
|
} catch (err) {
|
11
12
|
console.log(err);
|
@@ -14,7 +15,8 @@ export const insertDefaultEmbed = (editor, type, defaultURL = "") => {
|
|
14
15
|
export const createEmbedNode = (type, {
|
15
16
|
url,
|
16
17
|
alt,
|
17
|
-
images
|
18
|
+
images,
|
19
|
+
...rest
|
18
20
|
}) => ({
|
19
21
|
type,
|
20
22
|
alt,
|
@@ -23,6 +25,7 @@ export const createEmbedNode = (type, {
|
|
23
25
|
children: [{
|
24
26
|
text: " "
|
25
27
|
}],
|
28
|
+
...(rest || {}),
|
26
29
|
size: {
|
27
30
|
xs: {
|
28
31
|
widthInPercent: "100",
|