@flozy/editor 3.1.1 → 3.1.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.
|
@@ -107,7 +107,8 @@ const EditorButton = props => {
|
|
|
107
107
|
break;
|
|
108
108
|
case "page":
|
|
109
109
|
props.component = "a";
|
|
110
|
-
|
|
110
|
+
const [page, section] = url.split("#");
|
|
111
|
+
props.href = page === "home" ? `#${section}` : `/${url}`;
|
|
111
112
|
if (openInNewTab) {
|
|
112
113
|
props.target = "_blank";
|
|
113
114
|
}
|
|
@@ -180,7 +181,7 @@ const EditorButton = props => {
|
|
|
180
181
|
onClick: onMenuClick("nav"),
|
|
181
182
|
children: /*#__PURE__*/_jsx(LinkIcon, {})
|
|
182
183
|
})
|
|
183
|
-
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
184
|
+
}), linkType === "page" ? null : /*#__PURE__*/_jsx(Tooltip, {
|
|
184
185
|
title: "Open Link",
|
|
185
186
|
arrow: true,
|
|
186
187
|
children: /*#__PURE__*/_jsx(Box, {
|
|
@@ -6,7 +6,7 @@ import { IconButton, Tooltip, Grid as GridContainer } from "@mui/material";
|
|
|
6
6
|
import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
|
|
7
7
|
import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
|
|
8
8
|
import KeyboardReturnIcon from "@mui/icons-material/KeyboardReturn";
|
|
9
|
-
import ContentCopyIcon from
|
|
9
|
+
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
|
|
10
10
|
import { insertGrid } from "../../utils/grid";
|
|
11
11
|
import { GridAddGridIcon, GridSettingsIcon } from "../../common/iconslist";
|
|
12
12
|
import GridPopup from "./GridPopup";
|
|
@@ -155,7 +155,8 @@ const Grid = props => {
|
|
|
155
155
|
const onNewLine = direction => () => {
|
|
156
156
|
try {
|
|
157
157
|
if (direction) {
|
|
158
|
-
|
|
158
|
+
const path = ReactEditor.findPath(editor, element);
|
|
159
|
+
let moveTo = direction === "up" ? path : Path.next(path);
|
|
159
160
|
let lastLine = false;
|
|
160
161
|
if (moveTo < 0) {
|
|
161
162
|
moveTo = 0;
|
|
@@ -169,7 +170,8 @@ const Grid = props => {
|
|
|
169
170
|
text: ""
|
|
170
171
|
}]
|
|
171
172
|
}, {
|
|
172
|
-
at: [moveTo]
|
|
173
|
+
at: [...moveTo],
|
|
174
|
+
select: true
|
|
173
175
|
});
|
|
174
176
|
if (lastLine) {
|
|
175
177
|
Transforms.move(editor, {
|
|
@@ -5,7 +5,6 @@ import DownArrowIcon from "../../../assets/svg/DownArrowIcon";
|
|
|
5
5
|
import useWindowResize from "../../../hooks/useWindowResize";
|
|
6
6
|
import { BREAKPOINTS_DEVICES, getBreakPointsValue } from "../../../helper/theme";
|
|
7
7
|
import { headingMap, sizeMap } from "../../../utils/font";
|
|
8
|
-
import { useDebounce } from "use-debounce";
|
|
9
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
10
|
const fontSizeOptions = [16, 18, 20, 22, 26, 32, 36, 40, 48, 64, 96, 128];
|
|
@@ -21,7 +20,7 @@ function SelectFontSize({
|
|
|
21
20
|
const [size] = useWindowResize();
|
|
22
21
|
const val = activeMark(editor, format);
|
|
23
22
|
const value = getBreakPointsValue(val, size?.device);
|
|
24
|
-
const
|
|
23
|
+
const timerRef = useRef();
|
|
25
24
|
const updateMarkData = newVal => {
|
|
26
25
|
let upData = {
|
|
27
26
|
...getBreakPointsValue(val),
|
|
@@ -52,11 +51,6 @@ function SelectFontSize({
|
|
|
52
51
|
setFontSize(null);
|
|
53
52
|
}
|
|
54
53
|
};
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (deboundedValue) {
|
|
57
|
-
onChangeSize(deboundedValue);
|
|
58
|
-
}
|
|
59
|
-
}, [deboundedValue]);
|
|
60
54
|
const getSizeVal = () => {
|
|
61
55
|
try {
|
|
62
56
|
let size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
|
|
@@ -73,6 +67,14 @@ function SelectFontSize({
|
|
|
73
67
|
useEffect(() => {
|
|
74
68
|
setFontSize(getSizeVal());
|
|
75
69
|
}, [value]);
|
|
70
|
+
const onChange = e => {
|
|
71
|
+
clearTimeout(timerRef.current);
|
|
72
|
+
const value = e.target.value;
|
|
73
|
+
setFontSize(value);
|
|
74
|
+
timerRef.current = setTimeout(() => {
|
|
75
|
+
onChangeSize(value);
|
|
76
|
+
}, 500);
|
|
77
|
+
};
|
|
76
78
|
return /*#__PURE__*/_jsxs("div", {
|
|
77
79
|
ref: containerRef,
|
|
78
80
|
style: {
|
|
@@ -82,7 +84,7 @@ function SelectFontSize({
|
|
|
82
84
|
children: [/*#__PURE__*/_jsx(TextField, {
|
|
83
85
|
sx: classes?.miniFontSizeInput,
|
|
84
86
|
value: fontSize,
|
|
85
|
-
onChange:
|
|
87
|
+
onChange: onChange,
|
|
86
88
|
size: "small"
|
|
87
89
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
88
90
|
onClick: e => {
|
|
@@ -105,6 +107,7 @@ function SelectFontSize({
|
|
|
105
107
|
className: `customSelectOptionLabel ${fontSize === s ? "selected" : ""}`,
|
|
106
108
|
onClick: () => {
|
|
107
109
|
setFontSize(s);
|
|
110
|
+
onChangeSize(s);
|
|
108
111
|
},
|
|
109
112
|
children: s
|
|
110
113
|
})
|