diff --git a/blocks/ExternalSource/ExternalSource.js b/blocks/ExternalSource/ExternalSource.js index 70ca3e188..7610e0bee 100644 --- a/blocks/ExternalSource/ExternalSource.js +++ b/blocks/ExternalSource/ExternalSource.js @@ -43,6 +43,7 @@ export class ExternalSource extends UploaderBlock { activityCaption: '', selectedList: [], counter: 0, + multiple: false, onDone: () => { for (const message of this.$.selectedList) { const url = this.extractUrlFromMessage(message); @@ -87,6 +88,9 @@ export class ExternalSource extends UploaderBlock { this.sub('selectedList', (list) => { this.$.counter = list.length; }); + this.subConfigValue('multiple', (multiple) => { + this.$.multiple = multiple; + }); } /** @@ -122,7 +126,15 @@ export class ExternalSource extends UploaderBlock { * @param {SelectedFileMessage} message */ async handleFileSelected(message) { + if (!this.$.multiple && this.$.selectedList.length) { + return; + } + this.$.selectedList = [...this.$.selectedList, message]; + + if (!this.$.multiple) { + this.$.onDone(); + } } /** @private */ @@ -235,7 +247,7 @@ ExternalSource.template = /* HTML */ `
-
{{counter}}
+
{{counter}}