{"id":37902449,"url":"https://github.com/loadingio/ldcaret","last_synced_at":"2026-01-16T17:05:44.083Z","repository":{"id":36465157,"uuid":"225805139","full_name":"loadingio/ldcaret","owner":"loadingio","description":"caret manipulation library in Vanilla JS.","archived":false,"fork":false,"pushed_at":"2023-03-04T05:20:43.000Z","size":1148,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T14:12:35.774Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loadingio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-04T07:24:21.000Z","updated_at":"2022-01-19T16:15:40.000Z","dependencies_parsed_at":"2023-01-17T01:43:34.735Z","dependency_job_id":null,"html_url":"https://github.com/loadingio/ldcaret","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/loadingio/ldcaret","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadingio%2Fldcaret","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadingio%2Fldcaret/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadingio%2Fldcaret/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadingio%2Fldcaret/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loadingio","download_url":"https://codeload.github.com/loadingio/ldcaret/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadingio%2Fldcaret/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-16T17:05:43.327Z","updated_at":"2026-01-16T17:05:44.070Z","avatar_url":"https://github.com/loadingio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ldcaret\n\nCaret Manipulation Library, in Vanilla JS.\n\n\n## Usage\n\nInstall via npm:\n\n    npm install --save ldcaret\n\n\ninclude  js file:\n\n    \u003cscript src=\"path-to-ldcaret-js\"\u003e\u003c/script\u003e\n\n\ncall desired API (see below) provided by `ldcaret` object:\n\n    ldcaret.get();\n\n\n## API\n\nldcaret provides following API:\n\n * get() - get selection range in an object with following attributes:\n   - ns: start container\n   - os: start offset\n   - ne: end container\n   - oe: end offset\n * set(opt, edit) - set selection / caret based on option object `opt`\n   - opt: selection range, in two possible format\n     - simplified format:\n       - ns: start container\n       - os: start offset\n       - ne: end container ( will use ns when ne is omitted )\n       - oe: end offset ( will use os when oe is omitted )\n     - range object\n   - edit: when set to true, patch range into innermost element if possible. default false.\n * clear() - clear selection.\n * getContent() - get text content from current selection.\n * getBoundingBox() - get the bounding box of current selection.\n * setContent(content) - replace range of current selection with `content`.\n * insert(arg) - insert or replace current selection with arg. arg could be:\n   - text\n   - Element\n * byPtr({node, x, y, method}) - get a closest possible caret position under `node` based on `(x,y)` coordinates.\n   - method: method name (string) of the distance calculation algorithm. possible values:\n     - `euclidean` - straight line distnace\n     - `vertical` - favor y distance against x distance. default value.\n   - return value: {min, range, box}\n     - min: minimal distance in px from the calculated caret to `(x,y)` coordinates.\n     - range: corresponding range of the calculated caret.\n     - box: bounding box of the calculated range.\n\n\n## LICENSE\n\nMIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floadingio%2Fldcaret","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floadingio%2Fldcaret","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floadingio%2Fldcaret/lists"}