Add support for readonly and disconnected modes in comments

pull/1/head
yflory 5 years ago
parent 43fc0a3721
commit 5b337bef7d

@ -9,6 +9,19 @@
overflow-y: auto; overflow-y: auto;
color: @cryptpad_text_col; color: @cryptpad_text_col;
&.cp-comments-readonly {
.cp-comment-actions {
display: none !important;
}
.cp-comment-form {
display: none !important;
}
.cp-comment-edit {
display: none !important;
}
}
.buttons_main(); .buttons_main();
.cp-comment-reply { .cp-comment-reply {

@ -875,6 +875,16 @@ define([
var Env = cfg; var Env = cfg;
Env.comments = Util.clone(COMMENTS); Env.comments = Util.clone(COMMENTS);
var ro = cfg.framework.isReadOnly();
var onEditableChange = function (unlocked) {
Env.$container.removeClass('cp-comments-readonly');
if (ro || !unlocked) {
Env.$container.addClass('cp-comments-readonly');
}
};
cfg.framework.onEditableChange(onEditableChange);
onEditableChange();
addAddCommentHandler(Env); addAddCommentHandler(Env);
// Unselect comment when clicking outside // Unselect comment when clicking outside

Loading…
Cancel
Save