Commit 6745e359 authored by Randall Leeds's avatar Randall Leeds

fix input autofocus in annotations

parent d217c54e
......@@ -218,9 +218,6 @@ class Annotation
$scope.$on '$routeChangeStart', -> $scope.cancel() if $scope.editing
$scope.$on '$routeUpdate', -> $scope.cancel() if $scope.editing
$scope.$watch 'editing', (newValue) ->
if newValue then $timeout -> $element.find('textarea').focus()
$scope.$watch 'model.$modelValue', (annotation) ->
if annotation?
$scope.thread = threading.getContainer annotation.id
......
......@@ -20,7 +20,7 @@ annotation = ['$filter', ($filter) ->
]
markdown = ['$filter', ($filter) ->
markdown = ['$filter', '$timeout', ($filter, $timeout) ->
link: (scope, elem, attrs, controller) ->
return unless controller?
......@@ -36,8 +36,10 @@ markdown = ['$filter', ($filter) ->
# Publish the controller
scope.model = controller
# Auto-focus the input box
scope.$watch 'readonly', (newValue) ->
if newValue then elem.find('textarea').focus()
unless newValue then $timeout -> elem.find('textarea').focus()
require: '?ngModel'
restrict: 'E'
scope:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment