From 91afe588a2f9b6a2a71ed29cd2c9230ab8008619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Elgstr=C3=B6m?= Date: Thu, 4 May 2023 09:16:48 -0400 Subject: [PATCH] Added callKeyFunctions flag to enable certainfunctionality. More specifically in test.html, added the script tag window.callKeyFunctions to set the callKeyFunctions flag to true. In notie js, added an if statement to conditionally let the user use the enter/escapekey to submitt based on the value of the callKeyFunctions flag. --- dist/notie.js | 11 +++++++++-- src/notie.js | 2 +- test.html | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/dist/notie.js b/dist/notie.js index 0b1d1f4..75c3683 100644 --- a/dist/notie.js +++ b/dist/notie.js @@ -199,12 +199,19 @@ var getTransition = function getTransition() { }; var enterClicked = function enterClicked(event) { - return event.keyCode === 13; + if (callKeyFunctions) { + return event.keyCode === 13; + } + return false; }; var escapeClicked = function escapeClicked(event) { - return event.keyCode === 27; + if (callKeyFunctions) { + return event.keyCode === 27; + } + return false; }; + var addToDocument = function addToDocument(element, position) { element.classList.add(options.classes.container); element.style[position] = '-10000px'; diff --git a/src/notie.js b/src/notie.js index 03d1d27..bcb6833 100644 --- a/src/notie.js +++ b/src/notie.js @@ -668,4 +668,4 @@ export default { date, setOptions, hideAlerts -} +} \ No newline at end of file diff --git a/test.html b/test.html index 0b72a73..d243968 100644 --- a/test.html +++ b/test.html @@ -78,6 +78,7 @@ + - + \ No newline at end of file