update rich text toolbar comment button to reflect state

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

@ -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();

@ -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);
});
};

Loading…
Cancel
Save