Przeglądaj źródła

Display label hint immediately after opened balloon.

dkonopka 7 lat temu
rodzic
commit
c9bcc50b0b

+ 3 - 8
packages/ckeditor5-media-embed/src/ui/mediaformview.js

@@ -242,8 +242,10 @@ export default class MediaFormView extends View {
 	 * See {@link #isValid}.
 	 */
 	resetFormStatus() {
+		const t = this.locale.t;
+
 		this.urlInputView.errorText = null;
-		this.urlInputView.infoText = null;
+		this.urlInputView.infoText = t( 'Paste the URL here or into the content to embed faster.' );
 	}
 
 	/**
@@ -261,13 +263,6 @@ export default class MediaFormView extends View {
 		labeledInput.label = t( 'Media URL' );
 		inputView.placeholder = 'https://example.com';
 
-		inputView.on( 'input', () => {
-			// Display the #infoText only when there's some value to hide it when the input
-			// is empty, e.g. user used backspace to clean it up.
-			labeledInput.infoText = inputView.element.value ?
-				t( 'Paste the URL into the content to embed faster.' ) : null;
-		} );
-
 		return labeledInput;
 	}
 

+ 1 - 9
packages/ckeditor5-media-embed/tests/ui/mediaformview.js

@@ -82,16 +82,8 @@ describe( 'MediaFormView', () => {
 				expect( view.urlInputView.inputView.placeholder ).to.equal( 'https://example.com' );
 			} );
 
-			it( 'displays the info text when upon #input when the field has a value', () => {
-				view.urlInputView.inputView.element.value = 'foo';
-				view.urlInputView.inputView.fire( 'input' );
-
+			it( 'has info text' () => {
 				expect( view.urlInputView.infoText ).to.match( /^Paste the URL/ );
-
-				view.urlInputView.inputView.element.value = '';
-				view.urlInputView.inputView.fire( 'input' );
-
-				expect( view.urlInputView.infoText ).to.be.null;
 			} );
 		} );