mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Add commenting and track-changes keyboard shortcuts.
This commit is contained in:
parent
832764dd3d
commit
957b201fc1
3 changed files with 37 additions and 2 deletions
|
@ -51,6 +51,8 @@ div.full-size(
|
|||
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"
|
||||
|
|
|
@ -50,8 +50,10 @@ define [
|
|||
annotations: "="
|
||||
navigateHighlights: "="
|
||||
fileName: "="
|
||||
onCtrlEnter: "="
|
||||
onCtrlJ: "="
|
||||
onCtrlEnter: "=" # Compile
|
||||
onCtrlJ: "=" # Toggle the review panel
|
||||
onCtrlShiftC: "=" # Add a new comment
|
||||
onCtrlShiftA: "=" # Toggle track-changes on/off
|
||||
syntaxValidation: "="
|
||||
reviewPanel: "="
|
||||
eventsBridge: "="
|
||||
|
@ -172,6 +174,26 @@ define [
|
|||
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) =>
|
||||
selection = editor.getSelection()
|
||||
if !selection.isEmpty()
|
||||
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 == "/"
|
||||
|
|
|
@ -329,6 +329,11 @@ define [
|
|||
$scope.$broadcast "comment:start_adding"
|
||||
$scope.toggleReviewPanel()
|
||||
|
||||
$scope.addNewCommentFromKbdShortcut = () ->
|
||||
$scope.$broadcast "comment:start_adding"
|
||||
if !$scope.ui.reviewPanelOpen
|
||||
$scope.toggleReviewPanel()
|
||||
|
||||
$scope.startNewComment = () ->
|
||||
$scope.$broadcast "comment:select_line"
|
||||
$timeout () ->
|
||||
|
@ -479,6 +484,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 () ->
|
||||
|
|
Loading…
Reference in a new issue