From 75e6b308883974020dcea396f0a249ea0ccdc9e0 Mon Sep 17 00:00:00 2001 From: Martti Malmi Date: Sat, 16 May 2020 07:50:56 +0300 Subject: [PATCH] add close attachments button & esc --- src/css/style.css | 5 +++++ src/js/app.js | 43 +++++++++++++++++++++++++++++++------------ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/css/style.css b/src/css/style.css index 98e9c13e..333be7d9 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -391,6 +391,11 @@ header #back-button { max-height: 60vh; } +#attachment-preview button { + display: block; + margin-bottom: 10px; +} + #message-list { display: flex; max-width: 700px; diff --git a/src/js/app.js b/src/js/app.js index eaea50da..edc83e3b 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -327,27 +327,47 @@ if (!iris.util.isMobile) { }); } +$(document).keyup(function(e) { + if (e.key === "Escape") { // escape key maps to keycode `27` + closeAttachmentsPreview(); + } +}); + +function openAttachmentsPreview() { + var attachmentsPreview = $('#attachment-preview'); + attachmentsPreview.empty(); + var closeBtn = $('