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

@ -687,6 +687,7 @@ MessengerUI, Messages) {
return true;
});
var save = function () {
if (toolbar.history) { return; }
var name = $input.val().trim();
if (name === "") {
name = $input.attr('placeholder');
@ -717,6 +718,7 @@ MessengerUI, Messages) {
var displayInput = function () {
if (toolbar.connected === false) { return; }
if (toolbar.history) { return; }
$input.width(Math.max(($text.width() + 10), 300)+'px');
$text.hide();
//$pencilIcon.css('display', 'none');
@ -1273,12 +1275,14 @@ MessengerUI, Messages) {
//checkLag(toolbar, config);
};
toolbar.initializing = function (/*userId*/) {
if (toolbar.history) { return; }
toolbar.connected = false;
if (toolbar.spinner) {
toolbar.spinner.text(Messages.initializing);
}
};
toolbar.reconnecting = function (/*userId*/) {
if (toolbar.history) { return; }
toolbar.connected = false;
if (toolbar.spinner) {
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
Common.onLogout(function () {
failed();

Loading…
Cancel
Save