Remove the IMPORT button and editor toolbars in read-only mode
This commit is contained in:
parent
7cc5218422
commit
47e8be1681
@ -305,6 +305,7 @@ define([
|
||||
.click(exportText);
|
||||
$rightside.append($export);
|
||||
|
||||
if (!readOnly) {
|
||||
/* add an import button */
|
||||
var $import = $('<button>',{
|
||||
title: Messages.importButtonTitle
|
||||
@ -337,6 +338,7 @@ define([
|
||||
onLocal();
|
||||
}));
|
||||
$rightside.append($import);
|
||||
}
|
||||
|
||||
/* add a rename button */
|
||||
var $setTitle = $('<button>', {
|
||||
@ -410,7 +412,7 @@ define([
|
||||
.addClass('rightside-button')
|
||||
.click(function () {
|
||||
var baseUrl = window.location.origin + window.location.pathname + '#';
|
||||
var content = '<b>' + Messages.readonlyUrl + '</b><br><a target="_blank">' + baseUrl + viewHash + '</a><br>';
|
||||
var content = '<b>' + Messages.readonlyUrl + '</b><br><a>' + baseUrl + viewHash + '</a><br>';
|
||||
Cryptpad.alert(content);
|
||||
});
|
||||
$rightside.append($links);
|
||||
@ -470,9 +472,14 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
if (!readOnly) {
|
||||
configureLanguage(function () {
|
||||
configureTheme();
|
||||
});
|
||||
}
|
||||
else {
|
||||
configureTheme();
|
||||
}
|
||||
|
||||
// set the hash
|
||||
if (!readOnly) {
|
||||
|
||||
@ -86,6 +86,11 @@ define([
|
||||
|
||||
editor.on('instanceReady', function (Ckeditor) {
|
||||
|
||||
if (readOnly) {
|
||||
$('#pad-iframe')[0].contentWindow.$('#cke_1_toolbox > .cke_toolbar').hide();
|
||||
}
|
||||
|
||||
|
||||
/* add a class to the magicline plugin so we can pick it out more easily */
|
||||
|
||||
var ml = $('iframe')[0].contentWindow.CKEDITOR.instances.editor1.plugins.magicline
|
||||
@ -397,8 +402,7 @@ define([
|
||||
// build a dom from HJSON, diff, and patch the editor
|
||||
applyHjson(shjson);
|
||||
|
||||
if (readOnly) { return; }
|
||||
|
||||
if (!readOnly) {
|
||||
var shjson2 = stringifyDOM(inner);
|
||||
if (shjson2 !== shjson) {
|
||||
console.error("shjson2 !== shjson");
|
||||
@ -427,6 +431,7 @@ define([
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
notify();
|
||||
};
|
||||
|
||||
@ -505,7 +510,9 @@ define([
|
||||
.text(Messages.exportButton)
|
||||
.addClass('rightside-button')
|
||||
.click(exportFile);
|
||||
$rightside.append($export);
|
||||
|
||||
if (!readOnly) {
|
||||
/* add an import button */
|
||||
var $import = $('<button>', {
|
||||
title: Messages.importButtonTitle
|
||||
@ -517,7 +524,8 @@ define([
|
||||
applyHjson(shjson);
|
||||
realtimeOptions.onLocal();
|
||||
}));
|
||||
$rightside.append($export).append($import);
|
||||
$rightside.append($import);
|
||||
}
|
||||
|
||||
/* add a rename button */
|
||||
var $rename = $('<button>', {
|
||||
@ -578,7 +586,7 @@ define([
|
||||
.addClass('rightside-button')
|
||||
.click(function () {
|
||||
var baseUrl = window.location.origin + window.location.pathname + '#';
|
||||
var content = '<b>' + Messages.readonlyUrl + '</b><br><a target="_blank">' + baseUrl + viewHash + '</a><br>';
|
||||
var content = '<b>' + Messages.readonlyUrl + '</b><br><a>' + baseUrl + viewHash + '</a><br>';
|
||||
Cryptpad.alert(content);
|
||||
});
|
||||
$rightside.append($links);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user