Skip to content

Commit f06c5ff

Browse files
committed
feat(vue-kit): support pass editorOptions in useNoteEditor
1 parent 414e4f3 commit f06c5ff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/vue-kit/src/composables/useNoteEditor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { onBeforeUnmount, onMounted, shallowRef } from 'vue'
2+
import type { EditorOptions } from '@tiptap/vue-3'
23
import { Editor } from '@tiptap/vue-3'
34
import type { SetupKitOptions } from '../setupKit'
45
import { setupKit } from '../setupKit'
@@ -7,15 +8,14 @@ export interface UseNoteEditorOptions {
78
kitOptions: SetupKitOptions
89
}
910

10-
export function useNoteEditor(options?: Partial<UseNoteEditorOptions>) {
11+
export function useNoteEditor(editorOptions?: Partial<EditorOptions>, kitOptions?: Partial<SetupKitOptions>) {
1112
const editor = shallowRef<Editor>()
1213

1314
onMounted(() => {
1415
editor.value = new Editor({
1516
content: 'Note editor',
16-
extensions: [
17-
options?.kitOptions ? setupKit.configure(options?.kitOptions) : setupKit,
18-
],
17+
...editorOptions,
18+
extensions: [...(editorOptions?.extensions ?? []), kitOptions ? setupKit.configure(kitOptions) : setupKit],
1919
})
2020
})
2121
onBeforeUnmount(() => {

0 commit comments

Comments
 (0)