tiptapify
Version:
Tiptap3 editor with Vuetify3 menu implementation
33 lines (27 loc) • 624 B
text/typescript
import Link from "@tiptap/extension-link";
const name: string = 'link'
declare module '@tiptap/core' {
interface Commands<ReturnType> {
link: {
showLink: () => ReturnType
}
}
}
export const TiptapifyLink = Link.extend({
name,
addCommands() {
return {
...this.parent?.(),
showLink: () => ({ editor }) => {
const event = new CustomEvent(`tiptapify-show-${name}`, {
detail: {
link: editor.getAttributes('link'),
editorId: editor.instanceId
}
})
window.dispatchEvent(event)
return true
},
}
},
})