diff --git a/package-lock.json b/package-lock.json index ebd470122b8..0e9c052937d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "text", - "version": "3.6.0", + "name": "@nextcloud/text", + "version": "0.1.0-beta.3", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "text", - "version": "3.6.0", + "name": "@nextcloud/text", + "version": "0.1.0-beta.3", "license": "agpl", "dependencies": { "@nextcloud/auth": "^1.3.0", diff --git a/package.json b/package.json index c3f454bf81b..ba1be0481e0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nextcloud/text", "description": "Collaborative document editing", - "version": "0.1.0-beta.2", + "version": "0.1.0-beta.3", "authors": [ { "name": "Julius Härtl", diff --git a/package/marks/Link.js b/package/marks/Link.js index f4233cb0e83..616c676e84a 100644 --- a/package/marks/Link.js +++ b/package/marks/Link.js @@ -67,13 +67,18 @@ const Link = TipTapLink.extend({ new Plugin({ props: { key: new PluginKey('textLink'), - handleClick: (_view, _pos, event) => { - const attrs = this.editor.getAttributes('link') - const link = event.target.closest('a') - if (link && attrs.href && this.options.onClick) { - return this.options.onClick(event, attrs) + handleClick: (view, pos, event) => { + const $clicked = view.state.doc.resolve(pos) + const link = $clicked.marks().find(m => m.type.name === this.name) + if (!link) { + return false } - return false + if (!link.attrs.href) { + console.warn('Could not determine href of link.') + console.debug(link) + return false + } + return this.options.onClick?.(event, link.attrs) }, }, }),