show a spinner until the document has loaded

pull/1/head
ansuz 9 years ago
parent 653bb84064
commit 2d5caf38d9

@ -44,7 +44,8 @@ define([
TextPatcher: TextPatcher, TextPatcher: TextPatcher,
logFights: true, logFights: true,
fights: [], fights: [],
Cryptpad: Cryptpad Cryptpad: Cryptpad,
spinner: Cryptpad.spinner(document.body),
}; };
var toolbar; var toolbar;
@ -92,12 +93,28 @@ define([
editor.execCommand('maximize'); editor.execCommand('maximize');
var documentBody = ifrw.$('iframe')[0].contentDocument.body; 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; documentBody.innerHTML = Messages.initialState;
var inner = window.inner = documentBody;
var cursor = window.cursor = Cursor(inner); var cursor = window.cursor = Cursor(inner);
var setEditable = module.setEditable = function (bool) { 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); inner.setAttribute('contenteditable', bool);
}; };
@ -563,6 +580,8 @@ define([
}); });
} }
//if (!inner.innerText.trim()) { documentBody.innerHTML = Messages.initialState; }
console.log("Unlocking editor"); console.log("Unlocking editor");
setEditable(true); setEditable(true);
initializing = false; initializing = false;

Loading…
Cancel
Save