@github/markdown-toolbar-element
Advanced tools
+9
-1
@@ -283,5 +283,13 @@ const buttonSelectors = [ | ||
| const shortcutListeners = new WeakMap(); | ||
| function findHotkey(toolbar, key) { | ||
| for (const el of toolbar.querySelectorAll('[hotkey]')) { | ||
| if (el.getAttribute('hotkey') === key) { | ||
| return el; | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
| function shortcut(toolbar, event) { | ||
| if ((event.metaKey && modifierKey === 'Meta') || (event.ctrlKey && modifierKey === 'Control')) { | ||
| const button = toolbar.querySelector(`[hotkey="${event.key}"]`); | ||
| const button = findHotkey(toolbar, event.key); | ||
| if (button) { | ||
@@ -288,0 +296,0 @@ button.click(); |
+8
-8
| { | ||
| "name": "@github/markdown-toolbar-element", | ||
| "version": "1.3.1", | ||
| "version": "1.3.2", | ||
| "description": "Markdown formatting buttons for text inputs.", | ||
@@ -12,3 +12,3 @@ "repository": "github/markdown-toolbar-element", | ||
| "clean": "rm -rf dist", | ||
| "lint": "github-lint", | ||
| "lint": "eslint src/*.ts test/*.js", | ||
| "prebuild": "npm run clean && npm run lint && mkdir dist", | ||
@@ -33,11 +33,11 @@ "build": "tsc", | ||
| "chai": "^4.2.0", | ||
| "eslint": "^6.6.1", | ||
| "eslint-plugin-github": "^3.4.1", | ||
| "karma": "^5.0.9", | ||
| "eslint": "^7.6.0", | ||
| "eslint-plugin-github": "^4.1.1", | ||
| "karma": "^5.1.1", | ||
| "karma-chai": "^0.1.0", | ||
| "karma-chrome-launcher": "^2.2.0", | ||
| "karma-chrome-launcher": "^3.1.0", | ||
| "karma-mocha": "^2.0.1", | ||
| "karma-mocha-reporter": "^2.2.5", | ||
| "mocha": "^7.1.2", | ||
| "typescript": "^3.9.2" | ||
| "mocha": "^8.1.0", | ||
| "typescript": "^3.9.7" | ||
| }, | ||
@@ -44,0 +44,0 @@ "eslintIgnore": [ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
29261
0.69%664
1.22%1
Infinity%