Only allow left mouse button to open links (#3777)

* Only allow left mouse button to open links

* fix lint errors
This commit is contained in:
Abdullah Atta 2023-03-02 21:00:23 +05:00 committed by GitHub
parent da5c5864ed
commit dd3c7618ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,10 @@ export function clickHandler(options: ClickHandlerOptions): Plugin {
key: new PluginKey('handleClickLink'),
props: {
handleClick: (view, pos, event) => {
if (event.button !== 1) {
return false
}
const attrs = getAttributes(view.state, options.type.name)
const link = (event.target as HTMLElement)?.closest('a')