Closed CiordasFlorentina closed 2 years ago
Hello, I can't seem to get any event from commands to fire. I tried adding them to events object and they never get called.
public options: any = { toolbarButtons: { moreText: { buttons: ['bold', 'italic', 'underline', 'textColor', 'clearFormatting'] }, moreParagraph: { buttons: ['paragraphFormat', 'formatOLSimple', 'formatUL'] }, moreRich: { buttons: ['insertLink', 'insertTable'] }, moreMisc: { buttons: ['undo', 'redo', 'print', 'getPDF'] } }, events: { 'commands.textColor': (cmd, param1, param2) => { console.log(cmd, param1, param2); }, textColor: (cmd, param1, param2) => { console.log(cmd, param1, param2); } } };
I also tried to set them like this and still nothing: this.editor.events.on('commands.bold', function(event:any) { console.log('bold triggered'); });
Could somebody tell me where I'm doing things wrong? Thank you. (I'm using version 4.0.10)
Sorry, my mistake. If anyone is struggling with the same thing, it should be used like this: events: { 'commands.before': function(cmd,p1,p2) { if(cmd === "textColor"){ //event code } } }
Hello, I can't seem to get any event from commands to fire. I tried adding them to events object and they never get called.
public options: any = { toolbarButtons: { moreText: { buttons: ['bold', 'italic', 'underline', 'textColor', 'clearFormatting'] }, moreParagraph: { buttons: ['paragraphFormat', 'formatOLSimple', 'formatUL'] }, moreRich: { buttons: ['insertLink', 'insertTable'] }, moreMisc: { buttons: ['undo', 'redo', 'print', 'getPDF'] } }, events: { 'commands.textColor': (cmd, param1, param2) => { console.log(cmd, param1, param2); }, textColor: (cmd, param1, param2) => { console.log(cmd, param1, param2); } } };
I also tried to set them like this and still nothing: this.editor.events.on('commands.bold', function(event:any) { console.log('bold triggered'); });
Could somebody tell me where I'm doing things wrong? Thank you. (I'm using version 4.0.10)