add Ctrl-Enter hotkey

This commit is contained in:
James Allen 2014-07-21 15:39:15 +01:00
parent 27795c451f
commit 1d6314a2c1
3 changed files with 16 additions and 2 deletions

View file

@ -26,7 +26,8 @@ div.full-size(
goto-line="editor.gotoLine",
resize-on="layout:main:resize,layout:pdf:resize",
annotations="pdf.logEntryAnnotations[editor.open_doc_id]",
read-only="!permissions.write"
read-only="!permissions.write",
on-ctrl-enter="recompile"
)
.ui-layout-east

View file

@ -34,7 +34,8 @@ define [
text: "="
readOnly: "="
annotations: "="
navigateHighlights: "="
navigateHighlights: "=",
onCtrlEnter: "="
}
link: (scope, element, attrs) ->
# Don't freak out if we're already in an apply callback
@ -77,6 +78,15 @@ define [
readOnly: true
editor.commands.removeCommand "replace"
scope.$watch "onCtrlEnter", (callback) ->
if callback?
editor.commands.addCommand
name: "compile",
bindKey: win: "Ctrl-Enter", mac: "Command-Enter"
exec: (editor) =>
callback()
readOnly: true
# Make '/' work for search in vim mode.
editor.showCommandLine = (arg) =>
if arg == "/"

View file

@ -108,6 +108,9 @@ define [
$scope.pdf.compiling = false
$scope.pdf.error = true
# This needs to be public.
ide.$scope.recompile = $scope.recompile
$scope.clearCache = () ->
$http {
url: "/project/#{$scope.project_id}/output"