@flozy/editor 10.8.6 → 10.8.7
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/Toolbar/FormatTools/TextSize.js +23 -16
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +17 -10
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -2
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +8 -2
- package/package.json +1 -1
@@ -8,13 +8,19 @@ import { TextSizeDownArrow, TextSizeUpArrow } from "../../common/iconListV2.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
11
|
-
const TextSize =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
const TextSize = props => {
|
12
|
+
const {
|
13
|
+
classes,
|
14
|
+
editor,
|
15
|
+
format,
|
16
|
+
fullWidth,
|
17
|
+
fromMiniTextFormat,
|
18
|
+
setResizedSize,
|
19
|
+
resizedSize
|
20
|
+
} = props;
|
17
21
|
const [fontSize, setFontSize] = useState();
|
22
|
+
const sizeValue = fromMiniTextFormat ? resizedSize : fontSize;
|
23
|
+
const setSizeValue = fromMiniTextFormat ? setResizedSize : setFontSize;
|
18
24
|
const timerRef = useRef();
|
19
25
|
const [size] = useWindowResize();
|
20
26
|
const val = activeMark(editor, format);
|
@@ -24,7 +30,7 @@ const TextSize = ({
|
|
24
30
|
|
25
31
|
const value = getTextSizeVal(editor);
|
26
32
|
useEffect(() => {
|
27
|
-
|
33
|
+
setSizeValue(getSizeVal());
|
28
34
|
}, [value]);
|
29
35
|
const updateMarkData = newVal => {
|
30
36
|
let upData = {
|
@@ -51,9 +57,10 @@ const TextSize = ({
|
|
51
57
|
if (value) {
|
52
58
|
let inc = parseInt(value);
|
53
59
|
inc = inc > 200 ? 200 : inc;
|
60
|
+
setSizeValue(inc);
|
54
61
|
updateMarkData(inc);
|
55
62
|
} else {
|
56
|
-
|
63
|
+
setSizeValue(null);
|
57
64
|
}
|
58
65
|
};
|
59
66
|
const getSizeVal = () => {
|
@@ -63,20 +70,20 @@ const TextSize = ({
|
|
63
70
|
return "";
|
64
71
|
}
|
65
72
|
};
|
66
|
-
const combinedOldVal = getSizeVal();
|
67
73
|
const onIncreaseSize = () => {
|
68
|
-
|
69
|
-
|
70
|
-
updateMarkData(
|
74
|
+
const newValue = Math.min((sizeValue || 16) + 1, 200);
|
75
|
+
setSizeValue(newValue);
|
76
|
+
updateMarkData(newValue);
|
71
77
|
};
|
72
78
|
const onDecreaseSize = () => {
|
73
|
-
const
|
74
|
-
|
79
|
+
const newValue = sizeValue ? Math.max(sizeValue - 1, 1) : 16;
|
80
|
+
setSizeValue(newValue);
|
81
|
+
updateMarkData(newValue);
|
75
82
|
};
|
76
83
|
const onChange = e => {
|
77
84
|
clearTimeout(timerRef.current);
|
78
85
|
const value = e.target.value;
|
79
|
-
|
86
|
+
setSizeValue(value);
|
80
87
|
timerRef.current = setTimeout(() => {
|
81
88
|
onChangeSize(value);
|
82
89
|
}, 500);
|
@@ -84,7 +91,7 @@ const TextSize = ({
|
|
84
91
|
return /*#__PURE__*/_jsx(_Fragment, {
|
85
92
|
children: /*#__PURE__*/_jsx(TextField, {
|
86
93
|
sx: classes?.textSize,
|
87
|
-
value:
|
94
|
+
value: sizeValue || 16,
|
88
95
|
onChange: onChange,
|
89
96
|
size: "small",
|
90
97
|
inputProps: {
|
@@ -7,12 +7,18 @@ import { BREAKPOINTS_DEVICES, getBreakPointsValue, getTextSizeVal } from "../../
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
9
|
const fontSizeOptions = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 26, 32, 36, 40, 48, 64, 96, 128];
|
10
|
-
function SelectFontSize({
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
function SelectFontSize(props) {
|
11
|
+
const {
|
12
|
+
editor,
|
13
|
+
classes,
|
14
|
+
fromMiniTextFormat,
|
15
|
+
setResizedSize,
|
16
|
+
resizedSize
|
17
|
+
} = props;
|
14
18
|
const format = "fontSize";
|
15
19
|
const [fontSize, setFontSize] = useState();
|
20
|
+
const sizeValue = fromMiniTextFormat ? resizedSize : fontSize;
|
21
|
+
const setSizeValue = fromMiniTextFormat ? setResizedSize : setFontSize;
|
16
22
|
const [anchorEl, setAnchorEl] = useState(null);
|
17
23
|
const open = Boolean(anchorEl);
|
18
24
|
const containerRef = useRef();
|
@@ -45,9 +51,10 @@ function SelectFontSize({
|
|
45
51
|
if (value) {
|
46
52
|
let inc = parseInt(value);
|
47
53
|
inc = inc > 200 ? 200 : inc;
|
54
|
+
setSizeValue(inc);
|
48
55
|
updateMarkData(inc);
|
49
56
|
} else {
|
50
|
-
|
57
|
+
setSizeValue(null);
|
51
58
|
}
|
52
59
|
};
|
53
60
|
const getSizeVal = () => {
|
@@ -58,12 +65,12 @@ function SelectFontSize({
|
|
58
65
|
}
|
59
66
|
};
|
60
67
|
useEffect(() => {
|
61
|
-
|
68
|
+
setSizeValue(getSizeVal());
|
62
69
|
}, [value]);
|
63
70
|
const onChange = e => {
|
64
71
|
clearTimeout(timerRef.current);
|
65
72
|
const value = e.target.value;
|
66
|
-
|
73
|
+
setSizeValue(value);
|
67
74
|
timerRef.current = setTimeout(() => {
|
68
75
|
onChangeSize(value);
|
69
76
|
}, 500);
|
@@ -76,7 +83,7 @@ function SelectFontSize({
|
|
76
83
|
},
|
77
84
|
children: [/*#__PURE__*/_jsx(TextField, {
|
78
85
|
sx: classes?.miniFontSizeInput,
|
79
|
-
value:
|
86
|
+
value: sizeValue,
|
80
87
|
onChange: onChange,
|
81
88
|
size: "small"
|
82
89
|
}), /*#__PURE__*/_jsx(IconButton, {
|
@@ -97,9 +104,9 @@ function SelectFontSize({
|
|
97
104
|
children: fontSizeOptions.map((s, i) => {
|
98
105
|
return /*#__PURE__*/_jsx("div", {
|
99
106
|
children: /*#__PURE__*/_jsx(Button, {
|
100
|
-
className: `customSelectOptionLabel ${
|
107
|
+
className: `customSelectOptionLabel ${sizeValue === s ? "selected" : ""}`,
|
101
108
|
onClick: () => {
|
102
|
-
|
109
|
+
setSizeValue(s);
|
103
110
|
onChangeSize(s);
|
104
111
|
},
|
105
112
|
children: s
|
@@ -34,6 +34,7 @@ const MiniTextFormat = props => {
|
|
34
34
|
const [anchorEl, setAnchorEl] = useState(null);
|
35
35
|
const open = Boolean(anchorEl);
|
36
36
|
const id = open ? "popup-edit-tool" : "";
|
37
|
+
const [resizedSize, setResizedSize] = useState();
|
37
38
|
const [size] = useWindowResize();
|
38
39
|
const theme = useTheme();
|
39
40
|
const listType = getListType(editor);
|
@@ -84,7 +85,10 @@ const MiniTextFormat = props => {
|
|
84
85
|
className: "verticalLine mr-1"
|
85
86
|
}), /*#__PURE__*/_jsx(SelectFontSize, {
|
86
87
|
classes: classes,
|
87
|
-
editor: editor
|
88
|
+
editor: editor,
|
89
|
+
fromMiniTextFormat: true,
|
90
|
+
setResizedSize: setResizedSize,
|
91
|
+
resizedSize: resizedSize
|
88
92
|
}), /*#__PURE__*/_jsx("div", {
|
89
93
|
className: "verticalLine mr-1"
|
90
94
|
}), fontStyle?.map((m, i) => {
|
@@ -147,7 +151,10 @@ const MiniTextFormat = props => {
|
|
147
151
|
classes: classes,
|
148
152
|
closeMainPopup: closeMainPopup,
|
149
153
|
customProps: customProps,
|
150
|
-
commonProps: commonProps
|
154
|
+
commonProps: commonProps,
|
155
|
+
fromMiniTextFormat: true,
|
156
|
+
setResizedSize: setResizedSize,
|
157
|
+
resizedSize: resizedSize
|
151
158
|
})]
|
152
159
|
})
|
153
160
|
})
|
@@ -32,7 +32,10 @@ const TextFormat = props => {
|
|
32
32
|
onClose,
|
33
33
|
closeMainPopup,
|
34
34
|
customProps,
|
35
|
-
commonProps
|
35
|
+
commonProps,
|
36
|
+
setResizedSize,
|
37
|
+
resizedSize,
|
38
|
+
fromMiniTextFormat
|
36
39
|
} = props;
|
37
40
|
const [anchorEl, setAnchorEl] = useState(null);
|
38
41
|
const [type, setType] = useState(null);
|
@@ -252,7 +255,10 @@ const TextFormat = props => {
|
|
252
255
|
format: "fontSize",
|
253
256
|
activeMark: activeMark,
|
254
257
|
editor: editor,
|
255
|
-
fullWidth: true
|
258
|
+
fullWidth: true,
|
259
|
+
fromMiniTextFormat: fromMiniTextFormat,
|
260
|
+
setResizedSize: setResizedSize,
|
261
|
+
resizedSize: resizedSize
|
256
262
|
})
|
257
263
|
})]
|
258
264
|
})]
|