diff --git a/src/components/settings_modal/admin_tabs/emoji_tab.js b/src/components/settings_modal/admin_tabs/emoji_tab.js index ed7ed79735..940f0c6cf8 100644 --- a/src/components/settings_modal/admin_tabs/emoji_tab.js +++ b/src/components/settings_modal/admin_tabs/emoji_tab.js @@ -58,6 +58,11 @@ const EmojiTab = { } return result + }, + newEmojiUploadPreview () { + if (this.newEmojiUpload.upload.length > 0) { + return URL.createObjectURL(this.newEmojiUpload.upload[0]) + } } }, @@ -135,7 +140,11 @@ const EmojiTab = { }, metaEdited (prop) { - return this.pack && this.packMeta[prop] !== this.pack.pack[prop] + if (!this.pack) return + + const def = this.pack.pack[prop] || '' + const edited = this.packMeta[prop] || '' + return edited !== def }, savePackMetadata () { this.$store.state.api.backendInteractor.saveEmojiPackMetadata({ name: this.packName, newData: this.packMeta }).then( @@ -153,6 +162,11 @@ const EmojiTab = { }) }, + revertEmoji (shortcode) { + // Delete current changes and overwrite them with defaults. If the window is closed, they'll get cleared anyway + delete this.editedParts[this.packName][shortcode] + this.editEmoji(shortcode) + }, editEmoji (shortcode) { if (this.editedParts[this.packName] === undefined) { this.editedParts[this.packName] = {} } @@ -179,14 +193,22 @@ const EmojiTab = { this.sortPackFiles(this.packName) }) }, - saveEditedEmoji (shortcode) { + closedEditedEmoji (shortcode) { const edited = this.editedParts[this.packName][shortcode] if (edited.shortcode === shortcode && edited.file === this.pack.files[shortcode]) { delete this.editedParts[this.packName][shortcode] - return + + return true } + return false + }, + saveEditedEmoji (shortcode) { + if (this.closedEditedEmoji(shortcode)) return + + const edited = this.editedParts[this.packName][shortcode] + this.$store.state.api.backendInteractor.updateEmojiFile( { packName: this.packName, shortcode, newShortcode: edited.shortcode, newFilename: edited.file, force: false } ).then(resp => { diff --git a/src/components/settings_modal/admin_tabs/emoji_tab.scss b/src/components/settings_modal/admin_tabs/emoji_tab.scss index 52b9e2bbcf..71f46cc260 100644 --- a/src/components/settings_modal/admin_tabs/emoji_tab.scss +++ b/src/components/settings_modal/admin_tabs/emoji_tab.scss @@ -1,7 +1,7 @@ @import "src/variables"; .emoji-tab { - .btn-group .btn { + .btn-group .btn:not(:first-child) { margin-left: 0.5em; } @@ -35,21 +35,34 @@ } } +.emoji-tab-popover-button:not(:first-child) { + margin-left: 0.5em; +} + .emoji-tab-edit-popover { padding-left: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; -} -.emoji-tab-popover-button { - margin-left: 0.5em; + .emoji { + width: 32px; + height: 32px; + } } .emoji-tab-popover-input { - width: 20em; margin-bottom: 0.5em; - &:not(:first-child) { - margin-left: 0.5em; + label { + display: block; + margin-bottom: 0.5em; + } + + input { + width: 20em; + } + + .emoji-tab-popover-file { + padding-top: 3px; } } diff --git a/src/components/settings_modal/admin_tabs/emoji_tab.vue b/src/components/settings_modal/admin_tabs/emoji_tab.vue index 818e5973f4..729496a28d 100644 --- a/src/components/settings_modal/admin_tabs/emoji_tab.vue +++ b/src/components/settings_modal/admin_tabs/emoji_tab.vue @@ -7,6 +7,8 @@

{{ $t('admin_dash.tabs.emoji') }}

@@ -91,7 +103,7 @@
  • {{ $t('admin_dash.emoji.description') }} - +