improvements (emacs): more emacs key bindings

This commit is contained in:
Mickael KERJEAN 2018-04-18 00:37:00 +10:00
parent cd3d19b185
commit 6fb02b1cd3
2 changed files with 11 additions and 1 deletions

View file

@ -21,6 +21,7 @@ import 'codemirror/addon/fold/foldgutter.css';
import './editor.scss';
import { debounce, screenHeightWithMenubar } from '../../helpers/';
import config from '../../../config_client';
export class Editor extends React.Component {
constructor(props){
@ -51,7 +52,7 @@ export class Editor extends React.Component {
value: this.props.content,
lineNumbers: document.body.offsetWidth > size_small ? true : false,
mode: mode,
keyMap: "emacs",
keyMap: config.god_editor_mode ? "emacs" : "default",
lineWrapping: true,
foldGutter: {
minFoldSize: 1
@ -70,6 +71,14 @@ export class Editor extends React.Component {
}
});
if(config.god_editor_mode === true){
editor.addKeyMap({
"Ctrl-X Ctrl-C": function(cm){
history.back();
}
});
}
CodeMirror.commands.save = () => {
this.props.onSave && this.props.onSave();
};

View file

@ -1,4 +1,5 @@
module.exports = {
god_editor_mode: true,
fork_button: false,
search: {
enable: true,