File tree Expand file tree Collapse file tree 1 file changed +1
-31
lines changed Expand file tree Collapse file tree 1 file changed +1
-31
lines changed Original file line number Diff line number Diff line change @@ -83,37 +83,7 @@ export default class CodeEditor extends React.Component {
83
83
'Cmd-T' : function ( cm ) {
84
84
// Do nothing
85
85
} ,
86
- Enter : ( cm ) => {
87
- const cursor = cm . getCursor ( )
88
- const line = cm . getLine ( cursor . line )
89
- let bulletType
90
- if ( line . trim ( ) . startsWith ( '- ' ) ) {
91
- bulletType = 1 // dash
92
- } else if ( line . trim ( ) . startsWith ( '* ' ) ) {
93
- bulletType = 2 // star
94
- } else if ( line . trim ( ) . startsWith ( '+ ' ) ) {
95
- bulletType = 3 // plus
96
- } else {
97
- bulletType = 0 // not a bullet
98
- }
99
- const numberedListRegex = / ^ ( \d + ) \. .+ /
100
- const match = line . trim ( ) . match ( numberedListRegex )
101
- if ( bulletType !== 0 || match ) {
102
- cm . execCommand ( 'newlineAndIndent' )
103
- const range = { line : cursor . line + 1 , ch : cm . getLine ( cursor . line + 1 ) . length }
104
- if ( match ) {
105
- cm . replaceRange ( ( parseInt ( match [ 1 ] ) + 1 ) + '. ' , range )
106
- } else if ( bulletType === 1 ) {
107
- cm . replaceRange ( '- ' , range )
108
- } else if ( bulletType === 2 ) {
109
- cm . replaceRange ( '* ' , range )
110
- } else if ( bulletType === 3 ) {
111
- cm . replaceRange ( '+ ' , range )
112
- }
113
- } else {
114
- cm . execCommand ( 'newlineAndIndent' )
115
- }
116
- }
86
+ Enter : 'newlineAndIndentContinueMarkdownList'
117
87
}
118
88
} )
119
89
You can’t perform that action at this time.
0 commit comments