File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -241,6 +241,15 @@ export default class CodeEditor extends React.Component {
241
241
const newCursorPos = cm . doc . posFromIndex ( formattedCursorPos )
242
242
cm . doc . setCursor ( newCursorPos )
243
243
} ,
244
+ [ translateHotkey ( hotkey . sortLines ) ] : cm => {
245
+ const selection = cm . doc . getSelection ( )
246
+ const appendLineBreak = / \n $ / . test ( selection )
247
+
248
+ const sorted = _ . split ( selection . trim ( ) , '\n' ) . sort ( )
249
+ const sortedString = _ . join ( sorted , '\n' ) + ( appendLineBreak ? '\n' : '' )
250
+
251
+ cm . doc . replaceSelection ( sortedString )
252
+ } ,
244
253
[ translateHotkey ( hotkey . pasteSmartly ) ] : cm => {
245
254
this . handlePaste ( cm , true )
246
255
}
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ export const DEFAULT_CONFIG = {
32
32
deleteNote : OSX ? 'Command + Shift + Backspace' : 'Ctrl + Shift + Backspace' ,
33
33
pasteSmartly : OSX ? 'Command + Shift + V' : 'Ctrl + Shift + V' ,
34
34
prettifyMarkdown : 'Shift + F' ,
35
+ sortLines : OSX ? 'Command + Shift + S' : 'Ctrl + Shift + S' ,
35
36
insertDate : OSX ? 'Command + /' : 'Ctrl + /' ,
36
37
insertDateTime : OSX ? 'Command + Alt + /' : 'Ctrl + Shift + /' ,
37
38
toggleMenuBar : 'Alt'
You can’t perform that action at this time.
0 commit comments