JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.0
[ckeditor.git] / _source / plugins / image / plugin.js
diff --git a/_source/plugins/image/plugin.js b/_source/plugins/image/plugin.js
new file mode 100644 (file)
index 0000000..09b72c4
--- /dev/null
@@ -0,0 +1,64 @@
+/*\r
+Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+For licensing, see LICENSE.html or http://ckeditor.com/license\r
+*/\r
+\r
+/**\r
+ * @file Image plugin\r
+ */\r
+\r
+CKEDITOR.plugins.add( 'image',\r
+{\r
+       init : function( editor )\r
+       {\r
+               var pluginName = 'image';\r
+\r
+               // Register the dialog.\r
+               CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/image.js' );\r
+\r
+               // Register the command.\r
+               editor.addCommand( pluginName, new CKEDITOR.dialogCommand( pluginName ) );\r
+\r
+               // Register the toolbar button.\r
+               editor.ui.addButton( 'Image',\r
+                       {\r
+                               label : editor.lang.common.image,\r
+                               command : pluginName\r
+                       });\r
+\r
+               // If the "menu" plugin is loaded, register the menu items.\r
+               if ( editor.addMenuItems )\r
+               {\r
+                       editor.addMenuItems(\r
+                               {\r
+                                       image :\r
+                                       {\r
+                                               label : editor.lang.image.menu,\r
+                                               command : 'image',\r
+                                               group : 'image'\r
+                                       }\r
+                               });\r
+               }\r
+\r
+               // If the "contextmenu" plugin is loaded, register the listeners.\r
+               if ( editor.contextMenu )\r
+               {\r
+                       editor.contextMenu.addListener( function( element, selection )\r
+                               {\r
+                                       if ( !element || !element.is( 'img' ) || element.getAttribute( '_cke_realelement' ) )\r
+                                               return null;\r
+\r
+                                       return { image : CKEDITOR.TRISTATE_OFF };\r
+                               });\r
+               }\r
+       }\r
+} );\r
+\r
+/**\r
+ * Whether to remove links when emptying the link URL field in the image dialog.\r
+ * @type Boolean\r
+ * @default true\r
+ * @example\r
+ * config.image_removeLinkByEmptyURL = false;\r
+ */\r
+CKEDITOR.config.image_removeLinkByEmptyURL = true;\r