Skip to content

Commit 8245b85

Browse files
authored
Merge pull request #55 from github/use-dom-input-range
Use `dom-input-range` instead of internal implementation
2 parents eee5f70 + 8824151 commit 8245b85

10 files changed

+2162
-1314
lines changed

.devcontainer/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// Update 'VARIANT' to pick a Node version: 16, 14, 12.
88
// Append -bullseye or -buster to pin to an OS version.
99
// Use -bullseye variants on local arm64/Apple Silicon.
10-
"args": { "VARIANT": "16" }
10+
"args": { "VARIANT": "20" }
1111
},
1212

1313
// Set *default* container specific settings.json values on container create.

package-lock.json

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

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@
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",
3637
"chai": "^4.3.4",
3738
"chromium": "^3.0.3",
38-
"eslint": "^7.24.0",
39-
"eslint-plugin-github": "^4.1.3",
39+
"eslint": "^8.0.1",
40+
"eslint-plugin-github": "^4.10.2",
4041
"karma": "^6.3.2",
4142
"karma-chai": "^0.1.0",
4243
"karma-chrome-launcher": "^3.1.0",
@@ -45,7 +46,7 @@
4546
"mocha": "^8.3.2",
4647
"rollup": "^2.45.1",
4748
"rollup-plugin-node-resolve": "^5.2.0",
48-
"typescript": "^4.2.4"
49+
"typescript": "^5.4.5"
4950
},
5051
"eslintIgnore": [
5152
"build/",

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.

test/.eslintrc

+6
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,11 @@
88
},
99
"globals": {
1010
"assert": true
11+
},
12+
"rules": {
13+
"github/no-inner-html": "off",
14+
"filenames/match-regex": "off",
15+
// Linting currently runs as a pre-build step, so the dependent files may not exist yet by the time linting is run
16+
"import/no-unresolved": "off"
1117
}
1218
}

test/test.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
import './query-test'
22
import './text-expander-element-test'
3-
import './text-field-mirror-test'
4-
import './textarea-contents-height-test'

test/text-field-mirror-test.js

-47
This file was deleted.

test/textarea-contents-height-test.js

-56
This file was deleted.

0 commit comments

Comments
 (0)