From 83e2db29f1ef842f527f5907c42411bfe1ccb45d Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sat, 24 Jan 2009 23:39:05 -0800 Subject: [PATCH] Hack to prevent iframe from being incorrectly positioned if there is a closing (and thus moving) message or error box. --- static/js/Editor.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/static/js/Editor.js b/static/js/Editor.js index dc3cb42..976d7d9 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -232,6 +232,14 @@ Editor.prototype.claim_iframe = function ( position_after ) { if ( this.iframe ) return; + // hack to prevent iframe from being incorrectly positioned if there is a closing (and thus + // moving) message or error box + if ( getElementsByTagAndClassName( "div", "message" ).length > 0 || + getElementsByTagAndClassName( "div", "error" ).length > 0 ) { + setTimeout( function() { self.claim_iframe( position_after ); }, 25 ); + return; + } + // claim the reusable iframe for this note, stealing it from the note that's using it (if any) this.iframe = Editor.shared_iframe.iframe; this.iframe.setAttribute( "id", iframe_id );