@uiw/react-md-editor 4.0.4 → 4.0.6
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 +81 -76
- package/dist/mdeditor.css +193 -109
- package/dist/mdeditor.js +69395 -66037
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/dist/mdeditor.min.js.LICENSE.txt +2 -2
- package/esm/Context.d.ts +21 -34
- package/esm/Editor.js +6 -7
- package/esm/Editor.nohighlight.js +5 -6
- package/esm/Types.d.ts +1 -1
- package/esm/commands/bold.d.ts +1 -1
- package/esm/commands/bold.js +1 -1
- package/esm/commands/code.d.ts +1 -1
- package/esm/commands/code.js +1 -1
- package/esm/commands/comment.d.ts +1 -1
- package/esm/commands/comment.js +2 -3
- package/esm/commands/divider.d.ts +1 -1
- package/esm/commands/fullscreen.d.ts +1 -1
- package/esm/commands/group.d.ts +2 -2
- package/esm/commands/help.d.ts +1 -1
- package/esm/commands/hr.d.ts +1 -1
- package/esm/commands/hr.js +1 -1
- package/esm/commands/image.d.ts +1 -1
- package/esm/commands/image.js +1 -1
- package/esm/commands/index.cn.js +24 -24
- package/esm/commands/index.d.ts +1 -1
- package/esm/commands/index.js +25 -25
- package/esm/commands/issue.d.ts +1 -1
- package/esm/commands/issue.js +3 -3
- package/esm/commands/italic.d.ts +1 -1
- package/esm/commands/italic.js +1 -1
- package/esm/commands/link.d.ts +1 -1
- package/esm/commands/link.js +1 -1
- package/esm/commands/list.d.ts +1 -1
- package/esm/commands/list.js +1 -1
- package/esm/commands/preview.d.ts +1 -1
- package/esm/commands/preview.js +1 -2
- package/esm/commands/quote.d.ts +1 -1
- package/esm/commands/quote.js +1 -1
- package/esm/commands/strikeThrough.js +1 -1
- package/esm/commands/table.js +1 -1
- package/esm/commands/title.js +2 -2
- package/esm/commands/title1.js +1 -1
- package/esm/commands/title2.js +1 -1
- package/esm/commands/title3.js +1 -1
- package/esm/commands/title4.js +1 -1
- package/esm/commands/title5.js +1 -1
- package/esm/commands/title6.js +1 -1
- package/esm/components/TextArea/Markdown.js +1 -1
- package/esm/components/TextArea/Textarea.js +4 -4
- package/esm/components/TextArea/handleKeyDown.d.ts +0 -1
- package/esm/components/TextArea/handleKeyDown.js +3 -4
- package/esm/components/TextArea/index.d.ts +2 -2
- package/esm/components/TextArea/index.js +10 -11
- package/esm/components/TextArea/index.nohighlight.d.ts +2 -2
- package/esm/components/TextArea/index.nohighlight.js +8 -8
- package/esm/components/TextArea/shortcuts.d.ts +1 -2
- package/esm/components/Toolbar/Child.d.ts +1 -1
- package/esm/components/Toolbar/Child.js +2 -2
- package/esm/components/Toolbar/index.d.ts +1 -1
- package/esm/components/Toolbar/index.js +3 -4
- package/esm/index.css +0 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +10 -10
- package/esm/index.nohighlight.d.ts +2 -2
- package/esm/index.nohighlight.js +8 -8
- package/esm/utils/markdownUtils.d.ts +1 -2
- package/lib/Context.d.ts +21 -34
- package/lib/Editor.js +4 -4
- package/lib/Editor.nohighlight.js +3 -3
- package/lib/Types.d.ts +1 -1
- package/lib/commands/bold.d.ts +1 -1
- package/lib/commands/code.d.ts +1 -1
- package/lib/commands/comment.d.ts +1 -1
- package/lib/commands/divider.d.ts +1 -1
- package/lib/commands/fullscreen.d.ts +1 -1
- package/lib/commands/group.d.ts +2 -2
- package/lib/commands/help.d.ts +1 -1
- package/lib/commands/hr.d.ts +1 -1
- package/lib/commands/image.d.ts +1 -1
- package/lib/commands/index.d.ts +1 -1
- package/lib/commands/index.js +2 -4
- package/lib/commands/issue.d.ts +1 -1
- package/lib/commands/issue.js +2 -2
- package/lib/commands/italic.d.ts +1 -1
- package/lib/commands/link.d.ts +1 -1
- package/lib/commands/list.d.ts +1 -1
- package/lib/commands/preview.d.ts +1 -1
- package/lib/commands/quote.d.ts +1 -1
- package/lib/components/TextArea/Textarea.js +1 -1
- package/lib/components/TextArea/handleKeyDown.d.ts +0 -1
- package/lib/components/TextArea/handleKeyDown.js +1 -1
- package/lib/components/TextArea/index.d.ts +2 -2
- package/lib/components/TextArea/index.js +5 -5
- package/lib/components/TextArea/index.nohighlight.d.ts +2 -2
- package/lib/components/TextArea/index.nohighlight.js +5 -5
- package/lib/components/TextArea/shortcuts.d.ts +1 -2
- package/lib/components/Toolbar/Child.d.ts +1 -1
- package/lib/components/Toolbar/index.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -1
- package/lib/index.nohighlight.d.ts +2 -2
- package/lib/index.nohighlight.js +1 -1
- package/lib/utils/markdownUtils.d.ts +1 -2
- package/markdown-editor.css +0 -1
- package/package.json +1 -1
- package/src/Context.tsx +1 -1
- package/src/Editor.nohighlight.tsx +3 -3
- package/src/Editor.tsx +4 -4
- package/src/Types.ts +1 -1
- package/src/commands/bold.tsx +1 -1
- package/src/commands/code.tsx +1 -1
- package/src/commands/comment.tsx +1 -1
- package/src/commands/divider.tsx +1 -1
- package/src/commands/fullscreen.tsx +2 -2
- package/src/commands/group.tsx +1 -1
- package/src/commands/help.tsx +1 -1
- package/src/commands/hr.tsx +1 -1
- package/src/commands/image.tsx +1 -1
- package/src/commands/index.ts +1 -1
- package/src/commands/issue.tsx +3 -3
- package/src/commands/italic.tsx +1 -1
- package/src/commands/link.tsx +1 -1
- package/src/commands/list.tsx +1 -1
- package/src/commands/preview.tsx +2 -2
- package/src/commands/quote.tsx +1 -1
- package/src/components/TextArea/Textarea.tsx +1 -1
- package/src/components/TextArea/handleKeyDown.tsx +1 -1
- package/src/components/TextArea/index.nohighlight.tsx +2 -2
- package/src/components/TextArea/index.tsx +2 -2
- package/src/components/TextArea/shortcuts.ts +1 -1
- package/src/components/Toolbar/Child.tsx +1 -1
- package/src/components/Toolbar/index.tsx +1 -1
- package/src/index.nohighlight.tsx +2 -2
- package/src/index.tsx +2 -2
- package/src/utils/markdownUtils.ts +1 -2
|
@@ -2,14 +2,13 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
3
|
var _excluded = ["prefixCls", "className", "onScroll", "renderTextarea"];
|
|
4
4
|
import React, { useEffect, Fragment, useContext } from 'react';
|
|
5
|
-
import { EditorContext } from
|
|
6
|
-
import shortcuts from
|
|
7
|
-
import Markdown from
|
|
8
|
-
import Textarea from
|
|
9
|
-
import { TextAreaCommandOrchestrator } from
|
|
5
|
+
import { EditorContext } from "../../Context.js";
|
|
6
|
+
import shortcuts from "./shortcuts.js";
|
|
7
|
+
import Markdown from "./Markdown.js";
|
|
8
|
+
import Textarea from "./Textarea.js";
|
|
9
|
+
import { TextAreaCommandOrchestrator } from "../../commands/index.js";
|
|
10
10
|
import "./index.css";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
export default function TextArea(props) {
|
|
14
13
|
var _ref = props || {},
|
|
15
14
|
{
|
|
@@ -44,11 +43,11 @@ export default function TextArea(props) {
|
|
|
44
43
|
}, []);
|
|
45
44
|
useEffect(() => {
|
|
46
45
|
if (textRef.current && dispatch) {
|
|
47
|
-
var
|
|
48
|
-
executeRef.current =
|
|
46
|
+
var commandOrchestrator = new TextAreaCommandOrchestrator(textRef.current);
|
|
47
|
+
executeRef.current = commandOrchestrator;
|
|
49
48
|
dispatch({
|
|
50
49
|
textarea: textRef.current,
|
|
51
|
-
commandOrchestrator
|
|
50
|
+
commandOrchestrator
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -66,7 +65,7 @@ export default function TextArea(props) {
|
|
|
66
65
|
style: {
|
|
67
66
|
minHeight
|
|
68
67
|
},
|
|
69
|
-
children: renderTextarea ? (
|
|
68
|
+
children: renderTextarea ? (/*#__PURE__*/React.cloneElement(renderTextarea(_extends({}, otherProps, {
|
|
70
69
|
value: markdown,
|
|
71
70
|
autoComplete: 'off',
|
|
72
71
|
autoCorrect: 'off',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
2
|
import { ContextStore, ExecuteCommandState } from '../../Context';
|
|
3
3
|
import { TextAreaProps } from './Textarea';
|
|
4
4
|
import { IProps } from '../../Types';
|
|
5
|
-
import { TextAreaCommandOrchestrator, ICommand } from '../../commands';
|
|
5
|
+
import { TextAreaCommandOrchestrator, ICommand } from '../../commands/';
|
|
6
6
|
import './index.less';
|
|
7
7
|
type RenderTextareaHandle = {
|
|
8
8
|
dispatch: ContextStore['dispatch'];
|
|
@@ -2,10 +2,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
3
|
var _excluded = ["prefixCls", "className", "onScroll", "renderTextarea"];
|
|
4
4
|
import React, { useEffect, Fragment, useContext } from 'react';
|
|
5
|
-
import { EditorContext } from
|
|
6
|
-
import shortcuts from
|
|
7
|
-
import Textarea from
|
|
8
|
-
import { TextAreaCommandOrchestrator } from
|
|
5
|
+
import { EditorContext } from "../../Context.js";
|
|
6
|
+
import shortcuts from "./shortcuts.js";
|
|
7
|
+
import Textarea from "./Textarea.js";
|
|
8
|
+
import { TextAreaCommandOrchestrator } from "../../commands/index.js";
|
|
9
9
|
import "./index.css";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
export default function TextArea(props) {
|
|
@@ -40,11 +40,11 @@ export default function TextArea(props) {
|
|
|
40
40
|
}, []);
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
if (textRef.current && dispatch) {
|
|
43
|
-
var
|
|
44
|
-
executeRef.current =
|
|
43
|
+
var commandOrchestrator = new TextAreaCommandOrchestrator(textRef.current);
|
|
44
|
+
executeRef.current = commandOrchestrator;
|
|
45
45
|
dispatch({
|
|
46
46
|
textarea: textRef.current,
|
|
47
|
-
commandOrchestrator
|
|
47
|
+
commandOrchestrator
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -59,7 +59,7 @@ export default function TextArea(props) {
|
|
|
59
59
|
onScroll: onScroll,
|
|
60
60
|
children: /*#__PURE__*/_jsx("div", {
|
|
61
61
|
className: prefixCls + "-text",
|
|
62
|
-
children: renderTextarea ? (
|
|
62
|
+
children: renderTextarea ? (/*#__PURE__*/React.cloneElement(renderTextarea(_extends({}, otherProps, {
|
|
63
63
|
value: markdown,
|
|
64
64
|
autoComplete: 'off',
|
|
65
65
|
autoCorrect: 'off',
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { ICommand, TextAreaCommandOrchestrator } from '../../commands';
|
|
1
|
+
import { ICommand, TextAreaCommandOrchestrator } from '../../commands/';
|
|
3
2
|
import { ContextStore, ExecuteCommandState } from '../../Context';
|
|
4
3
|
export default function shortcutsHandle(e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>, commands?: ICommand[], commandOrchestrator?: TextAreaCommandOrchestrator, dispatch?: React.Dispatch<ContextStore>, state?: ExecuteCommandState): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useContext, useMemo } from 'react';
|
|
3
3
|
import "./Child.css";
|
|
4
|
-
import Toolbar from
|
|
5
|
-
import { EditorContext } from
|
|
4
|
+
import Toolbar from "./index.js";
|
|
5
|
+
import { EditorContext } from "../../Context.js";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
export default function Child(props) {
|
|
8
8
|
var {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { Fragment, useContext, useEffect, useRef } from 'react';
|
|
3
|
-
import { EditorContext } from
|
|
4
|
-
import Child from
|
|
3
|
+
import { EditorContext } from "../../Context.js";
|
|
4
|
+
import Child from "./Child.js";
|
|
5
5
|
import "./index.css";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
7
|
export function ToolbarItems(props) {
|
|
9
8
|
var {
|
|
10
9
|
prefixCls,
|
package/esm/index.css
CHANGED
package/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import MDEditor from './Editor';
|
|
2
|
-
import * as commands from './commands';
|
|
2
|
+
import * as commands from './commands/';
|
|
3
3
|
import * as MarkdownUtil from './utils/markdownUtils';
|
|
4
4
|
import './index.less';
|
|
5
|
-
export * from './commands';
|
|
5
|
+
export * from './commands/';
|
|
6
6
|
export * from './commands/group';
|
|
7
7
|
export * from './utils/markdownUtils';
|
|
8
8
|
export * from './utils/InsertTextAtPosition';
|
package/esm/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import MDEditor from
|
|
2
|
-
import * as commands from
|
|
3
|
-
import * as MarkdownUtil from
|
|
1
|
+
import MDEditor from "./Editor.js";
|
|
2
|
+
import * as commands from "./commands/index.js";
|
|
3
|
+
import * as MarkdownUtil from "./utils/markdownUtils.js";
|
|
4
4
|
import "./index.css";
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
5
|
+
export * from "./commands/index.js";
|
|
6
|
+
export * from "./commands/group.js";
|
|
7
|
+
export * from "./utils/markdownUtils.js";
|
|
8
|
+
export * from "./utils/InsertTextAtPosition.js";
|
|
9
|
+
export * from "./Editor.js";
|
|
10
|
+
export * from "./Context.js";
|
|
11
|
+
export * from "./Types.js";
|
|
12
12
|
export { MarkdownUtil, commands };
|
|
13
13
|
export default MDEditor;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import MDEditor from './Editor.nohighlight';
|
|
2
|
-
import * as commands from './commands';
|
|
2
|
+
import * as commands from './commands/';
|
|
3
3
|
import * as MarkdownUtil from './utils/markdownUtils';
|
|
4
4
|
import './index.less';
|
|
5
|
-
export * from './commands';
|
|
5
|
+
export * from './commands/';
|
|
6
6
|
export * from './commands/group';
|
|
7
7
|
export * from './utils/markdownUtils';
|
|
8
8
|
export * from './utils/InsertTextAtPosition';
|
package/esm/index.nohighlight.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import MDEditor from './Editor.nohighlight';
|
|
2
|
-
import * as commands from
|
|
3
|
-
import * as MarkdownUtil from
|
|
2
|
+
import * as commands from "./commands/index.js";
|
|
3
|
+
import * as MarkdownUtil from "./utils/markdownUtils.js";
|
|
4
4
|
import "./index.css";
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
5
|
+
export * from "./commands/index.js";
|
|
6
|
+
export * from "./commands/group.js";
|
|
7
|
+
export * from "./utils/markdownUtils.js";
|
|
8
|
+
export * from "./utils/InsertTextAtPosition.js";
|
|
9
9
|
export * from './Editor.nohighlight';
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
10
|
+
export * from "./Context.js";
|
|
11
|
+
export * from "./Types.js";
|
|
12
12
|
export { MarkdownUtil, commands };
|
|
13
13
|
export default MDEditor;
|
package/lib/Context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ICommand, TextAreaCommandOrchestrator } from './commands';
|
|
2
|
+
import { ICommand, TextAreaCommandOrchestrator } from './commands/';
|
|
3
3
|
import { MDEditorProps } from './Types';
|
|
4
4
|
export type PreviewType = 'live' | 'edit' | 'preview';
|
|
5
5
|
export interface ContextStore {
|
|
@@ -28,38 +28,25 @@ export interface ContextStore {
|
|
|
28
28
|
export type ExecuteCommandState = Pick<ContextStore, 'fullscreen' | 'preview' | 'highlightEnable'>;
|
|
29
29
|
export declare function reducer(state: ContextStore, action: ContextStore): {
|
|
30
30
|
[x: string]: any;
|
|
31
|
-
components?:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
highlightEnable?: boolean | undefined;
|
|
52
|
-
autoFocus?: boolean | undefined;
|
|
53
|
-
textarea?: HTMLTextAreaElement | undefined;
|
|
54
|
-
commandOrchestrator?: TextAreaCommandOrchestrator | undefined;
|
|
55
|
-
textareaWarp?: HTMLDivElement | undefined;
|
|
56
|
-
textareaPre?: HTMLPreElement | undefined;
|
|
57
|
-
container?: HTMLDivElement | null | undefined;
|
|
58
|
-
dispatch?: React.Dispatch<ContextStore> | undefined;
|
|
59
|
-
barPopup?: Record<string, boolean> | undefined;
|
|
60
|
-
scrollTop?: number | undefined;
|
|
61
|
-
scrollTopPreview?: number | undefined;
|
|
62
|
-
tabSize?: number | undefined;
|
|
63
|
-
defaultTabEnable?: boolean | undefined;
|
|
31
|
+
components?: MDEditorProps["components"];
|
|
32
|
+
commands?: ICommand<string>[];
|
|
33
|
+
extraCommands?: ICommand<string>[];
|
|
34
|
+
markdown?: string;
|
|
35
|
+
preview?: PreviewType;
|
|
36
|
+
height?: React.CSSProperties["height"];
|
|
37
|
+
fullscreen?: boolean;
|
|
38
|
+
highlightEnable?: boolean;
|
|
39
|
+
autoFocus?: boolean;
|
|
40
|
+
textarea?: HTMLTextAreaElement;
|
|
41
|
+
commandOrchestrator?: TextAreaCommandOrchestrator;
|
|
42
|
+
textareaWarp?: HTMLDivElement;
|
|
43
|
+
textareaPre?: HTMLPreElement;
|
|
44
|
+
container?: HTMLDivElement | null;
|
|
45
|
+
dispatch?: React.Dispatch<ContextStore>;
|
|
46
|
+
barPopup?: Record<string, boolean>;
|
|
47
|
+
scrollTop?: number;
|
|
48
|
+
scrollTopPreview?: number;
|
|
49
|
+
tabSize?: number;
|
|
50
|
+
defaultTabEnable?: boolean;
|
|
64
51
|
};
|
|
65
52
|
export declare const EditorContext: React.Context<ContextStore>;
|
package/lib/Editor.js
CHANGED
|
@@ -11,10 +11,10 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _reactMarkdownPreview = _interopRequireDefault(require("@uiw/react-markdown-preview"));
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var _DragBar = _interopRequireDefault(require("./components/DragBar"));
|
|
17
|
-
var _commands = require("./commands");
|
|
14
|
+
var _Toolbar = require("./components/Toolbar/");
|
|
15
|
+
var _TextArea = _interopRequireDefault(require("./components/TextArea/"));
|
|
16
|
+
var _DragBar = _interopRequireDefault(require("./components/DragBar/"));
|
|
17
|
+
var _commands = require("./commands/");
|
|
18
18
|
var _Context = require("./Context");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
var _excluded = ["prefixCls", "className", "value", "commands", "commandsFilter", "direction", "extraCommands", "height", "enableScroll", "visibleDragbar", "highlightEnable", "preview", "fullscreen", "overflow", "previewOptions", "textareaProps", "maxHeight", "minHeight", "autoFocus", "tabSize", "defaultTabEnable", "onChange", "onStatistics", "onHeightChange", "hideToolbar", "toolbarBottom", "components", "renderTextarea"];
|
|
@@ -12,9 +12,9 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _nohighlight = _interopRequireDefault(require("@uiw/react-markdown-preview/nohighlight"));
|
|
14
14
|
var _index = _interopRequireDefault(require("./components/TextArea/index.nohighlight"));
|
|
15
|
-
var _Toolbar = require("./components/Toolbar");
|
|
16
|
-
var _DragBar = _interopRequireDefault(require("./components/DragBar"));
|
|
17
|
-
var _commands = require("./commands");
|
|
15
|
+
var _Toolbar = require("./components/Toolbar/");
|
|
16
|
+
var _DragBar = _interopRequireDefault(require("./components/DragBar/"));
|
|
17
|
+
var _commands = require("./commands/");
|
|
18
18
|
var _Context = require("./Context");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
var _excluded = ["prefixCls", "className", "value", "commands", "commandsFilter", "direction", "extraCommands", "height", "enableScroll", "visibleDragbar", "highlightEnable", "preview", "fullscreen", "overflow", "previewOptions", "textareaProps", "maxHeight", "minHeight", "autoFocus", "tabSize", "defaultTabEnable", "onChange", "onStatistics", "onHeightChange", "hideToolbar", "toolbarBottom", "components", "renderTextarea"];
|
package/lib/Types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
1
|
+
import type { CSSProperties, JSX } from 'react';
|
|
2
2
|
import type { MarkdownPreviewProps } from '@uiw/react-markdown-preview/nohighlight';
|
|
3
3
|
import type { ITextAreaProps } from './components/TextArea/index.nohighlight';
|
|
4
4
|
import type { ICommand, TextState } from './commands';
|
package/lib/commands/bold.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICommand } from './';
|
|
1
|
+
import { type ICommand } from './';
|
|
2
2
|
export declare const bold: ICommand;
|
package/lib/commands/code.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICommand } from './';
|
|
1
|
+
import { type ICommand } from './';
|
|
2
2
|
export declare const comment: ICommand;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICommand } from './';
|
|
1
|
+
import { type ICommand } from './';
|
|
2
2
|
export declare const divider: ICommand;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICommand } from './';
|
|
1
|
+
import { type ICommand } from './';
|
|
2
2
|
export declare const fullscreen: ICommand;
|
package/lib/commands/group.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ICommand, ICommandChildCommands, ICommandChildHandle } from './';
|
|
1
|
+
import { type ICommand, type ICommandChildCommands, type ICommandChildHandle } from './';
|
|
2
2
|
export type GroupOptions = Omit<ICommand<string>, 'children'> & {
|
|
3
3
|
children?: ICommandChildHandle['children'];
|
|
4
4
|
};
|
|
5
|
-
export declare const group: (arr: ICommandChildCommands[
|
|
5
|
+
export declare const group: (arr: ICommandChildCommands["children"], options?: GroupOptions) => ICommand<string>;
|
package/lib/commands/help.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICommand } from './';
|
|
1
|
+
import { type ICommand } from './';
|
|
2
2
|
export declare const help: ICommand;
|
package/lib/commands/hr.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICommand } from './';
|
|
1
|
+
import { type ICommand } from './';
|
|
2
2
|
export declare const hr: ICommand;
|
package/lib/commands/image.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICommand } from './';
|
|
1
|
+
import { type ICommand } from './';
|
|
2
2
|
export declare const image: ICommand;
|
package/lib/commands/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ContextStore, ExecuteCommandState } from '../Context';
|
|
2
|
+
import { type ContextStore, ExecuteCommandState } from '../Context';
|
|
3
3
|
import { bold } from './bold';
|
|
4
4
|
import { code, codeBlock } from './code';
|
|
5
5
|
import { comment } from './comment';
|
package/lib/commands/index.js
CHANGED
|
@@ -246,7 +246,7 @@ var TextAreaTextApi = exports.TextAreaTextApi = /*#__PURE__*/function () {
|
|
|
246
246
|
* selection start and selection end will be the same and will both point to the end
|
|
247
247
|
* @param text Text that should replace the current selection
|
|
248
248
|
*/
|
|
249
|
-
(0, _createClass2["default"])(TextAreaTextApi, [{
|
|
249
|
+
return (0, _createClass2["default"])(TextAreaTextApi, [{
|
|
250
250
|
key: "replaceSelection",
|
|
251
251
|
value: function replaceSelection(text) {
|
|
252
252
|
(0, _InsertTextAtPosition.insertTextAtPosition)(this.textArea, text);
|
|
@@ -266,7 +266,6 @@ var TextAreaTextApi = exports.TextAreaTextApi = /*#__PURE__*/function () {
|
|
|
266
266
|
return getStateFromTextArea(this.textArea);
|
|
267
267
|
}
|
|
268
268
|
}]);
|
|
269
|
-
return TextAreaTextApi;
|
|
270
269
|
}();
|
|
271
270
|
var TextAreaCommandOrchestrator = exports.TextAreaCommandOrchestrator = /*#__PURE__*/function () {
|
|
272
271
|
function TextAreaCommandOrchestrator(textArea) {
|
|
@@ -276,7 +275,7 @@ var TextAreaCommandOrchestrator = exports.TextAreaCommandOrchestrator = /*#__PUR
|
|
|
276
275
|
this.textArea = textArea;
|
|
277
276
|
this.textApi = new TextAreaTextApi(textArea);
|
|
278
277
|
}
|
|
279
|
-
(0, _createClass2["default"])(TextAreaCommandOrchestrator, [{
|
|
278
|
+
return (0, _createClass2["default"])(TextAreaCommandOrchestrator, [{
|
|
280
279
|
key: "getState",
|
|
281
280
|
value: function getState() {
|
|
282
281
|
if (!this.textArea) return false;
|
|
@@ -290,5 +289,4 @@ var TextAreaCommandOrchestrator = exports.TextAreaCommandOrchestrator = /*#__PUR
|
|
|
290
289
|
}, getStateFromTextArea(this.textArea)), this.textApi, dispatch, state, shortcuts);
|
|
291
290
|
}
|
|
292
291
|
}]);
|
|
293
|
-
return TextAreaCommandOrchestrator;
|
|
294
292
|
}();
|
package/lib/commands/issue.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICommand } from './';
|
|
1
|
+
import { type ICommand } from './';
|
|
2
2
|
export declare const issue: ICommand;
|
package/lib/commands/issue.js
CHANGED
|
@@ -24,8 +24,8 @@ var issue = exports.issue = {
|
|
|
24
24
|
viewBox: "0 0 448 512",
|
|
25
25
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
26
26
|
fill: "currentColor",
|
|
27
|
-
d: "M181.3 32.4c17.4 2.9 29.2 19.4 26.3 36.8L197.8
|
|
28
|
-
//Font Awesome Free 6.
|
|
27
|
+
d: "M181.3 32.4c17.4 2.9 29.2 19.4 26.3 36.8L197.8 128l95.1 0 11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3s29.2 19.4 26.3 36.8L357.8 128l58.2 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-68.9 0L325.8 320l58.2 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-68.9 0-11.5 69.3c-2.9 17.4-19.4 29.2-36.8 26.3s-29.2-19.4-26.3-36.8l9.8-58.7-95.1 0-11.5 69.3c-2.9 17.4-19.4 29.2-36.8 26.3s-29.2-19.4-26.3-36.8L90.2 384 32 384c-17.7 0-32-14.3-32-32s14.3-32 32-32l68.9 0 21.3-128L64 192c-17.7 0-32-14.3-32-32s14.3-32 32-32l68.9 0 11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3zM187.1 192L165.8 320l95.1 0 21.3-128-95.1 0z"
|
|
28
|
+
//Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
|
|
29
29
|
})
|
|
30
30
|
}),
|
|
31
31
|
execute: function execute(state, api) {
|
package/lib/commands/italic.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICommand } from './';
|
|
1
|
+
import { type ICommand } from './';
|
|
2
2
|
export declare const italic: ICommand;
|
package/lib/commands/link.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICommand } from './';
|
|
1
|
+
import { type ICommand } from './';
|
|
2
2
|
export declare const link: ICommand;
|
package/lib/commands/list.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICommand, ExecuteState, TextAreaTextApi } from './';
|
|
1
|
+
import { type ICommand, type ExecuteState, TextAreaTextApi } from './';
|
|
2
2
|
import { AlterLineFunction } from '../utils/markdownUtils';
|
|
3
3
|
export declare const makeList: (state: ExecuteState, api: TextAreaTextApi, insertBefore: string | AlterLineFunction) => void;
|
|
4
4
|
export declare const unorderedListCommand: ICommand;
|
package/lib/commands/quote.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICommand } from './';
|
|
1
|
+
import { type ICommand } from './';
|
|
2
2
|
export declare const quote: ICommand;
|
|
@@ -11,7 +11,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _Context = require("../../Context");
|
|
14
|
-
var _commands = require("../../commands");
|
|
14
|
+
var _commands = require("../../commands/");
|
|
15
15
|
var _handleKeyDown = _interopRequireDefault(require("./handleKeyDown"));
|
|
16
16
|
var _shortcuts = _interopRequireDefault(require("./shortcuts"));
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = handleKeyDown;
|
|
7
7
|
var _InsertTextAtPosition = require("../../utils/InsertTextAtPosition");
|
|
8
8
|
var _markdownUtils = require("../../utils/markdownUtils");
|
|
9
|
-
var _commands = require("../../commands");
|
|
9
|
+
var _commands = require("../../commands/");
|
|
10
10
|
/**
|
|
11
11
|
* - `13` - `Enter`
|
|
12
12
|
* - `9` - `Tab`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
2
|
import { ContextStore, ExecuteCommandState } from '../../Context';
|
|
3
3
|
import { TextAreaProps } from './Textarea';
|
|
4
4
|
import { IProps } from '../../Types';
|
|
5
|
-
import { TextAreaCommandOrchestrator, ICommand } from '../../commands';
|
|
5
|
+
import { TextAreaCommandOrchestrator, ICommand } from '../../commands/';
|
|
6
6
|
import './index.less';
|
|
7
7
|
type RenderTextareaHandle = {
|
|
8
8
|
dispatch: ContextStore['dispatch'];
|
|
@@ -13,7 +13,7 @@ var _Context = require("../../Context");
|
|
|
13
13
|
var _shortcuts = _interopRequireDefault(require("./shortcuts"));
|
|
14
14
|
var _Markdown = _interopRequireDefault(require("./Markdown"));
|
|
15
15
|
var _Textarea = _interopRequireDefault(require("./Textarea"));
|
|
16
|
-
var _commands = require("../../commands");
|
|
16
|
+
var _commands = require("../../commands/");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
var _excluded = ["prefixCls", "className", "onScroll", "renderTextarea"];
|
|
19
19
|
function TextArea(props) {
|
|
@@ -47,11 +47,11 @@ function TextArea(props) {
|
|
|
47
47
|
}, []);
|
|
48
48
|
(0, _react.useEffect)(function () {
|
|
49
49
|
if (textRef.current && dispatch) {
|
|
50
|
-
var
|
|
51
|
-
executeRef.current =
|
|
50
|
+
var commandOrchestrator = new _commands.TextAreaCommandOrchestrator(textRef.current);
|
|
51
|
+
executeRef.current = commandOrchestrator;
|
|
52
52
|
dispatch({
|
|
53
53
|
textarea: textRef.current,
|
|
54
|
-
commandOrchestrator:
|
|
54
|
+
commandOrchestrator: commandOrchestrator
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -69,7 +69,7 @@ function TextArea(props) {
|
|
|
69
69
|
style: {
|
|
70
70
|
minHeight: minHeight
|
|
71
71
|
},
|
|
72
|
-
children: renderTextarea ? (
|
|
72
|
+
children: renderTextarea ? (/*#__PURE__*/_react["default"].cloneElement(renderTextarea((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, otherProps), {}, {
|
|
73
73
|
value: markdown,
|
|
74
74
|
autoComplete: 'off',
|
|
75
75
|
autoCorrect: 'off',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
2
|
import { ContextStore, ExecuteCommandState } from '../../Context';
|
|
3
3
|
import { TextAreaProps } from './Textarea';
|
|
4
4
|
import { IProps } from '../../Types';
|
|
5
|
-
import { TextAreaCommandOrchestrator, ICommand } from '../../commands';
|
|
5
|
+
import { TextAreaCommandOrchestrator, ICommand } from '../../commands/';
|
|
6
6
|
import './index.less';
|
|
7
7
|
type RenderTextareaHandle = {
|
|
8
8
|
dispatch: ContextStore['dispatch'];
|
|
@@ -12,7 +12,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _Context = require("../../Context");
|
|
13
13
|
var _shortcuts = _interopRequireDefault(require("./shortcuts"));
|
|
14
14
|
var _Textarea = _interopRequireDefault(require("./Textarea"));
|
|
15
|
-
var _commands = require("../../commands");
|
|
15
|
+
var _commands = require("../../commands/");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
var _excluded = ["prefixCls", "className", "onScroll", "renderTextarea"];
|
|
18
18
|
function TextArea(props) {
|
|
@@ -44,11 +44,11 @@ function TextArea(props) {
|
|
|
44
44
|
}, []);
|
|
45
45
|
(0, _react.useEffect)(function () {
|
|
46
46
|
if (textRef.current && dispatch) {
|
|
47
|
-
var
|
|
48
|
-
executeRef.current =
|
|
47
|
+
var commandOrchestrator = new _commands.TextAreaCommandOrchestrator(textRef.current);
|
|
48
|
+
executeRef.current = commandOrchestrator;
|
|
49
49
|
dispatch({
|
|
50
50
|
textarea: textRef.current,
|
|
51
|
-
commandOrchestrator:
|
|
51
|
+
commandOrchestrator: commandOrchestrator
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -63,7 +63,7 @@ function TextArea(props) {
|
|
|
63
63
|
onScroll: onScroll,
|
|
64
64
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
65
65
|
className: "".concat(prefixCls, "-text"),
|
|
66
|
-
children: renderTextarea ? (
|
|
66
|
+
children: renderTextarea ? (/*#__PURE__*/_react["default"].cloneElement(renderTextarea((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, otherProps), {}, {
|
|
67
67
|
value: markdown,
|
|
68
68
|
autoComplete: 'off',
|
|
69
69
|
autoCorrect: 'off',
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { ICommand, TextAreaCommandOrchestrator } from '../../commands';
|
|
1
|
+
import { ICommand, TextAreaCommandOrchestrator } from '../../commands/';
|
|
3
2
|
import { ContextStore, ExecuteCommandState } from '../../Context';
|
|
4
3
|
export default function shortcutsHandle(e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>, commands?: ICommand[], commandOrchestrator?: TextAreaCommandOrchestrator, dispatch?: React.Dispatch<ContextStore>, state?: ExecuteCommandState): void;
|