FIX: too many upload placeholders when uploading several files

This commit is contained in:
Régis Hanol 2016-07-06 17:58:11 +02:00
parent 3035d144c0
commit ee2780466c
3 changed files with 9 additions and 7 deletions

View File

@ -203,9 +203,8 @@ export default Ember.Component.extend({
$element.on("fileuploadsend", (e, data) => {
this._validUploads++;
// add upload placeholders (as much placeholders as valid files dropped)
const placeholder = _.times(this._validUploads, () => uploadPlaceholder).join("\n");
this.appEvents.trigger('composer:insert-text', placeholder);
// add upload placeholders
this.appEvents.trigger('composer:insert-text', uploadPlaceholder);
if (data.xhr && data.originalFiles.length === 1) {
this.set("isCancellable", true);

View File

@ -472,10 +472,14 @@ export default Ember.Component.extend({
},
_addText(sel, text) {
const $textarea = this.$('textarea.d-editor-input');
const insert = `${sel.pre}${text}`;
this.set('value', `${insert}${sel.post}`);
this._selectText(insert.length, 0);
Ember.run.scheduleOnce("afterRender", () => this.$("textarea.d-editor-input").focus());
const value = `${insert}${sel.post}`;
this.set('value', value);
$textarea.val(value);
$textarea.prop("selectionStart", insert.length);
$textarea.prop("selectionEnd", insert.length);
Ember.run.scheduleOnce("afterRender", () => $textarea.focus());
},
actions: {

View File

@ -22,7 +22,6 @@ const ComposerView = Ember.View.extend({
},
movePanels(sizePx) {
$('#main-outlet').css('padding-bottom', sizePx);
// signal the progress bar it should move!