-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathunderline.ts
26 lines (22 loc) · 911 Bytes
/
underline.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
import type { GeneralOptions } from '@/type'
import type { UnderlineOptions as TiptapUnderlineOptions } from '@tiptap/extension-underline'
import { Underline as TiptapUnderline } from '@tiptap/extension-underline'
import ActionButton from './components/ActionButton.vue'
export interface UnderlineOptions extends TiptapUnderlineOptions, GeneralOptions<UnderlineOptions> {}
export const Underline = /* @__PURE__*/ TiptapUnderline.extend<UnderlineOptions>({
addOptions() {
return {
...this.parent?.(),
button: ({ editor, t }) => ({
component: ActionButton,
componentProps: {
action: () => editor.chain().focus().toggleUnderline().run(),
isActive: () => editor.isActive('underline') || false,
disabled: !editor.can().toggleUnderline(),
icon: 'underline',
tooltip: t('editor.underline.tooltip')
}
})
}
}
})