fix: remove some magic strings

This commit is contained in:
Philipp Kühn
2021-12-02 14:56:57 +01:00
parent dedcf17d53
commit 6c34dec33a
25 changed files with 61 additions and 60 deletions

View File

@@ -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) {