From 1c3f1a15cdb8c82982c3e77b8b1dec6355657661 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 9 Jan 2017 17:02:01 +0100 Subject: [PATCH] make sure that /pad is resized after loading --- www/common/cryptpad-common.js | 4 ++-- www/pad/main.js | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 0bf419a24..6fdbeb0bc 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -678,8 +678,8 @@ define([ $loading.append($container); $('body').append($loading); }; - common.removeLoadingScreen = function () { - $('#' + LOADING).fadeOut(750); + common.removeLoadingScreen = function (cb) { + $('#' + LOADING).fadeOut(750, cb); }; common.errorLoadingScreen = function (error) { $('.spinnerContainer').hide(); diff --git a/www/pad/main.js b/www/pad/main.js index e957c5634..3c65bfcb0 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -62,6 +62,14 @@ define([ Cryptpad: Cryptpad, }; + var emitResize = APP.emitResize = function () { + var cw = $('#pad-iframe')[0].contentWindow; + + var evt = cw.document.createEvent('UIEvents'); + evt.initUIEvent('resize', true, false, cw, 0); + cw.dispatchEvent(evt); + }; + var toolbar; var isNotMagicLine = function (el) { @@ -630,11 +638,6 @@ define([ if (!APP.isMaximized) { editor.execCommand('maximize'); APP.isMaximized = true; - // We have to call it 3 times in Safari in order to have the editor fully maximized -_- - if ((''+window.navigator.vendor).indexOf('Apple') !== -1) { - editor.execCommand('maximize'); - editor.execCommand('maximize'); - } } module.patchText = TextPatcher.create({ @@ -661,7 +664,8 @@ define([ console.log("Unlocking editor"); setEditable(true); initializing = false; - Cryptpad.removeLoadingScreen(); + Cryptpad.removeLoadingScreen(emitResize); + // Update the toolbar list: // Add the current user in the metadata if he has edit rights if (readOnly) { return; }