diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index bb5dbf97..732691e7 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -235,13 +235,13 @@ const PostStatusForm = { this.posting = false }) }, - previewStatus (newStatus) { + previewStatus () { if (this.emptyStatus) { this.preview = { error: this.$t('status.preview_empty') } this.previewLoading = false return } - + const newStatus = this.newStatus this.previewLoading = true statusPoster.postStatus({ status: newStatus.status, @@ -269,18 +269,23 @@ const PostStatusForm = { this.previewLoading = false }) }, - debouncePreviewStatus: debounce(function (newStatus) { - this.previewStatus(newStatus) - }, 750), + debouncePreviewStatus: debounce(function () { this.previewStatus() }, 750), autoPreview () { if (!this.preview) return this.previewLoading = true - this.debouncePreviewStatus(this.newStatus) + this.debouncePreviewStatus() }, closePreview () { this.preview = null this.previewLoading = false }, + togglePreview () { + if (this.showPreview) { + this.closePreview() + } else { + this.previewStatus() + } + }, addMediaFile (fileInfo) { this.newStatus.files.push(fileInfo) }, diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 8201911e..0cebd36e 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -16,30 +16,26 @@ @drop.stop="fileDrop" />