forked from yikoyu/vuetify-pro-tiptap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
italic.ts
27 lines (23 loc) · 816 Bytes
/
italic.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 { ItalicOptions as TiptapItalicOptions } from '@tiptap/extension-italic'
import { Italic as TiptapItalic } from '@tiptap/extension-italic'
import ActionButton from './components/ActionButton.vue'
import type { ButtonView, GeneralOptions } from '@/type'
export interface ItalicOptions extends TiptapItalicOptions, GeneralOptions {
button: ButtonView
}
export const Italic = /* @__PURE__*/ TiptapItalic.extend<ItalicOptions>({
addOptions() {
return {
...this.parent?.(),
button: ({ editor, t }) => ({
component: ActionButton,
componentProps: {
action: () => editor.commands.toggleItalic(),
isActive: () => editor.isActive('italic') || false,
icon: 'italic',
tooltip: t('editor.italic.tooltip')
}
})
}
}
})