@flozy/editor 4.0.7 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +21 -25
- package/dist/Editor/CommonEditor.js +3 -0
- package/dist/Editor/Editor.css +12 -1
- package/dist/Editor/Elements/Accordion/Accordion.js +1 -1
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +21 -5
- package/dist/Editor/Elements/EmbedScript/Code.js +14 -12
- package/dist/Editor/Elements/EmbedScript/EmbedScript.js +7 -115
- package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +130 -0
- package/dist/Editor/Elements/Emoji/EmojiPicker.js +4 -2
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +35 -2
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +8 -2
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +43 -6
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +4 -0
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +3 -1
- package/dist/Editor/Elements/FreeGrid/styles.js +9 -0
- package/dist/Editor/Elements/List/CheckList.js +2 -1
- package/dist/Editor/Elements/Table/Table.js +1 -1
- package/dist/Editor/Elements/Table/TableCell.js +1 -1
- package/dist/Editor/Elements/Table/TableRow.js +2 -1
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +66 -0
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +9 -8
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +8 -4
- package/dist/Editor/common/ColorPickerButton.js +12 -4
- package/dist/Editor/common/FontLoader/FontLoader.js +68 -0
- package/dist/Editor/common/Icon.js +4 -0
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +7 -0
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +4 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +47 -0
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +4 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/index.js +3 -1
- package/dist/Editor/common/RnD/ElementSettings/settingsConstants.js +4 -2
- package/dist/Editor/common/RnD/OptionsPopup/style.js +23 -4
- package/dist/Editor/common/RnD/index.js +5 -3
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +2 -1
- package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +1 -0
- package/dist/Editor/common/StyleBuilder/boxStyle.js +31 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +1 -0
- package/dist/Editor/common/StyleBuilder/embedScriptStyle.js +10 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +15 -9
- 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/textOptions.js +19 -3
- package/dist/Editor/common/StyleBuilder/formButtonStyle.js +1 -0
- package/dist/Editor/common/StyleBuilder/formStyle.js +1 -0
- package/dist/Editor/helper/deserialize/index.js +3 -0
- package/dist/Editor/helper/index.js +22 -0
- package/dist/Editor/helper/theme.js +2 -1
- package/dist/Editor/hooks/useMouseMove.js +4 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +4 -10
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +9 -0
- package/dist/Editor/utils/embedScript.js +20 -2
- package/dist/Editor/utils/freegrid.js +61 -95
- package/dist/Editor/utils/mentions.js +2 -0
- package/package.json +2 -1
@@ -61,7 +61,8 @@ const RnD = props => {
|
|
61
61
|
dragging,
|
62
62
|
setDragging,
|
63
63
|
contextMenu,
|
64
|
-
setContextMenu
|
64
|
+
setContextMenu,
|
65
|
+
theme
|
65
66
|
} = useEditorContext();
|
66
67
|
const str_path = path.join("|");
|
67
68
|
const selectedElementProps = isSelectedElement(str_path, type);
|
@@ -245,7 +246,7 @@ const RnD = props => {
|
|
245
246
|
});
|
246
247
|
break;
|
247
248
|
default:
|
248
|
-
handleActionClick(actionType);
|
249
|
+
handleActionClick(actionType, path);
|
249
250
|
return;
|
250
251
|
}
|
251
252
|
} catch (err) {
|
@@ -520,7 +521,8 @@ const RnD = props => {
|
|
520
521
|
editor: editor,
|
521
522
|
path: sp,
|
522
523
|
...settingsProps,
|
523
|
-
elementProps: elementProps
|
524
|
+
elementProps: elementProps,
|
525
|
+
theme: theme
|
524
526
|
}), /*#__PURE__*/_jsx(DragInfo, {
|
525
527
|
anchorEl: rndRef?.current,
|
526
528
|
open: dragInfoOpen,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
1
2
|
const boxStyle = [{
|
2
3
|
tab: "Colors",
|
3
4
|
value: "sectionColors",
|
@@ -25,6 +26,36 @@ const boxStyle = [{
|
|
25
26
|
label: "Border",
|
26
27
|
key: "sectionBorderRadius",
|
27
28
|
type: "borderRadius"
|
29
|
+
}, {
|
30
|
+
label: "Border Color",
|
31
|
+
key: "borderColor",
|
32
|
+
type: "color"
|
33
|
+
}, {
|
34
|
+
label: "Border Width",
|
35
|
+
key: "borderWidth",
|
36
|
+
type: "text",
|
37
|
+
placeholder: "1px",
|
38
|
+
width: 6
|
39
|
+
}, {
|
40
|
+
label: "Border Style",
|
41
|
+
key: "borderStyle",
|
42
|
+
type: "textOptions",
|
43
|
+
width: 6,
|
44
|
+
options: [{
|
45
|
+
text: "Solid",
|
46
|
+
value: "solid"
|
47
|
+
}, {
|
48
|
+
text: "Dotted",
|
49
|
+
value: "dotted"
|
50
|
+
}, {
|
51
|
+
text: "Dashed",
|
52
|
+
value: "dashed"
|
53
|
+
}],
|
54
|
+
renderOption: option => {
|
55
|
+
return /*#__PURE__*/_jsx("span", {
|
56
|
+
children: option.text
|
57
|
+
});
|
58
|
+
}
|
28
59
|
}]
|
29
60
|
}];
|
30
61
|
export default boxStyle;
|
@@ -89,7 +89,9 @@ const BannerSpacing = props => {
|
|
89
89
|
value: !lockSpacing ? "" : pro_value?.top,
|
90
90
|
className: "sliderInput",
|
91
91
|
disabled: !lockSpacing,
|
92
|
-
onChange: handleChange
|
92
|
+
onChange: handleChange,
|
93
|
+
type: "number",
|
94
|
+
placeholder: "0"
|
93
95
|
})]
|
94
96
|
}), /*#__PURE__*/_jsx(FormControlLabel, {
|
95
97
|
className: "ccheckbox-primary",
|
@@ -131,50 +133,54 @@ const BannerSpacing = props => {
|
|
131
133
|
children: [/*#__PURE__*/_jsx("div", {
|
132
134
|
className: "bannerSpaceBoxTop",
|
133
135
|
children: /*#__PURE__*/_jsx("input", {
|
134
|
-
type: "
|
136
|
+
type: "number",
|
135
137
|
name: "top",
|
136
138
|
value: pro_value?.top,
|
137
139
|
className: "borderInput",
|
138
140
|
style: {
|
139
141
|
...squreStyle.topRight
|
140
142
|
},
|
141
|
-
onChange: handleChange
|
143
|
+
onChange: handleChange,
|
144
|
+
placeholder: "0"
|
142
145
|
})
|
143
146
|
}), /*#__PURE__*/_jsx("div", {
|
144
147
|
className: "bannerSpaceBoxRight",
|
145
148
|
children: /*#__PURE__*/_jsx("input", {
|
146
|
-
type: "
|
149
|
+
type: "number",
|
147
150
|
name: "right",
|
148
151
|
value: pro_value?.right,
|
149
152
|
className: "borderInput",
|
150
153
|
style: {
|
151
154
|
...squreStyle.bottomLeft
|
152
155
|
},
|
153
|
-
onChange: handleChange
|
156
|
+
onChange: handleChange,
|
157
|
+
placeholder: "0"
|
154
158
|
})
|
155
159
|
}), /*#__PURE__*/_jsx("div", {
|
156
160
|
className: "bannerSpaceBoxBottom",
|
157
161
|
children: /*#__PURE__*/_jsx("input", {
|
158
|
-
type: "
|
162
|
+
type: "number",
|
159
163
|
name: "bottom",
|
160
164
|
value: pro_value?.bottom,
|
161
165
|
className: "borderInput",
|
162
166
|
style: {
|
163
167
|
...squreStyle.bottomRight
|
164
168
|
},
|
165
|
-
onChange: handleChange
|
169
|
+
onChange: handleChange,
|
170
|
+
placeholder: "0"
|
166
171
|
})
|
167
172
|
}), /*#__PURE__*/_jsx("div", {
|
168
173
|
className: "bannerSpaceBoxLeft",
|
169
174
|
children: /*#__PURE__*/_jsx("input", {
|
170
|
-
type: "
|
175
|
+
type: "number",
|
171
176
|
name: "left",
|
172
177
|
className: "borderInput",
|
173
178
|
value: pro_value?.left,
|
174
179
|
style: {
|
175
180
|
...squreStyle.topLeft
|
176
181
|
},
|
177
|
-
onChange: handleChange
|
182
|
+
onChange: handleChange,
|
183
|
+
placeholder: "0"
|
178
184
|
})
|
179
185
|
})]
|
180
186
|
})
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
2
2
|
import { Grid, Typography, Slider, FormControlLabel, Checkbox, Box } from "@mui/material";
|
3
3
|
import { radiusStyle } from "./radiusStyle";
|
4
4
|
import useWindowResize from "../../../hooks/useWindowResize";
|
5
|
-
import { getBreakPointsValue } from "../../../helper/theme";
|
5
|
+
import { getBreakPointsValue, getCustomizationValue } from "../../../helper/theme";
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
8
|
const BORDER_RADIUS_KEYS = ["topLeft", "topRight", "bottomLeft", "bottomRight"];
|
@@ -80,11 +80,13 @@ const BorderRadius = props => {
|
|
80
80
|
}), /*#__PURE__*/_jsx(Box, {
|
81
81
|
sx: classes.sapcingInput,
|
82
82
|
component: "input",
|
83
|
-
value: !lockRadius ? "" : value?.topLeft
|
84
|
-
className: "sliderInput",
|
83
|
+
value: !lockRadius ? "" : getCustomizationValue(value?.topLeft),
|
84
|
+
className: "sliderInput removeScroll",
|
85
85
|
name: "topLeft",
|
86
86
|
disabled: !lockRadius,
|
87
|
-
onChange: handleChange
|
87
|
+
onChange: handleChange,
|
88
|
+
type: "number",
|
89
|
+
placeholder: "0"
|
88
90
|
})]
|
89
91
|
}), /*#__PURE__*/_jsx(FormControlLabel, {
|
90
92
|
className: "ccheckbox-primary",
|
@@ -125,10 +127,10 @@ const BorderRadius = props => {
|
|
125
127
|
borderRadius: `${value?.topLeft}px ${value?.topRight}px ${value?.bottomLeft}px ${value?.bottomRight}px`
|
126
128
|
},
|
127
129
|
children: [/*#__PURE__*/_jsx("input", {
|
128
|
-
type: "
|
130
|
+
type: "number",
|
129
131
|
name: "topLeft",
|
130
|
-
value: value?.topLeft,
|
131
|
-
className: "borderInput",
|
132
|
+
value: getCustomizationValue(value?.topLeft),
|
133
|
+
className: "borderInput removeScroll",
|
132
134
|
placeholder: "0",
|
133
135
|
style: {
|
134
136
|
...radiusStyle.topLeft,
|
@@ -136,10 +138,10 @@ const BorderRadius = props => {
|
|
136
138
|
},
|
137
139
|
onChange: handleChange
|
138
140
|
}), /*#__PURE__*/_jsx("input", {
|
139
|
-
type: "
|
141
|
+
type: "number",
|
140
142
|
name: "topRight",
|
141
|
-
value: value?.topRight,
|
142
|
-
className: "borderInput",
|
143
|
+
value: getCustomizationValue(value?.topRight),
|
144
|
+
className: "borderInput removeScroll",
|
143
145
|
placeholder: "0",
|
144
146
|
style: {
|
145
147
|
...radiusStyle.topRight,
|
@@ -148,10 +150,10 @@ const BorderRadius = props => {
|
|
148
150
|
},
|
149
151
|
onChange: handleChange
|
150
152
|
}), /*#__PURE__*/_jsx("input", {
|
151
|
-
type: "
|
153
|
+
type: "number",
|
152
154
|
name: "bottomLeft",
|
153
|
-
value: value?.bottomLeft,
|
154
|
-
className: "borderInput",
|
155
|
+
value: getCustomizationValue(value?.bottomLeft),
|
156
|
+
className: "borderInput removeScroll",
|
155
157
|
placeholder: "0",
|
156
158
|
style: {
|
157
159
|
...radiusStyle.bottomLeft,
|
@@ -160,10 +162,10 @@ const BorderRadius = props => {
|
|
160
162
|
},
|
161
163
|
onChange: handleChange
|
162
164
|
}), /*#__PURE__*/_jsx("input", {
|
163
|
-
type: "
|
165
|
+
type: "number",
|
164
166
|
name: "bottomRight",
|
165
|
-
value: value?.bottomRight,
|
166
|
-
className: "borderInput",
|
167
|
+
value: getCustomizationValue(value?.bottomRight),
|
168
|
+
className: "borderInput removeScroll",
|
167
169
|
placeholder: "0",
|
168
170
|
style: {
|
169
171
|
...radiusStyle.bottomRight,
|
@@ -12,11 +12,12 @@ const Color = props => {
|
|
12
12
|
} = props;
|
13
13
|
const {
|
14
14
|
key,
|
15
|
-
label
|
15
|
+
label,
|
16
|
+
hideGradient
|
16
17
|
} = data;
|
17
18
|
const [recentColors, setRecentColors] = useState({});
|
18
19
|
useEffect(() => {
|
19
|
-
const storedColors = JSON.parse(localStorage.getItem(
|
20
|
+
const storedColors = JSON.parse(localStorage.getItem("recentColors"));
|
20
21
|
if (storedColors) {
|
21
22
|
setRecentColors(storedColors);
|
22
23
|
}
|
@@ -39,7 +40,7 @@ const Color = props => {
|
|
39
40
|
[key]: updatedColors
|
40
41
|
};
|
41
42
|
setRecentColors(updatedColors);
|
42
|
-
localStorage.setItem(
|
43
|
+
localStorage.setItem("recentColors", JSON.stringify(updatedColors));
|
43
44
|
};
|
44
45
|
return /*#__PURE__*/_jsxs(Grid, {
|
45
46
|
item: true,
|
@@ -68,7 +69,8 @@ const Color = props => {
|
|
68
69
|
classes: classes,
|
69
70
|
value: value,
|
70
71
|
onSave: onSave,
|
71
|
-
recentColors: recentColors[key]
|
72
|
+
recentColors: recentColors[key],
|
73
|
+
hideGradient: hideGradient
|
72
74
|
})
|
73
75
|
})
|
74
76
|
}
|
@@ -2,6 +2,9 @@ import React from "react";
|
|
2
2
|
import { FormControl, Grid, ListItemIcon, ListSubheader, MenuItem, Select, Typography } from "@mui/material";
|
3
3
|
import { getBreakPointsValue } from "../../../helper/theme";
|
4
4
|
import useWindowResize from "../../../hooks/useWindowResize";
|
5
|
+
import { useEditorContext } from "../../../hooks/useMouseMove";
|
6
|
+
import FontFamilyAutocomplete from "../../../Toolbar/FormatTools/FontFamilyAutocomplete";
|
7
|
+
import { useSlate } from "slate-react";
|
5
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
7
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -22,12 +25,17 @@ const TextOptions = props => {
|
|
22
25
|
isBreakpoint,
|
23
26
|
options,
|
24
27
|
renderOption,
|
25
|
-
width
|
28
|
+
width,
|
29
|
+
webFont = false
|
26
30
|
} = data;
|
31
|
+
const {
|
32
|
+
fontFamilies
|
33
|
+
} = useEditorContext();
|
34
|
+
const editor = useSlate();
|
27
35
|
const [size] = useWindowResize();
|
28
36
|
const value = isBreakpoint ? getBreakPointsValue(val, size?.device) : val;
|
29
37
|
const metaDataMappingOptions = metaMappings?.boards || [];
|
30
|
-
const updatedOption = elementProps?.metadatamapping ? [...options, ...metaDataMappingOptions] : options;
|
38
|
+
const updatedOption = elementProps?.metadatamapping ? [...options, ...metaDataMappingOptions] : webFont ? fontFamilies?.options : options;
|
31
39
|
const handleChange = (e, d) => {
|
32
40
|
if (isBreakpoint) {
|
33
41
|
onChange({
|
@@ -69,7 +77,7 @@ const TextOptions = props => {
|
|
69
77
|
},
|
70
78
|
fullWidth: true,
|
71
79
|
size: "small",
|
72
|
-
children: /*#__PURE__*/_jsx(Select, {
|
80
|
+
children: !webFont ? /*#__PURE__*/_jsx(Select, {
|
73
81
|
onChange: handleChange,
|
74
82
|
value: value || updatedOption[0]?.value,
|
75
83
|
placeholder: data?.label,
|
@@ -94,6 +102,14 @@ const TextOptions = props => {
|
|
94
102
|
}), renderOption ? renderOption(m, elementProps) : m.label || m.text]
|
95
103
|
}, `${key}_${i}`);
|
96
104
|
})
|
105
|
+
}) : /*#__PURE__*/_jsx(FontFamilyAutocomplete, {
|
106
|
+
editor: editor,
|
107
|
+
format: key,
|
108
|
+
options: fontFamilies.options,
|
109
|
+
width: '100%',
|
110
|
+
onChange: onChange,
|
111
|
+
val: value,
|
112
|
+
webFont: true
|
97
113
|
})
|
98
114
|
})]
|
99
115
|
})
|
@@ -294,4 +294,26 @@ export const debounce = function (func, wait, immediate) {
|
|
294
294
|
timeout = setTimeout(later, wait);
|
295
295
|
if (callNow) func.apply(context, args);
|
296
296
|
};
|
297
|
+
};
|
298
|
+
export const getTextColor = (color = "") => {
|
299
|
+
return color?.indexOf("gradient") >= 0 ? {
|
300
|
+
background: color?.concat("text"),
|
301
|
+
WebkitBackgroundClip: "text",
|
302
|
+
WebkitTextFillColor: "transparent",
|
303
|
+
color: "transparent",
|
304
|
+
caretColor: "black"
|
305
|
+
} : {
|
306
|
+
color
|
307
|
+
};
|
308
|
+
};
|
309
|
+
export const getBorderColor = (borderColor = "") => {
|
310
|
+
const borderStyle = borderColor ? {
|
311
|
+
border: "1px solid"
|
312
|
+
} : {};
|
313
|
+
if (borderColor?.indexOf("gradient") >= 0) {
|
314
|
+
borderStyle.borderImage = `${borderColor} 1`;
|
315
|
+
} else {
|
316
|
+
borderStyle.borderColor = borderColor;
|
317
|
+
}
|
318
|
+
return borderStyle;
|
297
319
|
};
|
@@ -34,6 +34,7 @@ export const EditorProvider = ({
|
|
34
34
|
const [contextMenu, setContextMenu] = useState({
|
35
35
|
path: null
|
36
36
|
});
|
37
|
+
const [fontFamilies, setFontFamilies] = useState({});
|
37
38
|
useEffect(() => {
|
38
39
|
window.updateSelectedItem = d => {
|
39
40
|
setSelectedElement(d);
|
@@ -82,7 +83,9 @@ export const EditorProvider = ({
|
|
82
83
|
setContextMenu,
|
83
84
|
contextMenu,
|
84
85
|
openAI,
|
85
|
-
setOpenAI
|
86
|
+
setOpenAI,
|
87
|
+
fontFamilies,
|
88
|
+
setFontFamilies
|
86
89
|
},
|
87
90
|
children: children
|
88
91
|
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Editor, Transforms, Element as SlateElement } from "slate";
|
2
2
|
import { Box } from "@mui/material";
|
3
|
-
import {
|
3
|
+
import { sizeMap } from "./font";
|
4
4
|
import Link from "../Elements/Link/Link";
|
5
5
|
import Image from "../Elements/Embed/Image";
|
6
6
|
import Video from "../Elements/Embed/Video";
|
@@ -32,7 +32,7 @@ import FormField from "../Elements/Form/FormField";
|
|
32
32
|
import InlineIcon from "../Elements/InlineIcon/InlineIcon";
|
33
33
|
import SimpleText from "../Elements/SimpleText";
|
34
34
|
import CheckList from "../Elements/List/CheckList";
|
35
|
-
import { isEmptyTextNode } from "../helper";
|
35
|
+
import { getTextColor, isEmptyTextNode } from "../helper";
|
36
36
|
import Attachments from "../Elements/Attachments/Attachments";
|
37
37
|
import { getBreakPointsValue } from "../helper/theme";
|
38
38
|
import Variables from "../Elements/Variables/Variable";
|
@@ -206,14 +206,8 @@ export const getMarked = (leaf, children, theme) => {
|
|
206
206
|
}
|
207
207
|
// cover under single span
|
208
208
|
if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || className) {
|
209
|
-
const family =
|
210
|
-
const textStyles = leaf?.color
|
211
|
-
background: leaf?.color?.concat("text"),
|
212
|
-
WebkitBackgroundClip: "text",
|
213
|
-
WebkitTextFillColor: "transparent"
|
214
|
-
} : {
|
215
|
-
color: leaf.color
|
216
|
-
};
|
209
|
+
const family = leaf?.fontFamily;
|
210
|
+
const textStyles = getTextColor(leaf?.color);
|
217
211
|
children = /*#__PURE__*/_jsx("span", {
|
218
212
|
style: {
|
219
213
|
background: leaf.bgColor
|
@@ -321,6 +321,15 @@ export const getBlock = props => {
|
|
321
321
|
...attributes,
|
322
322
|
children: children
|
323
323
|
});
|
324
|
+
case "link":
|
325
|
+
return /*#__PURE__*/_jsx("p", {
|
326
|
+
...attributes,
|
327
|
+
...element.attr,
|
328
|
+
className: `content-editable ${isEmpty ? "empty" : ""}`
|
329
|
+
// placeholder="paragraph"
|
330
|
+
,
|
331
|
+
children: children
|
332
|
+
});
|
324
333
|
case "unorderedList":
|
325
334
|
return /*#__PURE__*/_jsx("ul", {
|
326
335
|
...attributes,
|
@@ -9,9 +9,10 @@ export const createEmbedScript = embedData => ({
|
|
9
9
|
}],
|
10
10
|
isEncoded: true,
|
11
11
|
// to handle the old code's that already inserted
|
12
|
-
isSanitized: true
|
12
|
+
isSanitized: true,
|
13
|
+
// to handle the old code's that already inserted
|
14
|
+
updatedOn: new Date().getTime()
|
13
15
|
});
|
14
|
-
|
15
16
|
export const insertEmbedScript = (editor, embedData) => {
|
16
17
|
try {
|
17
18
|
const embed = createEmbedScript(embedData);
|
@@ -22,4 +23,21 @@ export const insertEmbedScript = (editor, embedData) => {
|
|
22
23
|
} catch (err) {
|
23
24
|
console.log(err);
|
24
25
|
}
|
26
|
+
};
|
27
|
+
export const updateEmbedScript = (editor, embedData, updatePath = null, parentPath = null) => {
|
28
|
+
try {
|
29
|
+
Transforms.setNodes(editor, {
|
30
|
+
embedData: encodeString(embedData),
|
31
|
+
updatedOn: new Date().getTime()
|
32
|
+
}, {
|
33
|
+
at: updatePath
|
34
|
+
});
|
35
|
+
Transforms.setNodes(editor, {
|
36
|
+
lg_updatedOn: new Date().getTime()
|
37
|
+
}, {
|
38
|
+
at: parentPath
|
39
|
+
});
|
40
|
+
} catch (err) {
|
41
|
+
console.log(err);
|
42
|
+
}
|
25
43
|
};
|