Make sure the content is correctly applied in onReady

pull/1/head
yflory 8 years ago
parent 42b6cca18d
commit 5303e76ece

@ -812,6 +812,7 @@ define([
$('#' + LOADING).fadeOut(750, cb);
};
common.errorLoadingScreen = function (error, transparent) {
if (!$('#' + LOADING).is(':visible')) { common.addLoadingScreen(); }
$('.spinnerContainer').hide();
if (transparent) { $('#' + LOADING).css('opacity', 0.8); }
$('#' + LOADING).find('p').html(error || Messages.error);

@ -342,7 +342,7 @@ define([
var applyHjson = function (shjson) {
var userDocStateDom = hjsonToDom(JSON.parse(shjson));
if (!readOnly) {
if (!readOnly && !initializing) {
userDocStateDom.setAttribute("contenteditable", "true"); // lol wtf
}
var patch = (DD).diff(inner, userDocStateDom);
@ -686,6 +686,18 @@ define([
});
}
if (!readOnly) {
var shjson2 = stringifyDOM(inner);
var hjson2 = JSON.parse(shjson2).slice(0,-1);
var hjson = JSON.parse(shjson).slice(0,-1);
if (stringify(hjson2) !== stringify(hjson)) {
console.log('err');
console.error("shjson2 !== shjson");
Cryptpad.errorLoadingScreen("Unable to display the content of that realtime session in your browser. Please try to reload that page."); // TODO translate
throw new Error();
}
}
Cryptpad.getLastName(function (err, lastName) {
console.log("Unlocking editor");
setEditable(true);

Loading…
Cancel
Save