- No longer corrupted with an empty text field.
This commit is contained in:
vorotamoroz 2023-03-01 12:07:19 +09:00
parent 2e25300def
commit 24c8a3b56a
4 changed files with 6 additions and 5 deletions

View file

@ -80,7 +80,8 @@ class NinjaCursorForWindow {
textRange.setEndAfter(range.startContainer);
let textRect = textRange.getBoundingClientRect();
if (textRect.x == 0 && textRect.y == 0) {
textRange.setStart(range.endContainer, range.endOffset - 1);
const startEndOffset = range.endOffset - 1 < 0 ? 0 : range.endOffset - 1;
textRange.setStart(range.endContainer, startEndOffset);
textRange.setEnd(range.endContainer, range.endOffset);
const textRects = textRange.getClientRects();
const tempRect = textRects.item(textRects.length - 1);

View file

@ -1,7 +1,7 @@
{
"id": "ninja-cursor",
"name": "Ninja Cursor",
"version": "0.0.9",
"version": "0.0.10",
"minAppVersion": "0.12.0",
"description": "The plugin which enhance cursor visibility.",
"author": "vorotamoroz",

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "ninja-cursor",
"version": "0.0.9",
"version": "0.0.10",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "ninja-cursor",
"version": "0.0.9",
"version": "0.0.10",
"license": "MIT",
"devDependencies": {
"@types/node": "^16.11.6",

View file

@ -1,6 +1,6 @@
{
"name": "ninja-cursor",
"version": "0.0.9",
"version": "0.0.10",
"description": "The plugin which enhance cursor visibility.",
"main": "main.js",
"scripts": {