- var currentAlign = firstBlock.getComputedStyle( 'text-align' ).replace( alignRemoveRegex, '' );\r
- if ( ( !currentAlign && this.isDefaultAlign ) || currentAlign == this.value )\r
- return CKEDITOR.TRISTATE_ON;\r
- return CKEDITOR.TRISTATE_OFF;\r
+ return ( getAlignment( firstBlock, editor.config.useComputedState ) == this.value ) ?\r
+ CKEDITOR.TRISTATE_ON :\r
+ CKEDITOR.TRISTATE_OFF;\r
+ }\r
+\r
+ function getAlignment( element, useComputedState )\r
+ {\r
+ useComputedState = useComputedState === undefined || useComputedState;\r
+\r
+ var align = useComputedState ?\r
+ element.getComputedStyle( 'text-align' ) :\r
+ element.getStyle( 'text-align' ) || element.getAttribute( 'align' ) || '';\r
+\r
+ align && ( align = align.replace( /-moz-|-webkit-|start|auto/i, '' ) );\r
+\r
+ !align && useComputedState && ( align = element.getComputedStyle( 'direction' ) == 'rtl' ? 'right' : 'left' );\r
+\r
+ return align;\r