diff --git a/jslib b/jslib index 5b751d38a0..4eb50d757d 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 5b751d38a00ef529e801a63547fb214c31962761 +Subproject commit 4eb50d757d03343ee842ea68a6b2c8282ef3f382 diff --git a/src/app/send/add-edit.component.ts b/src/app/send/add-edit.component.ts index 5a4bf99030..9a13d77e08 100644 --- a/src/app/send/add-edit.component.ts +++ b/src/app/send/add-edit.component.ts @@ -12,6 +12,8 @@ import { UserService } from 'jslib/abstractions/user.service'; import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/send/add-edit.component'; +import { SendType } from 'jslib/enums/sendType'; + @Component({ selector: 'app-send-add-edit', templateUrl: 'add-edit.component.html', @@ -25,6 +27,15 @@ export class AddEditComponent extends BaseAddEditComponent { messagingService, policyService); } + async showSuccessMessage(inactive: boolean) { + if (inactive && this.copyLink && this.send.type === SendType.File) { + await this.platformUtilsService.showDialog(this.i18nService.t('createdSend'), null, + this.i18nService.t('ok'), null, 'success', null); + } else { + await super.showSuccessMessage(inactive); + } + } + copyLinkToClipboard(link: string) { // Copy function on web depends on the modal being open or not. Since this event occurs during a transition // of the modal closing we need to add a small delay to make sure state of the DOM is consistent. diff --git a/src/services/webPlatformUtils.service.ts b/src/services/webPlatformUtils.service.ts index 0a443ed397..ae1dbf8a3e 100644 --- a/src/services/webPlatformUtils.service.ts +++ b/src/services/webPlatformUtils.service.ts @@ -245,7 +245,10 @@ export class WebPlatformUtilsService implements PlatformUtilsService { textarea.select(); try { // Security exception may be thrown by some browsers. - doc.execCommand('copy'); + const copyEnabled = doc.execCommand('copy'); + if (!copyEnabled) { + throw new Error('Command unsupported or disabled'); + } } catch (e) { // tslint:disable-next-line console.warn('Copy to clipboard failed.', e);