@uiw/react-md-editor 4.0.4 → 4.0.5

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.
Files changed (40) hide show
  1. package/README.md +72 -75
  2. package/dist/mdeditor.css +86 -2
  3. package/dist/mdeditor.js +65647 -66250
  4. package/dist/mdeditor.min.css +1 -1
  5. package/dist/mdeditor.min.js +1 -1
  6. package/dist/mdeditor.min.js.LICENSE.txt +2 -2
  7. package/esm/Context.d.ts +20 -33
  8. package/esm/Editor.js +1 -2
  9. package/esm/Editor.nohighlight.js +1 -2
  10. package/esm/Types.d.ts +1 -1
  11. package/esm/commands/comment.js +1 -2
  12. package/esm/commands/group.d.ts +1 -1
  13. package/esm/commands/issue.js +2 -2
  14. package/esm/commands/preview.js +1 -2
  15. package/esm/components/TextArea/handleKeyDown.d.ts +0 -1
  16. package/esm/components/TextArea/index.d.ts +1 -1
  17. package/esm/components/TextArea/index.js +5 -6
  18. package/esm/components/TextArea/index.nohighlight.d.ts +1 -1
  19. package/esm/components/TextArea/index.nohighlight.js +4 -4
  20. package/esm/components/TextArea/shortcuts.d.ts +0 -1
  21. package/esm/components/Toolbar/Child.d.ts +1 -1
  22. package/esm/components/Toolbar/index.js +1 -2
  23. package/lib/Context.d.ts +20 -33
  24. package/lib/Types.d.ts +1 -1
  25. package/lib/commands/group.d.ts +1 -1
  26. package/lib/commands/index.js +2 -4
  27. package/lib/commands/issue.js +2 -2
  28. package/lib/components/TextArea/handleKeyDown.d.ts +0 -1
  29. package/lib/components/TextArea/index.d.ts +1 -1
  30. package/lib/components/TextArea/index.js +4 -4
  31. package/lib/components/TextArea/index.nohighlight.d.ts +1 -1
  32. package/lib/components/TextArea/index.nohighlight.js +4 -4
  33. package/lib/components/TextArea/shortcuts.d.ts +0 -1
  34. package/lib/components/Toolbar/Child.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/src/Types.ts +1 -1
  37. package/src/commands/issue.tsx +2 -2
  38. package/src/components/TextArea/index.nohighlight.tsx +1 -1
  39. package/src/components/TextArea/index.tsx +1 -1
  40. package/src/components/Toolbar/Child.tsx +1 -1
@@ -9,10 +9,10 @@
9
9
  */
10
10
 
11
11
  /**!
12
- * @uiw/copy-to-clipboard v1.0.16
12
+ * @uiw/copy-to-clipboard v1.0.17
13
13
  * Copy to clipboard.
14
14
  *
15
- * Copyright (c) 2023 Kenny Wang
15
+ * Copyright (c) 2024 Kenny Wang
16
16
  * https://github.com/uiwjs/copy-to-clipboard.git
17
17
  *
18
18
  * @website: https://uiwjs.github.io/copy-to-clipboard
package/esm/Context.d.ts CHANGED
@@ -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
- textarea?: ((props: React.HTMLAttributes<HTMLDivElement> | React.TextareaHTMLAttributes<HTMLTextAreaElement>, opts: {
33
- dispatch: React.Dispatch<ContextStore> | undefined;
34
- onChange?: React.ChangeEventHandler<HTMLTextAreaElement> | undefined;
35
- useContext?: {
36
- commands: ICommand<string>[] | undefined;
37
- extraCommands: ICommand<string>[] | undefined;
38
- commandOrchestrator?: TextAreaCommandOrchestrator | undefined;
39
- } | undefined;
40
- shortcuts?: ((e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>, commands: ICommand[], commandOrchestrator?: TextAreaCommandOrchestrator | undefined, dispatch?: React.Dispatch<ContextStore> | undefined, state?: ExecuteCommandState | undefined) => void) | undefined;
41
- }) => JSX.Element) | undefined;
42
- toolbar?: ((command: ICommand<string>, disabled: boolean, executeCommand: (command: ICommand<string>, name?: string | undefined) => void, index: number) => void | React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined) | undefined;
43
- preview?: ((source: string, state: ContextStore, dispath: React.Dispatch<ContextStore>) => JSX.Element) | undefined;
44
- } | undefined;
45
- commands?: ICommand<string>[] | undefined;
46
- extraCommands?: ICommand<string>[] | undefined;
47
- markdown?: string | undefined;
48
- preview?: PreviewType | undefined;
49
- height?: import("csstype").Property.Height<string | number> | undefined;
50
- fullscreen?: boolean | undefined;
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/esm/Editor.js CHANGED
@@ -8,8 +8,7 @@ import { ToolbarVisibility } from './components/Toolbar';
8
8
  import DragBar from './components/DragBar';
9
9
  import { getCommands, getExtraCommands, TextAreaCommandOrchestrator } from './commands';
10
10
  import { reducer, EditorContext } from './Context';
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
  function setGroupPopFalse(data) {
14
13
  if (data === void 0) {
15
14
  data = {};
@@ -8,8 +8,7 @@ import { ToolbarVisibility } from './components/Toolbar';
8
8
  import DragBar from './components/DragBar';
9
9
  import { getCommands, getExtraCommands, TextAreaCommandOrchestrator } from './commands';
10
10
  import { reducer, EditorContext } from './Context';
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
  function setGroupPopFalse(data) {
14
13
  if (data === void 0) {
15
14
  data = {};
package/esm/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';
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { selectWord, executeCommand } from '../utils/markdownUtils';
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- import { jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
4
  export var comment = {
6
5
  name: 'comment',
7
6
  keyCommand: 'comment',
@@ -2,4 +2,4 @@ import { ICommand, ICommandChildCommands, 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['children'], options?: GroupOptions) => ICommand<string>;
5
+ export declare const group: (arr: ICommandChildCommands["children"], options?: GroupOptions) => ICommand<string>;
@@ -17,8 +17,8 @@ export var issue = {
17
17
  viewBox: "0 0 448 512",
18
18
  children: /*#__PURE__*/_jsx("path", {
19
19
  fill: "currentColor",
20
- d: "M181.3 32.4c17.4 2.9 29.2 19.4 26.3 36.8L197.8 128h95.1l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3s29.2 19.4 26.3 36.8L357.8 128H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H347.1L325.8 320H384c17.7 0 32 14.3 32 32s-14.3 32-32 32H315.1l-11.5 69.3c-2.9 17.4-19.4 29.2-36.826.3s-29.2-19.4-26.3-36.8l9.8-58.7H155.1l-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 384H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l21.3-128H64c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3zM187.1 192L165.8320h95.1l21.3-128H187.1z"
21
- //Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com
20
+ 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"
21
+ //Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
22
22
  })
23
23
  }),
24
24
  execute: (state, api) => {
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
3
  export var codePreview = {
5
4
  name: 'preview',
6
5
  keyCommand: 'preview',
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export default function handleKeyDown(e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>, tabSize?: number, defaultTabEnable?: boolean): void;
@@ -1,4 +1,4 @@
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';
@@ -8,8 +8,7 @@ import Markdown from './Markdown';
8
8
  import Textarea from './Textarea';
9
9
  import { TextAreaCommandOrchestrator } from '../../commands';
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 _commandOrchestrator = new TextAreaCommandOrchestrator(textRef.current);
48
- executeRef.current = _commandOrchestrator;
46
+ var commandOrchestrator = new TextAreaCommandOrchestrator(textRef.current);
47
+ executeRef.current = commandOrchestrator;
49
48
  dispatch({
50
49
  textarea: textRef.current,
51
- commandOrchestrator: _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 ? ( /*#__PURE__*/React.cloneElement(renderTextarea(_extends({}, otherProps, {
68
+ children: renderTextarea ? (/*#__PURE__*/React.cloneElement(renderTextarea(_extends({}, otherProps, {
70
69
  value: markdown,
71
70
  autoComplete: 'off',
72
71
  autoCorrect: 'off',
@@ -1,4 +1,4 @@
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';
@@ -40,11 +40,11 @@ export default function TextArea(props) {
40
40
  }, []);
41
41
  useEffect(() => {
42
42
  if (textRef.current && dispatch) {
43
- var _commandOrchestrator = new TextAreaCommandOrchestrator(textRef.current);
44
- executeRef.current = _commandOrchestrator;
43
+ var commandOrchestrator = new TextAreaCommandOrchestrator(textRef.current);
44
+ executeRef.current = commandOrchestrator;
45
45
  dispatch({
46
46
  textarea: textRef.current,
47
- commandOrchestrator: _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 ? ( /*#__PURE__*/React.cloneElement(renderTextarea(_extends({}, otherProps, {
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
- /// <reference types="react" />
2
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,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { JSX } from 'react';
2
2
  import './Child.less';
3
3
  import { type IToolbarProps } from './';
4
4
  export type ChildProps = IToolbarProps & {
@@ -3,8 +3,7 @@ import React, { Fragment, useContext, useEffect, useRef } from 'react';
3
3
  import { EditorContext } from '../../Context';
4
4
  import Child from './Child';
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/lib/Context.d.ts CHANGED
@@ -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
- textarea?: ((props: React.HTMLAttributes<HTMLDivElement> | React.TextareaHTMLAttributes<HTMLTextAreaElement>, opts: {
33
- dispatch: React.Dispatch<ContextStore> | undefined;
34
- onChange?: React.ChangeEventHandler<HTMLTextAreaElement> | undefined;
35
- useContext?: {
36
- commands: ICommand<string>[] | undefined;
37
- extraCommands: ICommand<string>[] | undefined;
38
- commandOrchestrator?: TextAreaCommandOrchestrator | undefined;
39
- } | undefined;
40
- shortcuts?: ((e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>, commands: ICommand[], commandOrchestrator?: TextAreaCommandOrchestrator | undefined, dispatch?: React.Dispatch<ContextStore> | undefined, state?: ExecuteCommandState | undefined) => void) | undefined;
41
- }) => JSX.Element) | undefined;
42
- toolbar?: ((command: ICommand<string>, disabled: boolean, executeCommand: (command: ICommand<string>, name?: string | undefined) => void, index: number) => void | React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined) | undefined;
43
- preview?: ((source: string, state: ContextStore, dispath: React.Dispatch<ContextStore>) => JSX.Element) | undefined;
44
- } | undefined;
45
- commands?: ICommand<string>[] | undefined;
46
- extraCommands?: ICommand<string>[] | undefined;
47
- markdown?: string | undefined;
48
- preview?: PreviewType | undefined;
49
- height?: import("csstype").Property.Height<string | number> | undefined;
50
- fullscreen?: boolean | undefined;
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/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';
@@ -2,4 +2,4 @@ import { ICommand, ICommandChildCommands, 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['children'], options?: GroupOptions) => ICommand<string>;
5
+ export declare const group: (arr: ICommandChildCommands["children"], options?: GroupOptions) => ICommand<string>;
@@ -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
  }();
@@ -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 128h95.1l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3s29.2 19.4 26.3 36.8L357.8 128H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H347.1L325.8 320H384c17.7 0 32 14.3 32 32s-14.3 32-32 32H315.1l-11.5 69.3c-2.9 17.4-19.4 29.2-36.826.3s-29.2-19.4-26.3-36.8l9.8-58.7H155.1l-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 384H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l21.3-128H64c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3zM187.1 192L165.8320h95.1l21.3-128H187.1z"
28
- //Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com
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) {
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export default function handleKeyDown(e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>, tabSize?: number, defaultTabEnable?: boolean): void;
@@ -1,4 +1,4 @@
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';
@@ -47,11 +47,11 @@ function TextArea(props) {
47
47
  }, []);
48
48
  (0, _react.useEffect)(function () {
49
49
  if (textRef.current && dispatch) {
50
- var _commandOrchestrator = new _commands.TextAreaCommandOrchestrator(textRef.current);
51
- executeRef.current = _commandOrchestrator;
50
+ var commandOrchestrator = new _commands.TextAreaCommandOrchestrator(textRef.current);
51
+ executeRef.current = commandOrchestrator;
52
52
  dispatch({
53
53
  textarea: textRef.current,
54
- commandOrchestrator: _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 ? ( /*#__PURE__*/_react["default"].cloneElement(renderTextarea((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, otherProps), {}, {
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,4 +1,4 @@
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';
@@ -44,11 +44,11 @@ function TextArea(props) {
44
44
  }, []);
45
45
  (0, _react.useEffect)(function () {
46
46
  if (textRef.current && dispatch) {
47
- var _commandOrchestrator = new _commands.TextAreaCommandOrchestrator(textRef.current);
48
- executeRef.current = _commandOrchestrator;
47
+ var commandOrchestrator = new _commands.TextAreaCommandOrchestrator(textRef.current);
48
+ executeRef.current = commandOrchestrator;
49
49
  dispatch({
50
50
  textarea: textRef.current,
51
- commandOrchestrator: _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 ? ( /*#__PURE__*/_react["default"].cloneElement(renderTextarea((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, otherProps), {}, {
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
- /// <reference types="react" />
2
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,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { JSX } from 'react';
2
2
  import './Child.less';
3
3
  import { type IToolbarProps } from './';
4
4
  export type ChildProps = IToolbarProps & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uiw/react-md-editor",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
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",
package/src/Types.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';
@@ -12,8 +12,8 @@ export const issue: ICommand = {
12
12
  <svg role="img" width="12" height="12" viewBox="0 0 448 512">
13
13
  <path
14
14
  fill="currentColor"
15
- d="M181.3 32.4c17.4 2.9 29.2 19.4 26.3 36.8L197.8 128h95.1l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3s29.2 19.4 26.3 36.8L357.8 128H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H347.1L325.8 320H384c17.7 0 32 14.3 32 32s-14.3 32-32 32H315.1l-11.5 69.3c-2.9 17.4-19.4 29.2-36.826.3s-29.2-19.4-26.3-36.8l9.8-58.7H155.1l-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 384H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l21.3-128H64c-17.7 0-32-14.3-32-32s14.3-32 32-32h68.9l11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3zM187.1 192L165.8320h95.1l21.3-128H187.1z"
16
- //Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com
15
+ 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"
16
+ //Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
17
17
  />
18
18
  </svg>
19
19
  ),
@@ -1,4 +1,4 @@
1
- import React, { useEffect, Fragment, useContext } from 'react';
1
+ import React, { useEffect, Fragment, useContext, JSX } from 'react';
2
2
  import { EditorContext, ContextStore, ExecuteCommandState } from '../../Context';
3
3
  import shortcuts from './shortcuts';
4
4
  import Textarea, { TextAreaProps } from './Textarea';
@@ -1,4 +1,4 @@
1
- import React, { useEffect, Fragment, useContext } from 'react';
1
+ import React, { useEffect, Fragment, useContext, JSX } from 'react';
2
2
  import { EditorContext, ContextStore, ExecuteCommandState } from '../../Context';
3
3
  import shortcuts from './shortcuts';
4
4
  import Markdown from './Markdown';
@@ -1,4 +1,4 @@
1
- import React, { useContext, useMemo } from 'react';
1
+ import React, { useContext, useMemo, JSX } from 'react';
2
2
  import './Child.less';
3
3
  import Toolbar, { type IToolbarProps } from './';
4
4
  import { EditorContext } from '../../Context';