Nation Notes module contributed by Z&H Healthcare.
[openemr.git] / library / custom_template / ckeditor / _source / plugins / save / plugin.js
blobad8fe22e562c70bfcfb93f3dd6ca58e2a60d446a
1 /*
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
4 */
6 /**
7  * @fileSave plugin.
8  */
10 (function()
12         var saveCmd =
13         {
14                 modes : { wysiwyg:1, source:1 },
16                 exec : function( editor )
17                 {
18                         var $form = editor.element.$.form;
20                         if ( $form )
21                         {
22                                 try
23                                 {
24                                         $form.submit();
25                                 }
26                                 catch( e )
27                                 {
28                                         // If there's a button named "submit" then the form.submit
29                                         // function is masked and can't be called in IE/FF, so we
30                                         // call the click() method of that button.
31                                         if ( $form.submit.click )
32                                                 $form.submit.click();
33                                 }
34                         }
35                 }
36         };
38         var pluginName = 'save';
40         // Register a plugin named "save".
41         CKEDITOR.plugins.add( pluginName,
42         {
43                 init : function( editor )
44                 {
45                         var command = editor.addCommand( pluginName, saveCmd );
46                         command.modes = { wysiwyg : !!( editor.element.$.form ) };
48                         editor.ui.addButton( 'Save',
49                                 {
50                                         label : editor.lang.save,
51                                         command : pluginName
52                                 });
53                 }
54         });
55 })();