diff options
| author | Henry Jameson <me@hjkos.com> | 2021-06-18 02:04:01 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2021-06-18 02:04:01 +0300 |
| commit | f15599e6e57477131ba5592e2874916ed1da06e2 (patch) | |
| tree | c93759edaf658cabbdc8c3974a00c4495b8e8ba7 /src/components/attachment/attachment.js | |
| parent | 90345f158ff2eb12e619dbd7406f2fa81c379637 (diff) | |
gallery in post status form!
Diffstat (limited to 'src/components/attachment/attachment.js')
| -rw-r--r-- | src/components/attachment/attachment.js | 30 |
1 files changed, 23 insertions, 7 deletions
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 }) } } } |
