Suppression des images attachées fonctionnelle.
[ckeditor.git] / skins / ckeditor / _source / plugins / save / 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 * @fileSave plugin.
8 */
9
10 (function()
11 {
12 var saveCmd =
13 {
14 modes : { wysiwyg:1, source:1 },
15 readOnly : 1,
16
17 exec : function( editor )
18 {
19 var $form = editor.element.$.form;
20
21 if ( $form )
22 {
23 try
24 {
25 $form.submit();
26 }
27 catch( e )
28 {
29 // If there's a button named "submit" then the form.submit
30 // function is masked and can't be called in IE/FF, so we
31 // call the click() method of that button.
32 if ( $form.submit.click )
33 $form.submit.click();
34 }
35 }
36 }
37 };
38
39 var pluginName = 'save';
40
41 // Register a plugin named "save".
42 CKEDITOR.plugins.add( pluginName,
43 {
44 init : function( editor )
45 {
46 var command = editor.addCommand( pluginName, saveCmd );
47 command.modes = { wysiwyg : !!( editor.element.$.form ) };
48
49 editor.ui.addButton( 'Save',
50 {
51 label : editor.lang.save,
52 command : pluginName
53 });
54 }
55 });
56 })();