Skip to content

Commit 180d221

Browse files
authored
Use dom-input-range instead of internal implementation
1 parent eee5f70 commit 180d221

5 files changed

+11
-151
lines changed

package-lock.json

+7-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
],
3030
"prettier": "@github/prettier-config",
3131
"dependencies": {
32-
"@github/combobox-nav": "^2.0.2"
32+
"@github/combobox-nav": "^2.0.2",
33+
"dom-input-range": "^1.1.3"
3334
},
3435
"devDependencies": {
3536
"@github/prettier-config": "0.0.4",

src/text-expander-element.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Combobox from '@github/combobox-nav'
22
import query from './query'
3-
import textFieldSelectionPosition from './text-field-selection-position'
3+
import {InputRange} from 'dom-input-range'
44

55
type Match = {
66
text: string
@@ -103,7 +103,7 @@ class TextExpander {
103103

104104
this.expander.dispatchEvent(new Event('text-expander-activate'))
105105

106-
let {top, left} = textFieldSelectionPosition(this.input, match.position)
106+
let {top, left} = new InputRange(this.input, match.position).getBoundingClientRect()
107107
if (isTopLayer(menu)) {
108108
const rect = this.input.getBoundingClientRect()
109109
top += rect.top

src/text-field-mirror.ts

-115
This file was deleted.

src/text-field-selection-position.ts

-32
This file was deleted.

0 commit comments

Comments
 (0)