@uiw/react-md-editor 4.0.6 → 4.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -2
- package/commands.d.ts +14 -7
- package/dist/mdeditor.js +61 -17
- package/dist/mdeditor.min.js +1 -1
- package/esm/Context.d.ts +2 -0
- package/esm/Editor.js +5 -1
- package/esm/Editor.nohighlight.js +5 -1
- package/esm/Types.d.ts +6 -2
- package/esm/commands/index.cn.js +4 -4
- package/esm/commands/index.d.ts +8 -8
- package/esm/commands/index.js +8 -8
- package/esm/commands/title.d.ts +7 -1
- package/esm/commands/title.js +11 -4
- package/esm/commands/title1.d.ts +6 -0
- package/esm/commands/title1.js +16 -9
- package/esm/commands/title2.d.ts +6 -0
- package/esm/commands/title2.js +16 -9
- package/esm/commands/title3.d.ts +6 -0
- package/esm/commands/title3.js +16 -9
- package/esm/commands/title4.d.ts +6 -0
- package/esm/commands/title4.js +16 -9
- package/esm/commands/title5.d.ts +6 -0
- package/esm/commands/title5.js +16 -9
- package/esm/commands/title6.d.ts +6 -0
- package/esm/commands/title6.js +16 -9
- package/esm/components/TextArea/Textarea.js +18 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/lib/Context.d.ts +2 -0
- package/lib/Editor.js +8 -1
- package/lib/Editor.nohighlight.js +8 -1
- package/lib/Types.d.ts +6 -2
- package/lib/commands/index.cn.js +4 -4
- package/lib/commands/index.d.ts +8 -8
- package/lib/commands/index.js +42 -0
- package/lib/commands/title.d.ts +7 -1
- package/lib/commands/title.js +12 -4
- package/lib/commands/title1.d.ts +6 -0
- package/lib/commands/title1.js +16 -9
- package/lib/commands/title2.d.ts +6 -0
- package/lib/commands/title2.js +16 -9
- package/lib/commands/title3.d.ts +6 -0
- package/lib/commands/title3.js +16 -9
- package/lib/commands/title4.d.ts +6 -0
- package/lib/commands/title4.js +16 -9
- package/lib/commands/title5.d.ts +6 -0
- package/lib/commands/title5.js +16 -9
- package/lib/commands/title6.d.ts +6 -0
- package/lib/commands/title6.js +16 -9
- package/lib/components/TextArea/Textarea.js +18 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +9 -1
- package/nohighlight.d.ts +2 -0
- package/package.json +1 -1
- package/src/Context.tsx +1 -0
- package/src/Editor.nohighlight.tsx +2 -0
- package/src/Editor.tsx +2 -0
- package/src/Types.ts +6 -2
- package/src/commands/index.cn.ts +3 -3
- package/src/commands/index.ts +14 -7
- package/src/commands/title.tsx +11 -4
- package/src/commands/title1.tsx +14 -7
- package/src/commands/title2.tsx +14 -7
- package/src/commands/title3.tsx +14 -7
- package/src/commands/title4.tsx +14 -7
- package/src/commands/title5.tsx +14 -7
- package/src/commands/title6.tsx +14 -7
- package/src/components/TextArea/Textarea.tsx +18 -0
- package/src/index.tsx +1 -0
package/lib/Editor.js
CHANGED
|
@@ -17,7 +17,7 @@ var _DragBar = _interopRequireDefault(require("./components/DragBar/"));
|
|
|
17
17
|
var _commands = require("./commands/");
|
|
18
18
|
var _Context = require("./Context");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
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"];
|
|
20
|
+
var _excluded = ["prefixCls", "className", "value", "commands", "commandsFilter", "direction", "extraCommands", "height", "enableScroll", "visibleDragbar", "highlightEnable", "preview", "fullscreen", "overflow", "previewOptions", "textareaProps", "maxHeight", "minHeight", "autoFocus", "autoFocusEnd", "tabSize", "defaultTabEnable", "onChange", "onStatistics", "onHeightChange", "hideToolbar", "toolbarBottom", "components", "renderTextarea"];
|
|
21
21
|
function setGroupPopFalse() {
|
|
22
22
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23
23
|
Object.keys(data).forEach(function (keyname) {
|
|
@@ -59,6 +59,8 @@ var InternalMDEditor = /*#__PURE__*/_react["default"].forwardRef(function (props
|
|
|
59
59
|
_ref$minHeight = _ref.minHeight,
|
|
60
60
|
minHeight = _ref$minHeight === void 0 ? 100 : _ref$minHeight,
|
|
61
61
|
autoFocus = _ref.autoFocus,
|
|
62
|
+
_ref$autoFocusEnd = _ref.autoFocusEnd,
|
|
63
|
+
autoFocusEnd = _ref$autoFocusEnd === void 0 ? false : _ref$autoFocusEnd,
|
|
62
64
|
_ref$tabSize = _ref.tabSize,
|
|
63
65
|
tabSize = _ref$tabSize === void 0 ? 2 : _ref$tabSize,
|
|
64
66
|
_ref$defaultTabEnable = _ref.defaultTabEnable,
|
|
@@ -152,6 +154,11 @@ var InternalMDEditor = /*#__PURE__*/_react["default"].forwardRef(function (props
|
|
|
152
154
|
autoFocus: autoFocus
|
|
153
155
|
});
|
|
154
156
|
}, [autoFocus]);
|
|
157
|
+
(0, _react.useMemo)(function () {
|
|
158
|
+
return autoFocusEnd !== state.autoFocusEnd && dispatch({
|
|
159
|
+
autoFocusEnd: autoFocusEnd
|
|
160
|
+
});
|
|
161
|
+
}, [autoFocusEnd]);
|
|
155
162
|
(0, _react.useMemo)(function () {
|
|
156
163
|
return fullscreen !== state.fullscreen && dispatch({
|
|
157
164
|
fullscreen: fullscreen
|
|
@@ -17,7 +17,7 @@ var _DragBar = _interopRequireDefault(require("./components/DragBar/"));
|
|
|
17
17
|
var _commands = require("./commands/");
|
|
18
18
|
var _Context = require("./Context");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
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"];
|
|
20
|
+
var _excluded = ["prefixCls", "className", "value", "commands", "commandsFilter", "direction", "extraCommands", "height", "enableScroll", "visibleDragbar", "highlightEnable", "preview", "fullscreen", "overflow", "previewOptions", "textareaProps", "maxHeight", "minHeight", "autoFocus", "autoFocusEnd", "tabSize", "defaultTabEnable", "onChange", "onStatistics", "onHeightChange", "hideToolbar", "toolbarBottom", "components", "renderTextarea"];
|
|
21
21
|
function setGroupPopFalse() {
|
|
22
22
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23
23
|
Object.keys(data).forEach(function (keyname) {
|
|
@@ -59,6 +59,8 @@ var InternalMDEditor = /*#__PURE__*/_react["default"].forwardRef(function (props
|
|
|
59
59
|
_ref$minHeight = _ref.minHeight,
|
|
60
60
|
minHeight = _ref$minHeight === void 0 ? 100 : _ref$minHeight,
|
|
61
61
|
autoFocus = _ref.autoFocus,
|
|
62
|
+
_ref$autoFocusEnd = _ref.autoFocusEnd,
|
|
63
|
+
autoFocusEnd = _ref$autoFocusEnd === void 0 ? false : _ref$autoFocusEnd,
|
|
62
64
|
_ref$tabSize = _ref.tabSize,
|
|
63
65
|
tabSize = _ref$tabSize === void 0 ? 2 : _ref$tabSize,
|
|
64
66
|
_ref$defaultTabEnable = _ref.defaultTabEnable,
|
|
@@ -152,6 +154,11 @@ var InternalMDEditor = /*#__PURE__*/_react["default"].forwardRef(function (props
|
|
|
152
154
|
autoFocus: autoFocus
|
|
153
155
|
});
|
|
154
156
|
}, [autoFocus]);
|
|
157
|
+
(0, _react.useMemo)(function () {
|
|
158
|
+
return autoFocusEnd !== state.autoFocusEnd && dispatch({
|
|
159
|
+
autoFocusEnd: autoFocusEnd
|
|
160
|
+
});
|
|
161
|
+
}, [autoFocusEnd]);
|
|
155
162
|
(0, _react.useMemo)(function () {
|
|
156
163
|
return fullscreen !== state.fullscreen && dispatch({
|
|
157
164
|
fullscreen: fullscreen
|
package/lib/Types.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ export interface MDEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
34
34
|
* or it has an `autofocus` attribute and no other element is focused.
|
|
35
35
|
*/
|
|
36
36
|
autoFocus?: ITextAreaProps['autoFocus'];
|
|
37
|
+
/**
|
|
38
|
+
* Can be used to make `Markdown Editor` focus on the end of text on initialization.
|
|
39
|
+
*/
|
|
40
|
+
autoFocusEnd?: boolean;
|
|
37
41
|
/**
|
|
38
42
|
* The height of the editor.
|
|
39
43
|
* ⚠️ `Dragbar` is invalid when **`height`** parameter percentage.
|
|
@@ -52,7 +56,7 @@ export interface MDEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
52
56
|
*/
|
|
53
57
|
visibleDragbar?: boolean;
|
|
54
58
|
/**
|
|
55
|
-
* @deprecated use
|
|
59
|
+
* @deprecated use {@link MDEditorProps.visibleDragbar}
|
|
56
60
|
*/
|
|
57
61
|
visiableDragbar?: boolean;
|
|
58
62
|
/**
|
|
@@ -85,7 +89,7 @@ export interface MDEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
85
89
|
textareaProps?: ITextAreaProps;
|
|
86
90
|
/**
|
|
87
91
|
* Use div to replace TextArea or re-render TextArea
|
|
88
|
-
* @deprecated Please use
|
|
92
|
+
* @deprecated Please use {@link components}
|
|
89
93
|
*/
|
|
90
94
|
renderTextarea?: ITextAreaProps['renderTextarea'];
|
|
91
95
|
/**
|
package/lib/commands/index.cn.js
CHANGED
|
@@ -76,8 +76,8 @@ var fullscreen = exports.fullscreen = (0, _objectSpread2["default"])((0, _object
|
|
|
76
76
|
});
|
|
77
77
|
var hr = exports.hr = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _hr.hr), {}, {
|
|
78
78
|
buttonProps: {
|
|
79
|
-
'aria-label': '
|
|
80
|
-
title: '
|
|
79
|
+
'aria-label': '插入分割线 (ctrl + h)',
|
|
80
|
+
title: '插入分割线 (ctrl + h)'
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
var image = exports.image = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _image.image), {}, {
|
|
@@ -142,8 +142,8 @@ var quote = exports.quote = (0, _objectSpread2["default"])((0, _objectSpread2["d
|
|
|
142
142
|
});
|
|
143
143
|
var strikethrough = exports.strikethrough = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _strikeThrough.strikethrough), {}, {
|
|
144
144
|
buttonProps: {
|
|
145
|
-
'aria-label': '
|
|
146
|
-
title: '
|
|
145
|
+
'aria-label': '添加删除线文本 (ctrl + shift + x)',
|
|
146
|
+
title: '添加删除线文本 (ctrl + shift + x)'
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
var issue = exports.issue = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _issue.issue), {}, {
|
package/lib/commands/index.d.ts
CHANGED
|
@@ -14,13 +14,13 @@ import { checkedListCommand, orderedListCommand, unorderedListCommand } from './
|
|
|
14
14
|
import { codeEdit, codeLive, codePreview } from './preview';
|
|
15
15
|
import { quote } from './quote';
|
|
16
16
|
import { strikethrough } from './strikeThrough';
|
|
17
|
-
import { title } from './title';
|
|
18
|
-
import { title1 } from './title1';
|
|
19
|
-
import { title2 } from './title2';
|
|
20
|
-
import { title3 } from './title3';
|
|
21
|
-
import { title4 } from './title4';
|
|
22
|
-
import { title5 } from './title5';
|
|
23
|
-
import { title6 } from './title6';
|
|
17
|
+
import { title, heading } from './title';
|
|
18
|
+
import { title1, heading1 } from './title1';
|
|
19
|
+
import { title2, heading2 } from './title2';
|
|
20
|
+
import { title3, heading3 } from './title3';
|
|
21
|
+
import { title4, heading4 } from './title4';
|
|
22
|
+
import { title5, heading5 } from './title5';
|
|
23
|
+
import { title6, heading6 } from './title6';
|
|
24
24
|
import { table } from './table';
|
|
25
25
|
import { issue } from './issue';
|
|
26
26
|
import { help } from './help';
|
|
@@ -93,4 +93,4 @@ declare class TextAreaCommandOrchestrator implements CommandOrchestrator {
|
|
|
93
93
|
getState(): false | TextState;
|
|
94
94
|
executeCommand(command: ICommand<string>, dispatch?: React.Dispatch<ContextStore>, state?: ExecuteCommandState, shortcuts?: string[]): void;
|
|
95
95
|
}
|
|
96
|
-
export { title, title1, title2, title3, title4, title5, title6, bold, codeBlock, comment, italic, strikethrough, hr, group, divider, link, quote, code, image, unorderedListCommand, orderedListCommand, checkedListCommand, table, issue, help, codeEdit, codeLive, codePreview, fullscreen, getCommands, getExtraCommands, getStateFromTextArea, TextAreaCommandOrchestrator, TextAreaTextApi, };
|
|
96
|
+
export { title, title1, title2, title3, title4, title5, title6, heading, heading1, heading2, heading3, heading4, heading5, heading6, bold, codeBlock, comment, italic, strikethrough, hr, group, divider, link, quote, code, image, unorderedListCommand, orderedListCommand, checkedListCommand, table, issue, help, codeEdit, codeLive, codePreview, fullscreen, getCommands, getExtraCommands, getStateFromTextArea, TextAreaCommandOrchestrator, TextAreaTextApi, };
|
package/lib/commands/index.js
CHANGED
|
@@ -73,6 +73,48 @@ Object.defineProperty(exports, "group", {
|
|
|
73
73
|
return _group.group;
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
+
Object.defineProperty(exports, "heading", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function get() {
|
|
79
|
+
return _title.heading;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, "heading1", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function get() {
|
|
85
|
+
return _title2.heading1;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, "heading2", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function get() {
|
|
91
|
+
return _title3.heading2;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
Object.defineProperty(exports, "heading3", {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function get() {
|
|
97
|
+
return _title4.heading3;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(exports, "heading4", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function get() {
|
|
103
|
+
return _title5.heading4;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
Object.defineProperty(exports, "heading5", {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
get: function get() {
|
|
109
|
+
return _title6.heading5;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
Object.defineProperty(exports, "heading6", {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
get: function get() {
|
|
115
|
+
return _title7.heading6;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
76
118
|
Object.defineProperty(exports, "help", {
|
|
77
119
|
enumerable: true,
|
|
78
120
|
get: function get() {
|
package/lib/commands/title.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { ICommand, ExecuteState, TextAreaTextApi } from './';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function headingExecute({ state, api, prefix, suffix, }: {
|
|
3
3
|
state: ExecuteState;
|
|
4
4
|
api: TextAreaTextApi;
|
|
5
5
|
prefix: string;
|
|
6
6
|
suffix?: string;
|
|
7
7
|
}): void;
|
|
8
|
+
export declare const heading: ICommand;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use `heading` instead.
|
|
11
|
+
* This command is now deprecated and will be removed in future versions.
|
|
12
|
+
* Use `title` for inserting headings.
|
|
13
|
+
*/
|
|
8
14
|
export declare const title: ICommand;
|
package/lib/commands/title.js
CHANGED
|
@@ -4,14 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.heading = void 0;
|
|
8
|
+
exports.headingExecute = headingExecute;
|
|
7
9
|
exports.title = void 0;
|
|
8
|
-
exports.titleExecute = titleExecute;
|
|
9
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
12
|
var _title = require("./title1");
|
|
12
13
|
var _markdownUtils = require("../utils/markdownUtils");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function
|
|
15
|
+
function headingExecute(_ref) {
|
|
15
16
|
var state = _ref.state,
|
|
16
17
|
api = _ref.api,
|
|
17
18
|
prefix = _ref.prefix,
|
|
@@ -30,7 +31,7 @@ function titleExecute(_ref) {
|
|
|
30
31
|
suffix: suffix
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
|
-
var
|
|
34
|
+
var heading = exports.heading = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _title.heading1), {}, {
|
|
34
35
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
35
36
|
width: "12",
|
|
36
37
|
height: "12",
|
|
@@ -40,4 +41,11 @@ var title = exports.title = (0, _objectSpread2["default"])((0, _objectSpread2["d
|
|
|
40
41
|
d: "M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z"
|
|
41
42
|
})
|
|
42
43
|
})
|
|
43
|
-
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Use `heading` instead.
|
|
48
|
+
* This command is now deprecated and will be removed in future versions.
|
|
49
|
+
* Use `title` for inserting headings.
|
|
50
|
+
*/
|
|
51
|
+
var title = exports.title = heading;
|
package/lib/commands/title1.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { ICommand } from './';
|
|
2
|
+
export declare const heading1: ICommand;
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `heading1` instead.
|
|
5
|
+
* This command is now deprecated and will be removed in future versions.
|
|
6
|
+
* Use `title1` for inserting Heading 1.
|
|
7
|
+
*/
|
|
2
8
|
export declare const title1: ICommand;
|
package/lib/commands/title1.js
CHANGED
|
@@ -4,33 +4,40 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.title1 = void 0;
|
|
7
|
+
exports.title1 = exports.heading1 = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _title = require("../commands/title");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
var
|
|
12
|
-
name: '
|
|
13
|
-
keyCommand: '
|
|
11
|
+
var heading1 = exports.heading1 = {
|
|
12
|
+
name: 'heading1',
|
|
13
|
+
keyCommand: 'heading1',
|
|
14
14
|
shortcuts: 'ctrlcmd+1',
|
|
15
15
|
prefix: '# ',
|
|
16
16
|
suffix: '',
|
|
17
17
|
buttonProps: {
|
|
18
|
-
'aria-label': 'Insert
|
|
19
|
-
title: 'Insert
|
|
18
|
+
'aria-label': 'Insert Heading 1 (ctrl + 1)',
|
|
19
|
+
title: 'Insert Heading 1 (ctrl + 1)'
|
|
20
20
|
},
|
|
21
21
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22
22
|
style: {
|
|
23
23
|
fontSize: 18,
|
|
24
24
|
textAlign: 'left'
|
|
25
25
|
},
|
|
26
|
-
children: "
|
|
26
|
+
children: "Heading 1"
|
|
27
27
|
}),
|
|
28
28
|
execute: function execute(state, api) {
|
|
29
|
-
(0, _title.
|
|
29
|
+
(0, _title.headingExecute)({
|
|
30
30
|
state: state,
|
|
31
31
|
api: api,
|
|
32
32
|
prefix: state.command.prefix,
|
|
33
33
|
suffix: state.command.suffix
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `heading1` instead.
|
|
40
|
+
* This command is now deprecated and will be removed in future versions.
|
|
41
|
+
* Use `title1` for inserting Heading 1.
|
|
42
|
+
*/
|
|
43
|
+
var title1 = exports.title1 = heading1;
|
package/lib/commands/title2.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { ICommand } from './';
|
|
2
|
+
export declare const heading2: ICommand;
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `heading2` instead.
|
|
5
|
+
* This command is now deprecated and will be removed in future versions.
|
|
6
|
+
* Use `title2` for inserting Heading 2.
|
|
7
|
+
*/
|
|
2
8
|
export declare const title2: ICommand;
|
package/lib/commands/title2.js
CHANGED
|
@@ -4,33 +4,40 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.title2 = void 0;
|
|
7
|
+
exports.title2 = exports.heading2 = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _title = require("../commands/title");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
var
|
|
12
|
-
name: '
|
|
13
|
-
keyCommand: '
|
|
11
|
+
var heading2 = exports.heading2 = {
|
|
12
|
+
name: 'heading2',
|
|
13
|
+
keyCommand: 'heading2',
|
|
14
14
|
shortcuts: 'ctrlcmd+2',
|
|
15
15
|
prefix: '## ',
|
|
16
16
|
suffix: '',
|
|
17
17
|
buttonProps: {
|
|
18
|
-
'aria-label': 'Insert
|
|
19
|
-
title: 'Insert
|
|
18
|
+
'aria-label': 'Insert Heading 2 (ctrl + 2)',
|
|
19
|
+
title: 'Insert Heading 2 (ctrl + 2)'
|
|
20
20
|
},
|
|
21
21
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22
22
|
style: {
|
|
23
23
|
fontSize: 16,
|
|
24
24
|
textAlign: 'left'
|
|
25
25
|
},
|
|
26
|
-
children: "
|
|
26
|
+
children: "Heading 2"
|
|
27
27
|
}),
|
|
28
28
|
execute: function execute(state, api) {
|
|
29
|
-
(0, _title.
|
|
29
|
+
(0, _title.headingExecute)({
|
|
30
30
|
state: state,
|
|
31
31
|
api: api,
|
|
32
32
|
prefix: state.command.prefix,
|
|
33
33
|
suffix: state.command.suffix
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `heading2` instead.
|
|
40
|
+
* This command is now deprecated and will be removed in future versions.
|
|
41
|
+
* Use `title2` for inserting Heading 2.
|
|
42
|
+
*/
|
|
43
|
+
var title2 = exports.title2 = heading2;
|
package/lib/commands/title3.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { ICommand } from './';
|
|
2
|
+
export declare const heading3: ICommand;
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `heading3` instead.
|
|
5
|
+
* This command is now deprecated and will be removed in future versions.
|
|
6
|
+
* Use `title3` for inserting Heading 3.
|
|
7
|
+
*/
|
|
2
8
|
export declare const title3: ICommand;
|
package/lib/commands/title3.js
CHANGED
|
@@ -4,33 +4,40 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.title3 = void 0;
|
|
7
|
+
exports.title3 = exports.heading3 = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _title = require("../commands/title");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
var
|
|
12
|
-
name: '
|
|
13
|
-
keyCommand: '
|
|
11
|
+
var heading3 = exports.heading3 = {
|
|
12
|
+
name: 'heading3',
|
|
13
|
+
keyCommand: 'heading3',
|
|
14
14
|
shortcuts: 'ctrlcmd+3',
|
|
15
15
|
prefix: '### ',
|
|
16
16
|
suffix: '',
|
|
17
17
|
buttonProps: {
|
|
18
|
-
'aria-label': 'Insert
|
|
19
|
-
title: 'Insert
|
|
18
|
+
'aria-label': 'Insert Heading 3 (ctrl + 3)',
|
|
19
|
+
title: 'Insert Heading 3 (ctrl + 3)'
|
|
20
20
|
},
|
|
21
21
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22
22
|
style: {
|
|
23
23
|
fontSize: 15,
|
|
24
24
|
textAlign: 'left'
|
|
25
25
|
},
|
|
26
|
-
children: "
|
|
26
|
+
children: "Heading 3"
|
|
27
27
|
}),
|
|
28
28
|
execute: function execute(state, api) {
|
|
29
|
-
(0, _title.
|
|
29
|
+
(0, _title.headingExecute)({
|
|
30
30
|
state: state,
|
|
31
31
|
api: api,
|
|
32
32
|
prefix: state.command.prefix,
|
|
33
33
|
suffix: state.command.suffix
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `heading3` instead.
|
|
40
|
+
* This command is now deprecated and will be removed in future versions.
|
|
41
|
+
* Use `title3` for inserting Heading 3.
|
|
42
|
+
*/
|
|
43
|
+
var title3 = exports.title3 = heading3;
|
package/lib/commands/title4.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { ICommand } from './';
|
|
2
|
+
export declare const heading4: ICommand;
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `heading4` instead.
|
|
5
|
+
* This command is now deprecated and will be removed in future versions.
|
|
6
|
+
* Use `title4` for inserting Heading 4.
|
|
7
|
+
*/
|
|
2
8
|
export declare const title4: ICommand;
|
package/lib/commands/title4.js
CHANGED
|
@@ -4,33 +4,40 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.title4 = void 0;
|
|
7
|
+
exports.title4 = exports.heading4 = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _title = require("../commands/title");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
var
|
|
12
|
-
name: '
|
|
13
|
-
keyCommand: '
|
|
11
|
+
var heading4 = exports.heading4 = {
|
|
12
|
+
name: 'heading4',
|
|
13
|
+
keyCommand: 'heading4',
|
|
14
14
|
shortcuts: 'ctrlcmd+4',
|
|
15
15
|
prefix: '#### ',
|
|
16
16
|
suffix: '',
|
|
17
17
|
buttonProps: {
|
|
18
|
-
'aria-label': 'Insert
|
|
19
|
-
title: 'Insert
|
|
18
|
+
'aria-label': 'Insert Heading 4 (ctrl + 4)',
|
|
19
|
+
title: 'Insert Heading 4 (ctrl + 4)'
|
|
20
20
|
},
|
|
21
21
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22
22
|
style: {
|
|
23
23
|
fontSize: 14,
|
|
24
24
|
textAlign: 'left'
|
|
25
25
|
},
|
|
26
|
-
children: "
|
|
26
|
+
children: "Heading 4"
|
|
27
27
|
}),
|
|
28
28
|
execute: function execute(state, api) {
|
|
29
|
-
(0, _title.
|
|
29
|
+
(0, _title.headingExecute)({
|
|
30
30
|
state: state,
|
|
31
31
|
api: api,
|
|
32
32
|
prefix: state.command.prefix,
|
|
33
33
|
suffix: state.command.suffix
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `heading4` instead.
|
|
40
|
+
* This command is now deprecated and will be removed in future versions.
|
|
41
|
+
* Use `title4` for inserting Heading 4.
|
|
42
|
+
*/
|
|
43
|
+
var title4 = exports.title4 = heading4;
|
package/lib/commands/title5.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { ICommand } from './';
|
|
2
|
+
export declare const heading5: ICommand;
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `heading5` instead.
|
|
5
|
+
* This command is now deprecated and will be removed in future versions.
|
|
6
|
+
* Use `title5` for inserting Heading 5.
|
|
7
|
+
*/
|
|
2
8
|
export declare const title5: ICommand;
|
package/lib/commands/title5.js
CHANGED
|
@@ -4,33 +4,40 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.title5 = void 0;
|
|
7
|
+
exports.title5 = exports.heading5 = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _title = require("../commands/title");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
var
|
|
12
|
-
name: '
|
|
13
|
-
keyCommand: '
|
|
11
|
+
var heading5 = exports.heading5 = {
|
|
12
|
+
name: 'heading5',
|
|
13
|
+
keyCommand: 'heading5',
|
|
14
14
|
shortcuts: 'ctrlcmd+5',
|
|
15
15
|
prefix: '##### ',
|
|
16
16
|
suffix: '',
|
|
17
17
|
buttonProps: {
|
|
18
|
-
'aria-label': 'Insert
|
|
19
|
-
title: 'Insert
|
|
18
|
+
'aria-label': 'Insert Heading 5 (ctrl + 5)',
|
|
19
|
+
title: 'Insert Heading 5 (ctrl + 5)'
|
|
20
20
|
},
|
|
21
21
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22
22
|
style: {
|
|
23
23
|
fontSize: 12,
|
|
24
24
|
textAlign: 'left'
|
|
25
25
|
},
|
|
26
|
-
children: "
|
|
26
|
+
children: "Heading 5"
|
|
27
27
|
}),
|
|
28
28
|
execute: function execute(state, api) {
|
|
29
|
-
(0, _title.
|
|
29
|
+
(0, _title.headingExecute)({
|
|
30
30
|
state: state,
|
|
31
31
|
api: api,
|
|
32
32
|
prefix: state.command.prefix,
|
|
33
33
|
suffix: state.command.suffix
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `heading5` instead.
|
|
40
|
+
* This command is now deprecated and will be removed in future versions.
|
|
41
|
+
* Use `title5` for inserting Heading 5.
|
|
42
|
+
*/
|
|
43
|
+
var title5 = exports.title5 = heading5;
|
package/lib/commands/title6.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { ICommand } from './';
|
|
2
|
+
export declare const heading6: ICommand;
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `heading6` instead.
|
|
5
|
+
* This command is now deprecated and will be removed in future versions.
|
|
6
|
+
* Use `title6` for inserting Heading 6.
|
|
7
|
+
*/
|
|
2
8
|
export declare const title6: ICommand;
|
package/lib/commands/title6.js
CHANGED
|
@@ -4,33 +4,40 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.title6 = void 0;
|
|
7
|
+
exports.title6 = exports.heading6 = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _title = require("../commands/title");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
var
|
|
12
|
-
name: '
|
|
13
|
-
keyCommand: '
|
|
11
|
+
var heading6 = exports.heading6 = {
|
|
12
|
+
name: 'heading6',
|
|
13
|
+
keyCommand: 'heading6',
|
|
14
14
|
shortcuts: 'ctrlcmd+6',
|
|
15
15
|
prefix: '###### ',
|
|
16
16
|
suffix: '',
|
|
17
17
|
buttonProps: {
|
|
18
|
-
'aria-label': 'Insert
|
|
19
|
-
title: 'Insert
|
|
18
|
+
'aria-label': 'Insert Heading 6 (ctrl + 6)',
|
|
19
|
+
title: 'Insert Heading 6 (ctrl + 6)'
|
|
20
20
|
},
|
|
21
21
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22
22
|
style: {
|
|
23
23
|
fontSize: 12,
|
|
24
24
|
textAlign: 'left'
|
|
25
25
|
},
|
|
26
|
-
children: "
|
|
26
|
+
children: "Heading 6"
|
|
27
27
|
}),
|
|
28
28
|
execute: function execute(state, api) {
|
|
29
|
-
(0, _title.
|
|
29
|
+
(0, _title.headingExecute)({
|
|
30
30
|
state: state,
|
|
31
31
|
api: api,
|
|
32
32
|
prefix: state.command.prefix,
|
|
33
33
|
suffix: state.command.suffix
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `heading6` instead.
|
|
40
|
+
* This command is now deprecated and will be removed in future versions.
|
|
41
|
+
* Use `title6` for inserting Heading 6.
|
|
42
|
+
*/
|
|
43
|
+
var title6 = exports.title6 = heading6;
|
|
@@ -16,7 +16,7 @@ var _handleKeyDown = _interopRequireDefault(require("./handleKeyDown"));
|
|
|
16
16
|
var _shortcuts = _interopRequireDefault(require("./shortcuts"));
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
var _excluded = ["prefixCls", "onChange"],
|
|
19
|
-
_excluded2 = ["markdown", "commands", "fullscreen", "preview", "highlightEnable", "extraCommands", "tabSize", "defaultTabEnable", "dispatch"];
|
|
19
|
+
_excluded2 = ["markdown", "commands", "fullscreen", "preview", "highlightEnable", "extraCommands", "tabSize", "defaultTabEnable", "autoFocusEnd", "textareaWarp", "dispatch"];
|
|
20
20
|
function Textarea(props) {
|
|
21
21
|
var prefixCls = props.prefixCls,
|
|
22
22
|
_onChange = props.onChange,
|
|
@@ -30,6 +30,8 @@ function Textarea(props) {
|
|
|
30
30
|
extraCommands = _useContext.extraCommands,
|
|
31
31
|
tabSize = _useContext.tabSize,
|
|
32
32
|
defaultTabEnable = _useContext.defaultTabEnable,
|
|
33
|
+
autoFocusEnd = _useContext.autoFocusEnd,
|
|
34
|
+
textareaWarp = _useContext.textareaWarp,
|
|
33
35
|
dispatch = _useContext.dispatch,
|
|
34
36
|
otherStore = (0, _objectWithoutProperties2["default"])(_useContext, _excluded2);
|
|
35
37
|
var textRef = _react["default"].useRef(null);
|
|
@@ -56,6 +58,21 @@ function Textarea(props) {
|
|
|
56
58
|
}
|
|
57
59
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
60
|
}, []);
|
|
61
|
+
(0, _react.useEffect)(function () {
|
|
62
|
+
if (autoFocusEnd && textRef.current && textareaWarp) {
|
|
63
|
+
textRef.current.focus();
|
|
64
|
+
var length = textRef.current.value.length;
|
|
65
|
+
textRef.current.setSelectionRange(length, length);
|
|
66
|
+
setTimeout(function () {
|
|
67
|
+
if (textareaWarp) {
|
|
68
|
+
textareaWarp.scrollTop = textareaWarp.scrollHeight;
|
|
69
|
+
}
|
|
70
|
+
if (textRef.current) {
|
|
71
|
+
textRef.current.scrollTop = textRef.current.scrollHeight;
|
|
72
|
+
}
|
|
73
|
+
}, 0);
|
|
74
|
+
}
|
|
75
|
+
}, [textareaWarp]);
|
|
59
76
|
var onKeyDown = function onKeyDown(e) {
|
|
60
77
|
(0, _handleKeyDown["default"])(e, tabSize, defaultTabEnable);
|
|
61
78
|
(0, _shortcuts["default"])(e, [].concat((0, _toConsumableArray2["default"])(commands || []), (0, _toConsumableArray2["default"])(extraCommands || [])), executeRef.current, dispatch, statesRef.current);
|