@ -3757,7 +3757,7 @@ function rcube_webmail()
hidden = $ ( "[name='_pgpmime']" , form ) ,
hidden = $ ( "[name='_pgpmime']" , form ) ,
msgid = ref . set _busy ( true , draft || saveonly ? 'savingmessage' : 'sendingmessage' )
msgid = ref . set _busy ( true , draft || saveonly ? 'savingmessage' : 'sendingmessage' )
form . target = 'savetarget' ;
form . target = ref . get _save _target ( ) ;
form . _draft . value = draft ? '1' : '' ;
form . _draft . value = draft ? '1' : '' ;
form . action = ref . add _url ( form . action , '_unlock' , msgid ) ;
form . action = ref . add _url ( form . action , '_unlock' , msgid ) ;
form . action = ref . add _url ( form . action , '_framed' , 1 ) ;
form . action = ref . add _url ( form . action , '_framed' , 1 ) ;
@ -4386,7 +4386,7 @@ function rcube_webmail()
$ ( 'li' , this . gui _objects . attachmentlist ) . each ( function ( ) { files . push ( this . id . replace ( /^rcmfile/ , '' ) ) ; } ) ;
$ ( 'li' , this . gui _objects . attachmentlist ) . each ( function ( ) { files . push ( this . id . replace ( /^rcmfile/ , '' ) ) ; } ) ;
$ ( 'input[name="_attachments"]' , form ) . val ( files . join ( ) ) ;
$ ( 'input[name="_attachments"]' , form ) . val ( files . join ( ) ) ;
form . target = 'savetarget' ;
form . target = this . get _save _target ( ) ;
form . _draft . value = draft ? '1' : '' ;
form . _draft . value = draft ? '1' : '' ;
form . action = this . add _url ( form . action , '_unlock' , msgid ) ;
form . action = this . add _url ( form . action , '_unlock' , msgid ) ;
form . action = this . add _url ( form . action , '_lang' , lang ) ;
form . action = this . add _url ( form . action , '_lang' , lang ) ;
@ -4751,27 +4751,36 @@ function rcube_webmail()
this . env . draft _id = id ;
this . env . draft _id = id ;
$ ( "input[name='_draft_saveid']" ) . val ( id ) ;
$ ( "input[name='_draft_saveid']" ) . val ( id ) ;
// reset history of hidden iframe used for saving draft (#1489643)
// but don't do this on timer-triggered draft-autosaving (#1489789)
if ( window . frames [ 'savetarget' ] && window . frames [ 'savetarget' ] . history && ! this . draft _autosave _submit && ! this . mailvelope _editor ) {
window . frames [ 'savetarget' ] . history . back ( ) ;
}
}
this . draft _autosave _submit = false ;
// Resetting savetarget frame to workaround issues with window history
}
this . save _target . detach ( ) ;
// always remove local copy upon saving as draft
// always remove local copy upon saving as draft
this . remove _compose _data ( this . env . compose _id ) ;
this . remove _compose _data ( this . env . compose _id ) ;
this . compose _skip _unsavedcheck = false ;
this . compose _skip _unsavedcheck = false ;
} ;
} ;
// Create (attach) 'savetarget' iframe before use
this . get _save _target = function ( )
{
if ( ! this . save _target ) {
this . save _target = $ ( '<iframe>' ) . attr ( {
name : "savetarget" ,
style : "width:0;height:0;visibility:hidden;" ,
'aria-hidden' : "true"
} ) ;
}
this . save _target . detach ( ) . attr ( 'src' , "about:blank" ) . appendTo ( 'body' ) ;
return 'savetarget' ;
} ;
this . auto _save _start = function ( )
this . auto _save _start = function ( )
{
{
if ( this . env . draft _autosave ) {
if ( this . env . draft _autosave ) {
this . draft _autosave _submit = false ;
this . save _timer = setTimeout ( function ( ) {
this . save _timer = setTimeout ( function ( ) {
ref . draft _autosave _submit = true ; // set auto-saved flag (#1489789)
ref . command ( "savedraft" ) ;
ref . command ( "savedraft" ) ;
} , this . env . draft _autosave * 1000 ) ;
} , this . env . draft _autosave * 1000 ) ;
}
}