diff --git a/customize.dist/src/less2/include/comments.less b/customize.dist/src/less2/include/comments.less index 479609580..dc2ef0461 100644 --- a/customize.dist/src/less2/include/comments.less +++ b/customize.dist/src/less2/include/comments.less @@ -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) { diff --git a/www/pad/comments.js b/www/pad/comments.js index 1e6f37259..3735bf650 100644 --- a/www/pad/comments.js +++ b/www/pad/comments.js @@ -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');