-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathhorizontal-rule.ts
25 lines (21 loc) · 922 Bytes
/
horizontal-rule.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
import type { GeneralOptions } from '@/type'
import type { HorizontalRuleOptions as TiptapHorizontalRuleOptions } from '@tiptap/extension-horizontal-rule'
import { HorizontalRule as TiptapHorizontalRule } from '@tiptap/extension-horizontal-rule'
import ActionButton from './components/ActionButton.vue'
export interface HorizontalRuleOptions extends TiptapHorizontalRuleOptions, GeneralOptions<HorizontalRuleOptions> {}
export const HorizontalRule = /* @__PURE__*/ TiptapHorizontalRule.extend<HorizontalRuleOptions>({
addOptions() {
return {
...this.parent?.(),
button: ({ editor, t }) => ({
component: ActionButton,
componentProps: {
action: () => editor.chain().focus().setHorizontalRule().run(),
disabled: !editor.can().setHorizontalRule(),
icon: 'horizontalRule',
tooltip: t('editor.horizontalrule.tooltip')
}
})
}
}
})