FIX: too many upload placeholders when uploading several files
This commit is contained in:
parent
3035d144c0
commit
ee2780466c
|
@ -203,9 +203,8 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
$element.on("fileuploadsend", (e, data) => {
|
$element.on("fileuploadsend", (e, data) => {
|
||||||
this._validUploads++;
|
this._validUploads++;
|
||||||
// add upload placeholders (as much placeholders as valid files dropped)
|
// add upload placeholders
|
||||||
const placeholder = _.times(this._validUploads, () => uploadPlaceholder).join("\n");
|
this.appEvents.trigger('composer:insert-text', uploadPlaceholder);
|
||||||
this.appEvents.trigger('composer:insert-text', placeholder);
|
|
||||||
|
|
||||||
if (data.xhr && data.originalFiles.length === 1) {
|
if (data.xhr && data.originalFiles.length === 1) {
|
||||||
this.set("isCancellable", true);
|
this.set("isCancellable", true);
|
||||||
|
|
|
@ -472,10 +472,14 @@ export default Ember.Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_addText(sel, text) {
|
_addText(sel, text) {
|
||||||
|
const $textarea = this.$('textarea.d-editor-input');
|
||||||
const insert = `${sel.pre}${text}`;
|
const insert = `${sel.pre}${text}`;
|
||||||
this.set('value', `${insert}${sel.post}`);
|
const value = `${insert}${sel.post}`;
|
||||||
this._selectText(insert.length, 0);
|
this.set('value', value);
|
||||||
Ember.run.scheduleOnce("afterRender", () => this.$("textarea.d-editor-input").focus());
|
$textarea.val(value);
|
||||||
|
$textarea.prop("selectionStart", insert.length);
|
||||||
|
$textarea.prop("selectionEnd", insert.length);
|
||||||
|
Ember.run.scheduleOnce("afterRender", () => $textarea.focus());
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -22,7 +22,6 @@ const ComposerView = Ember.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
movePanels(sizePx) {
|
movePanels(sizePx) {
|
||||||
|
|
||||||
$('#main-outlet').css('padding-bottom', sizePx);
|
$('#main-outlet').css('padding-bottom', sizePx);
|
||||||
|
|
||||||
// signal the progress bar it should move!
|
// signal the progress bar it should move!
|
||||||
|
|
Loading…
Reference in New Issue