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

This commit is contained in:
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

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,