8
0
Pārlūkot izejas kodu

Change #field to #fieldView

panr 5 gadi atpakaļ
vecāks
revīzija
c848851e23

+ 5 - 5
packages/ckeditor5-link/src/linkui.js

@@ -146,7 +146,7 @@ export default class LinkUI extends Plugin {
 
 		const formView = new LinkFormView( editor.locale, linkCommand.manualDecorators );
 
-		formView.urlInputView.field.bind( 'value' ).to( linkCommand, 'value' );
+		formView.urlInputView.fieldView.bind( 'value' ).to( linkCommand, 'value' );
 
 		// Form elements should be read-only when corresponding commands are disabled.
 		formView.urlInputView.bind( 'isReadOnly' ).to( linkCommand, 'isEnabled', value => !value );
@@ -154,7 +154,7 @@ export default class LinkUI extends Plugin {
 
 		// Execute link command after clicking the "Save" button.
 		this.listenTo( formView, 'submit', () => {
-			editor.execute( 'link', formView.urlInputView.field.value, formView.getDecoratorSwitchesState() );
+			editor.execute( 'link', formView.urlInputView.fieldView.value, formView.getDecoratorSwitchesState() );
 			this._closeFormView();
 		} );
 
@@ -298,16 +298,16 @@ export default class LinkUI extends Plugin {
 
 		// Select input when form view is currently visible.
 		if ( this._balloon.visibleView === this.formView ) {
-			this.formView.urlInputView.field.select();
+			this.formView.urlInputView.fieldView.select();
 		}
 
 		// Make sure that each time the panel shows up, the URL field remains in sync with the value of
-		// the command. If the user typed in the input, then canceled the balloon (`urlInputView.field#value` stays
+		// the command. If the user typed in the input, then canceled the balloon (`urlInputView.fieldView#value` stays
 		// unaltered) and re-opened it without changing the value of the link command (e.g. because they
 		// clicked the same link), they would see the old value instead of the actual value of the command.
 		// https://github.com/ckeditor/ckeditor5-link/issues/78
 		// https://github.com/ckeditor/ckeditor5-link/issues/123
-		this.formView.urlInputView.field.value = linkCommand.value || '';
+		this.formView.urlInputView.fieldView.value = linkCommand.value || '';
 	}
 
 	/**

+ 1 - 1
packages/ckeditor5-link/src/ui/linkformview.js

@@ -216,7 +216,7 @@ export default class LinkFormView extends View {
 		const labeledInput = new LabeledFieldView( this.locale, createLabeledInputText );
 
 		labeledInput.label = t( 'Link URL' );
-		labeledInput.field.placeholder = 'https://example.com';
+		labeledInput.fieldView.placeholder = 'https://example.com';
 
 		return labeledInput;
 	}

+ 10 - 10
packages/ckeditor5-link/tests/linkui.js

@@ -236,12 +236,12 @@ describe( 'LinkUI', () => {
 			setModelData( editor.model, '<paragraph><$text linkHref="url">f[]oo</$text></paragraph>' );
 
 			// Mock some leftover value **in DOM**, e.g. after previous editing.
-			formView.urlInputView.field.value = 'leftover';
+			formView.urlInputView.fieldView.value = 'leftover';
 
 			linkUIFeature._showUI();
 			actionsView.fire( 'edit' );
 
-			expect( formView.urlInputView.field.value ).to.equal( 'url' );
+			expect( formView.urlInputView.fieldView.value ).to.equal( 'url' );
 		} );
 
 		// https://github.com/ckeditor/ckeditor5-link/issues/123
@@ -249,7 +249,7 @@ describe( 'LinkUI', () => {
 			setModelData( editor.model, '<paragraph>f[]oo</paragraph>' );
 
 			linkUIFeature._showUI();
-			expect( formView.urlInputView.field.value ).to.equal( '' );
+			expect( formView.urlInputView.fieldView.value ).to.equal( '' );
 		} );
 
 		it( 'should optionally force `main` stack to be visible', () => {
@@ -823,7 +823,7 @@ describe( 'LinkUI', () => {
 				linkUIFeature._showUI();
 				linkUIFeature._removeFormView();
 
-				const selectSpy = testUtils.sinon.spy( formView.urlInputView.field, 'select' );
+				const selectSpy = testUtils.sinon.spy( formView.urlInputView.fieldView, 'select' );
 				actionsView.fire( 'edit' );
 
 				expect( balloon.visibleView ).to.equal( formView );
@@ -913,19 +913,19 @@ describe( 'LinkUI', () => {
 			it( 'should bind formView.urlInputView#value to link command value', () => {
 				const command = editor.commands.get( 'link' );
 
-				expect( formView.urlInputView.field.value ).to.be.undefined;
+				expect( formView.urlInputView.fieldView.value ).to.be.undefined;
 
 				command.value = 'http://cksource.com';
-				expect( formView.urlInputView.field.value ).to.equal( 'http://cksource.com' );
+				expect( formView.urlInputView.fieldView.value ).to.equal( 'http://cksource.com' );
 			} );
 
 			it( 'should execute link command on formView#submit event', () => {
 				const executeSpy = testUtils.sinon.spy( editor, 'execute' );
 
-				formView.urlInputView.field.value = 'http://ckeditor.com';
-				expect( formView.urlInputView.field.value ).to.equal( 'http://ckeditor.com' );
+				formView.urlInputView.fieldView.value = 'http://ckeditor.com';
+				expect( formView.urlInputView.fieldView.value ).to.equal( 'http://ckeditor.com' );
 
-				formView.urlInputView.field.value = 'http://cksource.com';
+				formView.urlInputView.fieldView.value = 'http://cksource.com';
 				formView.fire( 'submit' );
 
 				expect( executeSpy.calledOnce ).to.be.true;
@@ -1056,7 +1056,7 @@ describe( 'LinkUI', () => {
 					const executeSpy = testUtils.sinon.spy( editor, 'execute' );
 
 					setModelData( model, 'f[<$text linkHref="url" linkIsFoo="true">ooba</$text>]r' );
-					expect( formView.urlInputView.field.element.value ).to.equal( 'url' );
+					expect( formView.urlInputView.fieldView.element.value ).to.equal( 'url' );
 					expect( formView.getDecoratorSwitchesState() ).to.deep.equal( { linkIsFoo: true } );
 
 					formView.fire( 'submit' );

+ 1 - 1
packages/ckeditor5-link/tests/ui/linkformview.js

@@ -81,7 +81,7 @@ describe( 'LinkFormView', () => {
 
 		describe( 'url input view', () => {
 			it( 'has placeholder', () => {
-				expect( view.urlInputView.field.placeholder ).to.equal( 'https://example.com' );
+				expect( view.urlInputView.fieldView.placeholder ).to.equal( 'https://example.com' );
 			} );
 		} );