Reputation: 679
I found some information on CKEditor4 on trapping a clicked tool on the CKEditor toolbar but the v5 rewrite means this no longer works:
editor.on('afterCommandExec', handleAfterCommandExec);
function handleAfterCommandExec(event)
{
var commandName = event.data.name;
// For 'bold' commmand
if (commandName == 'bold')
alert("Bold button pressed!");
}
Are there any examples of working CKEditor 5 code to detect when a tool has been clicked? I'm actually trying to trap when someone clicks Track Changes to show the changes sidebar but hide it otherwise.
Upvotes: 0
Views: 1717
Reputation: 21
Maybe this works
const command = editor.commands.get('bold')
command.on('execute', () => {
console.log('Bold has been executed')
})
Upvotes: 2