@uiw/react-md-editor 3.20.5 → 3.20.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 +5 -2
- package/dist/mdeditor.css +13 -0
- package/dist/mdeditor.js +8985 -914
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/esm/Context.d.ts +3 -3
- package/esm/Context.js +1 -2
- package/esm/Editor.d.ts +1 -1
- package/esm/Editor.js +9 -2
- package/esm/commands/bold.js +1 -2
- package/esm/commands/code.js +2 -3
- package/esm/commands/comment.js +2 -2
- package/esm/commands/divider.js +1 -2
- package/esm/commands/fullscreen.js +2 -3
- package/esm/commands/group.d.ts +1 -1
- package/esm/commands/group.js +1 -2
- package/esm/commands/hr.js +2 -3
- package/esm/commands/image.js +2 -3
- package/esm/commands/index.d.ts +2 -2
- package/esm/commands/index.js +1 -2
- package/esm/commands/italic.js +2 -3
- package/esm/commands/link.js +2 -3
- package/esm/commands/list.d.ts +1 -1
- package/esm/commands/list.js +2 -3
- package/esm/commands/preview.js +2 -3
- package/esm/commands/quote.js +2 -3
- package/esm/commands/strikeThrough.js +2 -3
- package/esm/commands/title.js +1 -2
- package/esm/commands/title1.js +1 -2
- package/esm/commands/title2.js +2 -3
- package/esm/commands/title3.js +2 -3
- package/esm/commands/title4.js +2 -3
- package/esm/commands/title5.js +2 -3
- package/esm/commands/title6.js +2 -3
- package/esm/components/DragBar/index.js +1 -2
- package/esm/components/TextArea/Markdown.js +1 -2
- package/esm/components/TextArea/Textarea.js +1 -2
- package/esm/components/TextArea/handleKeyDown.d.ts +1 -0
- package/esm/components/TextArea/handleKeyDown.js +1 -2
- package/esm/components/TextArea/index.d.ts +2 -2
- package/esm/components/TextArea/index.js +1 -2
- package/esm/components/TextArea/shortcuts.d.ts +1 -0
- package/esm/components/TextArea/shortcuts.js +1 -2
- package/esm/components/Toolbar/Child.d.ts +2 -1
- package/esm/components/Toolbar/Child.js +1 -2
- package/esm/components/Toolbar/index.d.ts +1 -0
- package/esm/components/Toolbar/index.js +1 -2
- package/esm/index.js +1 -2
- package/esm/react-app-env.d.ts +1 -0
- package/esm/utils/InsertTextAtPosition.js +1 -2
- package/esm/utils/markdownUtils.js +1 -2
- package/lib/Context.d.ts +3 -3
- package/lib/Context.js +1 -2
- package/lib/Editor.d.ts +1 -1
- package/lib/Editor.js +13 -2
- package/lib/commands/bold.js +1 -2
- package/lib/commands/code.js +3 -4
- package/lib/commands/comment.js +3 -2
- package/lib/commands/divider.js +1 -2
- package/lib/commands/fullscreen.js +3 -4
- package/lib/commands/group.d.ts +1 -1
- package/lib/commands/group.js +1 -2
- package/lib/commands/hr.js +3 -4
- package/lib/commands/image.js +3 -4
- package/lib/commands/index.d.ts +2 -2
- package/lib/commands/index.js +1 -2
- package/lib/commands/italic.js +3 -4
- package/lib/commands/link.js +3 -4
- package/lib/commands/list.d.ts +1 -1
- package/lib/commands/list.js +3 -4
- package/lib/commands/preview.js +3 -4
- package/lib/commands/quote.js +3 -4
- package/lib/commands/strikeThrough.js +3 -4
- package/lib/commands/title.js +1 -2
- package/lib/commands/title1.js +1 -2
- package/lib/commands/title2.js +3 -4
- package/lib/commands/title3.js +3 -4
- package/lib/commands/title4.js +3 -4
- package/lib/commands/title5.js +3 -4
- package/lib/commands/title6.js +3 -4
- package/lib/components/DragBar/index.js +1 -2
- package/lib/components/TextArea/Markdown.js +1 -2
- package/lib/components/TextArea/Textarea.js +1 -2
- package/lib/components/TextArea/handleKeyDown.d.ts +1 -0
- package/lib/components/TextArea/handleKeyDown.js +1 -2
- package/lib/components/TextArea/index.d.ts +2 -2
- package/lib/components/TextArea/index.js +1 -2
- package/lib/components/TextArea/shortcuts.d.ts +1 -0
- package/lib/components/TextArea/shortcuts.js +1 -2
- package/lib/components/Toolbar/Child.d.ts +2 -1
- package/lib/components/Toolbar/Child.js +1 -2
- package/lib/components/Toolbar/index.d.ts +1 -0
- package/lib/components/Toolbar/index.js +1 -2
- package/lib/index.js +1 -2
- package/lib/react-app-env.d.ts +1 -0
- package/lib/utils/InsertTextAtPosition.js +1 -2
- package/lib/utils/markdownUtils.js +1 -2
- package/package.json +1 -1
- package/src/Editor.tsx +4 -0
- package/src/__test__/commands.test.tsx +4 -4
- package/src/commands/code.tsx +1 -1
- package/src/commands/comment.tsx +1 -0
- package/src/commands/divider.tsx +1 -0
- package/src/commands/fullscreen.tsx +1 -1
- package/src/commands/hr.tsx +1 -1
- package/src/commands/image.tsx +1 -1
- 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 +1 -1
- package/src/commands/quote.tsx +1 -1
- package/src/commands/strikeThrough.tsx +1 -1
- package/src/commands/title2.tsx +1 -1
- package/src/commands/title3.tsx +1 -1
- package/src/commands/title4.tsx +1 -1
- package/src/commands/title5.tsx +1 -1
- package/src/commands/title6.tsx +1 -1
- package/esm/Context.js.map +0 -19
- package/esm/Editor.js.map +0 -116
- package/esm/commands/bold.js.map +0 -38
- package/esm/commands/code.js.map +0 -47
- package/esm/commands/comment.js.map +0 -35
- package/esm/commands/divider.js.map +0 -14
- package/esm/commands/fullscreen.js.map +0 -28
- package/esm/commands/group.js.map +0 -26
- package/esm/commands/hr.js.map +0 -27
- package/esm/commands/image.js.map +0 -40
- package/esm/commands/index.js.map +0 -69
- package/esm/commands/italic.js.map +0 -38
- package/esm/commands/link.js.map +0 -38
- package/esm/commands/list.js.map +0 -61
- package/esm/commands/preview.js.map +0 -31
- package/esm/commands/quote.js.map +0 -44
- package/esm/commands/strikeThrough.js.map +0 -38
- package/esm/commands/title.js.map +0 -16
- package/esm/commands/title1.js.map +0 -33
- package/esm/commands/title2.js.map +0 -33
- package/esm/commands/title3.js.map +0 -33
- package/esm/commands/title4.js.map +0 -33
- package/esm/commands/title5.js.map +0 -33
- package/esm/commands/title6.js.map +0 -33
- package/esm/components/DragBar/index.js.map +0 -41
- package/esm/components/TextArea/Markdown.js.map +0 -47
- package/esm/components/TextArea/Textarea.js.map +0 -47
- package/esm/components/TextArea/handleKeyDown.js.map +0 -66
- package/esm/components/TextArea/index.js.map +0 -57
- package/esm/components/TextArea/shortcuts.js.map +0 -52
- package/esm/components/Toolbar/Child.js.map +0 -28
- package/esm/components/Toolbar/index.js.map +0 -84
- package/esm/index.js.map +0 -15
- package/esm/utils/InsertTextAtPosition.js.map +0 -67
- package/esm/utils/markdownUtils.js.map +0 -31
- package/lib/Context.js.map +0 -19
- package/lib/Editor.js.map +0 -112
- package/lib/commands/bold.js.map +0 -37
- package/lib/commands/code.js.map +0 -46
- package/lib/commands/comment.js.map +0 -35
- package/lib/commands/divider.js.map +0 -14
- package/lib/commands/fullscreen.js.map +0 -27
- package/lib/commands/group.js.map +0 -25
- package/lib/commands/hr.js.map +0 -26
- package/lib/commands/image.js.map +0 -39
- package/lib/commands/index.js.map +0 -64
- package/lib/commands/italic.js.map +0 -37
- package/lib/commands/link.js.map +0 -37
- package/lib/commands/list.js.map +0 -60
- package/lib/commands/preview.js.map +0 -30
- package/lib/commands/quote.js.map +0 -43
- package/lib/commands/strikeThrough.js.map +0 -37
- package/lib/commands/title.js.map +0 -15
- package/lib/commands/title1.js.map +0 -32
- package/lib/commands/title2.js.map +0 -32
- package/lib/commands/title3.js.map +0 -32
- package/lib/commands/title4.js.map +0 -32
- package/lib/commands/title5.js.map +0 -32
- package/lib/commands/title6.js.map +0 -32
- package/lib/components/DragBar/index.js.map +0 -40
- package/lib/components/TextArea/Markdown.js.map +0 -47
- package/lib/components/TextArea/Textarea.js.map +0 -47
- package/lib/components/TextArea/handleKeyDown.js.map +0 -66
- package/lib/components/TextArea/index.js.map +0 -54
- package/lib/components/TextArea/shortcuts.js.map +0 -52
- package/lib/components/Toolbar/Child.js.map +0 -26
- package/lib/components/Toolbar/index.js.map +0 -82
- package/lib/index.js.map +0 -13
- package/lib/utils/InsertTextAtPosition.js.map +0 -67
- package/lib/utils/markdownUtils.js.map +0 -31
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.fullscreen = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
var fullscreen = {
|
|
11
11
|
name: 'fullscreen',
|
|
@@ -34,5 +34,4 @@ var fullscreen = {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
exports.fullscreen = fullscreen;
|
|
38
|
-
//# sourceMappingURL=fullscreen.js.map
|
|
37
|
+
exports.fullscreen = fullscreen;
|
package/lib/commands/group.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ICommand, ICommandChildCommands, ICommandChildHandle } from './';
|
|
2
|
-
export
|
|
2
|
+
export type GroupOptions = Omit<ICommand<string>, 'children'> & {
|
|
3
3
|
children?: ICommandChildHandle['children'];
|
|
4
4
|
};
|
|
5
5
|
export declare const group: (arr: ICommandChildCommands['children'], options?: GroupOptions) => ICommand<string>;
|
package/lib/commands/group.js
CHANGED
package/lib/commands/hr.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.hr = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
var hr = {
|
|
11
11
|
name: 'hr',
|
|
@@ -30,5 +30,4 @@ var hr = {
|
|
|
30
30
|
api.replaceSelection("".concat(state.selectedText, "\n\n").concat(state.command.value || '', "-\n\n"));
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
exports.hr = hr;
|
|
34
|
-
//# sourceMappingURL=hr.js.map
|
|
33
|
+
exports.hr = hr;
|
package/lib/commands/image.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.image = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _markdownUtils = require("../utils/markdownUtils");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var image = {
|
|
@@ -48,5 +48,4 @@ var image = {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
exports.image = image;
|
|
52
|
-
//# sourceMappingURL=image.js.map
|
|
51
|
+
exports.image = image;
|
package/lib/commands/index.d.ts
CHANGED
|
@@ -49,10 +49,10 @@ export interface ICommandBase<T> {
|
|
|
49
49
|
render?: (command: ICommand<T>, disabled: boolean, executeCommand: (command: ICommand<T>, name?: string) => void, index: number) => void | undefined | null | React.ReactElement;
|
|
50
50
|
execute?: (state: ExecuteState, api: TextAreaTextApi, dispatch?: React.Dispatch<ContextStore>, executeCommandState?: ExecuteCommandState, shortcuts?: string[]) => void;
|
|
51
51
|
}
|
|
52
|
-
export
|
|
52
|
+
export type ExecuteState = TextState & {
|
|
53
53
|
command: ICommand;
|
|
54
54
|
};
|
|
55
|
-
export
|
|
55
|
+
export type ICommand<T = string> = ICommandChildCommands<T> | ICommandChildHandle<T>;
|
|
56
56
|
export interface TextRange {
|
|
57
57
|
start: number;
|
|
58
58
|
end: number;
|
package/lib/commands/index.js
CHANGED
|
@@ -274,5 +274,4 @@ var TextAreaCommandOrchestrator = /*#__PURE__*/function () {
|
|
|
274
274
|
}]);
|
|
275
275
|
return TextAreaCommandOrchestrator;
|
|
276
276
|
}();
|
|
277
|
-
exports.TextAreaCommandOrchestrator = TextAreaCommandOrchestrator;
|
|
278
|
-
//# sourceMappingURL=index.js.map
|
|
277
|
+
exports.TextAreaCommandOrchestrator = TextAreaCommandOrchestrator;
|
package/lib/commands/italic.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.italic = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _markdownUtils = require("../utils/markdownUtils");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var italic = {
|
|
@@ -47,5 +47,4 @@ var italic = {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
exports.italic = italic;
|
|
51
|
-
//# sourceMappingURL=italic.js.map
|
|
50
|
+
exports.italic = italic;
|
package/lib/commands/link.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.link = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _markdownUtils = require("../utils/markdownUtils");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var link = {
|
|
@@ -47,5 +47,4 @@ var link = {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
exports.link = link;
|
|
51
|
-
//# sourceMappingURL=link.js.map
|
|
50
|
+
exports.link = link;
|
package/lib/commands/list.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ICommand, TextState, TextAreaTextApi } from './';
|
|
2
|
-
export
|
|
2
|
+
export type AlterLineFunction = (line: string, index: number) => string;
|
|
3
3
|
/**
|
|
4
4
|
* Inserts insertionString before each line
|
|
5
5
|
*/
|
package/lib/commands/list.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.checkedListCommand = void 0;
|
|
8
8
|
exports.insertBeforeEachLine = insertBeforeEachLine;
|
|
9
9
|
exports.unorderedListCommand = exports.orderedListCommand = exports.makeList = void 0;
|
|
10
|
-
var
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _markdownUtils = require("../utils/markdownUtils");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
/**
|
|
@@ -135,5 +135,4 @@ var checkedListCommand = {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
|
-
exports.checkedListCommand = checkedListCommand;
|
|
139
|
-
//# sourceMappingURL=list.js.map
|
|
138
|
+
exports.checkedListCommand = checkedListCommand;
|
package/lib/commands/preview.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.codePreview = exports.codeLive = exports.codeEdit = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
var codePreview = {
|
|
11
11
|
name: 'preview',
|
|
@@ -99,5 +99,4 @@ var codeLive = {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
|
-
exports.codeLive = codeLive;
|
|
103
|
-
//# sourceMappingURL=preview.js.map
|
|
102
|
+
exports.codeLive = codeLive;
|
package/lib/commands/quote.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.quote = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _markdownUtils = require("../utils/markdownUtils");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var quote = {
|
|
@@ -47,5 +47,4 @@ var quote = {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
exports.quote = quote;
|
|
51
|
-
//# sourceMappingURL=quote.js.map
|
|
50
|
+
exports.quote = quote;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.strikethrough = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _markdownUtils = require("../utils/markdownUtils");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var strikethrough = {
|
|
@@ -47,5 +47,4 @@ var strikethrough = {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
exports.strikethrough = strikethrough;
|
|
51
|
-
//# sourceMappingURL=strikeThrough.js.map
|
|
50
|
+
exports.strikethrough = strikethrough;
|
package/lib/commands/title.js
CHANGED
package/lib/commands/title1.js
CHANGED
package/lib/commands/title2.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.title2 = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _InsertTextAtPosition = require("../utils/InsertTextAtPosition");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var title2 = {
|
|
@@ -32,5 +32,4 @@ var title2 = {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
exports.title2 = title2;
|
|
36
|
-
//# sourceMappingURL=title2.js.map
|
|
35
|
+
exports.title2 = title2;
|
package/lib/commands/title3.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.title3 = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _InsertTextAtPosition = require("../utils/InsertTextAtPosition");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var title3 = {
|
|
@@ -32,5 +32,4 @@ var title3 = {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
exports.title3 = title3;
|
|
36
|
-
//# sourceMappingURL=title3.js.map
|
|
35
|
+
exports.title3 = title3;
|
package/lib/commands/title4.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.title4 = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _InsertTextAtPosition = require("../utils/InsertTextAtPosition");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var title4 = {
|
|
@@ -32,5 +32,4 @@ var title4 = {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
exports.title4 = title4;
|
|
36
|
-
//# sourceMappingURL=title4.js.map
|
|
35
|
+
exports.title4 = title4;
|
package/lib/commands/title5.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.title5 = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _InsertTextAtPosition = require("../utils/InsertTextAtPosition");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var title5 = {
|
|
@@ -32,5 +32,4 @@ var title5 = {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
exports.title5 = title5;
|
|
36
|
-
//# sourceMappingURL=title5.js.map
|
|
35
|
+
exports.title5 = title5;
|
package/lib/commands/title6.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.title6 = void 0;
|
|
8
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _InsertTextAtPosition = require("../utils/InsertTextAtPosition");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
var title6 = {
|
|
@@ -32,5 +32,4 @@ var title6 = {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
exports.title6 = title6;
|
|
36
|
-
//# sourceMappingURL=title6.js.map
|
|
35
|
+
exports.title6 = title6;
|
|
@@ -4,7 +4,7 @@ import { TextAreaProps } from './Textarea';
|
|
|
4
4
|
import { IProps } from '../../Editor';
|
|
5
5
|
import { TextAreaCommandOrchestrator, ICommand } from '../../commands';
|
|
6
6
|
import './index.less';
|
|
7
|
-
|
|
7
|
+
type RenderTextareaHandle = {
|
|
8
8
|
dispatch: ContextStore['dispatch'];
|
|
9
9
|
onChange?: TextAreaProps['onChange'];
|
|
10
10
|
useContext?: {
|
|
@@ -19,7 +19,7 @@ export interface ITextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTe
|
|
|
19
19
|
onScroll?: (e: React.UIEvent<HTMLDivElement>) => void;
|
|
20
20
|
renderTextarea?: (props: React.TextareaHTMLAttributes<HTMLTextAreaElement> | React.HTMLAttributes<HTMLDivElement>, opts: RenderTextareaHandle) => JSX.Element;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export type TextAreaRef = {
|
|
23
23
|
text?: HTMLTextAreaElement;
|
|
24
24
|
warp?: HTMLDivElement;
|
|
25
25
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ICommand, TextAreaCommandOrchestrator } from '../../commands';
|
|
2
3
|
import { ContextStore, ExecuteCommandState } from '../../Context';
|
|
3
4
|
export default function shortcutsHandle(e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>, commands?: ICommand[], commandOrchestrator?: TextAreaCommandOrchestrator, dispatch?: React.Dispatch<ContextStore>, state?: ExecuteCommandState): void;
|
package/lib/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="react-scripts" />
|
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.6",
|
|
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>",
|
package/src/Editor.tsx
CHANGED
|
@@ -265,6 +265,10 @@ const InternalMDEditor = (
|
|
|
265
265
|
() => height !== state.height && onHeightChange && onHeightChange(state.height, height, state),
|
|
266
266
|
[height, onHeightChange, state],
|
|
267
267
|
);
|
|
268
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
269
|
+
useMemo(() => commands !== state.commands && dispatch({ commands: cmds }), [props.commands]);
|
|
270
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
271
|
+
useMemo(() => extraCommands !== state.extraCommands && dispatch({ extraCommands: extraCmds }), [props.extraCommands]);
|
|
268
272
|
|
|
269
273
|
const textareaDomRef = useRef<HTMLDivElement>();
|
|
270
274
|
const active = useRef<'text' | 'preview'>('preview');
|
|
@@ -152,7 +152,7 @@ it('MDEditor commands HR', async () => {
|
|
|
152
152
|
}),
|
|
153
153
|
);
|
|
154
154
|
const inputNode = screen.getByTitle('test');
|
|
155
|
-
expect(inputNode).toHaveValue('\n\n
|
|
155
|
+
expect(inputNode).toHaveValue('\n\n-----------\n\ntitle');
|
|
156
156
|
});
|
|
157
157
|
|
|
158
158
|
it('MDEditor commands strikethrough text', async () => {
|
|
@@ -206,7 +206,7 @@ it('MDEditor commands link', async () => {
|
|
|
206
206
|
}),
|
|
207
207
|
);
|
|
208
208
|
const inputNode = screen.getByTitle('test');
|
|
209
|
-
expect(inputNode).toHaveValue('[title](
|
|
209
|
+
expect(inputNode).toHaveValue('[title](URL Here)');
|
|
210
210
|
});
|
|
211
211
|
|
|
212
212
|
it('MDEditor commands image', async () => {
|
|
@@ -233,7 +233,7 @@ it('MDEditor commands image', async () => {
|
|
|
233
233
|
}),
|
|
234
234
|
);
|
|
235
235
|
const inputNode = screen.getByTitle('test');
|
|
236
|
-
expect(inputNode).toHaveValue('');
|
|
236
|
+
expect(inputNode).toHaveValue('');
|
|
237
237
|
});
|
|
238
238
|
|
|
239
239
|
it("MDEditor commands image === ''", async () => {
|
|
@@ -260,7 +260,7 @@ it("MDEditor commands image === ''", async () => {
|
|
|
260
260
|
}),
|
|
261
261
|
);
|
|
262
262
|
const inputNode = screen.getByTitle('test');
|
|
263
|
-
expect(inputNode).toHaveValue('');
|
|
263
|
+
expect(inputNode).toHaveValue('');
|
|
264
264
|
});
|
|
265
265
|
|
|
266
266
|
it('MDEditor commands Add unordered list', async () => {
|
package/src/commands/code.tsx
CHANGED
package/src/commands/comment.tsx
CHANGED
package/src/commands/divider.tsx
CHANGED
package/src/commands/hr.tsx
CHANGED
package/src/commands/image.tsx
CHANGED
package/src/commands/italic.tsx
CHANGED
package/src/commands/link.tsx
CHANGED
package/src/commands/list.tsx
CHANGED
package/src/commands/preview.tsx
CHANGED