Skip to content

Commit

Permalink
fix reactivating issue when ngModel is updated
Browse files Browse the repository at this point in the history
initial watch activate summernote editor whenever contents are
updated, so if user enter key, ngModelUpdate occured multiple time.
It decrease performance.

fixed #117 , #119
  • Loading branch information
outsideris committed Mar 28, 2016
1 parent 20b9585 commit 7517bd6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/angular-summernote.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ angular.module('summernote', [])
}

summernoteConfig.callbacks = summernoteConfig.callbacks || {};

if (angular.isDefined($attrs.onInit)) {
summernoteConfig.callbacks.onInit = function(evt) {
$scope.init({evt:evt});
Expand Down Expand Up @@ -194,9 +194,8 @@ angular.module('summernote', [])
});
summernoteController.activate(scope, element, ngModel);
} else {
scope.$watch(function() {
return ngModel.$viewValue;
}, function(value) {
var clearWatch = scope.$watch(function() { return ngModel.$viewValue; }, function(value) {
clearWatch();
element.append(value);
summernoteController.activate(scope, element, ngModel);
}, true);
Expand Down

0 comments on commit 7517bd6

Please sign in to comment.