Skip to content

Commit

Permalink
Fix: Listen textiput event(for IE)
Browse files Browse the repository at this point in the history
  • Loading branch information
st44100 committed Jun 4, 2015
1 parent 230ed4d commit 22132ab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
7 changes: 3 additions & 4 deletions dist/angular-medium-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ angular.module('angular-medium-editor', [])
});

var onChange = function() {

scope.$apply(function() {

// If user cleared the whole text, we have to reset the editor because MediumEditor
Expand All @@ -58,7 +57,7 @@ angular.module('angular-medium-editor', [])

// view -> model
iElement.on('blur', onChange);
iElement.on('input', onChange);
iElement.on('input textinput', onChange);

// model -> view
ctrl.$render = function() {
Expand All @@ -73,9 +72,9 @@ angular.module('angular-medium-editor', [])
}

iElement.html(ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue);

// hide placeholder when view is not empty
if(!ctrl.$isEmpty(ctrl.$viewValue)) angular.element(iElement).removeClass('medium-editor-placeholder');
if(!ctrl.$isEmpty(ctrl.$viewValue)) angular.element(iElement).removeClass('medium-editor-placeholder');
};

}
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-medium-editor.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions src/angular-medium-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ angular.module('angular-medium-editor', [])
});

var onChange = function() {

scope.$apply(function() {

// If user cleared the whole text, we have to reset the editor because MediumEditor
Expand All @@ -58,7 +57,7 @@ angular.module('angular-medium-editor', [])

// view -> model
iElement.on('blur', onChange);
iElement.on('input', onChange);
iElement.on('input textinput', onChange);

// model -> view
ctrl.$render = function() {
Expand All @@ -73,9 +72,9 @@ angular.module('angular-medium-editor', [])
}

iElement.html(ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue);

// hide placeholder when view is not empty
if(!ctrl.$isEmpty(ctrl.$viewValue)) angular.element(iElement).removeClass('medium-editor-placeholder');
if(!ctrl.$isEmpty(ctrl.$viewValue)) angular.element(iElement).removeClass('medium-editor-placeholder');
};

}
Expand Down

0 comments on commit 22132ab

Please sign in to comment.