From a48d9d295eccd4189883d7a3fd10a6572c9c4c60 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Sun, 2 Jun 2024 20:23:33 -0500 Subject: [PATCH] Try binging to ctrl-X and CTRL-Shift-X which seem to somehow be available... --- client/homebrew/editor/editor.jsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index abe8c2f39..a9b330fcd 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -56,6 +56,7 @@ const Editor = createClass({ this.updateEditorSize(); this.highlightCustomMarkdown(); window.addEventListener('resize', this.updateEditorSize); + document.getElementById('BrewRenderer').addEventListener('keydown', this.handleControlKeys); document.addEventListener('keydown', this.handleControlKeys); const editorTheme = window.localStorage.getItem(EDITOR_THEME_KEY); @@ -72,6 +73,10 @@ const Editor = createClass({ componentDidUpdate : function(prevProps, prevState, snapshot) { this.highlightCustomMarkdown(); + if(this.props.jumpSource) { + this.sourceJump(); + this.setState({sourceJump: false}); + } if(prevProps.moveBrew !== this.props.moveBrew) { this.brewJump(); }; @@ -83,10 +88,10 @@ const Editor = createClass({ handleControlKeys : function(e){ if(!(e.ctrlKey || e.metaKey)) return; console.log(e); - const M_KEY = 77; - if((!e.shiftKey) && (e.keyCode == M_KEY)) this.brewJump(); - if (e.shiftKey && (e.keyCode == M_KEY)) this.sourceJump(); - if( e.keyCode == M_KEY) { + const X_KEY = 88; + if((!e.shiftKey) && (e.keyCode == X_KEY)) this.brewJump(); + if (e.shiftKey && (e.keyCode == X_KEY)) this.sourceJump(); + if( e.keyCode == X_KEY) { e.stopPropagation(); e.preventDefault(); }