FIX: don't use the filename for the upload placeholder
This commit is contained in:
parent
18a8853181
commit
a6934a200e
|
@ -215,8 +215,8 @@ Discourse.Utilities = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getUploadPlaceholder: function(filename) {
|
getUploadPlaceholder: function() {
|
||||||
return "[" + I18n.t("uploading_filename", { filename: filename }) + "]() ";
|
return "[" + I18n.t("uploading") + "]() ";
|
||||||
},
|
},
|
||||||
|
|
||||||
isAnImage: function(path) {
|
isAnImage: function(path) {
|
||||||
|
|
|
@ -342,9 +342,9 @@ const ComposerView = Ember.View.extend(Ember.Evented, {
|
||||||
this.messageBus.subscribe("/uploads/composer", upload => {
|
this.messageBus.subscribe("/uploads/composer", upload => {
|
||||||
if (!cancelledByTheUser) {
|
if (!cancelledByTheUser) {
|
||||||
if (upload && upload.url) {
|
if (upload && upload.url) {
|
||||||
const regex = new RegExp(`\\[${I18n.t("uploading")}.+?\\]\\(\\)`),
|
const old = Discourse.Utilities.getUploadPlaceholder(),
|
||||||
markdown = Discourse.Utilities.getUploadMarkdown(upload);
|
markdown = Discourse.Utilities.getUploadMarkdown(upload);
|
||||||
this.replaceMarkdown(regex, markdown);
|
this.replaceMarkdown(old, markdown);
|
||||||
} else {
|
} else {
|
||||||
Discourse.Utilities.displayErrorForUpload(upload);
|
Discourse.Utilities.displayErrorForUpload(upload);
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ const ComposerView = Ember.View.extend(Ember.Evented, {
|
||||||
// deal with cancellation
|
// deal with cancellation
|
||||||
cancelledByTheUser = false;
|
cancelledByTheUser = false;
|
||||||
// add upload placeholder
|
// add upload placeholder
|
||||||
const markdown = Discourse.Utilities.getUploadPlaceholder(data.files[0].name);
|
const markdown = Discourse.Utilities.getUploadPlaceholder();
|
||||||
this.addMarkdown(markdown);
|
this.addMarkdown(markdown);
|
||||||
|
|
||||||
if (data["xhr"]) {
|
if (data["xhr"]) {
|
||||||
|
@ -527,9 +527,9 @@ const ComposerView = Ember.View.extend(Ember.Evented, {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
replaceMarkdown(regex, text) {
|
replaceMarkdown(old, text) {
|
||||||
const reply = this.get("model.reply");
|
const reply = this.get("model.reply");
|
||||||
this.set("model.reply", reply.replace(regex, text));
|
this.set("model.reply", reply.replace(old, text));
|
||||||
},
|
},
|
||||||
|
|
||||||
// Uses javascript to get the image sizes from the preview, if present
|
// Uses javascript to get the image sizes from the preview, if present
|
||||||
|
|
Loading…
Reference in New Issue