From 574120f711ff748fd3e1a9f09676abf00d48649a Mon Sep 17 00:00:00 2001 From: iseulde Date: Fri, 24 Feb 2017 10:51:59 +0100 Subject: [PATCH] tinymce-single: set active button for default alignment --- tinymce-single/tinymce/block.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tinymce-single/tinymce/block.js b/tinymce-single/tinymce/block.js index 8c26fc85358cf1..bbc1607208e4be 100644 --- a/tinymce-single/tinymce/block.js +++ b/tinymce-single/tinymce/block.js @@ -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 ) ); + } } ); } } );