-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathbullet-list.ts
26 lines (22 loc) · 930 Bytes
/
bullet-list.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 { BulletListOptions as TiptapBulletListOptions } from '@tiptap/extension-bullet-list'
import { BulletList as TiptapBulletList } from '@tiptap/extension-bullet-list'
import ActionButton from './components/ActionButton.vue'
export interface BulletListOptions extends TiptapBulletListOptions, GeneralOptions<BulletListOptions> {}
export const BulletList = /* @__PURE__*/ TiptapBulletList.extend<BulletListOptions>({
addOptions() {
return {
...this.parent?.(),
button: ({ editor, t }) => ({
component: ActionButton,
componentProps: {
action: () => editor.chain().focus().toggleBulletList().run(),
isActive: () => editor.isActive('bulletList') || false,
disabled: !editor.can().toggleBulletList(),
icon: 'bulletList',
tooltip: t('editor.bulletlist.tooltip')
}
})
}
}
})