fix(publish): empty content

pull/109/head
三咲智子 2022-11-26 02:10:17 +08:00
rodzic 2ed22678ed
commit a812ea098f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 69992F2250DFD93E
2 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -21,7 +21,10 @@ let isSending = $ref(false)
let { draft } = $(useDraft(draftKey, inReplyToId))
const { editor } = useTiptap({
content: toRef(draft.params, 'status'),
content: computed({
get: () => draft.params.status,
set: newVal => draft.params.status = newVal,
}),
placeholder,
autofocus: isExpanded,
onSubmit: publish,

Wyświetl plik

@ -86,6 +86,12 @@ export function useTiptap(options: UseTiptapOptions) {
editable: true,
})
watch(content, (value) => {
if (editor.value?.getHTML() === value)
return
editor.value?.commands.setContent(value || '', false)
})
return {
editor,
}