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);
|
.click(exportText);
|
||||||
$rightside.append($export);
|
$rightside.append($export);
|
||||||
|
|
||||||
|
if (!readOnly) {
|
||||||
/* add an import button */
|
/* add an import button */
|
||||||
var $import = $('<button>',{
|
var $import = $('<button>',{
|
||||||
title: Messages.importButtonTitle
|
title: Messages.importButtonTitle
|
||||||
@ -337,6 +338,7 @@ define([
|
|||||||
onLocal();
|
onLocal();
|
||||||
}));
|
}));
|
||||||
$rightside.append($import);
|
$rightside.append($import);
|
||||||
|
}
|
||||||
|
|
||||||
/* add a rename button */
|
/* add a rename button */
|
||||||
var $setTitle = $('<button>', {
|
var $setTitle = $('<button>', {
|
||||||
@ -410,7 +412,7 @@ define([
|
|||||||
.addClass('rightside-button')
|
.addClass('rightside-button')
|
||||||
.click(function () {
|
.click(function () {
|
||||||
var baseUrl = window.location.origin + window.location.pathname + '#';
|
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);
|
Cryptpad.alert(content);
|
||||||
});
|
});
|
||||||
$rightside.append($links);
|
$rightside.append($links);
|
||||||
@ -470,9 +472,14 @@ define([
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!readOnly) {
|
||||||
configureLanguage(function () {
|
configureLanguage(function () {
|
||||||
configureTheme();
|
configureTheme();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
configureTheme();
|
||||||
|
}
|
||||||
|
|
||||||
// set the hash
|
// set the hash
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
|
|||||||
@ -86,6 +86,11 @@ define([
|
|||||||
|
|
||||||
editor.on('instanceReady', function (Ckeditor) {
|
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 */
|
/* 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
|
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
|
// build a dom from HJSON, diff, and patch the editor
|
||||||
applyHjson(shjson);
|
applyHjson(shjson);
|
||||||
|
|
||||||
if (readOnly) { return; }
|
if (!readOnly) {
|
||||||
|
|
||||||
var shjson2 = stringifyDOM(inner);
|
var shjson2 = stringifyDOM(inner);
|
||||||
if (shjson2 !== shjson) {
|
if (shjson2 !== shjson) {
|
||||||
console.error("shjson2 !== shjson");
|
console.error("shjson2 !== shjson");
|
||||||
@ -427,6 +431,7 @@ define([
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
notify();
|
notify();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -505,7 +510,9 @@ define([
|
|||||||
.text(Messages.exportButton)
|
.text(Messages.exportButton)
|
||||||
.addClass('rightside-button')
|
.addClass('rightside-button')
|
||||||
.click(exportFile);
|
.click(exportFile);
|
||||||
|
$rightside.append($export);
|
||||||
|
|
||||||
|
if (!readOnly) {
|
||||||
/* add an import button */
|
/* add an import button */
|
||||||
var $import = $('<button>', {
|
var $import = $('<button>', {
|
||||||
title: Messages.importButtonTitle
|
title: Messages.importButtonTitle
|
||||||
@ -517,7 +524,8 @@ define([
|
|||||||
applyHjson(shjson);
|
applyHjson(shjson);
|
||||||
realtimeOptions.onLocal();
|
realtimeOptions.onLocal();
|
||||||
}));
|
}));
|
||||||
$rightside.append($export).append($import);
|
$rightside.append($import);
|
||||||
|
}
|
||||||
|
|
||||||
/* add a rename button */
|
/* add a rename button */
|
||||||
var $rename = $('<button>', {
|
var $rename = $('<button>', {
|
||||||
@ -578,7 +586,7 @@ define([
|
|||||||
.addClass('rightside-button')
|
.addClass('rightside-button')
|
||||||
.click(function () {
|
.click(function () {
|
||||||
var baseUrl = window.location.origin + window.location.pathname + '#';
|
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);
|
Cryptpad.alert(content);
|
||||||
});
|
});
|
||||||
$rightside.append($links);
|
$rightside.append($links);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user