Fix comments panel not hidden when all the comments are removed

pull/1/head
yflory 5 years ago
parent 5031ed79f4
commit 9c68714018

@ -8,6 +8,10 @@
overflow-y: auto;
color: @cryptpad_text_col;
&:empty {
display: none !important;
}
&.cp-comments-readonly {
.cp-comment-actions {
display: none !important;
@ -61,10 +65,6 @@
}
}
#cp-comments-label {
display: none;
}
.cp-comment-container {
outline: none;
&:not(:focus) {

@ -307,10 +307,6 @@ define([
// "show" tells us if we need to display the "comments" column or not
var show = false;
// Add invisible label for accessibility tools
var label = h('label#cp-comments-label', Messages.comments_comment);
Env.$container.append(label);
// If we were adding a new comment, redraw our form
if ($oldInput && !$oldInput.attr('data-uid')) {
show = true;
@ -762,7 +758,7 @@ define([
// Get all comments ID contained within the selection
var applicable = Env.editor.plugins.comments.isApplicable();
if (!applicable) {
if (!applicable || !isEditable(Env.ifrWindow.document)) {
// Abort if our selection contains a comment
UI.warn(Messages.comments_error);
return;
@ -777,7 +773,7 @@ define([
if (!val) { return; }
var applicable = Env.editor.plugins.comments.isApplicable();
if (!applicable) {
if (!applicable || !isEditable(Env.ifrWindow.document)) {
// text has been deleted by another user while we were typing our comment?
return void UI.warn(Messages.error);
}
@ -853,6 +849,12 @@ define([
var Env = cfg;
Env.comments = Util.clone(COMMENTS);
// Add invisible label for accessibility tools
var label = h('label#cp-comments-label', {
style: "display:none;"
}, Messages.comments_comment);
Env.$container.before(label);
var ro = cfg.framework.isReadOnly();
var onEditableChange = function(unlocked) {
Env.$container.removeClass('cp-comments-readonly');

Loading…
Cancel
Save