fix: remove some magic strings
This commit is contained in:
@@ -82,13 +82,13 @@ export const Link = Mark.create<LinkOptions>({
|
||||
addCommands() {
|
||||
return {
|
||||
setLink: attributes => ({ commands }) => {
|
||||
return commands.setMark('link', attributes)
|
||||
return commands.setMark(this.name, attributes)
|
||||
},
|
||||
toggleLink: attributes => ({ commands }) => {
|
||||
return commands.toggleMark('link', attributes, { extendEmptyMarkRange: true })
|
||||
return commands.toggleMark(this.name, attributes, { extendEmptyMarkRange: true })
|
||||
},
|
||||
unsetLink: () => ({ commands }) => {
|
||||
return commands.unsetMark('link', { extendEmptyMarkRange: true })
|
||||
return commands.unsetMark(this.name, { extendEmptyMarkRange: true })
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -120,7 +120,7 @@ export const Link = Mark.create<LinkOptions>({
|
||||
key: new PluginKey('handleClickLink'),
|
||||
props: {
|
||||
handleClick: (view, pos, event) => {
|
||||
const attrs = this.editor.getAttributes('link')
|
||||
const attrs = this.editor.getAttributes(this.name)
|
||||
const link = (event.target as HTMLElement)?.closest('a')
|
||||
|
||||
if (link && attrs.href) {
|
||||
|
||||
Reference in New Issue
Block a user