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