forked from yikoyu/vuetify-pro-tiptap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlink.ts
27 lines (23 loc) · 769 Bytes
/
link.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import type { LinkOptions as TiptapLinkOptions } from '@tiptap/extension-link'
import { Link as TiptapLink } from '@tiptap/extension-link'
import LinkActionButton from './components/LinkActionButton.vue'
import type { ButtonView, GeneralOptions } from '@/type'
export interface LinkOptions extends TiptapLinkOptions, GeneralOptions {
button: ButtonView
}
export const Link = /* @__PURE__*/ TiptapLink.extend<LinkOptions>({
addOptions() {
return {
...this.parent?.(),
openOnClick: true,
button: ({ editor, t }) => ({
component: LinkActionButton,
componentProps: {
isActive: () => editor.isActive('link') || false,
icon: 'link',
tooltip: t('editor.link.tooltip')
}
})
}
}
})