@uiw/react-md-editor 4.1.2 → 4.1.3
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 +1 -0
- package/dist/mdeditor.css +3 -0
- package/dist/mdeditor.js +2291 -2173
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/esm/components/TextArea/handleKeyDown.js +2 -2
- package/esm/components/TextArea/index.css +3 -0
- package/esm/components/TextArea/index.less +4 -1
- package/lib/components/TextArea/handleKeyDown.js +2 -2
- package/lib/components/TextArea/index.less +4 -1
- package/markdown-editor.css +3 -0
- package/package.json +1 -1
- package/src/components/TextArea/handleKeyDown.tsx +2 -2
- package/src/components/TextArea/index.less +4 -1
|
@@ -113,7 +113,7 @@ export default function handleKeyDown(e, tabSize, defaultTabEnable) {
|
|
|
113
113
|
} else {
|
|
114
114
|
return insertTextAtPosition(target, space);
|
|
115
115
|
}
|
|
116
|
-
} else if (e.keyCode === 13 && e.code.toLowerCase() === 'enter' && (/^(-|\*)\s/.test(currentLineStr) || /^\d
|
|
116
|
+
} else if (e.keyCode === 13 && e.code.toLowerCase() === 'enter' && (/^(-|\*)\s/.test(currentLineStr) || /^\d+\.\s/.test(currentLineStr)) && !e.shiftKey) {
|
|
117
117
|
/**
|
|
118
118
|
* `13` - `Enter`
|
|
119
119
|
*/
|
|
@@ -125,7 +125,7 @@ export default function handleKeyDown(e, tabSize, defaultTabEnable) {
|
|
|
125
125
|
if (currentLineStr.startsWith('- [ ]') || currentLineStr.startsWith('- [X]') || currentLineStr.startsWith('- [x]')) {
|
|
126
126
|
startStr = '\n- [ ] ';
|
|
127
127
|
}
|
|
128
|
-
if (/^\d
|
|
128
|
+
if (/^\d+\.\s/.test(currentLineStr)) {
|
|
129
129
|
startStr = "\n" + (parseInt(currentLineStr) + 1) + ". ";
|
|
130
130
|
}
|
|
131
131
|
return insertTextAtPosition(target, startStr);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
@md-editor
|
|
1
|
+
@md-editor: ~'w-md-editor';
|
|
2
2
|
|
|
3
3
|
.@{md-editor} {
|
|
4
4
|
&-area {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
5
7
|
overflow: auto;
|
|
6
8
|
border-radius: 5px;
|
|
7
9
|
}
|
|
8
10
|
&-text {
|
|
11
|
+
flex: 1 0 auto;
|
|
9
12
|
min-height: 100%;
|
|
10
13
|
position: relative;
|
|
11
14
|
text-align: left;
|
|
@@ -117,7 +117,7 @@ function handleKeyDown(e) {
|
|
|
117
117
|
} else {
|
|
118
118
|
return (0, _InsertTextAtPosition.insertTextAtPosition)(target, space);
|
|
119
119
|
}
|
|
120
|
-
} else if (e.keyCode === 13 && e.code.toLowerCase() === 'enter' && (/^(-|\*)\s/.test(currentLineStr) || /^\d
|
|
120
|
+
} else if (e.keyCode === 13 && e.code.toLowerCase() === 'enter' && (/^(-|\*)\s/.test(currentLineStr) || /^\d+\.\s/.test(currentLineStr)) && !e.shiftKey) {
|
|
121
121
|
/**
|
|
122
122
|
* `13` - `Enter`
|
|
123
123
|
*/
|
|
@@ -129,7 +129,7 @@ function handleKeyDown(e) {
|
|
|
129
129
|
if (currentLineStr.startsWith('- [ ]') || currentLineStr.startsWith('- [X]') || currentLineStr.startsWith('- [x]')) {
|
|
130
130
|
startStr = '\n- [ ] ';
|
|
131
131
|
}
|
|
132
|
-
if (/^\d
|
|
132
|
+
if (/^\d+\.\s/.test(currentLineStr)) {
|
|
133
133
|
startStr = "\n".concat(parseInt(currentLineStr) + 1, ". ");
|
|
134
134
|
}
|
|
135
135
|
return (0, _InsertTextAtPosition.insertTextAtPosition)(target, startStr);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
@md-editor
|
|
1
|
+
@md-editor: ~'w-md-editor';
|
|
2
2
|
|
|
3
3
|
.@{md-editor} {
|
|
4
4
|
&-area {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
5
7
|
overflow: auto;
|
|
6
8
|
border-radius: 5px;
|
|
7
9
|
}
|
|
8
10
|
&-text {
|
|
11
|
+
flex: 1 0 auto;
|
|
9
12
|
min-height: 100%;
|
|
10
13
|
position: relative;
|
|
11
14
|
text-align: left;
|
package/markdown-editor.css
CHANGED
|
@@ -17,10 +17,13 @@
|
|
|
17
17
|
margin: 0 auto;
|
|
18
18
|
}
|
|
19
19
|
.w-md-editor-area {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
20
22
|
overflow: auto;
|
|
21
23
|
border-radius: 5px;
|
|
22
24
|
}
|
|
23
25
|
.w-md-editor-text {
|
|
26
|
+
flex: 1 0 auto;
|
|
24
27
|
min-height: 100%;
|
|
25
28
|
position: relative;
|
|
26
29
|
text-align: left;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uiw/react-md-editor",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
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",
|
|
@@ -102,7 +102,7 @@ export default function handleKeyDown(
|
|
|
102
102
|
} else if (
|
|
103
103
|
e.keyCode === 13 &&
|
|
104
104
|
e.code.toLowerCase() === 'enter' &&
|
|
105
|
-
(/^(-|\*)\s/.test(currentLineStr) || /^\d
|
|
105
|
+
(/^(-|\*)\s/.test(currentLineStr) || /^\d+\.\s/.test(currentLineStr)) &&
|
|
106
106
|
!e.shiftKey
|
|
107
107
|
) {
|
|
108
108
|
/**
|
|
@@ -123,7 +123,7 @@ export default function handleKeyDown(
|
|
|
123
123
|
startStr = '\n- [ ] ';
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
if (/^\d
|
|
126
|
+
if (/^\d+\.\s/.test(currentLineStr)) {
|
|
127
127
|
startStr = `\n${parseInt(currentLineStr) + 1}. `;
|
|
128
128
|
}
|
|
129
129
|
return insertTextAtPosition(target, startStr);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
@md-editor
|
|
1
|
+
@md-editor: ~'w-md-editor';
|
|
2
2
|
|
|
3
3
|
.@{md-editor} {
|
|
4
4
|
&-area {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
5
7
|
overflow: auto;
|
|
6
8
|
border-radius: 5px;
|
|
7
9
|
}
|
|
8
10
|
&-text {
|
|
11
|
+
flex: 1 0 auto;
|
|
9
12
|
min-height: 100%;
|
|
10
13
|
position: relative;
|
|
11
14
|
text-align: left;
|