@github/text-expander-element
Advanced tools
+9
-2
@@ -639,3 +639,4 @@ const ctrlBindings = !!navigator.userAgent.match(/Macintosh/); | ||
| positionMenu(menu, position) { | ||
| const caretRect = new InputRange(this.input, position).getBoundingClientRect(); | ||
| const clampedPosition = Math.min(position, this.input.value.length); | ||
| const caretRect = new InputRange(this.input, clampedPosition).getBoundingClientRect(); | ||
| const targetPosition = { left: caretRect.left, top: caretRect.top + caretRect.height }; | ||
@@ -713,2 +714,5 @@ const currentPosition = menu.getBoundingClientRect(); | ||
| } | ||
| isMatchStillValid(match) { | ||
| return match.position <= this.input.value.length; | ||
| } | ||
| async onInput() { | ||
@@ -723,4 +727,7 @@ if (this.justPasted) { | ||
| const menu = await this.notifyProviders(match); | ||
| if (!this.match) | ||
| if (!this.match || !this.isMatchStillValid(match)) { | ||
| this.match = null; | ||
| this.deactivate(); | ||
| return; | ||
| } | ||
| if (menu) { | ||
@@ -727,0 +734,0 @@ this.activate(match, menu); |
+9
-2
@@ -469,3 +469,4 @@ import Combobox from '@github/combobox-nav'; | ||
| positionMenu(menu, position) { | ||
| const caretRect = new InputRange(this.input, position).getBoundingClientRect(); | ||
| const clampedPosition = Math.min(position, this.input.value.length); | ||
| const caretRect = new InputRange(this.input, clampedPosition).getBoundingClientRect(); | ||
| const targetPosition = { left: caretRect.left, top: caretRect.top + caretRect.height }; | ||
@@ -543,2 +544,5 @@ const currentPosition = menu.getBoundingClientRect(); | ||
| } | ||
| isMatchStillValid(match) { | ||
| return match.position <= this.input.value.length; | ||
| } | ||
| async onInput() { | ||
@@ -553,4 +557,7 @@ if (this.justPasted) { | ||
| const menu = await this.notifyProviders(match); | ||
| if (!this.match) | ||
| if (!this.match || !this.isMatchStillValid(match)) { | ||
| this.match = null; | ||
| this.deactivate(); | ||
| return; | ||
| } | ||
| if (menu) { | ||
@@ -557,0 +564,0 @@ this.activate(match, menu); |
@@ -56,3 +56,4 @@ import Combobox from '@github/combobox-nav'; | ||
| positionMenu(menu, position) { | ||
| const caretRect = new InputRange(this.input, position).getBoundingClientRect(); | ||
| const clampedPosition = Math.min(position, this.input.value.length); | ||
| const caretRect = new InputRange(this.input, clampedPosition).getBoundingClientRect(); | ||
| const targetPosition = { left: caretRect.left, top: caretRect.top + caretRect.height }; | ||
@@ -130,2 +131,5 @@ const currentPosition = menu.getBoundingClientRect(); | ||
| } | ||
| isMatchStillValid(match) { | ||
| return match.position <= this.input.value.length; | ||
| } | ||
| async onInput() { | ||
@@ -140,4 +144,7 @@ if (this.justPasted) { | ||
| const menu = await this.notifyProviders(match); | ||
| if (!this.match) | ||
| if (!this.match || !this.isMatchStillValid(match)) { | ||
| this.match = null; | ||
| this.deactivate(); | ||
| return; | ||
| } | ||
| if (menu) { | ||
@@ -144,0 +151,0 @@ this.activate(match, menu); |
+1
-1
| { | ||
| "name": "@github/text-expander-element", | ||
| "version": "2.9.2", | ||
| "version": "2.9.4", | ||
| "description": "Activates a suggestion menu to expand text snippets as you type.", | ||
@@ -5,0 +5,0 @@ "repository": "github/text-expander-element", |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
79322
1.14%1793
1.19%0
-100%