-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathmarkdown-theme.ts
More file actions
40 lines (35 loc) · 1.06 KB
/
markdown-theme.ts
File metadata and controls
40 lines (35 loc) · 1.06 KB
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
30
31
32
33
34
35
36
37
38
39
40
import type { MarkdownThemeProps } from '@/constants/define'
import type { GeneralOptions } from '@/type'
import { Extension } from '@tiptap/core'
import { DEFAULT_MARKDOWN_THEME_LIST } from '@/constants/define'
import { MarkdownThemeActionMenuButton } from './components/ActionMenuButton'
/**
* Represents the interface for Markdown theme options, extending GeneralOptions.
*/
export interface MarkdownThemeOptions extends GeneralOptions<MarkdownThemeOptions> {
/**
* List of available Markdown theme properties
*
* @default DEFAULT_MARKDOWN_THEME_LIST
*/
markdownThemes: MarkdownThemeProps[]
}
export const MarkdownTheme = /* @__PURE__ */ Extension.create<MarkdownThemeOptions>({
name: 'markdownTheme',
addOptions() {
return {
...this.parent?.(),
markdownThemes: DEFAULT_MARKDOWN_THEME_LIST,
button: ({ editor, extension, t }) => {
return {
component: MarkdownThemeActionMenuButton,
componentProps: {
editor,
extension,
t,
},
}
},
}
},
})