JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
09b72c4e7c617ed70c3e5402cd30e9ed1ea47665
[ckeditor.git] / _source / plugins / image / plugin.js
1 /*\r
2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license\r
4 */\r
5 \r
6 /**\r
7  * @file Image plugin\r
8  */\r
9 \r
10 CKEDITOR.plugins.add( 'image',\r
11 {\r
12         init : function( editor )\r
13         {\r
14                 var pluginName = 'image';\r
15 \r
16                 // Register the dialog.\r
17                 CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/image.js' );\r
18 \r
19                 // Register the command.\r
20                 editor.addCommand( pluginName, new CKEDITOR.dialogCommand( pluginName ) );\r
21 \r
22                 // Register the toolbar button.\r
23                 editor.ui.addButton( 'Image',\r
24                         {\r
25                                 label : editor.lang.common.image,\r
26                                 command : pluginName\r
27                         });\r
28 \r
29                 // If the "menu" plugin is loaded, register the menu items.\r
30                 if ( editor.addMenuItems )\r
31                 {\r
32                         editor.addMenuItems(\r
33                                 {\r
34                                         image :\r
35                                         {\r
36                                                 label : editor.lang.image.menu,\r
37                                                 command : 'image',\r
38                                                 group : 'image'\r
39                                         }\r
40                                 });\r
41                 }\r
42 \r
43                 // If the "contextmenu" plugin is loaded, register the listeners.\r
44                 if ( editor.contextMenu )\r
45                 {\r
46                         editor.contextMenu.addListener( function( element, selection )\r
47                                 {\r
48                                         if ( !element || !element.is( 'img' ) || element.getAttribute( '_cke_realelement' ) )\r
49                                                 return null;\r
50 \r
51                                         return { image : CKEDITOR.TRISTATE_OFF };\r
52                                 });\r
53                 }\r
54         }\r
55 } );\r
56 \r
57 /**\r
58  * Whether to remove links when emptying the link URL field in the image dialog.\r
59  * @type Boolean\r
60  * @default true\r
61  * @example\r
62  * config.image_removeLinkByEmptyURL = false;\r
63  */\r
64 CKEDITOR.config.image_removeLinkByEmptyURL = true;\r