fix(tiptap): update placeholder in case of language change (#896)

zio/stable
Michel EDIGHOFFER 2023-01-09 10:34:26 +01:00 committed by GitHub
parent 886e2d6b73
commit 68d0d48199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -58,7 +58,7 @@ export function useTiptap(options: UseTiptapOptions) {
suggestion: HashtagSuggestion, suggestion: HashtagSuggestion,
}), }),
Placeholder.configure({ Placeholder.configure({
placeholder: placeholder.value, placeholder: () => placeholder.value!,
}), }),
CodeBlockShiki, CodeBlockShiki,
Extension.create({ Extension.create({
@ -106,6 +106,9 @@ export function useTiptap(options: UseTiptapOptions) {
return return
editor.value?.commands.setContent(value || '', false) editor.value?.commands.setContent(value || '', false)
}) })
watch(placeholder, () => {
editor.value?.view.dispatch(editor.value?.state.tr)
})
return { return {
editor, editor,