Skip to content

Commit

Permalink
tinymce-single: set active button for default alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Feb 24, 2017
1 parent a62d96c commit 574120f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tinymce-single/tinymce/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,15 @@
var button = this;

editor.on( 'nodechange', function( event ) {
element = event.parents[ event.parents.length - 1 ];

button.active( editor.$( element ).hasClass( 'align' + position ) );
$element = editor.$( event.parents[ event.parents.length - 1 ] );

if ( position === 'center' ) {
button.active( ! (
$element.hasClass( 'alignleft' ) || $element.hasClass( 'alignright' )
) );
} else {
button.active( $element.hasClass( 'align' + position ) );
}
} );
}
} );
Expand Down

0 comments on commit 574120f

Please sign in to comment.