浏览代码

More improvements to LabeledInputView and InputTextView.

Aleksander Nowodzinski 6 年之前
父节点
当前提交
06ad0adaec

+ 8 - 8
packages/ckeditor5-ui/src/inputtext/inputtextview.js

@@ -121,7 +121,7 @@ export default class InputTextView extends View {
 			on: {
 				input: bind.to( 'input' ),
 				change: bind.to( () => {
-					this.isEmpty = this._isEmpty;
+					this.isEmpty = isInputElementEmpty( this.element );
 				} )
 			}
 		} );
@@ -147,7 +147,7 @@ export default class InputTextView extends View {
 		};
 
 		const setIsEmpty = () => {
-			this.isEmpty = this._isEmpty;
+			this.isEmpty = isInputElementEmpty( this.element );
 		};
 
 		setValue( this.value );
@@ -174,11 +174,11 @@ export default class InputTextView extends View {
 	focus() {
 		this.element.focus();
 	}
+}
 
-	/**
-	 * TODO
-	 */
-	get _isEmpty() {
-		return this.element.value === '';
-	}
+/**
+ * TODO
+ */
+function isInputElementEmpty( element ) {
+	return element.value === '';
 }

+ 11 - 2
packages/ckeditor5-ui/src/labeledinput/labeledinputview.js

@@ -146,11 +146,20 @@ export default class LabeledInputView extends View {
 					'ck-labeled-input',
 					bind.if( 'isReadOnly', 'ck-disabled' ),
 					bind.if( 'isFocused', 'ck-labeled-input_focused' ),
+					bind.if( 'errorText', 'ck-error' )
 				]
 			},
 			children: [
-				this.inputView,
-				this.labelView,
+				{
+					tag: 'div',
+					attributes: {
+						class: [ 'ck-labeled-input__wrapper' ]
+					},
+					children: [
+						this.inputView,
+						this.labelView,
+					]
+				},
 				this.statusView
 			]
 		} );