Fix addComment button

pull/1/head
yflory 5 years ago
parent 49d037a085
commit 7ba88751eb

@ -723,7 +723,8 @@ define([
node: node, node: node,
button: button button: button
}; };
$(button).click(function () { $(button).click(function (e) {
e.stopPropagation();
Env.editor.execCommand('comment'); Env.editor.execCommand('comment');
Env.bubble = undefined; Env.bubble = undefined;
}); });
@ -745,6 +746,8 @@ define([
return; return;
} }
// Remove active class on other comments
Env.$container.find('.cp-comment-active').removeClass('cp-comment-active');
Env.$container.find('.cp-comment-form').remove(); Env.$container.find('.cp-comment-form').remove();
var form = getCommentForm(Env, false, function (val) { var form = getCommentForm(Env, false, function (val) {
$(form).remove(); $(form).remove();
@ -835,6 +838,9 @@ define([
if ($(e.target).closest('.cp-comment-container').length) { if ($(e.target).closest('.cp-comment-container').length) {
return; 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.$container.find('.cp-comment-active').removeClass('cp-comment-active');
Env.$inner.find('comment.active').removeClass('active'); Env.$inner.find('comment.active').removeClass('active');
Env.$container.find('.cp-comment-form').remove(); Env.$container.find('.cp-comment-form').remove();

Loading…
Cancel
Save