浏览代码

The initial implementation of the info text in the MediaFormView.

Aleksander Nowodzinski 7 年之前
父节点
当前提交
1dcabd0d85
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      packages/ckeditor5-media-embed/src/ui/mediaformview.js

+ 10 - 1
packages/ckeditor5-media-embed/src/ui/mediaformview.js

@@ -239,7 +239,8 @@ export default class MediaFormView extends View {
 	 * Cleans up the errors in all form fields. See {@link #isValid}.
 	 */
 	resetErrors() {
-		this.urlInputView.errorText = false;
+		this.urlInputView.errorText = null;
+		this.urlInputView.tipText = null;
 	}
 
 	/**
@@ -256,6 +257,14 @@ export default class MediaFormView extends View {
 		labeledInput.label = t( 'Media URL' );
 		labeledInput.inputView.placeholder = 'https://example.com';
 
+		labeledInput.inputView.on( 'input', () => {
+			if ( labeledInput.inputView.element.value ) {
+				labeledInput.tipText = t( 'Paste the URL into the content to embed faster.' );
+			} else {
+				labeledInput.tipText = null;
+			}
+		} );
+
 		return labeledInput;
 	}