From 0d2854571d6708baef0f6132a82b5b8e672f706f Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 27 Mar 2020 11:22:21 +0000 Subject: [PATCH] toolbar: show the "save revision" button only on the right toolbar. Revision b480416375d2 fixed a bug, but introduced a regression, and the "save revision" "star" button started to appear both on the left and the right toolbar. This change introduces a flag "whichMenu" in toolbar.menu(), that controls whether the left, the right or the timeslider toolbar is being drawn. --- src/node/utils/toolbar.js | 10 +++++++--- src/templates/pad.html | 4 ++-- src/templates/timeslider.html | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/node/utils/toolbar.js b/src/node/utils/toolbar.js index 429aac164..320fd4e45 100644 --- a/src/node/utils/toolbar.js +++ b/src/node/utils/toolbar.js @@ -251,7 +251,10 @@ module.exports = { return new SelectButton(attributes); }, - menu: function (buttons, isReadOnly) { + /* + * Valid values for whichMenu: 'left' | 'right' | 'timeslider-right' + */ + menu: function (buttons, isReadOnly, whichMenu) { if (isReadOnly) { // The best way to detect if it's the left editbar is to check for a bold button if (buttons[0].indexOf("bold") !== -1) { @@ -265,13 +268,14 @@ module.exports = { /* * This pad is not read only * - * Add back the savedrevision button (the "star") if is not already there. + * Add back the savedrevision button (the "star") if is not already there, + * but only on the right toolbar. * * This is a quick fix for #3702: it was sufficient to visit a single read * only pad to cause the disappearence of the star button from all the * pads. */ - if ((buttons[0].indexOf("savedrevision") === -1)) { + if ((buttons[0].indexOf("savedrevision") === -1) && (whichMenu === "right")) { buttons[0].push("savedrevision"); } } diff --git a/src/templates/pad.html b/src/templates/pad.html index 34bcf0599..14719b689 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -64,12 +64,12 @@ diff --git a/src/templates/timeslider.html b/src/templates/timeslider.html index 05f17d20b..2c1f465ce 100644 --- a/src/templates/timeslider.html +++ b/src/templates/timeslider.html @@ -82,7 +82,7 @@
<% e.begin_block("timesliderEditbarRight"); %> <% e.end_block(); %>