mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-22 21:20:57 +08:00
Also moves this component to the admin bundle. It is only used in the admin panel, and has dependencies on admin-specific i18n strings.
27 lines
753 B
JavaScript
Vendored
27 lines
753 B
JavaScript
Vendored
import Component from "@ember/component";
|
|
import { getOwner } from "@ember/owner";
|
|
import { tagName } from "@ember-decorators/component";
|
|
import UppyUpload from "discourse/lib/uppy/uppy-upload";
|
|
import I18n from "discourse-i18n";
|
|
|
|
@tagName("span")
|
|
export default class ImagesUploader extends Component {
|
|
uppyUpload = new UppyUpload(getOwner(this), {
|
|
id: "images-uploader",
|
|
type: "avatar",
|
|
validateUploadedFilesOptions: {
|
|
imagesOnly: true,
|
|
},
|
|
uploadDone: (upload) => {
|
|
this.done(upload);
|
|
},
|
|
});
|
|
|
|
get uploadingOrProcessing() {
|
|
return this.uppyUpload.uploading || this.uppyUpload.processing;
|
|
}
|
|
|
|
get uploadButtonText() {
|
|
return this.uploadingOrProcessing ? I18n.t("uploading") : I18n.t("upload");
|
|
}
|
|
}
|