Ticket #3279: 3279.patch
File 3279.patch, 1.6 KB (added by , 15 years ago) |
---|
-
_source/plugins/save/plugin.js
13 13 { 14 14 modes : { wysiwyg:1, source:1 }, 15 15 16 getForm : function( element ) // Find the form element. 17 { 18 var form = element.$.form; 19 20 if ( form ) 21 return form; 22 23 while ( element = element.getParent() ) 24 { 25 if ( element.getName() == 'form' ) 26 return element.$; 27 }; 28 29 return null; 30 }, 31 16 32 exec : function( editor ) 17 33 { 18 var $form = editor.element.$.form; 34 // Get the form element. 35 var form = this.getForm( editor.element ); 19 36 20 if ( $form )37 if ( form ) 21 38 { 22 39 try 23 40 { 24 $form.submit();41 form.submit(); 25 42 } 26 43 catch( e ) 27 44 { 28 45 // If there's a button named "submit" then the form.submit 29 46 // function is masked and can't be called in IE/FF, so we 30 47 // call the click() method of that button. 31 if ( $form.submit.click )32 $form.submit.click();48 if ( form.submit.click ) 49 form.submit.click(); 33 50 } 34 51 } 35 52 } … … 42 59 { 43 60 init : function( editor ) 44 61 { 45 var command = editor.addCommand( pluginName, saveCmd ) ;46 command.modes = { wysiwyg : !!( editor.element.$.form ) };62 var command = editor.addCommand( pluginName, saveCmd ), 63 formExists = !!saveCmd.getForm( editor.element ); 47 64 65 command.modes = { wysiwyg : formExists, source : formExists }; 66 48 67 editor.ui.addButton( 'Save', 49 68 { 50 69 label : editor.lang.save,