FIX: Improve emoji upload UI (#15603)

This commit adds a hover effect for drag and drop in
the admin emoji uploader. It also changes the "Add New
Emoji" button to open the file selector; previously it
was useless because it was disabled unless a name was
entered (which is not even a requirement for the emoji)
and also it didn't actually do anything on click even
if it wasn't disabled.

Now we have a way of adding files without having to drag
and drop them, which is nice.

Also in this PR, there was no indication before that the upload was
complete apart from the button becoming enabled again.
This commit adds the highlight class to the emoji list
and removes it once the highlight fade animation is done,
like we do for new posts.
This commit is contained in:
Martin Brennan
2022-01-17 11:48:49 +10:00
committed by GitHub
parent 5099c574d3
commit 35343e7f91
5 changed files with 58 additions and 21 deletions

View File

@@ -44,6 +44,19 @@ export default Controller.extend({
},
}),
_highlightEmojiList() {
const customEmojiListEl = document.querySelector("#custom_emoji");
if (
customEmojiListEl &&
!customEmojiListEl.classList.contains("highlighted")
) {
customEmojiListEl.classList.add("highlighted");
customEmojiListEl.addEventListener("animationend", () => {
customEmojiListEl.classList.remove("highlighted");
});
}
},
@action
filterGroups(value) {
this.set("filter", value);
@@ -54,6 +67,7 @@ export default Controller.extend({
emoji.url += "?t=" + new Date().getTime();
emoji.group = group;
this.model.pushObject(EmberObject.create(emoji));
this._highlightEmojiList();
},
@action