aboutsummaryrefslogtreecommitdiff
path: root/src/components/post_status_form
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/post_status_form')
-rw-r--r--src/components/post_status_form/post_status_form.js17
-rw-r--r--src/components/post_status_form/post_status_form.vue68
2 files changed, 44 insertions, 41 deletions
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"
/>
<div class="form-group">
- <a
- v-if="!showPreview"
- class="preview-start"
- @click.stop.prevent="previewStatus(newStatus)"
- >
- {{ $t('status.preview') }}
- </a>
+ <div class="preview-heading faint">
+ <a
+ class="preview-toggle faint"
+ @click.stop.prevent="togglePreview"
+ >
+ {{ $t('status.preview') }}
+ <i
+ class="icon-down-open"
+ :style="{ transform: showPreview ? 'rotate(0deg)' : 'rotate(-90deg)' }"
+ />
+ </a>
+ <i
+ v-show="previewLoading"
+ class="icon-spin3 animate-spin"
+ />
+ </div>
<div
- v-else
+ v-if="showPreview"
class="preview-container"
>
- <span class="preview-heading">
- <span class="preview-title">
- {{ $t('status.status_preview') }}
- </span>
- <i
- v-if="previewLoading"
- class="icon-spin3 animate-spin"
- />
- <i
- class="preview-close icon-cancel"
- @click.stop.prevent="closePreview"
- />
- </span>
<div
v-if="!preview"
class="preview-status"
@@ -369,28 +365,30 @@
max-width: 10em;
}
- .preview-start {
- margin-left: auto;
- cursor: pointer;
- }
+ .preview-heading {
+ display: flex;
+ width: 100%;
- .preview-container {
- margin-bottom: 1em;
+ .icon-spin3 {
+ margin-left: auto;
+ }
}
- .preview-heading {
+ .preview-toggle {
display: flex;
- width: 100%;
- color: $fallback--faint;
- color: var(--faint, $fallback--faint);
+ cursor: pointer;
+
+ &:hover {
+ text-decoration: underline;
+ }
}
- .preview-title {
- flex-grow: 1;
+ .icon-down-open {
+ transition: transform 0.1s;
}
- .preview-close {
- padding-left: 0.5em;
+ .preview-container {
+ margin-bottom: 1em;
}
.preview-error {