Fix comments panel not hidden when all the comments are removed

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

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

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

Loading…
Cancel
Save