@flozy/editor 3.2.3 → 3.2.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +24 -20
- package/dist/Editor/Styles/EditorStyles.js +3 -3
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +3 -3
- package/dist/Editor/Toolbar/PopupTool/index.js +21 -13
- package/dist/Editor/common/LinkSettings/NavComponents.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +2 -1
- package/dist/Editor/utils/helper.js +7 -3
- package/package.json +1 -1
@@ -185,29 +185,33 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
185
185
|
return getOnSaveData(deboundedValue);
|
186
186
|
},
|
187
187
|
insertFragments(fragments, clearAll = false, rest = {}) {
|
188
|
-
|
189
|
-
if (
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
188
|
+
try {
|
189
|
+
if (!clearAll) {
|
190
|
+
if (rest?.nextLine) {
|
191
|
+
const {
|
192
|
+
anchor
|
193
|
+
} = editor?.selection || {};
|
194
|
+
if (anchor?.path !== undefined && anchor?.path[0] !== undefined) {
|
195
|
+
editor.insertNode(fragments, {
|
196
|
+
at: [anchor?.path[0] + 1]
|
197
|
+
});
|
198
|
+
}
|
199
|
+
} else {
|
200
|
+
editor.insertNode(fragments);
|
197
201
|
}
|
198
202
|
} else {
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
Transforms.delete(editor, {
|
205
|
-
at: [0]
|
203
|
+
// loop delete all
|
204
|
+
editor.children.forEach(() => {
|
205
|
+
Transforms.delete(editor, {
|
206
|
+
at: [0]
|
207
|
+
});
|
206
208
|
});
|
207
|
-
});
|
208
209
|
|
209
|
-
|
210
|
-
|
210
|
+
// reset init
|
211
|
+
editor.children = fragments;
|
212
|
+
}
|
213
|
+
} catch (err) {
|
214
|
+
console.log(err);
|
211
215
|
}
|
212
216
|
},
|
213
217
|
toggleFullscreen() {
|
@@ -451,7 +455,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
451
455
|
customProps: customProps,
|
452
456
|
toolbarOptions: toolbarOptions,
|
453
457
|
theme: theme
|
454
|
-
}) : null, footer && /*#__PURE__*/_jsx(Typography, {
|
458
|
+
}) : null, footer && (fullScreen || readOnly) && /*#__PURE__*/_jsx(Typography, {
|
455
459
|
sx: {
|
456
460
|
color: "rgb(100, 116, 139)",
|
457
461
|
fontSize: "13px",
|
@@ -24,10 +24,10 @@ const editorStyles = ({
|
|
24
24
|
left: 0,
|
25
25
|
width: "100%",
|
26
26
|
zIndex: 99999,
|
27
|
-
backgroundColor: theme?.palette?.editor?.background,
|
28
|
-
color: theme?.palette?.editor?.textColor,
|
27
|
+
backgroundColor: theme?.palette?.editor?.background || "#fff",
|
28
|
+
color: theme?.palette?.editor?.textColor || "black",
|
29
29
|
"& .MuiOutlinedInput-input": {
|
30
|
-
color: theme?.palette?.editor?.textColor
|
30
|
+
color: theme?.palette?.editor?.textColor || "black"
|
31
31
|
}
|
32
32
|
}
|
33
33
|
},
|
@@ -483,7 +483,7 @@ const usePopupStyle = theme => ({
|
|
483
483
|
gap: "4px"
|
484
484
|
},
|
485
485
|
"& .verticalLine": {
|
486
|
-
borderLeft: `1px solid ${theme?.palette?.primary?.border8}`,
|
486
|
+
borderLeft: `1px solid ${theme?.palette?.primary?.border8 || "black"}`,
|
487
487
|
minHeight: "20px",
|
488
488
|
height: "100%"
|
489
489
|
},
|
@@ -531,7 +531,7 @@ const usePopupStyle = theme => ({
|
|
531
531
|
}
|
532
532
|
},
|
533
533
|
"& .customSelectOptionLabel": {
|
534
|
-
color: theme?.palette?.editor?.textColor,
|
534
|
+
color: theme?.palette?.editor?.textColor || "black",
|
535
535
|
margin: "0px",
|
536
536
|
width: "100%",
|
537
537
|
justifyContent: "start",
|
@@ -539,7 +539,7 @@ const usePopupStyle = theme => ({
|
|
539
539
|
fontSize: "14px",
|
540
540
|
lineHeight: "1.75 !important",
|
541
541
|
fontWeight: 400,
|
542
|
-
background: theme?.palette?.editor?.background,
|
542
|
+
background: theme?.palette?.editor?.background || "#fff",
|
543
543
|
"&:hover": {
|
544
544
|
background: `${theme?.palette?.action?.selected} !important`
|
545
545
|
},
|
@@ -53,19 +53,27 @@ const PopupTool = props => {
|
|
53
53
|
}
|
54
54
|
}, [selection]);
|
55
55
|
const updateAnchorEl = () => {
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
const
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
56
|
+
try {
|
57
|
+
const domSelection = window.getSelection();
|
58
|
+
if (!domSelection?.anchorOffset) {
|
59
|
+
// no selection
|
60
|
+
return;
|
61
|
+
}
|
62
|
+
const domRange = domSelection?.getRangeAt(0);
|
63
|
+
const {
|
64
|
+
startOffset,
|
65
|
+
endOffset
|
66
|
+
} = domRange || {};
|
67
|
+
if (startOffset !== endOffset) {
|
68
|
+
const rect = domRange.getBoundingClientRect();
|
69
|
+
setAnchorEl({
|
70
|
+
clientWidth: rect.width,
|
71
|
+
clientHeight: rect.height,
|
72
|
+
getBoundingClientRect: () => rect
|
73
|
+
});
|
74
|
+
}
|
75
|
+
} catch (err) {
|
76
|
+
console.log(err);
|
69
77
|
}
|
70
78
|
};
|
71
79
|
const handleClose = () => {
|
@@ -78,7 +78,7 @@ export const SelectPage = props => {
|
|
78
78
|
}, [value, pages]);
|
79
79
|
return /*#__PURE__*/_jsxs("div", {
|
80
80
|
children: [/*#__PURE__*/_jsx(FreeSoloCreateOption, {
|
81
|
-
label: page?.label,
|
81
|
+
label: page?.label || "Home",
|
82
82
|
setValue: val => onChange(val?.value),
|
83
83
|
placeholder: "Select Page",
|
84
84
|
options: pages
|
@@ -235,7 +235,8 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
235
235
|
props.component = "a";
|
236
236
|
const [page, section] = url.split("#");
|
237
237
|
const sec = section ? `#${section}` : "";
|
238
|
-
|
238
|
+
const isHome = page === "home" || !page;
|
239
|
+
props.href = isHome ? `${sec}` : `/${url}`;
|
239
240
|
if (openInNewTab) {
|
240
241
|
props.target = "_blank";
|
241
242
|
}
|
@@ -274,8 +275,11 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
274
275
|
}
|
275
276
|
|
276
277
|
props.onTouchEnd = e => {
|
277
|
-
e
|
278
|
-
|
278
|
+
if (e) {
|
279
|
+
// onTouchEnd will get triggered on web, only for image element, for that case event is getting undefined.
|
280
|
+
e.preventDefault();
|
281
|
+
e.stopPropagation();
|
282
|
+
}
|
279
283
|
if (props.target) {
|
280
284
|
window.open(props.href);
|
281
285
|
} else {
|