diff --git a/www/pad/comment.js b/www/pad/comment.js index 412a762be..b79be44f1 100644 --- a/www/pad/comment.js +++ b/www/pad/comment.js @@ -170,4 +170,4 @@ } }); -})(); \ No newline at end of file +})(); diff --git a/www/pad/comments.js b/www/pad/comments.js index a2154c69c..482591ca2 100644 --- a/www/pad/comments.js +++ b/www/pad/comments.js @@ -723,7 +723,8 @@ define([ node: node, button: button }; - $(button).click(function () { + $(button).click(function (e) { + e.stopPropagation(); Env.editor.execCommand('comment'); Env.bubble = undefined; }); @@ -745,6 +746,8 @@ define([ return; } + // Remove active class on other comments + Env.$container.find('.cp-comment-active').removeClass('cp-comment-active'); Env.$container.find('.cp-comment-form').remove(); var form = getCommentForm(Env, false, function (val) { $(form).remove(); @@ -835,6 +838,9 @@ define([ if ($(e.target).closest('.cp-comment-container').length) { return; } + // Add comment button? don't remove anything because this handler is called after + // the button action + if (e.target.classList.contains('cke_button__comment_icon')) { return; } Env.$container.find('.cp-comment-active').removeClass('cp-comment-active'); Env.$inner.find('comment.active').removeClass('active'); Env.$container.find('.cp-comment-form').remove();