From 57d18e9a9ab714a21b45d794fe7ca8458a3ed897 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 24 Sep 2020 17:03:19 +0200 Subject: [PATCH] Fix editable title in history mode --- www/common/sframe-app-framework.js | 10 ++++++++-- www/common/toolbar.js | 11 +++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index d62a90397..30343d486 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -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) { diff --git a/www/common/toolbar.js b/www/common/toolbar.js index 31fe38406..28661de46 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -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();