-
Notifications
You must be signed in to change notification settings - Fork 31
/
blockquote.ts
29 lines (25 loc) · 976 Bytes
/
blockquote.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
28
29
import type { GeneralOptions } from '@/type'
import type { BlockquoteOptions as TiptapBlockquoteOptions } from '@tiptap/extension-blockquote'
import { Blockquote as TiptapBlockquote } from '@tiptap/extension-blockquote'
import ActionButton from './components/ActionButton.vue'
export interface BlockquoteOptions extends TiptapBlockquoteOptions, GeneralOptions<BlockquoteOptions> {}
export const Blockquote = /* @__PURE__*/ TiptapBlockquote.extend<BlockquoteOptions>({
addOptions() {
return {
...this.parent?.(),
HTMLAttributes: {
class: 'blockquote'
},
button: ({ editor, t }) => ({
component: ActionButton,
componentProps: {
action: () => editor.commands.toggleBlockquote(),
isActive: () => editor.isActive('blockquote') || false,
disabled: !editor.can().toggleBlockquote(),
icon: 'blockquote',
tooltip: t('editor.blockquote.tooltip')
}
})
}
}
})