1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-17 18:44:45 +02:00

Desktop: Add swapLineUp and swapLineDown keys to Code Mirror editor (#3363)

This commit is contained in:
Caleb John 2020-06-16 05:59:33 -06:00 committed by GitHub
parent 7826cc0b03
commit 23ae4fb790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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' },
};