diff --git a/services/web/app/views/project/editor/editor.pug b/services/web/app/views/project/editor/editor.pug index e8217a9319..96b3fd2f6d 100644 --- a/services/web/app/views/project/editor/editor.pug +++ b/services/web/app/views/project/editor/editor.pug @@ -50,6 +50,9 @@ div.full-size( read-only="!permissions.write", file-name="editor.open_doc_name", on-ctrl-enter="recompileViaKey", + on-ctrl-j="toggleReviewPanel", + on-ctrl-shift-c="addNewCommentFromKbdShortcut", + on-ctrl-shift-a="toggleTrackChangesFromKbdShortcut", syntax-validation="settings.syntaxValidation", review-panel="reviewPanel", events-bridge="reviewPanelEventsBridge" diff --git a/services/web/app/views/project/editor/hotkeys.pug b/services/web/app/views/project/editor/hotkeys.pug index 15153cdccf..cab8ea09b3 100644 --- a/services/web/app/views/project/editor/hotkeys.pug +++ b/services/web/app/views/project/editor/hotkeys.pug @@ -9,38 +9,38 @@ script(type="text/ng-template", id="hotkeysModalTemplate") .modal-body.modal-hotkeys h3 #{translate("common")} .row - .col-xs-6 + .col-xs-4 .hotkey span.combination {{ctrl}} + F span.description Find (and replace) .hotkey span.combination {{ctrl}} + Enter span.description Compile - .col-xs-6 + .col-xs-4 .hotkey span.combination {{ctrl}} + Z span.description Undo + .col-xs-4 .hotkey span.combination {{ctrl}} + Y span.description Redo - h3 #{translate("navigation")} .row - .col-xs-6 + .col-xs-4 .hotkey span.combination {{ctrl}} + Home span.description Beginning of document + .col-xs-4 .hotkey span.combination {{ctrl}} + End span.description End of document - .col-xs-6 + .col-xs-4 .hotkey span.combination {{ctrl}} + L span.description Go To Line - h3 #{translate("editing")} .row - .col-xs-6 + .col-xs-4 .hotkey span.combination {{ctrl}} + / span.description Toggle Comment @@ -50,16 +50,17 @@ script(type="text/ng-template", id="hotkeysModalTemplate") .hotkey span.combination {{ctrl}} + A span.description Select All - .hotkey - span.combination Tab - span.description Indent Selection - .col-xs-6 + .col-xs-4 .hotkey span.combination Ctrl + U span.description To Uppercase .hotkey span.combination Ctrl + Shift + U span.description To Lowercase + .hotkey + span.combination Tab + span.description Indent Selection + .col-xs-4 .hotkey span.combination {{ctrl}} + B span.description Bold text @@ -69,27 +70,40 @@ script(type="text/ng-template", id="hotkeysModalTemplate") h3 #{translate("autocomplete")} .row - .col-xs-6 + .col-xs-4 .hotkey span.combination Ctrl + Space span.description Autocomplete Menu - - .col-xs-6 + .col-xs-4 .hotkey span.combination Tab / Up / Down span.description Select Candidate - + .col-xs-4 .hotkey span.combination Enter span.description Insert Candidate h3 !{translate("autocomplete_references")} .row - .col-xs-6 + .col-xs-4 .hotkey span.combination Ctrl + Space span.description Search References + h3 #{translate("review")} + .row + .col-xs-4 + .hotkey + span.combination {{ctrl}} + J + span.description Toggle review panel + .col-xs-4 + .hotkey + span.combination {{ctrl}} + Shift + A + span.description Toggle track changes + .col-xs-4 + .hotkey + span.combination {{ctrl}} + Shift + C + span.description Add a comment .modal-footer button.btn.btn-default( diff --git a/services/web/app/views/project/editor/review-panel.pug b/services/web/app/views/project/editor/review-panel.pug index 47e21eb848..3707af11eb 100644 --- a/services/web/app/views/project/editor/review-panel.pug +++ b/services/web/app/views/project/editor/review-panel.pug @@ -29,7 +29,10 @@ ) i.fa.fa-comment |  #{translate("add_comment")} - + a.review-panel-toggler( + href + ng-click="handleTogglerClick($event);" + ) .review-panel-toolbar resolved-comments-dropdown( class="rp-flex-block" diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee index e4a08a7bb5..377d5c0103 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor.coffee @@ -51,7 +51,10 @@ define [ annotations: "=" navigateHighlights: "=" fileName: "=" - onCtrlEnter: "=" + onCtrlEnter: "=" # Compile + onCtrlJ: "=" # Toggle the review panel + onCtrlShiftC: "=" # Add a new comment + onCtrlShiftA: "=" # Toggle track-changes on/off syntaxValidation: "=" reviewPanel: "=" eventsBridge: "=" @@ -164,6 +167,33 @@ 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 + + scope.$watch "onCtrlShiftC", (callback) -> + if callback? + editor.commands.addCommand + name: "add-new-comment", + bindKey: win: "Ctrl-Shift-C", mac: "Command-Shift-C" + exec: (editor) => + callback() + readOnly: true + + scope.$watch "onCtrlShiftA", (callback) -> + if callback? + editor.commands.addCommand + name: "toggle-track-changes", + bindKey: win: "Ctrl-Shift-A", mac: "Command-Shift-A" + exec: (editor) => + callback() + readOnly: true + # Make '/' work for search in vim mode. editor.showCommandLine = (arg) => if arg == "/" diff --git a/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee b/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee index 18d075c094..0ec2c46cf1 100644 --- a/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee +++ b/services/web/public/coffee/ide/hotkeys/controllers/HotkeysController.coffee @@ -9,6 +9,7 @@ define [ $modal.open { templateUrl: "hotkeysModalTemplate" controller: "HotkeysModalController" + size: "lg" } App.controller "HotkeysModalController", ($scope, $modalInstance)-> diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index 394809d508..6c4d7973c7 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -341,7 +341,8 @@ define [ response = getChkTex() # display the combined result - response.finally annotateFiles + if response? + response.finally annotateFiles getRootDocOverride_id = () -> doc = ide.editorManager.getCurrentDocValue() diff --git a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee index 28a8290e5e..fe4f8871f0 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -375,10 +375,22 @@ define [ else bulkReject() + $scope.handleTogglerClick = (e) -> + e.target.blur() + $scope.toggleReviewPanel() + $scope.addNewComment = () -> $scope.$broadcast "comment:start_adding" $scope.toggleReviewPanel() + $scope.addNewCommentFromKbdShortcut = () -> + $scope.$broadcast "comment:select_line" + if !$scope.ui.reviewPanelOpen + $scope.toggleReviewPanel() + $timeout () -> + $scope.$broadcast "review-panel:layout" + $scope.$broadcast "comment:start_adding" + $scope.startNewComment = () -> $scope.$broadcast "comment:select_line" $timeout () -> @@ -529,6 +541,12 @@ define [ event_tracking.sendMB "rp-trackchanges-toggle", { value } else $scope.openTrackChangesUpgradeModal() + + $scope.toggleTrackChangesFromKbdShortcut = () -> + if $scope.editor.wantTrackChanges + $scope.toggleTrackChanges false + else + $scope.toggleTrackChanges true ide.socket.on "toggle-track-changes", (value) -> $scope.$apply () -> diff --git a/services/web/public/stylesheets/app/editor/review-panel.less b/services/web/public/stylesheets/app/editor/review-panel.less index 018a402015..861360b526 100644 --- a/services/web/public/stylesheets/app/editor/review-panel.less +++ b/services/web/public/stylesheets/app/editor/review-panel.less @@ -963,6 +963,50 @@ } } +.review-panel-toggler { + display: none; + position: absolute; + top: 0; + bottom: 0; + width: 10px; + opacity: 0.5; + color: @rp-highlight-blue; + z-index: 1; + background-color: transparent; + transition: background 0.1s; + + .rp-size-mini &, + .rp-size-expanded & { + display: block; + } + + .rp-size-expanded & { + &::after { + content: "\f105"; + } + } + + &:hover, + &:focus { + color: @rp-highlight-blue; + background-color: #FFF; + } + + &::after { + content: "\f104"; + font-family: FontAwesome; + line-height: 1; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-size: 16px; + display: block; + position: absolute; + top: 50%; + width: 100%; + text-align: center; + margin-top: -0.5em; + } +} // Helper class for elements which aren't treated as flex-items by IE10, e.g: // * inline items; // * unknown elements (elements which aren't standard DOM elements, such as custom element directives)