mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 08:22:24 +01:00
improvements (emacs): more emacs key bindings
This commit is contained in:
parent
cd3d19b185
commit
6fb02b1cd3
2 changed files with 11 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ import 'codemirror/addon/fold/foldgutter.css';
|
||||||
|
|
||||||
import './editor.scss';
|
import './editor.scss';
|
||||||
import { debounce, screenHeightWithMenubar } from '../../helpers/';
|
import { debounce, screenHeightWithMenubar } from '../../helpers/';
|
||||||
|
import config from '../../../config_client';
|
||||||
|
|
||||||
export class Editor extends React.Component {
|
export class Editor extends React.Component {
|
||||||
constructor(props){
|
constructor(props){
|
||||||
|
|
@ -51,7 +52,7 @@ export class Editor extends React.Component {
|
||||||
value: this.props.content,
|
value: this.props.content,
|
||||||
lineNumbers: document.body.offsetWidth > size_small ? true : false,
|
lineNumbers: document.body.offsetWidth > size_small ? true : false,
|
||||||
mode: mode,
|
mode: mode,
|
||||||
keyMap: "emacs",
|
keyMap: config.god_editor_mode ? "emacs" : "default",
|
||||||
lineWrapping: true,
|
lineWrapping: true,
|
||||||
foldGutter: {
|
foldGutter: {
|
||||||
minFoldSize: 1
|
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 = () => {
|
CodeMirror.commands.save = () => {
|
||||||
this.props.onSave && this.props.onSave();
|
this.props.onSave && this.props.onSave();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
god_editor_mode: true,
|
||||||
fork_button: false,
|
fork_button: false,
|
||||||
search: {
|
search: {
|
||||||
enable: true,
|
enable: true,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue