Merge pull request #510 from sharelatex/pr-hide-review-panel

Hide review panel+keyboard shortcuts for review
This commit is contained in:
Paulo Jorge Reis 2017-05-26 09:40:11 +01:00 committed by GitHub
commit 104bcc94f5
7 changed files with 126 additions and 18 deletions

View file

@ -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"

View file

@ -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(

View file

@ -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"

View file

@ -50,7 +50,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: "="
@ -162,6 +165,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 == "/"

View file

@ -9,6 +9,7 @@ define [
$modal.open {
templateUrl: "hotkeysModalTemplate"
controller: "HotkeysModalController"
size: "lg"
}
App.controller "HotkeysModalController", ($scope, $modalInstance)->

View file

@ -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 () ->

View file

@ -963,6 +963,45 @@
}
}
.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-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)