Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.dist.prod.util.Caret.js.map Maven / Gradle / Ivy
{
"version": 3,
"sources": ["../../../src/util/Caret.ts"],
"sourcesContent": ["/**\n * Returns the caret (cursor) position of the specified text field (field).\n * Return value range is 0-field.value.length.\n */\nconst getCaretPosition = (field: HTMLInputElement): number | null => {\n\t// Initialize\n\tlet caretPos: number | null = 0;\n\n\tif (field.selectionStart || field.selectionStart === 0) { // Firefox support\n\t\tcaretPos = field.selectionDirection === \"backward\" ? field.selectionStart : field.selectionEnd;\n\t}\n\n\treturn caretPos;\n};\n\nconst setCaretPosition = (field: HTMLInputElement, caretPos: number | null) => {\n\tif (field.selectionStart) {\n\t\tfield.focus();\n\t\tfield.setSelectionRange(caretPos, caretPos);\n\t} else {\n\t\tfield.focus();\n\t}\n};\n\nexport {\n\tgetCaretPosition,\n\tsetCaretPosition,\n};\n"],
"mappings": "aAIA,MAAMA,EAAoBC,GAA2C,CAEpE,IAAIC,EAA0B,EAE9B,OAAID,EAAM,gBAAkBA,EAAM,iBAAmB,KACpDC,EAAWD,EAAM,qBAAuB,WAAaA,EAAM,eAAiBA,EAAM,cAG5EC,CACR,EAEMC,EAAmB,CAACF,EAAyBC,IAA4B,CAC1ED,EAAM,gBACTA,EAAM,MAAM,EACZA,EAAM,kBAAkBC,EAAUA,CAAQ,GAE1CD,EAAM,MAAM,CAEd,EAEA,OACCD,KAAA,iBACAG,KAAA",
"names": ["getCaretPosition", "field", "caretPos", "setCaretPosition"]
}