mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Merge pull request #23756 from shiftkey/add-textarea-caret-package
add textarea-caret package
This commit is contained in:
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for textarea-caret 3.0
|
||||
// Project: https://github.com/component/textarea-caret-position
|
||||
// Definitions by: Brendan Forster <https://github.com/shiftkey>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
export = textarea_caret;
|
||||
|
||||
interface Caret {
|
||||
top: number;
|
||||
left: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
declare function textarea_caret(element: HTMLElement, position: number, options?: Options): Caret;
|
||||
@@ -0,0 +1,8 @@
|
||||
import getCaretCoordinates = require('textarea-caret');
|
||||
|
||||
const element = document.querySelector('textarea');
|
||||
|
||||
element!.addEventListener('input', function() {
|
||||
const caret = getCaretCoordinates(this, this.selectionEnd);
|
||||
console.log('(top, left, height) = (%s, %s, %s)', caret.top, caret.left, caret.height);
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"textarea-caret-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"indent": [true, "spaces", 4],
|
||||
"max-line-length": [true, 100],
|
||||
"no-any": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user