PluginExtensions: Fixed issue in typings for the onClick link callback (#65978)

* Fixed bug with event being forced.

* Made onClick undefinable in the config as well.

* Fixed some more type issues.
This commit is contained in:
Marcus Andersson
2023-04-05 07:55:44 +02:00
committed by GitHub
parent d974e5f25a
commit 9719ee9bd3
2 changed files with 4 additions and 4 deletions

View File

@@ -108,14 +108,14 @@ function getLinkExtensionOverrides(pluginId: string, config: PluginExtensionLink
function getLinkExtensionOnClick(
config: PluginExtensionLinkConfig,
context?: object
): ((event: React.MouseEvent) => void) | undefined {
): ((event?: React.MouseEvent) => void) | undefined {
const { onClick } = config;
if (!onClick) {
return;
}
return function onClickExtensionLink(event: React.MouseEvent) {
return function onClickExtensionLink(event?: React.MouseEvent) {
try {
const result = onClick(event, getEventHelpers(context));