Sfoglia il codice sorgente

Internal: The toolbar provided by DecoupledEditorUIView should have the dir attribute for proper items styling. See ckeditor/ckeditor5#1151.

Aleksander Nowodzinski 6 anni fa
parent
commit
15d9c2afa0

+ 5 - 2
packages/ckeditor5-editor-decoupled/src/decouplededitoruiview.js

@@ -52,13 +52,16 @@ export default class DecoupledEditorUIView extends EditorUIView {
 		this.editable = new InlineEditableUIView( locale, editingView, editableElement );
 
 		// This toolbar may be placed anywhere in the page so things like font size need to be reset in it.
-		// Also because of the above, make sure the toolbar supports rounded corners.
+		// Because of the above, make sure the toolbar supports rounded corners.
+		// Also, make sure the toolbar has the proper dir attribute because its ancestor may not have one
+		// and some toolbar item styles depend on this attribute.
 		Template.extend( this.toolbar.template, {
 			attributes: {
 				class: [
 					'ck-reset_all',
 					'ck-rounded-corners'
-				]
+				],
+				dir: locale.uiLanguageDirection
 			}
 		} );
 	}

+ 4 - 0
packages/ckeditor5-editor-decoupled/tests/decouplededitoruiview.js

@@ -93,6 +93,10 @@ describe( 'DecoupledEditorUIView', () => {
 				expect( view.toolbar.element.classList.contains( 'ck-reset_all' ) ).to.be.true;
 				expect( view.toolbar.element.classList.contains( 'ck-rounded-corners' ) ).to.be.true;
 			} );
+
+			it( 'gets the "dir" attribute corresponding to Locale#uiLanguageDirection', () => {
+				expect( view.toolbar.element.getAttribute( 'dir' ) ).to.equal( 'ltr' );
+			} );
 		} );
 
 		describe( '#editable', () => {