From 34475fcfc93b2551a406693c947864107fa92d48 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sun, 24 Jan 2016 16:13:59 +0100 Subject: [PATCH] SpeedDial: Fix Esc key to close edit popups --- src/lib/data/html/speeddial.html | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/lib/data/html/speeddial.html b/src/lib/data/html/speeddial.html index daf0fc91d..02e8b4eb5 100644 --- a/src/lib/data/html/speeddial.html +++ b/src/lib/data/html/speeddial.html @@ -63,6 +63,15 @@ var SD_CENTER = %SD-CENTER%; var editingId = -1; +$(document).keyup(function(e) { + if (editingId == -1) + return; + if (e.keyCode == 13) + boxEdited(); + else if (e.keyCode == 27) + $('#fadeOverlay').click(); +}); + function addSpeedDial() { onEditClick(addBox('', NEW_PAGE, '')); @@ -112,18 +121,6 @@ function onRemoveClick(box) { removeBox($(box).index()); } -function onEditKeyPress(e) { - if (e.keyCode == 13) { - boxEdited(); - return false; - } - else if (e.keyCode == 27) { - $('#fadeOverlay').click(); - return false; - } - return true; -} - function onFetchTitleClick(checkbox) { var displayStyle; checkbox.checked ? displayStyle = 'hidden' : displayStyle = 'visible'; @@ -142,7 +139,7 @@ function onEditClick(box) { boxUrl = 'http://'; $('body').append('