Przeglądaj źródła

Merge branch 'master' into t/ckeditor5/456

Piotrek Koszuliński 8 lat temu
rodzic
commit
1b1ed18fd4

+ 1 - 29
packages/ckeditor5-ui/src/dropdown/dropdownview.js

@@ -98,34 +98,6 @@ export default class DropdownView extends View {
 
 		// Toggle the visibility of the panel when the dropdown becomes open.
 		panelView.bind( 'isVisible' ).to( this, 'isOpen' );
-
-		/**
-		 * The label of the dropdown.
-		 *
-		 * @observable
-		 * @member {String} #label
-		 */
-
-		/**
-		 * Controls whether the dropdown is enabled (can be clicked).
-		 *
-		 * @observable
-		 * @member {Boolean} #isEnabled
-		 */
-
-		/**
-		 * Controls whether the {@link #buttonView} is "pushed".
-		 *
-		 * @observable
-		 * @member {Boolean} #isOn
-		 */
-
-		/**
-		 * (Optional) Whether the label of the dropdown is visible. See {@link module:ui/button/buttonview~ButtonView#withText}.
-		 *
-		 * @observable
-		 * @member {Boolean} #withText
-		 */
 	}
 
 	/**
@@ -149,7 +121,7 @@ export default class DropdownView extends View {
 		// Open the dropdown panel using the arrow down key, just like with return or space.
 		this.keystrokes.set( 'arrowdown', ( data, cancel ) => {
 			// Don't open if the dropdown is disabled or already open.
-			if ( this.isEnabled && !this.isOpen ) {
+			if ( this.buttonView.isEnabled && !this.isOpen ) {
 				this.isOpen = true;
 				cancel();
 			}

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

@@ -134,7 +134,10 @@ export default class BalloonPanelView extends View {
 
 			on: {
 				// https://github.com/ckeditor/ckeditor5-ui/issues/206
-				mousedown: preventDefault( this )
+				mousedown: preventDefault( this ),
+
+				// https://github.com/ckeditor/ckeditor5-ui/issues/243
+				selectstart: bind.to( evt => evt.preventDefault() )
 			}
 		} );
 	}

+ 0 - 4
packages/ckeditor5-ui/src/view.js

@@ -48,7 +48,6 @@ import isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';
  *			document.body.appendChild( view.element );
  *		} );
  *
- * @mixes module:utils/dom/emittermixin~EmmiterMixin
  * @mixes module:utils/observablemixin~ObservableMixin
  */
 export default class View {
@@ -150,9 +149,6 @@ export default class View {
 		return ( this._element = this.template.render() );
 	}
 
-	/**
-	 * @type {HTMLElement}
-	 */
 	set element( el ) {
 		this._element = el;
 	}

+ 3 - 3
packages/ckeditor5-ui/src/viewcollection.js

@@ -46,7 +46,7 @@ export default class ViewCollection extends Collection {
 		} );
 
 		/**
-		 * The {@link module:core/editor~Editor editor's locale} instance.
+		 * The {@link module:core/editor/editor~Editor editor's locale} instance.
 		 *
 		 * @member {module:utils/locale~Locale}
 		 */
@@ -182,8 +182,8 @@ export default class ViewCollection extends Collection {
 	 *
 	 * See {@link module:utils/emittermixin~EmitterMixin#delegate}.
 	 *
-	 * @param {...String} events {@link module:ui/view~View} event names to be delegated to another {@link
-	 * module:utils/emittermixin~EmitterMixin}.
+	 * @param {...String} events {@link module:ui/view~View} event names to be delegated to another
+	 * {@link module:utils/emittermixin~EmitterMixin}.
 	 * @returns {module:ui/viewcollection~ViewCollection#delegate.to}
 	 */
 	delegate( ...events ) {

+ 2 - 2
packages/ckeditor5-ui/tests/dropdown/dropdownview.js

@@ -127,7 +127,7 @@ describe( 'DropdownView', () => {
 					stopPropagation: sinon.spy()
 				};
 
-				view.isEnabled = true;
+				view.buttonView.isEnabled = true;
 
 				view.isOpen = true;
 				view.keystrokes.press( keyEvtData );
@@ -149,7 +149,7 @@ describe( 'DropdownView', () => {
 					stopPropagation: sinon.spy()
 				};
 
-				view.isEnabled = false;
+				view.buttonView.isEnabled = false;
 				view.isOpen = false;
 
 				view.keystrokes.press( keyEvtData );

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

@@ -127,6 +127,17 @@ describe( 'BalloonPanelView', () => {
 				view.element.dispatchEvent( evt );
 				sinon.assert.calledOnce( spy );
 			} );
+
+			// https://github.com/ckeditor/ckeditor5-ui/issues/243
+			it( 'prevents default on #selectstart', () => {
+				const event = new Event( 'selectstart', { bubbles: true } );
+				const spy = sinon.spy( event, 'preventDefault' );
+				const child = document.createElement( 'div' );
+
+				view.element.appendChild( child );
+				child.dispatchEvent( event );
+				sinon.assert.calledOnce( spy );
+			} );
 		} );
 	} );