-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathordered-list.ts
26 lines (22 loc) · 947 Bytes
/
ordered-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 { OrderedListOptions as TiptapOrderedListOptions } from '@tiptap/extension-ordered-list'
import { OrderedList as TiptapOrderedList } from '@tiptap/extension-ordered-list'
import ActionButton from './components/ActionButton.vue'
export interface OrderedListOptions extends TiptapOrderedListOptions, GeneralOptions<OrderedListOptions> {}
export const OrderedList = /* @__PURE__*/ TiptapOrderedList.extend<OrderedListOptions>({
addOptions() {
return {
...this.parent?.(),
button: ({ editor, t }) => ({
component: ActionButton,
componentProps: {
action: () => editor.chain().focus().toggleOrderedList().run(),
isActive: () => editor.isActive('orderedList') || false,
disabled: !editor.can().toggleOrderedList(),
icon: 'orderedList',
tooltip: t('editor.orderedlist.tooltip')
}
})
}
}
})