update rich text toolbar comment button to reflect state

pull/1/head
ansuz 4 years ago
parent 2051f38f25
commit 526c17810b

@ -68,7 +68,7 @@
}; };
// Register the command. // Register the command.
editor.addCommand('comment', { var command = editor.plugins.comments.command = editor.addCommand('comment', {
exec: function(editor) { exec: function(editor) {
if (editor.readOnly) { return; } if (editor.readOnly) { return; }
editor.focus(); editor.focus();

@ -812,9 +812,13 @@ define([
}); });
$(Env.ifrWindow.document).on('selectionchange', function() { $(Env.ifrWindow.document).on('selectionchange', function() {
removeCommentBubble(Env); removeCommentBubble(Env);
var applicable = Env.editor.plugins.comments.isApplicable(); var comments = Env.editor.plugins.comments;
if (!applicable || !isEditable(Env.ifrWindow.document)) { return; } var applicable = comments.isApplicable();
if (!applicable || !isEditable(Env.ifrWindow.document)) {
return void comments.command.setState(0);
}
addCommentBubble(Env); addCommentBubble(Env);
comments.command.setState(2);
}); });
}; };

Loading…
Cancel
Save