Opened 8 years ago

Closed 7 years ago

#4640 closed Bug (fixed)

Small optimizations in the fileBrowser plugin

Reported by: alfonsoml Owned by: alfonsoml
Priority: Normal Milestone: CKEditor 3.2
Component: General Version: 3.0.1
Keywords: Review+ Cc:


At the bottom, the elements that are reused can be declared as local variables so it's a little clearer and it will compress a little further (sorry, I still don't have installed here any SVN to provide a diff)

	CKEDITOR.plugins.add( 'filebrowser',
		init : function( editor, pluginPath )
			editor._.filebrowserFn = setUrl, editor );

			CKEDITOR.on( 'dialogDefinition', function( evt )
				var definition =, 
				// Associate filebrowser to elements with 'filebrowser' attribute.
				for ( var i in definition.contents )
					element = definition.contents[ i ] ;
					attachFileBrowser( evt.editor,, definition, element.elements );
					if ( element.hidden && element.filebrowser )
						element.hidden =
							!isConfigured( definition, element[ 'id' ], element.filebrowser );
			} );
	} );

In the isConfigured I think that the last line can be also optimized to avoid repeated function calls: Turn

		return ( definition.getContents( tabId ).get( elementId ).filebrowser && 
				 definition.getContents( tabId ).get( elementId ).filebrowser.url );


		var elementFileBrowser = definition.getContents( tabId ).get( elementId ).filebrowser;
		return ( elementFileBrowser && elementFileBrowser.url );

Attachments (1)

4640.patch (2.0 KB) - added by alfonsoml 7 years ago.
Patch. It doesn't change the behavior, just a little rewrite of the code

Download all attachments as: .zip

Change History (5)

comment:1 Changed 8 years ago by fredck

  • Milestone set to CKEditor 3.2

Changed 7 years ago by alfonsoml

Patch. It doesn't change the behavior, just a little rewrite of the code

comment:2 Changed 7 years ago by alfonsoml

  • Keywords Review? added; HasPatch removed
  • Owner set to alfonsoml
  • Status changed from new to assigned

Provided patch for review.

comment:3 Changed 7 years ago by fredck

  • Keywords Review+ added; Review? removed

comment:4 Changed 7 years ago by alfonsoml

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed with [4918]

Note: See TracTickets for help on using tickets.
© 2003 – 2016 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy