Skip to content

Commit

Permalink
Make placeholder optional; merge #52; bumped version
Browse files Browse the repository at this point in the history
  • Loading branch information
thijsw committed Mar 15, 2016
1 parent 39dc0b4 commit 5b27c24
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-medium-editor",
"version": "1.1.0",
"version": "1.1.1",
"dependencies": {
"angular": ">=1.3.0",
"medium-editor": "5.*"
Expand Down
9 changes: 8 additions & 1 deletion dist/angular-medium-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ angular.module('angular-medium-editor', [])

ngModel.$render = function() {
iElement.html(ngModel.$viewValue || "");
ngModel.editor.getExtensionByName('placeholder').updatePlaceholder(iElement[0]);
var placeholder = ngModel.editor.getExtensionByName('placeholder');
if (placeholder) {
placeholder.updatePlaceholder(iElement[0]);
}
};

ngModel.$isEmpty = function(value) {
Expand All @@ -46,6 +49,10 @@ angular.module('angular-medium-editor', [])
scope.$watch('bindOptions', function(bindOptions) {
ngModel.editor.init(iElement, bindOptions);
});

scope.$on('$destroy', function() {
ngModel.editor.destroy();
});
}
};

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.

8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-medium-editor",
"version": "1.1.0",
"version": "1.1.1",
"description": "AngularJS directive for Medium.com editor clone",
"keywords": [
"angular",
Expand All @@ -17,11 +17,7 @@
"type": "git",
"url": "https://github.com/thijsw/angular-medium-editor.git"
},
"licenses": [
{
"type": "MIT"
}
],
"license": "MIT",
"devDependencies": {
"connect-livereload": "^0.4.0",
"grunt": "^0.4.5",
Expand Down
5 changes: 4 additions & 1 deletion src/angular-medium-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ angular.module('angular-medium-editor', [])

ngModel.$render = function() {
iElement.html(ngModel.$viewValue || "");
ngModel.editor.getExtensionByName('placeholder').updatePlaceholder(iElement[0]);
var placeholder = ngModel.editor.getExtensionByName('placeholder');
if (placeholder) {
placeholder.updatePlaceholder(iElement[0]);
}
};

ngModel.$isEmpty = function(value) {
Expand Down

0 comments on commit 5b27c24

Please sign in to comment.