mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-14 18:27:44 +02:00
Desktop: Add swapLineUp and swapLineDown keys to Code Mirror editor (#3363)
This commit is contained in:
parent
7826cc0b03
commit
23ae4fb790
@ -1,7 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { useEffect, useImperativeHandle, useState, useRef, useCallback, forwardRef } from 'react';
|
||||
|
||||
const CodeMirror = require('codemirror');
|
||||
import 'codemirror/addon/comment/comment';
|
||||
import 'codemirror/addon/dialog/dialog';
|
||||
import 'codemirror/addon/edit/closebrackets';
|
||||
@ -15,6 +13,7 @@ import useLineSorting from './utils/useLineSorting';
|
||||
|
||||
import 'codemirror/keymap/emacs';
|
||||
import 'codemirror/keymap/vim';
|
||||
import 'codemirror/keymap/sublime'; // Used for swapLineUp and swapLineDown
|
||||
|
||||
import 'codemirror/mode/gfm/gfm';
|
||||
import 'codemirror/mode/xml/xml';
|
||||
@ -26,6 +25,8 @@ import 'codemirror/mode/clike/clike';
|
||||
import 'codemirror/mode/diff/diff';
|
||||
import 'codemirror/mode/sql/sql';
|
||||
|
||||
const CodeMirror = require('codemirror');
|
||||
|
||||
export interface CancelledKeys {
|
||||
mac: string[],
|
||||
default: string[],
|
||||
@ -134,6 +135,12 @@ function Editor(props: EditorProps, ref: any) {
|
||||
extraKeys: { 'Enter': 'insertListElement',
|
||||
'Ctrl-/': 'toggleComment',
|
||||
'Ctrl-Alt-S': 'sortSelectedLines',
|
||||
'Alt-Up': 'swapLineUp',
|
||||
'Alt-Down': 'swapLineDown',
|
||||
'Cmd-/': 'toggleComment',
|
||||
'Cmd-Opt-S': 'sortSelectedLines',
|
||||
'Opt-Up': 'swapLineUp',
|
||||
'Opt-Down': 'swapLineDown',
|
||||
'Tab': 'smartListIndent',
|
||||
'Shift-Tab': 'smartListUnindent' },
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user