Mimimum syndical pour en faire un produit zope / cmf.
[ckeditor.git] / skins / ckeditor / _source / plugins / save / plugin.js
diff --git a/skins/ckeditor/_source/plugins/save/plugin.js b/skins/ckeditor/_source/plugins/save/plugin.js
new file mode 100644 (file)
index 0000000..4a075b5
--- /dev/null
@@ -0,0 +1,56 @@
+/*\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+For licensing, see LICENSE.html or http://ckeditor.com/license\r
+*/\r
+\r
+/**\r
+ * @fileSave plugin.\r
+ */\r
+\r
+(function()\r
+{\r
+       var saveCmd =\r
+       {\r
+               modes : { wysiwyg:1, source:1 },\r
+               readOnly : 1,\r
+\r
+               exec : function( editor )\r
+               {\r
+                       var $form = editor.element.$.form;\r
+\r
+                       if ( $form )\r
+                       {\r
+                               try\r
+                               {\r
+                                       $form.submit();\r
+                               }\r
+                               catch( e )\r
+                               {\r
+                                       // If there's a button named "submit" then the form.submit\r
+                                       // function is masked and can't be called in IE/FF, so we\r
+                                       // call the click() method of that button.\r
+                                       if ( $form.submit.click )\r
+                                               $form.submit.click();\r
+                               }\r
+                       }\r
+               }\r
+       };\r
+\r
+       var pluginName = 'save';\r
+\r
+       // Register a plugin named "save".\r
+       CKEDITOR.plugins.add( pluginName,\r
+       {\r
+               init : function( editor )\r
+               {\r
+                       var command = editor.addCommand( pluginName, saveCmd );\r
+                       command.modes = { wysiwyg : !!( editor.element.$.form ) };\r
+\r
+                       editor.ui.addButton( 'Save',\r
+                               {\r
+                                       label : editor.lang.save,\r
+                                       command : pluginName\r
+                               });\r
+               }\r
+       });\r
+})();\r