Ajout du bouton « Plinn Image » avec toute la glue qui va bien. Pour l'instant, le...
[ckeditor.git] / skins / ckeditor / _source / plugins / iframe / 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 (function()
7 {
8 CKEDITOR.plugins.add( 'iframe',
9 {
10 requires : [ 'dialog', 'fakeobjects' ],
11 init : function( editor )
12 {
13 var pluginName = 'iframe',
14 lang = editor.lang.iframe;
15
16 CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/iframe.js' );
17 editor.addCommand( pluginName, new CKEDITOR.dialogCommand( pluginName ) );
18
19 editor.addCss(
20 'img.cke_iframe' +
21 '{' +
22 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/placeholder.png' ) + ');' +
23 'background-position: center center;' +
24 'background-repeat: no-repeat;' +
25 'border: 1px solid #a9a9a9;' +
26 'width: 80px;' +
27 'height: 80px;' +
28 '}'
29 );
30
31 editor.ui.addButton( 'Iframe',
32 {
33 label : lang.toolbar,
34 command : pluginName
35 });
36
37 editor.on( 'doubleclick', function( evt )
38 {
39 var element = evt.data.element;
40 if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'iframe' )
41 evt.data.dialog = 'iframe';
42 });
43
44 if ( editor.addMenuItems )
45 {
46 editor.addMenuItems(
47 {
48 iframe :
49 {
50 label : lang.title,
51 command : 'iframe',
52 group : 'image'
53 }
54 });
55 }
56
57 // If the "contextmenu" plugin is loaded, register the listeners.
58 if ( editor.contextMenu )
59 {
60 editor.contextMenu.addListener( function( element, selection )
61 {
62 if ( element && element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'iframe' )
63 return { iframe : CKEDITOR.TRISTATE_OFF };
64 });
65 }
66 },
67 afterInit : function( editor )
68 {
69 var dataProcessor = editor.dataProcessor,
70 dataFilter = dataProcessor && dataProcessor.dataFilter;
71
72 if ( dataFilter )
73 {
74 dataFilter.addRules(
75 {
76 elements :
77 {
78 iframe : function( element )
79 {
80 return editor.createFakeParserElement( element, 'cke_iframe', 'iframe', true );
81 }
82 }
83 });
84 }
85 }
86 });
87 })();