Fix a race condition causing the drive to be empty

pull/1/head
yflory 8 years ago
parent 1b671edce9
commit 3ff3eac283

@ -18,7 +18,6 @@ define([
// Use `$(function () {});` to make sure the html is loaded before doing anything else // Use `$(function () {});` to make sure the html is loaded before doing anything else
$(function () { $(function () {
var $iframe = $('#pad-iframe').contents();
var ifrw = $('#pad-iframe')[0].contentWindow; var ifrw = $('#pad-iframe')[0].contentWindow;
Cryptpad.addLoadingScreen(); Cryptpad.addLoadingScreen();
@ -126,7 +125,7 @@ define([
}; };
var setSearchCursor = function () { var setSearchCursor = function () {
var $input = $iframe.find('#searchInput'); var $input = APP.$iframe.find('#searchInput');
localStorage.searchCursor = $input[0].selectionStart; localStorage.searchCursor = $input[0].selectionStart;
}; };
var getSearchCursor = function () { var getSearchCursor = function () {
@ -140,12 +139,12 @@ define([
var setEditable = function (state) { var setEditable = function (state) {
APP.editable = state; APP.editable = state;
if (!state) { if (!state) {
$iframe.find('#content').addClass('readonly'); APP.$iframe.find('#content').addClass('readonly');
$iframe.find('[draggable="true"]').attr('draggable', false); APP.$iframe.find('[draggable="true"]').attr('draggable', false);
} }
else { else {
$iframe.find('#content').removeClass('readonly'); APP.$iframe.find('#content').removeClass('readonly');
$iframe.find('[draggable="false"]').attr('draggable', true); APP.$iframe.find('[draggable="false"]').attr('draggable', true);
} }
}; };
@ -189,6 +188,8 @@ define([
config.workgroup = isWorkgroup(); config.workgroup = isWorkgroup();
config.Cryptpad = Cryptpad; config.Cryptpad = Cryptpad;
var $iframe = APP.$iframe;
var filesOp = FO.init(files, config); var filesOp = FO.init(files, config);
filesOp.fixFiles(); filesOp.fixFiles();
@ -2646,6 +2647,7 @@ define([
Cryptpad.ready(function () { Cryptpad.ready(function () {
Cryptpad.reportAppUsage(); Cryptpad.reportAppUsage();
if (!APP.loggedIn) { Cryptpad.feedback('ANONYMOUS_DRIVE'); } if (!APP.loggedIn) { Cryptpad.feedback('ANONYMOUS_DRIVE'); }
var $iframe = APP.$iframe = $('#pad-iframe').contents();
APP.$bar = $iframe.find('#toolbar'); APP.$bar = $iframe.find('#toolbar');
var storeObj = Cryptpad.getStore().getProxy && Cryptpad.getStore().getProxy().proxy ? Cryptpad.getStore().getProxy() : undefined; var storeObj = Cryptpad.getStore().getProxy && Cryptpad.getStore().getProxy().proxy ? Cryptpad.getStore().getProxy() : undefined;

Loading…
Cancel
Save