Fix editable title in history mode

pull/1/head
yflory 4 years ago
parent 3c5eed5939
commit 57d18e9a9a

@ -263,6 +263,7 @@ define([
var setHistoryMode = function (bool, update) { var setHistoryMode = function (bool, update) {
cpNfInner.metadataMgr.setHistory(bool); cpNfInner.metadataMgr.setHistory(bool);
toolbar.setHistory(bool);
stateChange((bool) ? STATE.HISTORY_MODE : STATE.READY); stateChange((bool) ? STATE.HISTORY_MODE : STATE.READY);
if (!bool && update) { onRemote(); } if (!bool && update) { onRemote(); }
else { else {
@ -358,7 +359,9 @@ define([
} }
cpNfInner.metadataMgr.updateMetadata(metadata); cpNfInner.metadataMgr.updateMetadata(metadata);
newContent = normalize(newContent); newContent = normalize(newContent);
contentUpdate(newContent, waitFor); if (state !== STATE.HISTORY_MODE) {
contentUpdate(newContent, waitFor);
}
} else { } else {
if (!cpNfInner.metadataMgr.getPrivateData().isNewFile) { if (!cpNfInner.metadataMgr.getPrivateData().isNewFile) {
// We're getting 'new pad' but there is an existing file // We're getting 'new pad' but there is an existing file
@ -376,7 +379,9 @@ define([
evOnDefaultContentNeeded.fire(); evOnDefaultContentNeeded.fire();
} }
}).nThen(function () { }).nThen(function () {
stateChange(STATE.READY); if (state !== STATE.HISTORY_MODE) {
stateChange(STATE.READY);
}
firstConnection = false; firstConnection = false;
oldContent = undefined; oldContent = undefined;
@ -414,6 +419,7 @@ define([
}); });
}; };
var onConnectionChange = function (info) { var onConnectionChange = function (info) {
if (state === STATE.HISTORY_MODE) { return; }
if (state === STATE.DELETED) { return; } if (state === STATE.DELETED) { return; }
stateChange(info.state ? STATE.INITIALIZING : STATE.DISCONNECTED, info.permanent); stateChange(info.state ? STATE.INITIALIZING : STATE.DISCONNECTED, info.permanent);
/*if (info.state) { /*if (info.state) {

@ -687,6 +687,7 @@ MessengerUI, Messages) {
return true; return true;
}); });
var save = function () { var save = function () {
if (toolbar.history) { return; }
var name = $input.val().trim(); var name = $input.val().trim();
if (name === "") { if (name === "") {
name = $input.attr('placeholder'); name = $input.attr('placeholder');
@ -717,6 +718,7 @@ MessengerUI, Messages) {
var displayInput = function () { var displayInput = function () {
if (toolbar.connected === false) { return; } if (toolbar.connected === false) { return; }
if (toolbar.history) { return; }
$input.width(Math.max(($text.width() + 10), 300)+'px'); $input.width(Math.max(($text.width() + 10), 300)+'px');
$text.hide(); $text.hide();
//$pencilIcon.css('display', 'none'); //$pencilIcon.css('display', 'none');
@ -1273,12 +1275,14 @@ MessengerUI, Messages) {
//checkLag(toolbar, config); //checkLag(toolbar, config);
}; };
toolbar.initializing = function (/*userId*/) { toolbar.initializing = function (/*userId*/) {
if (toolbar.history) { return; }
toolbar.connected = false; toolbar.connected = false;
if (toolbar.spinner) { if (toolbar.spinner) {
toolbar.spinner.text(Messages.initializing); toolbar.spinner.text(Messages.initializing);
} }
}; };
toolbar.reconnecting = function (/*userId*/) { toolbar.reconnecting = function (/*userId*/) {
if (toolbar.history) { return; }
toolbar.connected = false; toolbar.connected = false;
if (toolbar.spinner) { if (toolbar.spinner) {
var state = -1; var state = -1;
@ -1342,6 +1346,13 @@ MessengerUI, Messages) {
} }
}; };
toolbar.setHistory = function (bool) {
toolbar.history = bool;
if (bool && toolbar.spinner) {
toolbar.spinner.text("HISTORY"); // XXX
}
};
// On log out, remove permanently the realtime elements of the toolbar // On log out, remove permanently the realtime elements of the toolbar
Common.onLogout(function () { Common.onLogout(function () {
failed(); failed();

Loading…
Cancel
Save