Skip to content

Commit

Permalink
Merge branch 't/10689'
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Jasiun committed Aug 28, 2013
2 parents a7609c3 + 4a3a9dc commit b154b45
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -3,6 +3,7 @@ CKEditor 4 Changelog

## CKEditor 4.2.1

* [#10689](http://dev.ckeditor.com/ticket/10689): Save toolbar button saves only first instance.
* [#10368](http://dev.ckeditor.com/ticket/10368): Move language reading direction definition ("dir") from main language file to core.
* [#9330](http://dev.ckeditor.com/ticket/9330): Fixed pasting anchors from MS Word.
* [#8103](http://dev.ckeditor.com/ticket/8103): Fixed pasting nested lists from MS Word.
Expand Down
26 changes: 19 additions & 7 deletions core/editor.js
Expand Up @@ -677,22 +677,34 @@

// #8031 If textarea had required attribute and editor is empty fire 'required' event and if
// it was cancelled, prevent submitting the form.
if ( editor._.required && !element.getValue() && editor.fire( 'required' ) === false )
if ( editor._.required && !element.getValue() && editor.fire( 'required' ) === false ) {
// When user press save button event (evt) is undefined (see save plugin).
// This method works because it throws error so originalSubmit won't be called.
// Also this error won't be shown because it will be caught in save plugin.
evt.data.preventDefault();
}
}
form.on( 'submit', onSubmit );

// Setup the submit function because it doesn't fire the
// "submit" event.
if ( !form.$.submit.nodeName && !form.$.submit.length ) {
function isFunction( f ) {
// For IE8 typeof fun == object so we cannot use it.
return !!( f && f.call && f.apply );
};

// Check if there is no element/elements input with name == "submit".
// If they exists they will overwrite form submit function (form.$.submit).
// If form.$.submit is overwritten we can not do anything with it.
if ( isFunction( form.$.submit ) ) {
// Setup the submit function because it doesn't fire the
// "submit" event.
form.$.submit = CKEDITOR.tools.override( form.$.submit, function( originalSubmit ) {
return function( evt ) {
onSubmit( new CKEDITOR.dom.event( evt ) );
return function() {
onSubmit();

// For IE, the DOM submit function is not a
// function, so we need third check.
if ( originalSubmit.apply )
originalSubmit.apply( this, arguments );
originalSubmit.apply( this );
else
originalSubmit();
};
Expand Down

0 comments on commit b154b45

Please sign in to comment.