2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
10 CKEDITOR.plugins.add( 'image',
12 init : function( editor )
14 var pluginName = 'image';
16 // Register the dialog.
17 CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/image.js' );
19 // Register the command.
20 editor.addCommand( pluginName, new CKEDITOR.dialogCommand( pluginName ) );
22 // Register the toolbar button.
23 editor.ui.addButton( 'Image',
25 label : editor.lang.common.image,
29 editor.on( 'doubleclick', function( evt )
31 var element = evt.data.element;
33 if ( element.is( 'img' ) && !element.data( 'cke-realelement' ) && !element.isReadOnly() )
34 evt.data.dialog = 'image';
37 // If the "menu" plugin is loaded, register the menu items.
38 if ( editor.addMenuItems )
44 label : editor.lang.image.menu,
51 // If the "contextmenu" plugin is loaded, register the listeners.
52 if ( editor.contextMenu )
54 editor.contextMenu.addListener( function( element, selection )
56 if ( !element || !element.is( 'img' ) || element.data( 'cke-realelement' ) || element.isReadOnly() )
59 return { image : CKEDITOR.TRISTATE_OFF };
66 * Whether to remove links when emptying the link URL field in the image dialog.
70 * config.image_removeLinkByEmptyURL = false;
72 CKEDITOR.config.image_removeLinkByEmptyURL = true;
75 * Padding text to set off the image in preview area.
76 * @name CKEDITOR.config.image_previewText
78 * @default "Lorem ipsum dolor..." placehoder text.
80 * config.image_previewText = CKEDITOR.tools.repeat( '___ ', 100 );