Skip to content

Commit

Permalink
Merge pull request #746 from episodeyang/patch-2
Browse files Browse the repository at this point in the history
fix(textAngularSetup): handle corner case when commonElement is document.
  • Loading branch information
JoelParke committed Jul 8, 2015
2 parents b49bf81 + 49b7df2 commit dbea624
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/textAngularSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ angular.module('textAngularSetup', [])
},
activeState: function(commonElement){
var result = false;
if (!commonElement || commonElement.nodeName === '#document') return false;
if(commonElement) result =
commonElement.css('text-align') === 'left' ||
commonElement.attr('align') === 'left' ||
Expand All @@ -462,6 +463,7 @@ angular.module('textAngularSetup', [])
},
activeState: function(commonElement){
var result = false;
if (!commonElement || commonElement.nodeName === '#document') return false;
if(commonElement) result = commonElement.css('text-align') === 'right';
result = result || this.$editor().queryCommandState('justifyRight');
return result;
Expand All @@ -475,6 +477,7 @@ angular.module('textAngularSetup', [])
},
activeState: function(commonElement){
var result = false;
if (!commonElement || commonElement.nodeName === '#document') return false;
if(commonElement) result = commonElement.css('text-align') === 'center';
result = result || this.$editor().queryCommandState('justifyCenter');
return result;
Expand Down

0 comments on commit dbea624

Please sign in to comment.