@uiw/react-md-editor 3.20.6 → 3.20.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/README.md +3 -0
- package/dist/mdeditor.js +375 -181
- package/dist/mdeditor.min.js +1 -1
- package/esm/components/DragBar/index.js +7 -1
- package/lib/components/DragBar/index.js +7 -1
- package/package.json +1 -1
- package/src/components/DragBar/index.tsx +9 -1
|
@@ -8,6 +8,12 @@ var DragBar = props => {
|
|
|
8
8
|
} = props || {};
|
|
9
9
|
var $dom = useRef(null);
|
|
10
10
|
var dragRef = useRef();
|
|
11
|
+
var heightRef = useRef(props.height);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (heightRef.current !== props.height) {
|
|
14
|
+
heightRef.current = props.height;
|
|
15
|
+
}
|
|
16
|
+
}, [props.height]);
|
|
11
17
|
function handleMouseMove(event) {
|
|
12
18
|
if (dragRef.current) {
|
|
13
19
|
var _changedTouches$;
|
|
@@ -31,7 +37,7 @@ var DragBar = props => {
|
|
|
31
37
|
event.preventDefault();
|
|
32
38
|
var clientY = event.clientY || ((_changedTouches$2 = event.changedTouches[0]) == null ? void 0 : _changedTouches$2.clientY);
|
|
33
39
|
dragRef.current = {
|
|
34
|
-
height:
|
|
40
|
+
height: heightRef.current,
|
|
35
41
|
dragY: clientY
|
|
36
42
|
};
|
|
37
43
|
document.addEventListener('mousemove', handleMouseMove);
|
|
@@ -13,6 +13,12 @@ var DragBar = function DragBar(props) {
|
|
|
13
13
|
onChange = _ref.onChange;
|
|
14
14
|
var $dom = (0, _react.useRef)(null);
|
|
15
15
|
var dragRef = (0, _react.useRef)();
|
|
16
|
+
var heightRef = (0, _react.useRef)(props.height);
|
|
17
|
+
(0, _react.useEffect)(function () {
|
|
18
|
+
if (heightRef.current !== props.height) {
|
|
19
|
+
heightRef.current = props.height;
|
|
20
|
+
}
|
|
21
|
+
}, [props.height]);
|
|
16
22
|
function handleMouseMove(event) {
|
|
17
23
|
if (dragRef.current) {
|
|
18
24
|
var _changedTouches$;
|
|
@@ -36,7 +42,7 @@ var DragBar = function DragBar(props) {
|
|
|
36
42
|
event.preventDefault();
|
|
37
43
|
var clientY = event.clientY || ((_changedTouches$2 = event.changedTouches[0]) === null || _changedTouches$2 === void 0 ? void 0 : _changedTouches$2.clientY);
|
|
38
44
|
dragRef.current = {
|
|
39
|
-
height:
|
|
45
|
+
height: heightRef.current,
|
|
40
46
|
dragY: clientY
|
|
41
47
|
};
|
|
42
48
|
document.addEventListener('mousemove', handleMouseMove);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uiw/react-md-editor",
|
|
3
|
-
"version": "3.20.
|
|
3
|
+
"version": "3.20.7",
|
|
4
4
|
"description": "A markdown editor with preview, implemented with React.js and TypeScript.",
|
|
5
5
|
"homepage": "https://uiwjs.github.io/react-md-editor/",
|
|
6
6
|
"author": "kenny wang <wowohoo@qq.com>",
|
|
@@ -13,6 +13,14 @@ const DragBar: React.FC<IDragBarProps> = (props) => {
|
|
|
13
13
|
const { prefixCls, onChange } = props || {};
|
|
14
14
|
const $dom = useRef<HTMLDivElement>(null);
|
|
15
15
|
const dragRef = useRef<{ height: number; dragY: number }>();
|
|
16
|
+
const heightRef = useRef(props.height);
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (heightRef.current !== props.height) {
|
|
20
|
+
heightRef.current = props.height;
|
|
21
|
+
}
|
|
22
|
+
}, [props.height]);
|
|
23
|
+
|
|
16
24
|
function handleMouseMove(event: Event) {
|
|
17
25
|
if (dragRef.current) {
|
|
18
26
|
const clientY =
|
|
@@ -35,7 +43,7 @@ const DragBar: React.FC<IDragBarProps> = (props) => {
|
|
|
35
43
|
const clientY =
|
|
36
44
|
(event as unknown as MouseEvent).clientY || (event as unknown as TouchEvent).changedTouches[0]?.clientY;
|
|
37
45
|
dragRef.current = {
|
|
38
|
-
height:
|
|
46
|
+
height: heightRef.current,
|
|
39
47
|
dragY: clientY,
|
|
40
48
|
};
|
|
41
49
|
document.addEventListener('mousemove', handleMouseMove);
|