diff --git a/www/pad/comment.js b/www/pad/comment.js index 9b95dba1a..a44431b47 100644 --- a/www/pad/comment.js +++ b/www/pad/comment.js @@ -68,7 +68,7 @@ }; // Register the command. - editor.addCommand('comment', { + var command = editor.plugins.comments.command = editor.addCommand('comment', { exec: function(editor) { if (editor.readOnly) { return; } editor.focus(); diff --git a/www/pad/comments.js b/www/pad/comments.js index 3735bf650..2fbd7711a 100644 --- a/www/pad/comments.js +++ b/www/pad/comments.js @@ -812,9 +812,13 @@ define([ }); $(Env.ifrWindow.document).on('selectionchange', function() { removeCommentBubble(Env); - var applicable = Env.editor.plugins.comments.isApplicable(); - if (!applicable || !isEditable(Env.ifrWindow.document)) { return; } + var comments = Env.editor.plugins.comments; + var applicable = comments.isApplicable(); + if (!applicable || !isEditable(Env.ifrWindow.document)) { + return void comments.command.setState(0); + } addCommentBubble(Env); + comments.command.setState(2); }); };