mirror of
https://github.com/elk-zone/elk.git
synced 2024-09-06 20:29:08 +01:00
fix(publish): empty content
This commit is contained in:
parent
2ed22678ed
commit
a812ea098f
2 changed files with 10 additions and 1 deletions
|
@ -21,7 +21,10 @@ let isSending = $ref(false)
|
||||||
let { draft } = $(useDraft(draftKey, inReplyToId))
|
let { draft } = $(useDraft(draftKey, inReplyToId))
|
||||||
|
|
||||||
const { editor } = useTiptap({
|
const { editor } = useTiptap({
|
||||||
content: toRef(draft.params, 'status'),
|
content: computed({
|
||||||
|
get: () => draft.params.status,
|
||||||
|
set: newVal => draft.params.status = newVal,
|
||||||
|
}),
|
||||||
placeholder,
|
placeholder,
|
||||||
autofocus: isExpanded,
|
autofocus: isExpanded,
|
||||||
onSubmit: publish,
|
onSubmit: publish,
|
||||||
|
|
|
@ -86,6 +86,12 @@ export function useTiptap(options: UseTiptapOptions) {
|
||||||
editable: true,
|
editable: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(content, (value) => {
|
||||||
|
if (editor.value?.getHTML() === value)
|
||||||
|
return
|
||||||
|
editor.value?.commands.setContent(value || '', false)
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
editor,
|
editor,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue