mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #534 from sharelatex/ja-recompile-on-w
Recompile one Cmd-S, :w and Ctrl-. for v1 compatibility
This commit is contained in:
commit
1e0e006eef
3 changed files with 25 additions and 8 deletions
|
@ -154,7 +154,10 @@ block requirejs
|
|||
},
|
||||
"ace/ext-language_tools": {
|
||||
"deps": ["ace/ace"]
|
||||
}
|
||||
},
|
||||
"ace/keybinding-vim": {
|
||||
"deps": ["ace/ace"]
|
||||
},
|
||||
},
|
||||
"config":{
|
||||
"moment":{
|
||||
|
|
|
@ -58,6 +58,7 @@ div.full-size(
|
|||
read-only="!permissions.write",
|
||||
file-name="editor.open_doc_name",
|
||||
on-ctrl-enter="recompileViaKey",
|
||||
on-save="recompileViaKey",
|
||||
on-ctrl-j="toggleReviewPanel",
|
||||
on-ctrl-shift-c="addNewCommentFromKbdShortcut",
|
||||
on-ctrl-shift-a="toggleTrackChangesFromKbdShortcut",
|
||||
|
|
|
@ -3,6 +3,7 @@ define [
|
|||
"ace/ace"
|
||||
"ace/ext-searchbox"
|
||||
"ace/ext-modelist"
|
||||
"ace/keybinding-vim"
|
||||
"ide/editor/directives/aceEditor/undo/UndoManager"
|
||||
"ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager"
|
||||
"ide/editor/directives/aceEditor/spell-check/SpellCheckManager"
|
||||
|
@ -14,9 +15,10 @@ define [
|
|||
"ide/graphics/services/graphics"
|
||||
"ide/preamble/services/preamble"
|
||||
"ide/files/services/files"
|
||||
], (App, Ace, SearchBox, ModeList, UndoManager, AutoCompleteManager, SpellCheckManager, HighlightsManager, CursorPositionManager, TrackChangesManager, MetadataManager) ->
|
||||
], (App, Ace, SearchBox, Vim, ModeList, UndoManager, AutoCompleteManager, SpellCheckManager, HighlightsManager, CursorPositionManager, TrackChangesManager, MetadataManager) ->
|
||||
EditSession = ace.require('ace/edit_session').EditSession
|
||||
ModeList = ace.require('ace/ext/modelist')
|
||||
Vim = ace.require('ace/keyboard/vim').Vim
|
||||
|
||||
# set the path for ace workers if using a CDN (from editor.pug)
|
||||
if window.aceWorkerPath != ""
|
||||
|
@ -60,6 +62,7 @@ define [
|
|||
onCtrlJ: "=" # Toggle the review panel
|
||||
onCtrlShiftC: "=" # Add a new comment
|
||||
onCtrlShiftA: "=" # Toggle track-changes on/off
|
||||
onSave: "=" # Cmd/Ctrl-S or :w in Vim
|
||||
syntaxValidation: "="
|
||||
reviewPanel: "="
|
||||
eventsBridge: "="
|
||||
|
@ -106,16 +109,26 @@ define [
|
|||
metadataManager = new MetadataManager(scope, editor, element, metadata)
|
||||
autoCompleteManager = new AutoCompleteManager(scope, editor, element, metadataManager, graphics, preamble, files)
|
||||
|
||||
# Prevert Ctrl|Cmd-S from triggering save dialog
|
||||
editor.commands.addCommand
|
||||
name: "save",
|
||||
bindKey: win: "Ctrl-S", mac: "Command-S"
|
||||
exec: () ->
|
||||
readOnly: true
|
||||
scope.$watch "onSave", (callback) ->
|
||||
if callback?
|
||||
Vim.defineEx 'write', 'w', callback
|
||||
editor.commands.addCommand
|
||||
name: "save",
|
||||
bindKey: win: "Ctrl-S", mac: "Command-S"
|
||||
exec: callback
|
||||
readOnly: true
|
||||
# Not technically 'save', but Ctrl-. recompiles in OL v1
|
||||
# so maintain compatibility
|
||||
editor.commands.addCommand
|
||||
name: "recompile_v1",
|
||||
bindKey: win: "Ctrl-.", mac: "Ctrl-."
|
||||
exec: callback
|
||||
readOnly: true
|
||||
editor.commands.removeCommand "transposeletters"
|
||||
editor.commands.removeCommand "showSettingsMenu"
|
||||
editor.commands.removeCommand "foldall"
|
||||
|
||||
|
||||
# For European keyboards, the / is above 7 so needs Shift pressing.
|
||||
# This comes through as Command-Shift-/ on OS X, which is mapped to
|
||||
# toggleBlockComment.
|
||||
|
|
Loading…
Reference in a new issue