-
Notifications
You must be signed in to change notification settings - Fork 27
/
strike.ts
26 lines (22 loc) · 847 Bytes
/
strike.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 { StrikeOptions as TiptapStrikeOptions } from '@tiptap/extension-strike'
import { Strike as TiptapStrike } from '@tiptap/extension-strike'
import ActionButton from './components/ActionButton.vue'
import type { GeneralOptions } from '@/type'
export interface StrikeOptions extends TiptapStrikeOptions, GeneralOptions<StrikeOptions> {}
export const Strike = /* @__PURE__*/ TiptapStrike.extend<StrikeOptions>({
addOptions() {
return {
...this.parent?.(),
button: ({ editor, t }) => ({
component: ActionButton,
componentProps: {
action: () => editor.commands.toggleStrike(),
isActive: () => editor.isActive('strike') || false,
disabled: !editor.can().toggleStrike(),
icon: 'strike',
tooltip: t('editor.strike.tooltip')
}
})
}
}
})