@flozy/editor 7.0.2 → 7.0.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/CommonEditor.js +2 -4
- package/dist/Editor/Editor.css +2 -3
- package/dist/Editor/Styles/EditorStyles.js +2 -4
- package/dist/Editor/Toolbar/PopupTool/index.js +5 -13
- package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
- package/dist/Editor/common/ImageSelector/UploadStyles.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -1
- package/dist/Editor/hooks/useDrag.js +17 -11
- package/dist/Editor/hooks/useEditorScroll.js +0 -1
- package/package.json +2 -2
@@ -91,8 +91,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
91
91
|
otherProps,
|
92
92
|
isIframe,
|
93
93
|
theme,
|
94
|
-
showViewport = false
|
95
|
-
overrideWrapperStyles = {}
|
94
|
+
showViewport = false
|
96
95
|
} = props;
|
97
96
|
const editorWrapper = useRef();
|
98
97
|
const mentionsRef = useRef();
|
@@ -153,8 +152,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
153
152
|
const classes = editorStyles({
|
154
153
|
padHeight: !fullScreen ? otherProps?.padHeight : 20,
|
155
154
|
placeHolderColor: invertColor(pageColor || "#FFF"),
|
156
|
-
theme
|
157
|
-
overrideWrapperStyles
|
155
|
+
theme
|
158
156
|
});
|
159
157
|
const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
|
160
158
|
useEffect(() => {
|
package/dist/Editor/Editor.css
CHANGED
@@ -1279,10 +1279,9 @@ blockquote {
|
|
1279
1279
|
background: none !important;
|
1280
1280
|
}
|
1281
1281
|
@media (max-width: 899px) {
|
1282
|
-
|
1283
|
-
/* .MuiPopover-root {
|
1282
|
+
.MuiPopover-root {
|
1284
1283
|
z-index: 1302 !important;
|
1285
|
-
}
|
1284
|
+
}
|
1286
1285
|
|
1287
1286
|
canvas {
|
1288
1287
|
max-width: 100% !important;
|
@@ -1,8 +1,7 @@
|
|
1
1
|
const editorStyles = ({
|
2
2
|
padHeight,
|
3
3
|
placeHolderColor,
|
4
|
-
theme
|
5
|
-
overrideWrapperStyles = {}
|
4
|
+
theme
|
6
5
|
}) => ({
|
7
6
|
root: {
|
8
7
|
display: "flex",
|
@@ -57,8 +56,7 @@ const editorStyles = ({
|
|
57
56
|
backgroundColor: "#FFF",
|
58
57
|
zIndex: 10
|
59
58
|
}
|
60
|
-
}
|
61
|
-
...overrideWrapperStyles
|
59
|
+
}
|
62
60
|
},
|
63
61
|
slateWrapper: {
|
64
62
|
paddingTop: "0px",
|
@@ -14,6 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
const PopupTool = props => {
|
15
15
|
const {
|
16
16
|
theme,
|
17
|
+
setIsTextSelected,
|
17
18
|
customProps,
|
18
19
|
editorWrapper
|
19
20
|
} = props;
|
@@ -34,12 +35,8 @@ const PopupTool = props => {
|
|
34
35
|
const {
|
35
36
|
selectedElement
|
36
37
|
} = useEditorContext();
|
37
|
-
console.log("Editor debug ====>", event, open, anchorEl, selection);
|
38
38
|
const updateAnchorEl = useCallback(() => {
|
39
39
|
try {
|
40
|
-
const {
|
41
|
-
selection
|
42
|
-
} = editor;
|
43
40
|
const isHavingSelection = selection && !Range.isCollapsed(selection);
|
44
41
|
if (isHavingSelection) {
|
45
42
|
const domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
@@ -59,7 +56,7 @@ const PopupTool = props => {
|
|
59
56
|
} catch (err) {
|
60
57
|
console.log(err);
|
61
58
|
}
|
62
|
-
}, [
|
59
|
+
}, [selection]);
|
63
60
|
useEditorScroll(editorWrapper, updateAnchorEl);
|
64
61
|
useEffect(() => {
|
65
62
|
const userStoppedSelection = size?.device === "xs" ? true : event === "end"; // for mobile, when user starts the selection, we are gonna show the popup tool
|
@@ -74,12 +71,12 @@ const PopupTool = props => {
|
|
74
71
|
if (!isCarouselEdit) {
|
75
72
|
setOpen(true);
|
76
73
|
setPopupType("textFormat");
|
77
|
-
|
74
|
+
setIsTextSelected(true);
|
78
75
|
}
|
79
76
|
} else if (!anchorEl) {
|
80
77
|
setOpen(false);
|
81
78
|
setPopupType("");
|
82
|
-
|
79
|
+
setIsTextSelected(false);
|
83
80
|
}
|
84
81
|
}, [event, anchorEl]);
|
85
82
|
useEffect(() => {
|
@@ -91,12 +88,7 @@ const PopupTool = props => {
|
|
91
88
|
}
|
92
89
|
}, [selection]);
|
93
90
|
useEffect(() => {
|
94
|
-
|
95
|
-
path,
|
96
|
-
enable
|
97
|
-
} = selectedElement || {};
|
98
|
-
const isFreeGridElement = path && path.split("|").length > 2;
|
99
|
-
if (enable === 1 && isFreeGridElement) {
|
91
|
+
if (selectedElement?.enable === 1) {
|
100
92
|
setAnchorEl(null);
|
101
93
|
}
|
102
94
|
}, [selection, selectedElement?.path, selectedElement?.enable]);
|
@@ -58,8 +58,8 @@ const useElementSettingsStyle = theme => ({
|
|
58
58
|
maxHeight: "500px",
|
59
59
|
overflowX: "hidden",
|
60
60
|
overflowY: "auto",
|
61
|
-
paddingLeft: "4px",
|
62
61
|
background: theme?.palette?.editor?.background,
|
62
|
+
paddingLeft: "4px",
|
63
63
|
"& .MuiTypography-root, .MuiInputBase-root, input": {
|
64
64
|
color: theme?.palette?.editor?.textColor
|
65
65
|
},
|
@@ -1,20 +1,26 @@
|
|
1
|
-
import {
|
1
|
+
import { useEffect, useState } from "react";
|
2
2
|
const useDrag = () => {
|
3
3
|
const [event, setEvent] = useState("");
|
4
|
-
const onMouseDown = useCallback(() => {
|
5
|
-
setEvent("start");
|
6
|
-
}, []);
|
7
|
-
const onMouseUp = useCallback(() => {
|
8
|
-
setEvent("end");
|
9
|
-
}, []);
|
10
4
|
useEffect(() => {
|
11
|
-
|
12
|
-
document.addEventListener("pointerup", onMouseUp);
|
5
|
+
addListener();
|
13
6
|
return () => {
|
14
|
-
|
15
|
-
document.removeEventListener("pointerup", onMouseUp);
|
7
|
+
removeListener();
|
16
8
|
};
|
17
9
|
}, []);
|
10
|
+
const onMouseDown = () => {
|
11
|
+
setEvent("start");
|
12
|
+
};
|
13
|
+
const onMouseUp = () => {
|
14
|
+
setEvent("end");
|
15
|
+
};
|
16
|
+
const addListener = () => {
|
17
|
+
document.addEventListener("pointerdown", onMouseDown);
|
18
|
+
document.addEventListener("pointerup", onMouseUp);
|
19
|
+
};
|
20
|
+
const removeListener = () => {
|
21
|
+
document.removeEventListener("pointerdown", onMouseDown);
|
22
|
+
document.removeEventListener("pointerup", onMouseUp);
|
23
|
+
};
|
18
24
|
return [event];
|
19
25
|
};
|
20
26
|
export default useDrag;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flozy/editor",
|
3
|
-
"version": "7.0.
|
3
|
+
"version": "7.0.3",
|
4
4
|
"description": "An Editor for flozy app brain",
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -61,7 +61,7 @@
|
|
61
61
|
"scripts": {
|
62
62
|
"prepare": "husky install .husky",
|
63
63
|
"analyze": "source-map-explorer build/static/js/*.js",
|
64
|
-
"lint": "./node_modules/.
|
64
|
+
"lint": "./node_modules/.bin/eslint --ignore-path .gitignore .",
|
65
65
|
"start": "craco start",
|
66
66
|
"build": "NODE_OPTIONS='--max_old_space_size=4096' craco build",
|
67
67
|
"test": "craco test --passWithNoTests",
|