summaryrefslogtreecommitdiff
path: root/src/node/utils
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2015-05-19 16:43:19 +0100
committerJohn McLear <john@mclear.co.uk>2015-05-19 16:43:19 +0100
commitb662d5c61802d42ee4214799520e7c3ed95a3ef5 (patch)
treefd619faba4ff42ebb8a115a54cd109f05c2adb80 /src/node/utils
parent9e9207d8b6091375017aba122eb8c3db0fb10e8a (diff)
downloadetherpad-lite-b662d5c61802d42ee4214799520e7c3ed95a3ef5.zip
dont show editing buttons in R/O view
Diffstat (limited to 'src/node/utils')
-rw-r--r--src/node/utils/toolbar.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/node/utils/toolbar.js b/src/node/utils/toolbar.js
index 07b86496..97eb2ffa 100644
--- a/src/node/utils/toolbar.js
+++ b/src/node/utils/toolbar.js
@@ -236,10 +236,32 @@ module.exports = {
selectButton: function (attributes) {
return new SelectButton(attributes);
},
- menu: function (buttons) {
+ menu: function (buttons, isReadOnly) {
+ 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){
+ // Clear all formatting buttons
+ buttons = []
+ }else{
+ // Remove Save Revision from the right menu
+ buttons[0].remove("savedrevision");
+ }
+ }
+
var groups = _.map(buttons, function (group) {
return ButtonsGroup.fromArray(group).render();
});
return groups.join(this.separator());
}
};
+
+Array.prototype.remove = function() {
+ var what, a = arguments, L = a.length, ax;
+ while (L && this.length) {
+ what = a[--L];
+ while ((ax = this.indexOf(what)) !== -1) {
+ this.splice(ax, 1);
+ }
+ }
+ return this;
+};