Skip to content

Commit

Permalink
check editor object is undeifned.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloverhearts committed Jan 11, 2017
1 parent 8e6bfb4 commit 5ecfabb
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -1133,6 +1133,9 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
});

$scope.$on('focusParagraph', function(event, paragraphId, cursorPos, mouseEvent) {
if (!$scope.editor) {
return;
}
if ($scope.paragraph.id === paragraphId) {
// focus editor
if (!$scope.paragraph.config.editorHide) {
Expand Down Expand Up @@ -1177,8 +1180,10 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
), 1000);

deferred.promise.then(function(data) {
$scope.editor.focus();
$scope.goToEnd($scope.editor);
if ($scope.editor) {
$scope.editor.focus();
$scope.goToEnd($scope.editor);
}
});
}
});
Expand Down

0 comments on commit 5ecfabb

Please sign in to comment.