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