Fix small OO bugs

pull/1/head
yflory 4 years ago
parent 176c9b99b8
commit 937d42e267

@ -2373,9 +2373,14 @@ define([
};
postMsg('INIT');
/*
window.addEventListener('beforeunload', function () {
postMsg('CLOSE');
});
*/
window.addEventListener('unload', function () {
postMsg('CLOSE');
});
} else if (false && !noWorker && !noSharedWorker && 'serviceWorker' in navigator) {
var initializing = true;
var stopWaiting = waitFor2(); // Call this function when we're ready

@ -2215,20 +2215,22 @@ define([
}
};
var wasEditing = false;
var setStrictEditing = function () {
if (APP.isFast) { return; }
var editor = getEditor();
var isModified = editor.asc_isDocumentModified || editor.isDocumentModified;
var editing = isModified();
var editing = editor.asc_isDocumentModified ? editor.asc_isDocumentModified() : editor.isDocumentModified();
if (editing) {
evOnPatch.fire();
} else {
evOnSync.fire();
}
wasEditing = Boolean(editing);
};
APP.onFastChange = function (isFast) {
APP.isFast = isFast;
if (isFast) {
wasEditing = false;
if (APP.hasChangedInterval) {
window.clearInterval(APP.hasChangedInterval);
}
@ -2575,6 +2577,7 @@ define([
sframeChan.event("EV_CORRUPTED_CACHE");
};
var firstReady = true;
config.onReady = function (info) {
if (APP.realtime !== info.realtime) {
APP.realtime = info.realtime;
@ -2684,8 +2687,12 @@ define([
setMyId();
oldHashes = JSON.parse(JSON.stringify(content.hashes));
initializing = false;
common.openPadChat(APP.onLocal);
// Only execute the following code the first time we call onReady
if (!firstReady) { return void setEditable(!readOnly); }
firstReady = false;
common.openPadChat(APP.onLocal);
if (!readOnly) {
var cursors = {};

Loading…
Cancel
Save