mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-05 18:52:38 +00:00
Try binging to ctrl-X and CTRL-Shift-X which seem to somehow be available...
This commit is contained in:
@@ -56,6 +56,7 @@ const Editor = createClass({
|
|||||||
this.updateEditorSize();
|
this.updateEditorSize();
|
||||||
this.highlightCustomMarkdown();
|
this.highlightCustomMarkdown();
|
||||||
window.addEventListener('resize', this.updateEditorSize);
|
window.addEventListener('resize', this.updateEditorSize);
|
||||||
|
document.getElementById('BrewRenderer').addEventListener('keydown', this.handleControlKeys);
|
||||||
document.addEventListener('keydown', this.handleControlKeys);
|
document.addEventListener('keydown', this.handleControlKeys);
|
||||||
|
|
||||||
const editorTheme = window.localStorage.getItem(EDITOR_THEME_KEY);
|
const editorTheme = window.localStorage.getItem(EDITOR_THEME_KEY);
|
||||||
@@ -72,6 +73,10 @@ const Editor = createClass({
|
|||||||
|
|
||||||
componentDidUpdate : function(prevProps, prevState, snapshot) {
|
componentDidUpdate : function(prevProps, prevState, snapshot) {
|
||||||
this.highlightCustomMarkdown();
|
this.highlightCustomMarkdown();
|
||||||
|
if(this.props.jumpSource) {
|
||||||
|
this.sourceJump();
|
||||||
|
this.setState({sourceJump: false});
|
||||||
|
}
|
||||||
if(prevProps.moveBrew !== this.props.moveBrew) {
|
if(prevProps.moveBrew !== this.props.moveBrew) {
|
||||||
this.brewJump();
|
this.brewJump();
|
||||||
};
|
};
|
||||||
@@ -83,10 +88,10 @@ const Editor = createClass({
|
|||||||
handleControlKeys : function(e){
|
handleControlKeys : function(e){
|
||||||
if(!(e.ctrlKey || e.metaKey)) return;
|
if(!(e.ctrlKey || e.metaKey)) return;
|
||||||
console.log(e);
|
console.log(e);
|
||||||
const M_KEY = 77;
|
const X_KEY = 88;
|
||||||
if((!e.shiftKey) && (e.keyCode == M_KEY)) this.brewJump();
|
if((!e.shiftKey) && (e.keyCode == X_KEY)) this.brewJump();
|
||||||
if (e.shiftKey && (e.keyCode == M_KEY)) this.sourceJump();
|
if (e.shiftKey && (e.keyCode == X_KEY)) this.sourceJump();
|
||||||
if( e.keyCode == M_KEY) {
|
if( e.keyCode == X_KEY) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user