@flozy/editor 4.3.1 → 4.3.3
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/Elements/AI/AIInput.js +3 -2
- package/dist/Editor/Elements/AI/PopoverAIInput.js +8 -3
- package/dist/Editor/Elements/Button/EditorButton.js +0 -1
- package/dist/Editor/Elements/Mentions/Mentions.js +3 -2
- package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +17 -22
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +17 -21
- package/dist/Editor/common/FontLoader/FontLoader.js +11 -4
- package/dist/Editor/common/LinkSettings/index.js +5 -2
- package/dist/Editor/common/LinkSettings/style.js +20 -6
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Link.js +6 -4
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +0 -1
- package/dist/Editor/common/RnD/index.js +4 -2
- package/package.json +1 -1
|
@@ -42,7 +42,8 @@ function AIInput({
|
|
|
42
42
|
onInputChange,
|
|
43
43
|
onClickOutside,
|
|
44
44
|
startRecording,
|
|
45
|
-
loading
|
|
45
|
+
loading,
|
|
46
|
+
isMobile
|
|
46
47
|
}, ref) {
|
|
47
48
|
const {
|
|
48
49
|
theme
|
|
@@ -130,7 +131,7 @@ function AIInput({
|
|
|
130
131
|
component: "div",
|
|
131
132
|
style: classes.sendIconContainer,
|
|
132
133
|
className: "icons-elements",
|
|
133
|
-
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
134
|
+
children: [isMobile ? null : /*#__PURE__*/_jsx(IconButton, {
|
|
134
135
|
disabled: loading,
|
|
135
136
|
onClick: () => startRecording(),
|
|
136
137
|
children: /*#__PURE__*/_jsx(ChatMicIcon, {})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
2
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
|
3
3
|
import Styles from "./Styles";
|
|
4
4
|
import { Fade, Paper, Popper } from "@mui/material";
|
|
@@ -173,10 +173,11 @@ function PopoverAIInput({
|
|
|
173
173
|
const [generatedText, setGeneratedText] = useState("");
|
|
174
174
|
const [inputValue, setInputValue] = useState("");
|
|
175
175
|
const [selectedOption, setSelectedOption] = useState();
|
|
176
|
+
const selectedEleRef = useRef({});
|
|
176
177
|
const classes = Styles();
|
|
177
178
|
const editor = useSlate();
|
|
178
179
|
const updateAnchor = () => {
|
|
179
|
-
updateAnchorEl(setAnchorEl, editor, openAI,
|
|
180
|
+
updateAnchorEl(setAnchorEl, editor, openAI, selectedEleRef.current);
|
|
180
181
|
};
|
|
181
182
|
useEditorScroll(editorWrapper, updateAnchor);
|
|
182
183
|
const onClickOutside = () => {
|
|
@@ -195,6 +196,9 @@ function PopoverAIInput({
|
|
|
195
196
|
scrollToAIInput(editor);
|
|
196
197
|
}
|
|
197
198
|
}, [openAI]);
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
selectedEleRef.current = selectedElement;
|
|
201
|
+
}, [selectedElement]);
|
|
198
202
|
const onSend = async (type, option) => {
|
|
199
203
|
if (type === "close") {
|
|
200
204
|
onClickOutside();
|
|
@@ -303,7 +307,8 @@ function PopoverAIInput({
|
|
|
303
307
|
openAI: openAI,
|
|
304
308
|
inputValue: inputValue,
|
|
305
309
|
onInputChange: onInputChange,
|
|
306
|
-
onClickOutside: onClickOutside
|
|
310
|
+
onClickOutside: onClickOutside,
|
|
311
|
+
isMobile: otherProps?.isMobile
|
|
307
312
|
})
|
|
308
313
|
})
|
|
309
314
|
})
|
|
@@ -10,7 +10,6 @@ import { getTRBLBreakPoints, getBreakPointsValue, groupByBreakpoint } from "../.
|
|
|
10
10
|
import { handleLinkType, windowVar } from "../../utils/helper";
|
|
11
11
|
import LinkSettings from "../../common/LinkSettings";
|
|
12
12
|
import Icon from "../../common/Icon";
|
|
13
|
-
import { useEditorContext } from "../../hooks/useMouseMove";
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
15
|
const EditorButton = props => {
|
|
@@ -14,9 +14,10 @@ const Mentions = ({
|
|
|
14
14
|
verticalAlign: "baseline",
|
|
15
15
|
display: "inline-block",
|
|
16
16
|
borderRadius: "4px",
|
|
17
|
-
backgroundColor: "#
|
|
17
|
+
backgroundColor: "#2563EB",
|
|
18
18
|
fontSize: "0.9em",
|
|
19
|
-
boxShadow: selected && focused ? "0 0 0 2px #B4D5FF" : "none"
|
|
19
|
+
boxShadow: selected && focused ? "0 0 0 2px #B4D5FF" : "none",
|
|
20
|
+
color: "#FFF"
|
|
20
21
|
};
|
|
21
22
|
// See if our empty text child has any styling marks applied and apply those
|
|
22
23
|
if (element.children[0].bold) {
|
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Box,
|
|
2
|
+
import { Box, Card, CardMedia, Grid } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
// const Select = (props) => {
|
|
5
|
+
// const { classes, data, onSelectTemplate } = props;
|
|
6
|
+
// return (
|
|
7
|
+
// <Box
|
|
8
|
+
// className="template-card-action"
|
|
9
|
+
// component={"div"}
|
|
10
|
+
// sx={classes.templateCardBtnGrp}
|
|
11
|
+
// style={{ padding: 0, background: "transparent"}}
|
|
12
|
+
// >
|
|
13
|
+
// <Button className="blueBtn" onClick={onSelectTemplate(data)}>
|
|
14
|
+
// Select
|
|
15
|
+
// </Button>
|
|
16
|
+
// </Box>
|
|
17
|
+
// );
|
|
18
|
+
// };
|
|
3
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
const Select = props => {
|
|
5
|
-
const {
|
|
6
|
-
classes,
|
|
7
|
-
data,
|
|
8
|
-
onSelectTemplate
|
|
9
|
-
} = props;
|
|
10
|
-
return /*#__PURE__*/_jsx(Box, {
|
|
11
|
-
className: "template-card-action",
|
|
12
|
-
component: "div",
|
|
13
|
-
sx: classes.templateCardBtnGrp,
|
|
14
|
-
style: {
|
|
15
|
-
padding: 0,
|
|
16
|
-
background: "transparent"
|
|
17
|
-
},
|
|
18
|
-
children: /*#__PURE__*/_jsx(Button, {
|
|
19
|
-
className: "blueBtn",
|
|
20
|
-
onClick: onSelectTemplate(data),
|
|
21
|
-
children: "Select"
|
|
22
|
-
})
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
20
|
const ButtonTemplateCard = props => {
|
|
26
21
|
const {
|
|
27
22
|
classes,
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Box,
|
|
2
|
+
import { Box, Card, CardMedia, Grid } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
// const Select = (props) => {
|
|
5
|
+
// const { classes, data, onSelectTemplate } = props;
|
|
6
|
+
// return (
|
|
7
|
+
// <Box
|
|
8
|
+
// className="template-card-action"
|
|
9
|
+
// component={"div"}
|
|
10
|
+
// sx={classes.templateCardBtnGrp}
|
|
11
|
+
// style={{background: "transparent"}}
|
|
12
|
+
// >
|
|
13
|
+
// <Button className="blueBtn" onClick={onSelectTemplate(data)}>
|
|
14
|
+
// Select
|
|
15
|
+
// </Button>
|
|
16
|
+
// </Box>
|
|
17
|
+
// );
|
|
18
|
+
// };
|
|
3
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
const Select = props => {
|
|
5
|
-
const {
|
|
6
|
-
classes,
|
|
7
|
-
data,
|
|
8
|
-
onSelectTemplate
|
|
9
|
-
} = props;
|
|
10
|
-
return /*#__PURE__*/_jsx(Box, {
|
|
11
|
-
className: "template-card-action",
|
|
12
|
-
component: "div",
|
|
13
|
-
sx: classes.templateCardBtnGrp,
|
|
14
|
-
style: {
|
|
15
|
-
background: "transparent"
|
|
16
|
-
},
|
|
17
|
-
children: /*#__PURE__*/_jsx(Button, {
|
|
18
|
-
className: "blueBtn",
|
|
19
|
-
onClick: onSelectTemplate(data),
|
|
20
|
-
children: "Select"
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
20
|
const FullViewCard = props => {
|
|
25
21
|
const {
|
|
26
22
|
classes,
|
|
@@ -50,9 +50,6 @@ const FontLoader = props => {
|
|
|
50
50
|
}
|
|
51
51
|
loadNextBatch();
|
|
52
52
|
};
|
|
53
|
-
const sanitizeFontFamily = fontFamily => {
|
|
54
|
-
return fontFamily.replace(/\\/g, '').replace(/['"]/g, '');
|
|
55
|
-
};
|
|
56
53
|
useEffect(() => {
|
|
57
54
|
let families = [...defaultFonts];
|
|
58
55
|
if (!readOnly) {
|
|
@@ -70,13 +67,23 @@ const FontLoader = props => {
|
|
|
70
67
|
console.log(err);
|
|
71
68
|
});
|
|
72
69
|
} else {
|
|
70
|
+
function correctFontArray(fontString) {
|
|
71
|
+
let fontsArray = fontString.split(',');
|
|
72
|
+
let cleanedFontsArray = [...new Set(fontsArray.map(font => font.trim()))];
|
|
73
|
+
return cleanedFontsArray;
|
|
74
|
+
}
|
|
75
|
+
function sanitizeFontFamily(fontFamily) {
|
|
76
|
+
const correctedFonts = correctFontArray(fontFamily);
|
|
77
|
+
return correctedFonts.join(', ');
|
|
78
|
+
}
|
|
73
79
|
const elements = Array.from(document?.querySelectorAll("*"));
|
|
74
80
|
const fontSet = new Set();
|
|
75
81
|
elements.forEach(element => {
|
|
76
82
|
const computedStyles = window?.getComputedStyle(element);
|
|
77
83
|
fontSet.add(sanitizeFontFamily(computedStyles?.fontFamily));
|
|
78
84
|
});
|
|
79
|
-
families = Array.from(fontSet);
|
|
85
|
+
let families = Array.from(fontSet);
|
|
86
|
+
families = correctFontArray(families.join(', '));
|
|
80
87
|
loadFontsInBatches(families);
|
|
81
88
|
}
|
|
82
89
|
}, []);
|
|
@@ -11,6 +11,7 @@ import LinkSettingsStyles from "./style";
|
|
|
11
11
|
import { getNavOptions } from "./navOptions";
|
|
12
12
|
import { ScrollTopBottom, SelectPage, TextInput, Trigger } from "./NavComponents";
|
|
13
13
|
import SwipeableDrawer from "../SwipeableDrawer";
|
|
14
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -30,18 +31,20 @@ function getNav(navType, navOptions) {
|
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
export default function LinkSettings(props) {
|
|
34
|
+
const {
|
|
35
|
+
theme
|
|
36
|
+
} = useEditorContext();
|
|
33
37
|
const {
|
|
34
38
|
handleClose,
|
|
35
39
|
onSave,
|
|
36
40
|
customProps,
|
|
37
41
|
navType
|
|
38
42
|
} = props;
|
|
39
|
-
const themeType = localStorage.getItem("themeType");
|
|
40
43
|
const {
|
|
41
44
|
isMobile
|
|
42
45
|
} = customProps;
|
|
43
46
|
const navOptions = getNavOptions(customProps.hideTools);
|
|
44
|
-
const classes = LinkSettingsStyles(
|
|
47
|
+
const classes = LinkSettingsStyles(theme);
|
|
45
48
|
const [nav, setNav] = useState(getNav(navType, navOptions));
|
|
46
49
|
const [navValue, setNavValue] = useState(props?.navValue || "");
|
|
47
50
|
const [openInNewTab, setOpenInNewTab] = useState(props.openInNewTab || false);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
const ButtonNavSettingsStyles =
|
|
1
|
+
const ButtonNavSettingsStyles = theme => ({
|
|
2
2
|
dialogContainer: {
|
|
3
|
-
"& .MuiPaper-root": {
|
|
4
|
-
background: themeType === "dark" ? "#141720 !important" : "#ffffff !important"
|
|
5
|
-
},
|
|
6
3
|
"& .MuiDialogContent-root": {
|
|
7
4
|
padding: "0px 20px"
|
|
8
5
|
},
|
|
@@ -19,6 +16,23 @@ const ButtonNavSettingsStyles = themeType => ({
|
|
|
19
16
|
},
|
|
20
17
|
"& .MuiGrid-item": {
|
|
21
18
|
padding: "14px"
|
|
19
|
+
},
|
|
20
|
+
"& .MuiPaper-root": {
|
|
21
|
+
backgroundColor: theme?.palette?.editor?.background,
|
|
22
|
+
"& .MuiTypography-root": {
|
|
23
|
+
color: theme?.palette?.editor?.textColor
|
|
24
|
+
},
|
|
25
|
+
"& .MuiInputBase-root": {
|
|
26
|
+
border: `1px solid ${theme?.palette?.editor?.textColor}`,
|
|
27
|
+
color: theme?.palette?.editor?.textColor
|
|
28
|
+
},
|
|
29
|
+
"& .MuiSvgIcon-root": {
|
|
30
|
+
color: theme?.palette?.editor?.textColor
|
|
31
|
+
},
|
|
32
|
+
"& .MuiFormLabel-root": {
|
|
33
|
+
color: theme?.palette?.editor?.textColor,
|
|
34
|
+
backgroundColor: theme?.palette?.editor?.background
|
|
35
|
+
}
|
|
22
36
|
}
|
|
23
37
|
},
|
|
24
38
|
saveBtn: {
|
|
@@ -49,7 +63,7 @@ const ButtonNavSettingsStyles = themeType => ({
|
|
|
49
63
|
position: "absolute",
|
|
50
64
|
right: 8,
|
|
51
65
|
top: 8,
|
|
52
|
-
color: theme
|
|
66
|
+
color: theme?.palette?.grey[500]
|
|
53
67
|
},
|
|
54
68
|
gridDivider: {
|
|
55
69
|
borderRight: "1px solid rgba(0, 0, 0, 0.12)"
|
|
@@ -60,7 +74,7 @@ const ButtonNavSettingsStyles = themeType => ({
|
|
|
60
74
|
gap: "8px",
|
|
61
75
|
paddingTop: "14px",
|
|
62
76
|
marginTop: "14px",
|
|
63
|
-
borderTop:
|
|
77
|
+
borderTop: `1px solid ${theme?.palette?.grey[300]}`
|
|
64
78
|
}
|
|
65
79
|
});
|
|
66
80
|
export default ButtonNavSettingsStyles;
|
|
@@ -11,7 +11,8 @@ const Link = props => {
|
|
|
11
11
|
customProps,
|
|
12
12
|
editor,
|
|
13
13
|
path,
|
|
14
|
-
childType
|
|
14
|
+
childType,
|
|
15
|
+
theme
|
|
15
16
|
} = props;
|
|
16
17
|
const pPath = path?.split("|")?.map(m => parseInt(m));
|
|
17
18
|
const element_path = [...pPath, 0];
|
|
@@ -137,7 +138,7 @@ const Link = props => {
|
|
|
137
138
|
console.log(err);
|
|
138
139
|
}
|
|
139
140
|
};
|
|
140
|
-
return
|
|
141
|
+
return /*#__PURE__*/_jsx(LinkSettings, {
|
|
141
142
|
handleClose: onClose,
|
|
142
143
|
onSave: d => {
|
|
143
144
|
const upData = getTransformedData(d);
|
|
@@ -147,7 +148,8 @@ const Link = props => {
|
|
|
147
148
|
onClose();
|
|
148
149
|
},
|
|
149
150
|
...(blockProps || {}),
|
|
150
|
-
customProps: customProps
|
|
151
|
-
|
|
151
|
+
customProps: customProps,
|
|
152
|
+
theme: theme
|
|
153
|
+
});
|
|
152
154
|
};
|
|
153
155
|
export default Link;
|
|
@@ -416,7 +416,9 @@ const RnD = props => {
|
|
|
416
416
|
}
|
|
417
417
|
};
|
|
418
418
|
const onMouseOver = e => {
|
|
419
|
-
|
|
419
|
+
if (type !== "child") {
|
|
420
|
+
e.stopPropagation();
|
|
421
|
+
}
|
|
420
422
|
if (type !== "child") {
|
|
421
423
|
updateDragging({
|
|
422
424
|
dragOver: str_path
|
|
@@ -546,7 +548,7 @@ const RnD = props => {
|
|
|
546
548
|
contextMenu: contextMenu,
|
|
547
549
|
handleClose: handleClose,
|
|
548
550
|
theme: theme
|
|
549
|
-
}), type === "parent" && breakpoint === "lg" ? /*#__PURE__*/_jsx(VirtualElement, {
|
|
551
|
+
}), type === "parent" && breakpoint === "lg" && !readOnly ? /*#__PURE__*/_jsx(VirtualElement, {
|
|
550
552
|
parentEle: positionRef?.current?.resizableElement?.current,
|
|
551
553
|
updated_at: updated_at,
|
|
552
554
|
path: str_path,
|