From ea68bab135e5f789bf3e408e40d8caf861cdb2cd Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Wed, 26 May 2021 15:11:12 -0400 Subject: [PATCH] FIX: Close hyperlink modal on ESC key (#13166) --- .../javascripts/discourse/app/controllers/insert-hyperlink.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/controllers/insert-hyperlink.js b/app/assets/javascripts/discourse/app/controllers/insert-hyperlink.js index 42c3deeb323..07c13c87b38 100644 --- a/app/assets/javascripts/discourse/app/controllers/insert-hyperlink.js +++ b/app/assets/javascripts/discourse/app/controllers/insert-hyperlink.js @@ -22,7 +22,6 @@ export default Controller.extend(ModalFunctionality, { schedule("afterRender", () => { const element = document.querySelector(".insert-link"); - element.addEventListener("keydown", this.keyDown); element @@ -57,6 +56,8 @@ export default Controller.extend(ModalFunctionality, { this.set("searchResults", []); event.preventDefault(); event.stopPropagation(); + } else { + this.send("closeModal"); } break; }