From 6b174934c807616001d183c1dd7a1fff037cfca5 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Wed, 16 Aug 2017 12:40:15 +0200 Subject: [PATCH] Try waiting for iframe document.onload instead of looping and waiting for document.body to exist. --- www/pad/wysiwygarea-plugin.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/www/pad/wysiwygarea-plugin.js b/www/pad/wysiwygarea-plugin.js index 1abf010ef..1c87dee2c 100644 --- a/www/pad/wysiwygarea-plugin.js +++ b/www/pad/wysiwygarea-plugin.js @@ -470,14 +470,10 @@ // CryptPad var _iframe = window._iframe = iframe.$; - var fw = this; - var intr = setInterval(function () { - //console.log(_iframe.contentWindow.document.body); - if (_iframe.contentWindow && _iframe.contentWindow.document && _iframe.contentWindow.document.body) { - clearInterval(intr); - CKEDITOR.tools.callFunction(fw._.frameLoadedHandler, _iframe.contentWindow); - } - }, 10); + var fw = this; + _iframe.contentWindow.onload = function () { + CKEDITOR.tools.callFunction(fw._.frameLoadedHandler, _iframe.contentWindow); + }; return; // Work around Firefox bug - error prune when called from XUL (http://dev.ckeditor.com/ticket/320),