@flozy/editor 4.1.3 → 4.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +13 -8
- package/dist/Editor/Elements/Embed/Frames/ImageFrame.js +24 -9
- package/dist/Editor/Elements/Embed/Image.js +1 -0
- package/dist/Editor/Elements/FreeGrid/Options/sectionItemOptions.js +1 -1
- package/dist/Editor/Elements/FreeGrid/styles.js +5 -0
- package/dist/Editor/common/RnD/ElementOptions/Actions.js +7 -0
- package/dist/Editor/common/RnD/index.js +8 -0
- package/package.json +1 -1
@@ -426,16 +426,21 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
426
426
|
};
|
427
427
|
const handleCursorScroll = container => {
|
428
428
|
try {
|
429
|
-
const
|
430
|
-
|
431
|
-
|
432
|
-
container
|
433
|
-
|
434
|
-
|
435
|
-
|
429
|
+
const selection = window?.getSelection();
|
430
|
+
if (selection && selection.rangeCount > 0) {
|
431
|
+
const cursorPosition = selection.getRangeAt(0)?.getBoundingClientRect();
|
432
|
+
const containerBottom = container?.getBoundingClientRect()?.bottom;
|
433
|
+
if (cursorPosition && cursorPosition.bottom > containerBottom - 250) {
|
434
|
+
container?.scrollBy({
|
435
|
+
top: 200,
|
436
|
+
behavior: "smooth"
|
437
|
+
});
|
438
|
+
}
|
439
|
+
} else {
|
440
|
+
console.warn('No valid selection range found');
|
436
441
|
}
|
437
442
|
} catch (err) {
|
438
|
-
console.log(err);
|
443
|
+
console.log('handleCursorScroll', err);
|
439
444
|
}
|
440
445
|
};
|
441
446
|
return /*#__PURE__*/_jsx(EditorProvider, {
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
2
|
-
import useDragDom from "../../../hooks/useDragDom";
|
3
2
|
import { IconButton, Popper } from "@mui/material";
|
4
3
|
import Box from "@mui/material/Box";
|
5
4
|
import ContinuousSlider from "./Slider";
|
6
|
-
import frames from ".";
|
7
5
|
import { useEditorContext } from "../../../hooks/useMouseMove";
|
8
6
|
import { CloseIcon } from "../../../common/iconslist";
|
7
|
+
import useDragDom from "../../../hooks/useDragDom";
|
9
8
|
import FramesStyles from "./Styles";
|
9
|
+
import frames from ".";
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
12
12
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -48,18 +48,28 @@ const ImageFrame = props => {
|
|
48
48
|
const SVGFrame = frame ? frames[frame] : null;
|
49
49
|
const {
|
50
50
|
selectedPath,
|
51
|
-
setSelectedPath
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
theme
|
51
|
+
setSelectedPath,
|
52
|
+
selectedElement,
|
53
|
+
theme,
|
54
|
+
setSelectedElement
|
56
55
|
} = useEditorContext();
|
56
|
+
const freeGridItemPath = `${selectedElement?.path?.split("|")?.join(",")},0`;
|
57
|
+
const isFreegridSelection = freeGridItemPath === id;
|
58
|
+
const open = (selectedPath === id || isFreegridSelection) && Boolean(anchorEl);
|
57
59
|
const classes = FramesStyles(theme);
|
58
60
|
useEffect(() => {
|
59
61
|
if (imageRef?.current && !readOnly) {
|
60
62
|
setDOM(dom);
|
61
63
|
}
|
62
64
|
}, [imageRef]);
|
65
|
+
useEffect(() => {
|
66
|
+
if (svgRef?.current && selectedElement?.selectedAction === "imageFrame") {
|
67
|
+
const imageFrameDom = document.getElementById(`opt_ref_${selectedElement?.path}`);
|
68
|
+
setAnchorEl(imageFrameDom);
|
69
|
+
} else {
|
70
|
+
setAnchorEl(null);
|
71
|
+
}
|
72
|
+
}, [isFreegridSelection, svgRef?.current, selectedElement?.selectedAction]);
|
63
73
|
useEffect(() => {
|
64
74
|
if (event === "end" && !readOnly) {
|
65
75
|
onChange({
|
@@ -97,6 +107,11 @@ const ImageFrame = props => {
|
|
97
107
|
const handleClose = () => {
|
98
108
|
setAnchorEl(null);
|
99
109
|
setSelectedPath(null);
|
110
|
+
setSelectedElement({
|
111
|
+
...selectedElement,
|
112
|
+
enable: 1,
|
113
|
+
selectedAction: null
|
114
|
+
});
|
100
115
|
};
|
101
116
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
102
117
|
children: [/*#__PURE__*/_jsx(SVGFrame, {
|
@@ -118,8 +133,8 @@ const ImageFrame = props => {
|
|
118
133
|
sx: {
|
119
134
|
zIndex: 100
|
120
135
|
},
|
121
|
-
placement: "top",
|
122
|
-
disablePortal:
|
136
|
+
placement: isFreegridSelection ? "bottom" : "top",
|
137
|
+
disablePortal: false,
|
123
138
|
children: /*#__PURE__*/_jsxs(Box, {
|
124
139
|
sx: classes?.sliderContainer,
|
125
140
|
children: [/*#__PURE__*/_jsx(ContinuousSlider, {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
const commonOptions = ["drag", "edit", "settings", "saveAsTemplate", "close"];
|
2
2
|
const textOptions = ["edit", "settings", "link", "saveAsTemplate", "close"];
|
3
3
|
const buttonOptions = ["settings", "link", "saveAsTemplate", "close"];
|
4
|
-
const imageOptions = ["settings", "link", "saveAsTemplate", "close"];
|
4
|
+
const imageOptions = ["settings", "link", "imageFrame", "saveAsTemplate", "close"];
|
5
5
|
const boxOptions = ["settings", "link", "saveAsTemplate", "close"];
|
6
6
|
const appHeaderOptions = ["settings", "saveAsTemplate", "close"];
|
7
7
|
const tableOptions = ["drag", "edit", "settings", "saveAsTemplate", "close"];
|
@@ -11,6 +11,7 @@ import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
|
|
11
11
|
import SaveIcon from "@mui/icons-material/Save";
|
12
12
|
import LinkIcon from "./Icons/LinkIcon";
|
13
13
|
import CodeIcon from "@mui/icons-material/Code";
|
14
|
+
import FilterFramesIcon from "@mui/icons-material/FilterFrames";
|
14
15
|
import { GridAddSectionIcon, WorkflowIcon } from "../../iconslist";
|
15
16
|
const Actions = {
|
16
17
|
ai: {
|
@@ -104,6 +105,12 @@ const Actions = {
|
|
104
105
|
Button: IconButton,
|
105
106
|
Icon: SaveIcon,
|
106
107
|
title: "Save As Template"
|
108
|
+
},
|
109
|
+
imageFrame: {
|
110
|
+
type: "imageFrame",
|
111
|
+
Button: IconButton,
|
112
|
+
Icon: FilterFramesIcon,
|
113
|
+
title: "Image Frame Settings"
|
107
114
|
}
|
108
115
|
};
|
109
116
|
export default Actions;
|
@@ -236,6 +236,14 @@ const RnD = props => {
|
|
236
236
|
selectedActionPath: path
|
237
237
|
});
|
238
238
|
break;
|
239
|
+
case "imageFrame":
|
240
|
+
setSelectedElement({
|
241
|
+
...selectedElementProps,
|
242
|
+
enable: 2,
|
243
|
+
selectedAction: actionType,
|
244
|
+
selectedActionPath: path
|
245
|
+
});
|
246
|
+
break;
|
239
247
|
case "saveAsTemplate":
|
240
248
|
const curPath = type === "parent" ? Path.parent(path) : path;
|
241
249
|
const currentNode = Node.get(editor, curPath);
|