fix(publishWidget): add max height (#136)

This commit is contained in:
Chris 2022-11-27 01:20:30 +08:00 committed by GitHub
parent d4300d8d83
commit ad8b878120
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,9 +16,10 @@ const {
expanded?: boolean
}>()
let isExpanded = $ref(_expanded)
let isSending = $ref(false)
let { draft } = $(useDraft(draftKey, inReplyToId))
const isExistDraft = $computed(() => !!draft.params.status && draft.params.status !== '<p></p>')
let isExpanded = $ref(isExistDraft || _expanded)
const { editor } = useTiptap({
content: computed({
@ -180,7 +181,7 @@ onUnmounted(() => {
<div relative>
<EditorContent
:editor="editor"
:class="isExpanded ? 'min-h-120px' : ''"
:class="isExpanded ? 'min-h-120px max-h-720px of-y-auto' : ''"
/>
<div v-if="isExpanded" absolute right-0 bottom-0 pointer-events-none text-sm op25>
{{ characterLimit - editor?.storage.characterCount.characters() }}
@ -254,7 +255,7 @@ onUnmounted(() => {
</CommonDropdown>
<button
btn-solid rounded-full text-sm
:disabled="isUploading || (draft.attachments.length === 0 && !draft.params.status)"
:disabled="!isExistDraft || isUploading || (draft.attachments.length === 0 && !draft.params.status)"
@click="publish"
>
{{ !draft.editingStatus ? 'Publish!' : 'Save changes' }}