@flozy/editor 3.2.0 → 3.2.2
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/Embed/Image.js +1 -1
- package/dist/Editor/Elements/Table/TableCell.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +0 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +1 -1
- package/dist/Editor/common/Shorthands/elements.js +2 -0
- package/dist/Editor/common/StyleBuilder/index.js +31 -12
- package/dist/Editor/hooks/useDragDom.js +10 -8
- package/dist/Editor/utils/SlateUtilityFunctions.js +17 -13
- package/dist/Editor/utils/helper.js +1 -1
- package/package.json +1 -1
|
@@ -183,7 +183,7 @@ const Image = ({
|
|
|
183
183
|
opacity: frame ? 0 : 1,
|
|
184
184
|
cursor: webAddress ? "pointer" : "",
|
|
185
185
|
border: `1px solid ${borderColor}`,
|
|
186
|
-
borderWidth: borderWidth
|
|
186
|
+
borderWidth: `${borderWidth}`?.includes('px') ? borderWidth : `${borderWidth}px`
|
|
187
187
|
},
|
|
188
188
|
alt: alt,
|
|
189
189
|
src: url,
|
|
@@ -125,7 +125,7 @@ const TableCell = props => {
|
|
|
125
125
|
classes: classes,
|
|
126
126
|
onMouseDown: onMouseDown,
|
|
127
127
|
height: tableDOM.getBoundingClientRect()?.height
|
|
128
|
-
}) : null, hasSelected ? /*#__PURE__*/_jsx("div", {
|
|
128
|
+
}) : null, hasSelected && !readOnly ? /*#__PURE__*/_jsx("div", {
|
|
129
129
|
className: "selection-area-tc",
|
|
130
130
|
contentEditable: false
|
|
131
131
|
}) : null]
|
|
@@ -540,7 +540,7 @@ const usePopupStyle = theme => ({
|
|
|
540
540
|
lineHeight: "1.75 !important",
|
|
541
541
|
fontWeight: 400,
|
|
542
542
|
background: theme?.palette?.editor?.background,
|
|
543
|
-
"
|
|
543
|
+
"&:hover": {
|
|
544
544
|
background: `${theme?.palette?.action?.selected} !important`
|
|
545
545
|
},
|
|
546
546
|
"&.selected": {
|
|
@@ -10,6 +10,7 @@ import { TableUtil } from "../../utils/table";
|
|
|
10
10
|
import Icon from "../Icon";
|
|
11
11
|
import EmojiButton from "../../Elements/Emoji/EmojiButton";
|
|
12
12
|
import { insertDivider } from "../../utils/divider";
|
|
13
|
+
import { Transforms } from "slate";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
const ELEMENTS_LIST = [{
|
|
15
16
|
name: "Heading 1",
|
|
@@ -175,6 +176,7 @@ const ELEMENTS_LIST = [{
|
|
|
175
176
|
icon: "accordion"
|
|
176
177
|
}),
|
|
177
178
|
onInsert: editor => {
|
|
179
|
+
Transforms.delete(editor, editor.selection); // remove text '/accordion' typed by user
|
|
178
180
|
insertAccordion(editor);
|
|
179
181
|
}
|
|
180
182
|
}, {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
-
import { DialogTitle, DialogContent, DialogActions, Button, Grid, IconButton, Typography, Drawer } from "@mui/material";
|
|
2
|
+
import { DialogTitle, DialogContent, DialogActions, Button, Grid, IconButton, Typography, Drawer, SwipeableDrawer } from "@mui/material";
|
|
3
3
|
import FieldMap from "./fieldTypes";
|
|
4
4
|
import CloseIcon from "@mui/icons-material/Close";
|
|
5
5
|
import useCommonStyle from "../../commonStyle";
|
|
6
6
|
import { useEditorContext } from "../../hooks/useMouseMove";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
10
|
const StyleContent = props => {
|
|
10
11
|
const {
|
|
11
12
|
value,
|
|
@@ -61,6 +62,9 @@ const StyleBuilder = props => {
|
|
|
61
62
|
theme
|
|
62
63
|
} = useEditorContext();
|
|
63
64
|
const classes = useCommonStyle(theme);
|
|
65
|
+
const {
|
|
66
|
+
isMobile = false
|
|
67
|
+
} = customProps;
|
|
64
68
|
const [elementProps, setElementProps] = useState(element);
|
|
65
69
|
const [tab] = useState(renderTabs[0]?.value);
|
|
66
70
|
const tabVal = renderTabs?.find(f => f.value === tab);
|
|
@@ -100,16 +104,8 @@ const StyleBuilder = props => {
|
|
|
100
104
|
const handleClose = () => {
|
|
101
105
|
onClose();
|
|
102
106
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
className: ` dialogComp tools-drawer`,
|
|
106
|
-
anchor: "right",
|
|
107
|
-
onClose: onClose,
|
|
108
|
-
style: {
|
|
109
|
-
zIndex: "1300"
|
|
110
|
-
},
|
|
111
|
-
sx: classes.sideBarDrawer,
|
|
112
|
-
children: /*#__PURE__*/_jsxs(Grid, {
|
|
107
|
+
const renderDrawerMenu = () => {
|
|
108
|
+
return /*#__PURE__*/_jsxs(Grid, {
|
|
113
109
|
item: true,
|
|
114
110
|
xs: 12,
|
|
115
111
|
sx: {
|
|
@@ -143,7 +139,7 @@ const StyleBuilder = props => {
|
|
|
143
139
|
})
|
|
144
140
|
}), /*#__PURE__*/_jsx(DialogContent, {
|
|
145
141
|
sx: {
|
|
146
|
-
maxHeight: `${window.innerHeight - 125}px`,
|
|
142
|
+
maxHeight: isMobile ? `500px` : `${window.innerHeight - 125}px`,
|
|
147
143
|
padding: "8px"
|
|
148
144
|
},
|
|
149
145
|
children: renderTabs.map((m, i) => {
|
|
@@ -173,6 +169,29 @@ const StyleBuilder = props => {
|
|
|
173
169
|
children: "Save"
|
|
174
170
|
})]
|
|
175
171
|
}) : null]
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
175
|
+
children: isMobile ? /*#__PURE__*/_jsx(SwipeableDrawer, {
|
|
176
|
+
open: true,
|
|
177
|
+
className: ` dialogComp tools-drawer`,
|
|
178
|
+
anchor: "bottom",
|
|
179
|
+
onClose: onClose,
|
|
180
|
+
style: {
|
|
181
|
+
zIndex: "1300"
|
|
182
|
+
},
|
|
183
|
+
sx: classes.bottomBarDrawer,
|
|
184
|
+
children: renderDrawerMenu()
|
|
185
|
+
}) : /*#__PURE__*/_jsx(Drawer, {
|
|
186
|
+
open: true,
|
|
187
|
+
className: ` dialogComp tools-drawer`,
|
|
188
|
+
anchor: "right",
|
|
189
|
+
onClose: onClose,
|
|
190
|
+
style: {
|
|
191
|
+
zIndex: "1300"
|
|
192
|
+
},
|
|
193
|
+
sx: classes.sideBarDrawer,
|
|
194
|
+
children: renderDrawerMenu()
|
|
176
195
|
})
|
|
177
196
|
});
|
|
178
197
|
};
|
|
@@ -20,7 +20,7 @@ const useDragDom = props => {
|
|
|
20
20
|
removeListener();
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
}, [refDom]);
|
|
23
|
+
}, [refDom, event]);
|
|
24
24
|
const onMouseDown = e => {
|
|
25
25
|
ePos.x = e.x;
|
|
26
26
|
ePos.y = e.y;
|
|
@@ -39,16 +39,18 @@ const useDragDom = props => {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
const onMouseUp = e => {
|
|
42
|
-
setEvent("end");
|
|
43
|
-
ePos.x = 0;
|
|
44
|
-
ePos.y = 0;
|
|
45
42
|
if (event === "start") {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
setEvent("end");
|
|
44
|
+
ePos.x = 0;
|
|
45
|
+
ePos.y = 0;
|
|
46
|
+
|
|
47
|
+
// setDelta({
|
|
48
|
+
// x: e.x - ePos.x,
|
|
49
|
+
// y: e.y - ePos.y,
|
|
50
|
+
// });
|
|
50
51
|
}
|
|
51
52
|
};
|
|
53
|
+
|
|
52
54
|
const onClear = () => {
|
|
53
55
|
setDelta({
|
|
54
56
|
x: 0,
|
|
@@ -211,20 +211,24 @@ export const getMarked = (leaf, children) => {
|
|
|
211
211
|
} : {
|
|
212
212
|
color: leaf.color
|
|
213
213
|
};
|
|
214
|
-
children = /*#__PURE__*/_jsx(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
sx: {
|
|
218
|
-
fontSize: {
|
|
219
|
-
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
|
220
|
-
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
|
221
|
-
},
|
|
222
|
-
background: leaf.bgColor,
|
|
223
|
-
...textStyles,
|
|
224
|
-
fontFamily: family,
|
|
225
|
-
fontWeight: leaf.fontWeight
|
|
214
|
+
children = /*#__PURE__*/_jsx("span", {
|
|
215
|
+
style: {
|
|
216
|
+
background: leaf.bgColor
|
|
226
217
|
},
|
|
227
|
-
children:
|
|
218
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
219
|
+
className: className,
|
|
220
|
+
component: "span",
|
|
221
|
+
sx: {
|
|
222
|
+
fontSize: {
|
|
223
|
+
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
|
224
|
+
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
|
225
|
+
},
|
|
226
|
+
...textStyles,
|
|
227
|
+
fontFamily: family,
|
|
228
|
+
fontWeight: leaf.fontWeight
|
|
229
|
+
},
|
|
230
|
+
children: children
|
|
231
|
+
})
|
|
228
232
|
});
|
|
229
233
|
}
|
|
230
234
|
if (leaf.decoration === "link") {
|
|
@@ -235,7 +235,7 @@ 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
|
-
props.href = page === "home" ? sec : `/${url}`;
|
|
238
|
+
props.href = page === "home" ? `/${sec}` : `/${url}`;
|
|
239
239
|
if (openInNewTab) {
|
|
240
240
|
props.target = "_blank";
|
|
241
241
|
}
|