When there's an error, remove all empty editors. This prevents a bug where
empty editor frames stay displayed but never load if there's a network connectivity problem.
This commit is contained in:
parent
e6b5054e50
commit
f9b355277c
|
@ -320,7 +320,7 @@ Editor.prototype.blurred = function () {
|
|||
|
||||
Editor.prototype.empty = function () {
|
||||
if ( !this.document || !this.document.body )
|
||||
return false; // we don't know yet whether it's empty
|
||||
return true; // consider it empty as of now
|
||||
|
||||
return ( scrapeText( this.document.body ).length == 0 );
|
||||
}
|
||||
|
@ -493,8 +493,12 @@ Editor.prototype.shutdown = function( event ) {
|
|||
disconnectAll( this.options_button );
|
||||
disconnectAll( this.hide_button );
|
||||
disconnectAll( iframe );
|
||||
disconnectAll( this.document.body );
|
||||
disconnectAll( this.document );
|
||||
|
||||
if ( this.document ) {
|
||||
disconnectAll( this.document.body );
|
||||
disconnectAll( this.document );
|
||||
}
|
||||
|
||||
blindUp( iframe, options = { "duration": 0.5, afterFinish: function () {
|
||||
try {
|
||||
removeElement( note_controls );
|
||||
|
|
|
@ -729,6 +729,14 @@ Wiki.prototype.display_error = function ( text ) {
|
|||
this.clear_messages();
|
||||
this.clear_pulldowns();
|
||||
|
||||
// remove all empty editors, some of which might exist due to a problem reaching the server
|
||||
var iframes = getElementsByTagAndClassName( "iframe", "note_frame" );
|
||||
for ( var i in iframes ) {
|
||||
var editor = iframes[ i ].editor;
|
||||
if ( editor.empty() )
|
||||
editor.shutdown();
|
||||
}
|
||||
|
||||
var inner_div = DIV( { "class": "error_inner" }, text );
|
||||
var div = DIV( { "class": "error" }, inner_div );
|
||||
appendChildNodes( "notes", div );
|
||||
|
|
Reference in New Issue