1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Remove d3 from keyboard.js

This commit is contained in:
Nick O'Leary 2022-08-05 21:19:45 +01:00
parent 30ea300f65
commit c24d7fafa9
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -267,7 +267,7 @@ RED.keyboard = (function() {
return resolveKeyEvent(evt); return resolveKeyEvent(evt);
} }
if (Object.keys(handler).length > 0) { if (Object.keys(handler).length > 0) {
// check if there's a potential combined handler initiated by this keyCode // check if there's a potential combined handler initiated by this keyCode
for (let h in handler) { for (let h in handler) {
if (matchHandlerToEvent(evt,handler[h]) > -1) { if (matchHandlerToEvent(evt,handler[h]) > -1) {
partialState = handler; partialState = handler;
@ -298,21 +298,21 @@ RED.keyboard = (function() {
return resolveKeyEvent(evt); return resolveKeyEvent(evt);
} }
} }
d3.select(window).on("keydown",function() { document.addEventListener("keydown", function(event) {
if (!handlersActive) { if (!handlersActive) {
return; return;
} }
if (metaKeyCodes[d3.event.keyCode]) { if (metaKeyCodes[event.keyCode]) {
return; return;
} }
var handler = resolveKeyEvent(d3.event); var handler = resolveKeyEvent(event);
if (handler && handler.ondown) { if (handler && handler.ondown) {
if (typeof handler.ondown === "string") { if (typeof handler.ondown === "string") {
RED.actions.invoke(handler.ondown); RED.actions.invoke(handler.ondown);
} else { } else {
handler.ondown(); handler.ondown();
} }
d3.event.preventDefault(); event.preventDefault();
} }
}); });