|
|
@ -162,6 +162,8 @@ define([
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
state = newState;
|
|
|
|
state = newState;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (state === STATE.READY) {
|
|
|
|
|
|
|
|
// Refreshing ready state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch (state) {
|
|
|
|
switch (state) {
|
|
|
|
case STATE.DISCONNECTED:
|
|
|
|
case STATE.DISCONNECTED:
|
|
|
@ -311,6 +313,7 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var closeSnapshot = function (restore) {
|
|
|
|
var closeSnapshot = function (restore) {
|
|
|
|
if (restore && state !== STATE.READY) { return false; }
|
|
|
|
if (restore && state !== STATE.READY) { return false; }
|
|
|
|
|
|
|
|
toolbar.setSnapshot(false);
|
|
|
|
setUnsyncMode(false); // Unlock onLocal and onRemote
|
|
|
|
setUnsyncMode(false); // Unlock onLocal and onRemote
|
|
|
|
if (restore) { onLocal(); } // Restore? commit the content
|
|
|
|
if (restore) { onLocal(); } // Restore? commit the content
|
|
|
|
onRemote(); // Make sure we're back to the realtime content
|
|
|
|
onRemote(); // Make sure we're back to the realtime content
|
|
|
@ -318,6 +321,7 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var loadSnapshot = function (hash, data) {
|
|
|
|
var loadSnapshot = function (hash, data) {
|
|
|
|
setUnsyncMode(true);
|
|
|
|
setUnsyncMode(true);
|
|
|
|
|
|
|
|
toolbar.setSnapshot(true);
|
|
|
|
Snapshots.create(common, {
|
|
|
|
Snapshots.create(common, {
|
|
|
|
readOnly: readOnly,
|
|
|
|
readOnly: readOnly,
|
|
|
|
$toolbar: $(toolbarContainer),
|
|
|
|
$toolbar: $(toolbarContainer),
|
|
|
@ -326,10 +330,8 @@ define([
|
|
|
|
close: closeSnapshot,
|
|
|
|
close: closeSnapshot,
|
|
|
|
applyVal: function (val) {
|
|
|
|
applyVal: function (val) {
|
|
|
|
var newContent = JSON.parse(val);
|
|
|
|
var newContent = JSON.parse(val);
|
|
|
|
/*
|
|
|
|
|
|
|
|
var meta = extractMetadata(newContent);
|
|
|
|
var meta = extractMetadata(newContent);
|
|
|
|
cpNfInner.metadataMgr.updateMetadata(meta);
|
|
|
|
cpNfInner.metadataMgr.updateMetadata(meta);
|
|
|
|
*/
|
|
|
|
|
|
|
|
contentUpdate(normalize(newContent) || ["BODY",{},[]], function (h) {
|
|
|
|
contentUpdate(normalize(newContent) || ["BODY",{},[]], function (h) {
|
|
|
|
return h;
|
|
|
|
return h;
|
|
|
|
});
|
|
|
|
});
|
|
|
|