-
Notifications
You must be signed in to change notification settings - Fork 27
/
bold.ts
26 lines (22 loc) · 815 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
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 { GeneralOptions } from '@/type'
export interface BoldOptions extends TiptapImageOptions, GeneralOptions<BoldOptions> {}
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,
disabled: !editor.can().toggleBold(),
icon: 'bold',
tooltip: t('editor.bold.tooltip')
}
})
}
}
})