Only remove inbox entry after share has been triggered

This commit is contained in:
Andreas Nedbal 2023-10-18 20:04:14 +02:00
parent 8b86e2f123
commit bc45bda517
1 changed files with 5 additions and 1 deletions

View File

@ -23,7 +23,7 @@ export default class extends Controller {
this.twitterTarget.addEventListener('click', () => this.close()); this.twitterTarget.addEventListener('click', () => this.close());
this.tumblrTarget.addEventListener('click', () => this.close()); this.tumblrTarget.addEventListener('click', () => this.close());
this.telegramTarget.addEventListener('click', () => this.close()); this.telegramTarget.addEventListener('click', () => this.close());
this.otherTarget.addEventListener('click', () => this.close()); this.otherTarget.addEventListener('click', () => this.closeAfterShare());
if (this.hasCustomTarget) { if (this.hasCustomTarget) {
this.customTarget.addEventListener('click', () => this.close()); this.customTarget.addEventListener('click', () => this.close());
@ -50,4 +50,8 @@ export default class extends Controller {
close(): void { close(): void {
(this.element.closest(".inbox-entry")).remove(); (this.element.closest(".inbox-entry")).remove();
} }
closeAfterShare(): void {
this.otherTarget.addEventListener('retrospring:shared', () => this.close());
}
} }