【发布时间】:2022-12-23 18:01:37
【问题描述】:
我必须访问按钮的onClick event,类似于event.target。将按钮添加到工具栏时,我们有 onAction 处理程序,它不公开 onClick event 但只有 isEnabled 和 setEnabled 方法。我可以访问window.event,但已弃用。所以代码会是这样的:
editor.ui.registry.addButton('button', {
text: 'Button text',
icon: 'icon',
onAction: (api:ToolbarButtonInstanceApi) => { // Here I have access to only button
//api, but I need access to event as
//well so I can use it as event.currentTarget
},
});```
How could I access to `onClick event`?
【问题讨论】:
标签: events onclick tinymce toolbar