hide toolbar when in read-only mode

pull/1/head
ansuz 8 years ago
parent bf82704def
commit fcb9848b3a

@ -110,7 +110,7 @@ define([
var defaultName = Cryptpad.getDefaultName(parsedHash); var defaultName = Cryptpad.getDefaultName(parsedHash);
if (readOnly) { if (readOnly) {
$('#pad-iframe')[0].contentWindow.$('#cke_1_toolbox > .cke_toolbar').hide(); $('#pad-iframe')[0].contentWindow.$('#cke_1_toolbox > .cke_toolbox_main').hide();
} }
/* add a class to the magicline plugin so we can pick it out more easily */ /* add a class to the magicline plugin so we can pick it out more easily */
@ -584,23 +584,24 @@ define([
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys); editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
} }
// Expand / collapse the toolbar var $existingButton = $bar.find('#cke_1_toolbar_collapser').hide();
var $existingButton = $bar.find('#cke_1_toolbar_collapser'); if (!readOnly) {
var $collapse = Cryptpad.createButton(null, true); // Expand / collapse the toolbar
$existingButton.hide(); var $collapse = Cryptpad.createButton(null, true);
$collapse.removeClass('fa-question'); $collapse.removeClass('fa-question');
var updateIcon = function () { var updateIcon = function () {
$collapse.removeClass('fa-caret-down').removeClass('fa-caret-up'); $collapse.removeClass('fa-caret-down').removeClass('fa-caret-up');
var isCollapsed = !$bar.find('.cke_toolbox_main').is(':visible'); var isCollapsed = !$bar.find('.cke_toolbox_main').is(':visible');
if (isCollapsed) { $collapse.addClass('fa-caret-down'); } if (isCollapsed) { $collapse.addClass('fa-caret-down'); }
else { $collapse.addClass('fa-caret-up'); } else { $collapse.addClass('fa-caret-up'); }
}; };
updateIcon();
$collapse.click(function () {
$existingButton.click();
updateIcon(); updateIcon();
}); $collapse.click(function () {
$rightside.append($collapse); $existingButton.click();
updateIcon();
});
$rightside.append($collapse);
}
/* add an export button */ /* add an export button */
var $export = Cryptpad.createButton('export', true, {}, exportFile); var $export = Cryptpad.createButton('export', true, {}, exportFile);

Loading…
Cancel
Save