quantifai-editorjs-shortcuts
Advanced tools
Comparing version 1.1.1-mp.2.0.1 to 1.1.1-mp.2.1.0
{ | ||
"name": "quantifai-editorjs-shortcuts", | ||
"version": "1.1.1-mp.2.0.1", | ||
"version": "1.1.1-mp.2.1.0", | ||
"description": "Library for handling keyboard shortcuts", | ||
@@ -5,0 +5,0 @@ "main": "./dist/shortcuts.js", |
@@ -49,2 +49,4 @@ const keycode = require('keycode'); | ||
this.name = shortcut.name; | ||
this.previousEnteredKey = null; | ||
this.sequenceStartKey = null; | ||
@@ -67,2 +69,7 @@ this.parseShortcutName(shortcut.name); | ||
parseShortcutName(shortcut) { | ||
const sequentialShortcuts = shortcut.split(','); | ||
if (sequentialShortcuts.length === 2) { | ||
this.sequenceStartKey = sequentialShortcuts[0]; | ||
shortcut = sequentialShortcuts[1]; | ||
} | ||
shortcut = shortcut.split('+'); | ||
@@ -117,3 +124,4 @@ for (let key = 0; key < shortcut.length; key++) { | ||
let key, | ||
allKeysPassed = true; | ||
allKeysPassed = true, | ||
sequenceStartKeyPressed = true; | ||
@@ -124,3 +132,11 @@ for (key in this.keys) { | ||
if (allCommandsPassed && allKeysPassed) { | ||
if ( | ||
this.sequenceStartKey && | ||
keycode(this.sequenceStartKey) !== this.previousEnteredKey | ||
) { | ||
sequenceStartKeyPressed = false; | ||
} | ||
this.previousEnteredKey = event.keyCode; | ||
if (allCommandsPassed && allKeysPassed && sequenceStartKeyPressed) { | ||
this.callback(event); | ||
@@ -127,0 +143,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18372
239
0