On prépare de quoi se concentrer sur les images incorporées.
[ckeditor.git] / skins / ckeditor / _source / plugins / image / plugin.js
1 /*
2 Copyright (c) 2003-2011, 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 editor.on( 'doubleclick', function( evt )
30 {
31 var element = evt.data.element;
32
33 if ( element.is( 'img' ) && !element.data( 'cke-realelement' ) && !element.isReadOnly() )
34 evt.data.dialog = 'image';
35 });
36
37 // If the "menu" plugin is loaded, register the menu items.
38 if ( editor.addMenuItems )
39 {
40 editor.addMenuItems(
41 {
42 image :
43 {
44 label : editor.lang.image.menu,
45 command : 'image',
46 group : 'image'
47 }
48 });
49 }
50
51 // If the "contextmenu" plugin is loaded, register the listeners.
52 if ( editor.contextMenu )
53 {
54 editor.contextMenu.addListener( function( element, selection )
55 {
56 if ( !element || !element.is( 'img' ) || element.data( 'cke-realelement' ) || element.isReadOnly() )
57 return null;
58
59 return { image : CKEDITOR.TRISTATE_OFF };
60 });
61 }
62 }
63 } );
64
65 /**
66 * Whether to remove links when emptying the link URL field in the image dialog.
67 * @type Boolean
68 * @default true
69 * @example
70 * config.image_removeLinkByEmptyURL = false;
71 */
72 CKEDITOR.config.image_removeLinkByEmptyURL = true;
73
74 /**
75 * Padding text to set off the image in preview area.
76 * @name CKEDITOR.config.image_previewText
77 * @type String
78 * @default "Lorem ipsum dolor..." placehoder text.
79 * @example
80 * config.image_previewText = CKEDITOR.tools.repeat( '___ ', 100 );
81 */