From c97613490e14c14e0e004541a2473712751513ed Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Thu, 22 Jan 2009 13:30:00 -0800 Subject: [PATCH] Fixing some assumptions in Wiki.js that there are multiple iframes. --- static/js/Editor.js | 1 + static/js/Wiki.js | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/static/js/Editor.js b/static/js/Editor.js index ece7609..59143bf 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -1098,6 +1098,7 @@ Editor.prototype.shutdown = function( event ) { if ( !iframe ) return; + iframe.editor = null; blindUp( iframe, options = { "duration": 0.25, afterFinish: function () { try { if ( iframe ) diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 68bba2b..49ae106 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -860,7 +860,7 @@ Wiki.prototype.create_editor = function ( id, note_text, deleted_from_id, revisi } Wiki.prototype.resize_editor = function () { - if ( Editor.shared_iframe.editor ) + if ( Editor.shared_frame && Editor.shared_iframe.editor ) Editor.shared_iframe.editor.resize(); } @@ -2695,8 +2695,6 @@ Wiki.prototype.delete_all_editors = function ( event ) { } Wiki.prototype.display_empty_message = function ( replace_messages ) { - var iframes = getElementsByTagAndClassName( "iframe", "note_frame" ); - if ( !replace_messages ) { // if there are any messages already open, bail var messages = getElementsByTagAndClassName( "div", "message" ); @@ -2708,11 +2706,10 @@ Wiki.prototype.display_empty_message = function ( replace_messages ) { } // if there are any open editors, bail - for ( var i in iframes ) { - var iframe = iframes[ i ]; - if ( iframe.editor.closed == false ) - return false; - } + if ( Editor.shared_frame && Editor.shared_frame.editor && !Editor.shared_frame.editor.closed ) + return false; + if ( getElementsByTagAndClassName( "div", "static_note_div" ).length > 0 ) + return false; if ( !this.total_notes_count ) { if ( this.parent_id )