8
0
Просмотр исходного кода

Added className property to the BalloonPanelView interface.

Oskar Wróbel 8 лет назад
Родитель
Сommit
72297a4f28

+ 11 - 1
packages/ckeditor5-ui/src/panel/balloon/balloonpanelview.js

@@ -88,6 +88,15 @@ export default class BalloonPanelView extends View {
 		 */
 		this.set( 'withArrow', true );
 
+		/**
+		 * Additional css class added to the {#element}.
+		 *
+		 * @observable
+		 * @default ''
+		 * @member {String} #className
+		 */
+		this.set( 'className', '' );
+
 		/**
 		 * Max width of the balloon panel, as in CSS.
 		 *
@@ -118,7 +127,8 @@ export default class BalloonPanelView extends View {
 					'ck-balloon-panel',
 					bind.to( 'position', ( value ) => `ck-balloon-panel_${ value }` ),
 					bind.if( 'isVisible', 'ck-balloon-panel_visible' ),
-					bind.if( 'withArrow', 'ck-balloon-panel_with-arrow' )
+					bind.if( 'withArrow', 'ck-balloon-panel_with-arrow' ),
+					bind.to( 'className' )
 				],
 
 				style: {

+ 12 - 0
packages/ckeditor5-ui/tests/panel/balloon/balloonpanelview.js

@@ -106,6 +106,18 @@ describe( 'BalloonPanelView', () => {
 			} );
 		} );
 
+		describe( 'className', () => {
+			it( 'should set additional class to the view#element', () => {
+				view.className = 'foo';
+
+				expect( view.element.classList.contains( 'foo' ) ).to.true;
+
+				view.className = '';
+
+				expect( view.element.classList.contains( 'foo' ) ).to.false;
+			} );
+		} );
+
 		describe( 'children', () => {
 			it( 'should react on view#content', () => {
 				expect( view.element.childNodes.length ).to.equal( 0 );