From 2d5caf38d9c73c1e2e30fd5f6a165cb903736d09 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 4 Aug 2016 17:00:30 +0200 Subject: [PATCH] show a spinner until the document has loaded --- www/pad/main.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/www/pad/main.js b/www/pad/main.js index e741d9816..366b25701 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -44,7 +44,8 @@ define([ TextPatcher: TextPatcher, logFights: true, fights: [], - Cryptpad: Cryptpad + Cryptpad: Cryptpad, + spinner: Cryptpad.spinner(document.body), }; var toolbar; @@ -92,12 +93,28 @@ define([ editor.execCommand('maximize'); var documentBody = ifrw.$('iframe')[0].contentDocument.body; + var inner = window.inner = documentBody; + + // hide all content until the realtime doc is ready + $(inner).css({ + color: 'white', + 'background-color': 'white', + }); documentBody.innerHTML = Messages.initialState; - var inner = window.inner = documentBody; var cursor = window.cursor = Cursor(inner); var setEditable = module.setEditable = function (bool) { + if (bool) { + $(inner).css({ + color: 'unset', + 'background-color': 'unset', + }); + $(module.spinner.get().el).fadeOut(750); + } else { + module.spinner.show(); + } + inner.setAttribute('contenteditable', bool); }; @@ -563,6 +580,8 @@ define([ }); } + //if (!inner.innerText.trim()) { documentBody.innerHTML = Messages.initialState; } + console.log("Unlocking editor"); setEditable(true); initializing = false;