From f15599e6e57477131ba5592e2874916ed1da06e2 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 18 Jun 2021 02:04:01 +0300 Subject: gallery in post status form! --- src/components/attachment/attachment.js | 30 +++- src/components/attachment/attachment.vue | 279 +++++++++++++++++-------------- 2 files changed, 177 insertions(+), 132 deletions(-) (limited to 'src/components/attachment') diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index 3ea96a7a..a80c5c2e 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -13,7 +13,9 @@ import { faPlayCircle, faTimes, faStop, - faSearchPlus + faSearchPlus, + faTrashAlt, + faPencilAlt } from '@fortawesome/free-solid-svg-icons' library.add( @@ -24,19 +26,25 @@ library.add( faPlayCircle, faTimes, faStop, - faSearchPlus + faSearchPlus, + faTrashAlt, + faPencilAlt ) const Attachment = { props: [ 'attachment', + 'description', + 'hideDescription', 'nsfw', 'size', 'setMedia', - 'naturalSizeLoad' + 'remove', + 'edit' ], data () { return { + localDescription: this.description || this.attachment.description, nsfwImage: this.$store.state.instance.nsfwCensorImage || nsfwImage, hideNsfwLocal: this.$store.getters.mergedConfig.hideNsfw, preloadImage: this.$store.getters.mergedConfig.preloadImage, @@ -93,9 +101,6 @@ const Attachment = { isEmpty () { return (this.type === 'html' && !this.attachment.oembed) || this.type === 'unknown' }, - isSmall () { - return this.size === 'small' - }, useModal () { const modalTypes = this.size === 'hide' ? ['image', 'video', 'audio'] : this.mergedConfig.playVideosInModal @@ -105,6 +110,11 @@ const Attachment = { }, ...mapGetters(['mergedConfig']) }, + watch: { + localDescription (newVal) { + this.onEdit(newVal) + } + }, methods: { linkClicked ({ target }) { if (target.tagName === 'A') { @@ -121,6 +131,12 @@ const Attachment = { this.$emit('setMedia') this.$store.dispatch('setCurrentMedia', this.attachment) }, + onEdit (event) { + console.log('ONEDIT', event) + this.edit && this.edit(this.attachment, event) + }, + onRemove () { + this.remove && this.remove(this.attachment) }, stopFlash () { this.$refs.flash.closePlayer() @@ -154,7 +170,7 @@ const Attachment = { onImageLoad (image) { const width = image.naturalWidth const height = image.naturalHeight - this.naturalSizeLoad && this.naturalSizeLoad({ width, height }) + this.$emit('naturalSizeLoad', { id: this.attachment.id, width, height }) } } } diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index fe9e9398..9b1e83a7 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -12,151 +12,180 @@ :href="attachment.url" :alt="attachment.description" :title="attachment.description" + @click.prevent="" > {{ nsfw ? "NSFW / " : "" }}{{ placeholderName }}
- - - -
- - - -
- - - - + :title="attachment.description" + @click.prevent.stop="toggleHidden" + > + + + +
+ + + + +
- - - - + + + - - + + + + + + + -
- -
- +
- - + +

+ {{ localDescription }} +

+
-- cgit v1.2.3-70-g09d2