diff --git a/app/assets/javascripts/discourse/app/components/emoji-uploader.js b/app/assets/javascripts/discourse/app/components/emoji-uploader.js index 9693811c157..0be91fec745 100644 --- a/app/assets/javascripts/discourse/app/components/emoji-uploader.js +++ b/app/assets/javascripts/discourse/app/components/emoji-uploader.js @@ -1,4 +1,4 @@ -import { notEmpty, not } from "@ember/object/computed"; +import { notEmpty } from "@ember/object/computed"; import { action } from "@ember/object"; import Component from "@ember/component"; import discourseComputed from "discourse-common/utils/decorators"; @@ -11,7 +11,6 @@ export default Component.extend(UploadMixin, { uploadUrl: "/admin/customize/emojis", hasName: notEmpty("name"), hasGroup: notEmpty("group"), - addDisabled: not("hasName"), group: "default", emojiGroups: null, newEmojiGroups: null, @@ -23,6 +22,11 @@ export default Component.extend(UploadMixin, { this.set("newEmojiGroups", this.emojiGroups); }, + @discourseComputed("hasName", "uploading") + addDisabled() { + return !this.hasName || this.uploading; + }, + uploadOptions() { return { sequentialUploads: true }; }, diff --git a/app/assets/javascripts/discourse/app/mixins/upload.js b/app/assets/javascripts/discourse/app/mixins/upload.js index 85fdbc00319..b7394663a99 100644 --- a/app/assets/javascripts/discourse/app/mixins/upload.js +++ b/app/assets/javascripts/discourse/app/mixins/upload.js @@ -39,8 +39,10 @@ export default Mixin.create({ _initialize: on("didInsertElement", function() { const $upload = $(this.element); - const reset = () => + const reset = () => { this.setProperties({ uploading: false, uploadProgress: 0 }); + document.getElementsByClassName("hidden-upload-field")[0].value = ""; + }; const maxFiles = this.getWithDefault( "maxFiles", this.siteSettings.simultaneous_uploads diff --git a/app/assets/javascripts/discourse/app/templates/components/emoji-uploader.hbs b/app/assets/javascripts/discourse/app/templates/components/emoji-uploader.hbs index 7e1506383ca..6839c6cb6f3 100644 --- a/app/assets/javascripts/discourse/app/templates/components/emoji-uploader.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/emoji-uploader.hbs @@ -1,48 +1,51 @@ -{{#conditional-loading-section isLoading=uploading}} -
-
- - {{i18n "admin.emoji.name"}} - -
- {{input - name="name" - placeholderKey="admin.emoji.name" - value=(readonly name) - input=(action (mut name) value="target.value") - }} -
-
-
- - {{i18n "admin.emoji.group"}} - -
- {{combo-box - name="group" - value=group - content=newEmojiGroups - onChange=(action "createEmojiGroup") - valueProperty=null - nameProperty=null - options=(hash - allowAny=true - ) - }} -
-
-
-
- -
+
+
+ + {{i18n "admin.emoji.name"}} + +
+ {{input + name="name" + placeholderKey="admin.emoji.name" + value=(readonly name) + input=(action (mut name) value="target.value") + }}
-{{/conditional-loading-section}} +
+ + {{i18n "admin.emoji.group"}} + +
+ {{combo-box + name="group" + value=group + content=newEmojiGroups + onChange=(action "createEmojiGroup") + valueProperty=null + nameProperty=null + options=(hash + allowAny=true + ) + }} +
+
+
+
+ +
+
+
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 3c85e215fbc..95830e309ae 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -4673,6 +4673,7 @@ en: title: "Emoji" help: "Add new emoji that will be available to everyone. (PROTIP: drag & drop multiple files at once)" add: "Add New Emoji" + uploading: "Uploading..." name: "Name" group: "Group" image: "Image"