quantifai-editorjs-shortcuts
Advanced tools
Comparing version 1.1.1-mp.2.1.0 to 1.1.1-mp.2.1.1
@@ -6,8 +6,8 @@ /*! | ||
* @author CodeX (https://codex.so) | ||
* @version 1.1.1-mp.2 | ||
* @version 1.1.1-mp.2.1.0 | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Shortcut=t():e.Shortcut=t()}(window,function(){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}n.r(t);var u=n(1),a=function(){function a(e){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),this.commands={},this.keys={},this.name=e.name,this.parseShortcutName(e.name),this.element=e.on,this.callback=e.callback,this.executeShortcut=function(e){t.execute(e)},this.element.addEventListener("keydown",this.executeShortcut,!1)}return o(a,null,[{key:"supportedCommands",get:function(){return{SHIFT:["SHIFT"],CMD:["CMD","CONTROL","COMMAND","WINDOWS","CTRL"],ALT:["ALT","OPTION"]}}}]),o(a,[{key:"parseShortcutName",value:function(e){e=e.split("+");for(var t=0;t<e.length;t++){e[t]=e[t].toUpperCase();var n=!1;for(var r in a.supportedCommands)if(a.supportedCommands[r].includes(e[t])){n=this.commands[r]=!0;break}n||(this.keys[e[t]]=!0)}for(var o in a.supportedCommands)this.commands[o]||(this.commands[o]=!1)}},{key:"execute",value:function(e){var t,n={CMD:e.ctrlKey||e.metaKey,SHIFT:e.shiftKey,ALT:e.altKey},r=!0;for(t in this.commands)this.commands[t]!==n[t]&&(r=!1);var o,a=!0;for(o in this.keys)a=a&&e.keyCode===u(o);r&&a&&this.callback(e)}},{key:"remove",value:function(){this.element.removeEventListener("keydown",this.executeShortcut)}}]),a}();t.default=a},function(e,t){function n(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return u[e];var n,r=String(e);return(n=o[r.toLowerCase()])?n:(n=a[r.toLowerCase()])||(1===r.length?r.charCodeAt(0):void 0)}n.isEventKey=function(e,t){if(e&&"object"==typeof e){var n=e.which||e.keyCode||e.charCode;if(null==n)return!1;if("string"==typeof t){var r;if(r=o[t.toLowerCase()])return r===n;if(r=a[t.toLowerCase()])return r===n}else if("number"==typeof t)return t===n;return!1}};var o=(t=e.exports=n).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},a=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91}; | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Shortcut=t():e.Shortcut=t()}(window,function(){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}n.r(t);var u=n(1),a=function(){function i(e){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),this.commands={},this.keys={},this.name=e.name,this.previousEnteredKey=null,this.sequenceStartKey=null,this.parseShortcutName(e.name),this.element=e.on,this.callback=e.callback,this.executeShortcut=function(e){t.execute(e)},this.element.addEventListener("keydown",this.executeShortcut,!1)}return o(i,null,[{key:"supportedCommands",get:function(){return{SHIFT:["SHIFT"],CMD:["CMD","CONTROL","COMMAND","WINDOWS","CTRL"],ALT:["ALT","OPTION"]}}}]),o(i,[{key:"parseShortcutName",value:function(e){var t=e.split(",");2===t.length&&(this.sequenceStartKey=t[0],e=t[1]),e=e.split("+");for(var n=0;n<e.length;n++){e[n]=e[n].toUpperCase();var r=!1;for(var o in i.supportedCommands)if(i.supportedCommands[o].includes(e[n])){r=this.commands[o]=!0;break}r||(this.keys[e[n]]=!0)}for(var a in i.supportedCommands)this.commands[a]||(this.commands[a]=!1)}},{key:"execute",value:function(e){var t,n={CMD:e.ctrlKey||e.metaKey,SHIFT:e.shiftKey,ALT:e.altKey},r=!0;for(t in this.commands)this.commands[t]!==n[t]&&(r=!1);var o,a=!0,i=!0;for(o in this.keys)a=a&&e.keyCode===u(o);this.sequenceStartKey&&u(this.sequenceStartKey)!==this.previousEnteredKey&&(i=!1),this.previousEnteredKey=e.keyCode,r&&a&&i&&this.callback(e)}},{key:"remove",value:function(){this.element.removeEventListener("keydown",this.executeShortcut)}}]),i}();t.default=a},function(e,t){function n(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return i[e];var n,r=String(e);return(n=o[r.toLowerCase()])?n:(n=a[r.toLowerCase()])||(1===r.length?r.charCodeAt(0):void 0)}n.isEventKey=function(e,t){if(e&&"object"==typeof e){var n=e.which||e.keyCode||e.charCode;if(null==n)return!1;if("string"==typeof t){var r;if(r=o[t.toLowerCase()])return r===n;if(r=a[t.toLowerCase()])return r===n}else if("number"==typeof t)return t===n;return!1}};var o=(t=e.exports=n).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},a=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91}; | ||
/*! | ||
* Programatically add the following | ||
*/ | ||
for(r=97;r<123;r++)o[String.fromCharCode(r)]=r-32;for(var r=48;r<58;r++)o[r-48]=r;for(r=1;r<13;r++)o["f"+r]=r+111;for(r=0;r<10;r++)o["numpad "+r]=r+96;var u=t.names=t.title={};for(r in o)u[o[r]]=r;for(var i in a)o[i]=a[i]}]).default}); | ||
for(r=97;r<123;r++)o[String.fromCharCode(r)]=r-32;for(var r=48;r<58;r++)o[r-48]=r;for(r=1;r<13;r++)o["f"+r]=r+111;for(r=0;r<10;r++)o["numpad "+r]=r+96;var i=t.names=t.title={};for(r in o)i[o[r]]=r;for(var u in a)o[u]=a[u]}]).default}); |
{ | ||
"name": "quantifai-editorjs-shortcuts", | ||
"version": "1.1.1-mp.2.1.0", | ||
"version": "1.1.1-mp.2.1.1", | ||
"description": "Library for handling keyboard shortcuts", | ||
@@ -5,0 +5,0 @@ "main": "./dist/shortcuts.js", |
@@ -69,2 +69,3 @@ const keycode = require('keycode'); | ||
const sequentialShortcuts = shortcut.split(','); | ||
if (sequentialShortcuts.length === 2) { | ||
@@ -71,0 +72,0 @@ this.sequenceStartKey = sequentialShortcuts[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
18626
240