@uiw/react-md-editor 4.0.8 → 4.0.9
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 +95 -28
- package/dist/mdeditor.css +1 -1
- package/dist/mdeditor.js +178 -222
- package/dist/mdeditor.min.js +1 -1
- package/esm/Editor.d.ts +1 -1
- package/esm/Editor.nohighlight.d.ts +1 -1
- package/esm/components/DragBar/index.d.ts +1 -1
- package/esm/components/TextArea/Markdown.d.ts +1 -1
- package/esm/components/TextArea/Textarea.d.ts +1 -1
- package/esm/components/TextArea/index.d.ts +4 -4
- package/esm/components/TextArea/index.nohighlight.d.ts +3 -3
- package/esm/components/Toolbar/Child.d.ts +1 -1
- package/esm/components/Toolbar/index.d.ts +1 -1
- package/esm/index.css +1 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/lib/Editor.d.ts +1 -1
- package/lib/Editor.nohighlight.d.ts +1 -1
- package/lib/components/DragBar/index.d.ts +1 -1
- package/lib/components/TextArea/Markdown.d.ts +1 -1
- package/lib/components/TextArea/Textarea.d.ts +1 -1
- package/lib/components/TextArea/index.d.ts +4 -4
- package/lib/components/TextArea/index.nohighlight.d.ts +3 -3
- package/lib/components/Toolbar/Child.d.ts +1 -1
- package/lib/components/Toolbar/index.d.ts +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +18 -1
- package/markdown-editor.css +1 -0
- package/package.json +1 -1
- package/src/Editor.nohighlight.tsx +2 -2
- package/src/Editor.tsx +3 -3
- package/src/components/DragBar/index.tsx +1 -1
- package/src/components/TextArea/Markdown.tsx +1 -1
- package/src/components/TextArea/Textarea.tsx +2 -2
- package/src/components/TextArea/index.nohighlight.tsx +5 -4
- package/src/components/TextArea/index.tsx +6 -5
- package/src/components/Toolbar/Child.tsx +1 -1
- package/src/components/Toolbar/index.tsx +2 -2
- package/src/index.tsx +2 -0
package/esm/Editor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import MarkdownPreview from '@uiw/react-markdown-preview';
|
|
3
|
-
import { ContextStore } from './Context';
|
|
3
|
+
import { type ContextStore } from './Context';
|
|
4
4
|
import type { MDEditorProps } from './Types';
|
|
5
5
|
export interface RefMDEditor extends ContextStore {
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import MarkdownPreview from '@uiw/react-markdown-preview/nohighlight';
|
|
3
|
-
import { ContextStore } from './Context';
|
|
3
|
+
import { type ContextStore } from './Context';
|
|
4
4
|
import type { MDEditorProps } from './Types';
|
|
5
5
|
export interface RefMDEditor extends ContextStore {
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IProps } from '../../Types';
|
|
2
|
+
import { type IProps } from '../../Types';
|
|
3
3
|
export interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {
|
|
4
4
|
}
|
|
5
5
|
export default function Markdown(props: MarkdownProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { JSX } from 'react';
|
|
2
|
-
import { ContextStore, ExecuteCommandState } from '../../Context';
|
|
3
|
-
import { TextAreaProps } from './Textarea';
|
|
4
|
-
import { IProps } from '../../Types';
|
|
5
|
-
import { TextAreaCommandOrchestrator, ICommand } from '../../commands/';
|
|
2
|
+
import { type ContextStore, type ExecuteCommandState } from '../../Context';
|
|
3
|
+
import { type TextAreaProps } from './Textarea';
|
|
4
|
+
import { type IProps } from '../../Types';
|
|
5
|
+
import { TextAreaCommandOrchestrator, type ICommand } from '../../commands/';
|
|
6
6
|
import './index.less';
|
|
7
7
|
type RenderTextareaHandle = {
|
|
8
8
|
dispatch: ContextStore['dispatch'];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { JSX } from 'react';
|
|
2
|
-
import { ContextStore, ExecuteCommandState } from '../../Context';
|
|
2
|
+
import { type ContextStore, ExecuteCommandState } from '../../Context';
|
|
3
3
|
import { TextAreaProps } from './Textarea';
|
|
4
|
-
import { IProps } from '../../Types';
|
|
5
|
-
import { TextAreaCommandOrchestrator, ICommand } from '../../commands/';
|
|
4
|
+
import { type IProps } from '../../Types';
|
|
5
|
+
import { TextAreaCommandOrchestrator, type ICommand } from '../../commands/';
|
|
6
6
|
import './index.less';
|
|
7
7
|
type RenderTextareaHandle = {
|
|
8
8
|
dispatch: ContextStore['dispatch'];
|
package/esm/index.css
CHANGED
package/esm/index.d.ts
CHANGED
|
@@ -10,5 +10,7 @@ export * from './utils/InsertTextAtPosition';
|
|
|
10
10
|
export * from './Editor';
|
|
11
11
|
export * from './Context';
|
|
12
12
|
export * from './Types';
|
|
13
|
+
export { default as handleKeyDown } from './components/TextArea/handleKeyDown';
|
|
14
|
+
export { default as shortcuts } from './components/TextArea/shortcuts';
|
|
13
15
|
export { MarkdownUtil, commands };
|
|
14
16
|
export default MDEditor;
|
package/esm/index.js
CHANGED
|
@@ -10,5 +10,7 @@ export * from "./utils/InsertTextAtPosition.js";
|
|
|
10
10
|
export * from "./Editor.js";
|
|
11
11
|
export * from "./Context.js";
|
|
12
12
|
export * from "./Types.js";
|
|
13
|
+
export { default as handleKeyDown } from "./components/TextArea/handleKeyDown.js";
|
|
14
|
+
export { default as shortcuts } from "./components/TextArea/shortcuts.js";
|
|
13
15
|
export { MarkdownUtil, commands };
|
|
14
16
|
export default MDEditor;
|
package/lib/Editor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import MarkdownPreview from '@uiw/react-markdown-preview';
|
|
3
|
-
import { ContextStore } from './Context';
|
|
3
|
+
import { type ContextStore } from './Context';
|
|
4
4
|
import type { MDEditorProps } from './Types';
|
|
5
5
|
export interface RefMDEditor extends ContextStore {
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import MarkdownPreview from '@uiw/react-markdown-preview/nohighlight';
|
|
3
|
-
import { ContextStore } from './Context';
|
|
3
|
+
import { type ContextStore } from './Context';
|
|
4
4
|
import type { MDEditorProps } from './Types';
|
|
5
5
|
export interface RefMDEditor extends ContextStore {
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IProps } from '../../Types';
|
|
2
|
+
import { type IProps } from '../../Types';
|
|
3
3
|
export interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {
|
|
4
4
|
}
|
|
5
5
|
export default function Markdown(props: MarkdownProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { JSX } from 'react';
|
|
2
|
-
import { ContextStore, ExecuteCommandState } from '../../Context';
|
|
3
|
-
import { TextAreaProps } from './Textarea';
|
|
4
|
-
import { IProps } from '../../Types';
|
|
5
|
-
import { TextAreaCommandOrchestrator, ICommand } from '../../commands/';
|
|
2
|
+
import { type ContextStore, type ExecuteCommandState } from '../../Context';
|
|
3
|
+
import { type TextAreaProps } from './Textarea';
|
|
4
|
+
import { type IProps } from '../../Types';
|
|
5
|
+
import { TextAreaCommandOrchestrator, type ICommand } from '../../commands/';
|
|
6
6
|
import './index.less';
|
|
7
7
|
type RenderTextareaHandle = {
|
|
8
8
|
dispatch: ContextStore['dispatch'];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { JSX } from 'react';
|
|
2
|
-
import { ContextStore, ExecuteCommandState } from '../../Context';
|
|
2
|
+
import { type ContextStore, ExecuteCommandState } from '../../Context';
|
|
3
3
|
import { TextAreaProps } from './Textarea';
|
|
4
|
-
import { IProps } from '../../Types';
|
|
5
|
-
import { TextAreaCommandOrchestrator, ICommand } from '../../commands/';
|
|
4
|
+
import { type IProps } from '../../Types';
|
|
5
|
+
import { TextAreaCommandOrchestrator, type ICommand } from '../../commands/';
|
|
6
6
|
import './index.less';
|
|
7
7
|
type RenderTextareaHandle = {
|
|
8
8
|
dispatch: ContextStore['dispatch'];
|
package/lib/index.d.ts
CHANGED
|
@@ -10,5 +10,7 @@ export * from './utils/InsertTextAtPosition';
|
|
|
10
10
|
export * from './Editor';
|
|
11
11
|
export * from './Context';
|
|
12
12
|
export * from './Types';
|
|
13
|
+
export { default as handleKeyDown } from './components/TextArea/handleKeyDown';
|
|
14
|
+
export { default as shortcuts } from './components/TextArea/shortcuts';
|
|
13
15
|
export { MarkdownUtil, commands };
|
|
14
16
|
export default MDEditor;
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
3
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
@@ -7,15 +8,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
8
|
var _exportNames = {
|
|
8
9
|
commands: true,
|
|
9
10
|
MarkdownUtil: true,
|
|
10
|
-
headingExecute: true
|
|
11
|
+
headingExecute: true,
|
|
12
|
+
handleKeyDown: true,
|
|
13
|
+
shortcuts: true
|
|
11
14
|
};
|
|
12
15
|
exports["default"] = exports.commands = exports.MarkdownUtil = void 0;
|
|
16
|
+
Object.defineProperty(exports, "handleKeyDown", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function get() {
|
|
19
|
+
return _handleKeyDown["default"];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
13
22
|
Object.defineProperty(exports, "headingExecute", {
|
|
14
23
|
enumerable: true,
|
|
15
24
|
get: function get() {
|
|
16
25
|
return _title.headingExecute;
|
|
17
26
|
}
|
|
18
27
|
});
|
|
28
|
+
Object.defineProperty(exports, "shortcuts", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function get() {
|
|
31
|
+
return _shortcuts["default"];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
19
34
|
var _Editor = _interopRequireWildcard(require("./Editor"));
|
|
20
35
|
Object.keys(_Editor).forEach(function (key) {
|
|
21
36
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -103,4 +118,6 @@ Object.keys(_Types).forEach(function (key) {
|
|
|
103
118
|
}
|
|
104
119
|
});
|
|
105
120
|
});
|
|
121
|
+
var _handleKeyDown = _interopRequireDefault(require("./components/TextArea/handleKeyDown"));
|
|
122
|
+
var _shortcuts = _interopRequireDefault(require("./components/TextArea/shortcuts"));
|
|
106
123
|
var _default = exports["default"] = _Editor["default"];
|
package/markdown-editor.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uiw/react-md-editor",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.9",
|
|
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
|
"funding": "https://jaywcjlove.github.io/#/sponsor",
|
|
@@ -3,8 +3,8 @@ import MarkdownPreview from '@uiw/react-markdown-preview/nohighlight';
|
|
|
3
3
|
import TextArea from './components/TextArea/index.nohighlight';
|
|
4
4
|
import { ToolbarVisibility } from './components/Toolbar/';
|
|
5
5
|
import DragBar from './components/DragBar/';
|
|
6
|
-
import { getCommands, getExtraCommands, ICommand, TextState, TextAreaCommandOrchestrator } from './commands/';
|
|
7
|
-
import { reducer, EditorContext, ContextStore } from './Context';
|
|
6
|
+
import { getCommands, getExtraCommands, type ICommand, type TextState, TextAreaCommandOrchestrator } from './commands/';
|
|
7
|
+
import { reducer, EditorContext, type ContextStore } from './Context';
|
|
8
8
|
import type { MDEditorProps } from './Types';
|
|
9
9
|
|
|
10
10
|
function setGroupPopFalse(data: Record<string, boolean> = {}) {
|
package/src/Editor.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useEffect, useReducer, useMemo, useRef, useImperativeHandle
|
|
1
|
+
import React, { useEffect, useReducer, useMemo, useRef, useImperativeHandle } from 'react';
|
|
2
2
|
import MarkdownPreview from '@uiw/react-markdown-preview';
|
|
3
3
|
import { ToolbarVisibility } from './components/Toolbar/';
|
|
4
4
|
import TextArea from './components/TextArea/';
|
|
5
5
|
import DragBar from './components/DragBar/';
|
|
6
|
-
import { getCommands, getExtraCommands, ICommand, TextState, TextAreaCommandOrchestrator } from './commands/';
|
|
7
|
-
import { reducer, EditorContext, ContextStore } from './Context';
|
|
6
|
+
import { getCommands, getExtraCommands, type ICommand, type TextState, TextAreaCommandOrchestrator } from './commands/';
|
|
7
|
+
import { reducer, EditorContext, type ContextStore } from './Context';
|
|
8
8
|
import type { MDEditorProps } from './Types';
|
|
9
9
|
|
|
10
10
|
function setGroupPopFalse(data: Record<string, boolean> = {}) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useEffect } from 'react';
|
|
2
2
|
import { rehype } from 'rehype';
|
|
3
3
|
import rehypePrism from 'rehype-prism-plus';
|
|
4
|
-
import { IProps } from '../../Types';
|
|
4
|
+
import { type IProps } from '../../Types';
|
|
5
5
|
import { EditorContext } from '../../Context';
|
|
6
6
|
|
|
7
7
|
function html2Escape(sHtml: string) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext, useEffect } from 'react';
|
|
2
|
-
import { IProps } from '../../Types';
|
|
3
|
-
import { EditorContext, ExecuteCommandState } from '../../Context';
|
|
2
|
+
import { type IProps } from '../../Types';
|
|
3
|
+
import { EditorContext, type ExecuteCommandState } from '../../Context';
|
|
4
4
|
import { TextAreaCommandOrchestrator } from '../../commands/';
|
|
5
5
|
import handleKeyDown from './handleKeyDown';
|
|
6
6
|
import shortcuts from './shortcuts';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, Fragment, useContext, JSX } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import type * as CSS from 'csstype';
|
|
3
|
+
import { EditorContext, type ContextStore, ExecuteCommandState } from '../../Context';
|
|
3
4
|
import shortcuts from './shortcuts';
|
|
4
5
|
import Textarea, { TextAreaProps } from './Textarea';
|
|
5
|
-
import { IProps } from '../../Types';
|
|
6
|
-
import { TextAreaCommandOrchestrator, ICommand } from '../../commands/';
|
|
6
|
+
import { type IProps } from '../../Types';
|
|
7
|
+
import { TextAreaCommandOrchestrator, type ICommand } from '../../commands/';
|
|
7
8
|
import './index.less';
|
|
8
9
|
|
|
9
10
|
type RenderTextareaHandle = {
|
|
@@ -66,7 +67,7 @@ export default function TextArea(props: ITextAreaProps) {
|
|
|
66
67
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
68
|
}, []);
|
|
68
69
|
|
|
69
|
-
const textStyle:
|
|
70
|
+
const textStyle: CSS.Properties = { WebkitTextFillColor: 'initial', overflow: 'auto' };
|
|
70
71
|
|
|
71
72
|
return (
|
|
72
73
|
<div ref={warp} className={`${prefixCls}-area ${className || ''}`} onScroll={onScroll}>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, Fragment, useContext, JSX } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import type * as CSS from 'csstype';
|
|
3
|
+
import { EditorContext, type ContextStore, type ExecuteCommandState } from '../../Context';
|
|
3
4
|
import shortcuts from './shortcuts';
|
|
4
5
|
import Markdown from './Markdown';
|
|
5
|
-
import Textarea, { TextAreaProps } from './Textarea';
|
|
6
|
-
import { IProps } from '../../Types';
|
|
7
|
-
import { TextAreaCommandOrchestrator, ICommand } from '../../commands/';
|
|
6
|
+
import Textarea, { type TextAreaProps } from './Textarea';
|
|
7
|
+
import { type IProps } from '../../Types';
|
|
8
|
+
import { TextAreaCommandOrchestrator, type ICommand } from '../../commands/';
|
|
8
9
|
import './index.less';
|
|
9
10
|
|
|
10
11
|
type RenderTextareaHandle = {
|
|
@@ -68,7 +69,7 @@ export default function TextArea(props: ITextAreaProps) {
|
|
|
68
69
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
70
|
}, []);
|
|
70
71
|
|
|
71
|
-
const textStyle:
|
|
72
|
+
const textStyle: CSS.Properties = highlightEnable ? {} : { WebkitTextFillColor: 'initial', overflow: 'auto' };
|
|
72
73
|
|
|
73
74
|
return (
|
|
74
75
|
<div ref={warp} className={`${prefixCls}-area ${className || ''}`} onScroll={onScroll}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Fragment, useContext, useEffect, useRef } from 'react';
|
|
2
|
-
import { IProps } from '../../Types';
|
|
3
|
-
import { EditorContext, PreviewType, ContextStore } from '../../Context';
|
|
2
|
+
import { type IProps } from '../../Types';
|
|
3
|
+
import { EditorContext, type PreviewType, type ContextStore } from '../../Context';
|
|
4
4
|
import { ICommand } from '../../commands/';
|
|
5
5
|
import Child from './Child';
|
|
6
6
|
import './index.less';
|
package/src/index.tsx
CHANGED
|
@@ -11,6 +11,8 @@ export * from './utils/InsertTextAtPosition';
|
|
|
11
11
|
export * from './Editor';
|
|
12
12
|
export * from './Context';
|
|
13
13
|
export * from './Types';
|
|
14
|
+
export { default as handleKeyDown } from './components/TextArea/handleKeyDown';
|
|
15
|
+
export { default as shortcuts } from './components/TextArea/shortcuts';
|
|
14
16
|
|
|
15
17
|
export { MarkdownUtil, commands };
|
|
16
18
|
|