From 832764dd3df5c62159fe410cff6adad1bce48436 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 18 May 2017 11:02:50 +0100 Subject: [PATCH] Add key shortcut to toggle the review panel. --- services/web/app/views/project/editor/editor.pug | 1 + .../coffee/ide/editor/directives/aceEditor.coffee | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/services/web/app/views/project/editor/editor.pug b/services/web/app/views/project/editor/editor.pug index e8217a9319..b94eedf3ed 100644 --- a/services/web/app/views/project/editor/editor.pug +++ b/services/web/app/views/project/editor/editor.pug @@ -50,6 +50,7 @@ div.full-size( read-only="!permissions.write", file-name="editor.open_doc_name", on-ctrl-enter="recompileViaKey", + on-ctrl-j="toggleReviewPanel", syntax-validation="settings.syntaxValidation", review-panel="reviewPanel", events-bridge="reviewPanelEventsBridge" diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee index 2a633e24f8..8ba351d775 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee @@ -51,6 +51,7 @@ define [ navigateHighlights: "=" fileName: "=" onCtrlEnter: "=" + onCtrlJ: "=" syntaxValidation: "=" reviewPanel: "=" eventsBridge: "=" @@ -162,6 +163,15 @@ define [ callback() readOnly: true + scope.$watch "onCtrlJ", (callback) -> + if callback? + editor.commands.addCommand + name: "toggle-review-panel", + bindKey: win: "Ctrl-J", mac: "Command-J" + exec: (editor) => + callback() + readOnly: true + # Make '/' work for search in vim mode. editor.showCommandLine = (arg) => if arg == "/"