Forráskód Böngészése

Simplify collection of switches with decorators.

Mateusz Samsel 6 éve
szülő
commit
93c7db326f
1 módosított fájl, 7 hozzáadás és 7 törlés
  1. 7 7
      packages/ckeditor5-link/src/ui/linkformview.js

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

@@ -272,23 +272,23 @@ export default class LinkFormView extends View {
 	_createManualDecoratorSwitches() {
 		const switches = this.createCollection();
 
-		switches.bindTo( this.manualDecorators ).using( item => {
+		for ( const manualDecorator of this.manualDecorators ) {
 			const switchButton = new SwitchButtonView( this.locale );
 
 			switchButton.set( {
-				name: item.id,
-				label: item.label,
+				name: manualDecorator.id,
+				label: manualDecorator.label,
 				withText: true
 			} );
 
-			switchButton.bind( 'isOn' ).to( item, 'value' );
+			switchButton.bind( 'isOn' ).to( manualDecorator, 'value' );
 
 			switchButton.on( 'execute', () => {
-				item.set( 'value', !switchButton.isOn );
+				manualDecorator.set( 'value', !switchButton.isOn );
 			} );
 
-			return switchButton;
-		} );
+			switches.add( switchButton );
+		}
 
 		return switches;
 	}