@uiw/react-md-editor 3.20.6 → 3.20.8
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 +393 -196
- package/dist/mdeditor.min.js +1 -1
- package/dist/mdeditor.min.js.LICENSE.txt +12 -10
- package/esm/components/DragBar/index.js +7 -1
- package/esm/components/TextArea/Markdown.js +8 -8
- package/lib/components/DragBar/index.js +7 -1
- package/lib/components/TextArea/Markdown.js +8 -10
- package/package.json +1 -1
- package/src/components/DragBar/index.tsx +9 -1
- package/src/components/TextArea/Markdown.tsx +11 -9
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* @uiw/copy-to-clipboard v1.0.12
|
|
3
|
-
* Copy to clipboard.
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2021 Kenny Wang
|
|
6
|
-
* https://github.com/uiwjs/copy-to-clipboard.git
|
|
7
|
-
*
|
|
8
|
-
* Licensed under the MIT license.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
1
|
/*!
|
|
12
2
|
* Determine if an object is a Buffer
|
|
13
3
|
*
|
|
@@ -34,3 +24,15 @@
|
|
|
34
24
|
* This source code is licensed under the MIT license found in the
|
|
35
25
|
* LICENSE file in the root directory of this source tree.
|
|
36
26
|
*/
|
|
27
|
+
|
|
28
|
+
/**!
|
|
29
|
+
* @uiw/copy-to-clipboard v1.0.14
|
|
30
|
+
* Copy to clipboard.
|
|
31
|
+
*
|
|
32
|
+
* Copyright (c) 2023 Kenny Wang
|
|
33
|
+
* https://github.com/uiwjs/copy-to-clipboard.git
|
|
34
|
+
*
|
|
35
|
+
* @website: https://uiwjs.github.io/copy-to-clipboard
|
|
36
|
+
|
|
37
|
+
* Licensed under the MIT license
|
|
38
|
+
*/
|
|
@@ -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);
|
|
@@ -6,14 +6,14 @@ import rehypePrism from 'rehype-prism-plus';
|
|
|
6
6
|
import { EditorContext } from '../../Context';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
function html2Escape(sHtml) {
|
|
9
|
-
return sHtml
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
return sHtml
|
|
10
|
+
// .replace(/```(\w+)?([\s\S]*?)(\s.+)?```/g, (str: string) => {
|
|
11
|
+
// return str.replace(
|
|
12
|
+
// /[<&"]/g,
|
|
13
|
+
// (c: string) => (({ '<': '<', '>': '>', '&': '&', '"': '"' } as Record<string, string>)[c]),
|
|
14
|
+
// );
|
|
15
|
+
// })
|
|
16
|
+
.replace(/[<&"]/g, c => ({
|
|
17
17
|
'<': '<',
|
|
18
18
|
'>': '>',
|
|
19
19
|
'&': '&',
|
|
@@ -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);
|
|
@@ -14,16 +14,14 @@ var _Context = require("../../Context");
|
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
var _templateObject;
|
|
16
16
|
function html2Escape(sHtml) {
|
|
17
|
-
return sHtml
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
26
|
-
}).replace(/[<&"]/g, function (c) {
|
|
17
|
+
return sHtml
|
|
18
|
+
// .replace(/```(\w+)?([\s\S]*?)(\s.+)?```/g, (str: string) => {
|
|
19
|
+
// return str.replace(
|
|
20
|
+
// /[<&"]/g,
|
|
21
|
+
// (c: string) => (({ '<': '<', '>': '>', '&': '&', '"': '"' } as Record<string, string>)[c]),
|
|
22
|
+
// );
|
|
23
|
+
// })
|
|
24
|
+
.replace(/[<&"]/g, function (c) {
|
|
27
25
|
return {
|
|
28
26
|
'<': '<',
|
|
29
27
|
'>': '>',
|
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.8",
|
|
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);
|
|
@@ -5,17 +5,19 @@ import { IProps } from '../../Editor';
|
|
|
5
5
|
import { EditorContext } from '../../Context';
|
|
6
6
|
|
|
7
7
|
function html2Escape(sHtml: string) {
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
return (
|
|
9
|
+
sHtml
|
|
10
|
+
// .replace(/```(\w+)?([\s\S]*?)(\s.+)?```/g, (str: string) => {
|
|
11
|
+
// return str.replace(
|
|
12
|
+
// /[<&"]/g,
|
|
13
|
+
// (c: string) => (({ '<': '<', '>': '>', '&': '&', '"': '"' } as Record<string, string>)[c]),
|
|
14
|
+
// );
|
|
15
|
+
// })
|
|
16
|
+
.replace(
|
|
11
17
|
/[<&"]/g,
|
|
12
18
|
(c: string) => (({ '<': '<', '>': '>', '&': '&', '"': '"' } as Record<string, string>)[c]),
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
.replace(
|
|
16
|
-
/[<&"]/g,
|
|
17
|
-
(c: string) => (({ '<': '<', '>': '>', '&': '&', '"': '"' } as Record<string, string>)[c]),
|
|
18
|
-
);
|
|
19
|
+
)
|
|
20
|
+
);
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {}
|