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", goto-line="editor.gotoLine",
resize-on="layout:main:resize,layout:pdf:resize", resize-on="layout:main:resize,layout:pdf:resize",
annotations="pdf.logEntryAnnotations[editor.open_doc_id]", annotations="pdf.logEntryAnnotations[editor.open_doc_id]",
read-only="!permissions.write" read-only="!permissions.write",
on-ctrl-enter="recompile"
) )
.ui-layout-east .ui-layout-east

View file

@ -34,7 +34,8 @@ define [
text: "=" text: "="
readOnly: "=" readOnly: "="
annotations: "=" annotations: "="
navigateHighlights: "=" navigateHighlights: "=",
onCtrlEnter: "="
} }
link: (scope, element, attrs) -> link: (scope, element, attrs) ->
# Don't freak out if we're already in an apply callback # Don't freak out if we're already in an apply callback
@ -76,6 +77,15 @@ define [
ace.require("ace/ext/searchbox").Search(editor, true) ace.require("ace/ext/searchbox").Search(editor, true)
readOnly: true readOnly: true
editor.commands.removeCommand "replace" 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. # Make '/' work for search in vim mode.
editor.showCommandLine = (arg) => editor.showCommandLine = (arg) =>

View file

@ -107,6 +107,9 @@ define [
.error () -> .error () ->
$scope.pdf.compiling = false $scope.pdf.compiling = false
$scope.pdf.error = true $scope.pdf.error = true
# This needs to be public.
ide.$scope.recompile = $scope.recompile
$scope.clearCache = () -> $scope.clearCache = () ->
$http { $http {