aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index 7ec4f69f3..bfb29fe8d 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -575,7 +575,7 @@ export function simulateMouseClick(element: Element | null | undefined, x: numbe
export function DashColor(color: string) {
try {
- return Color(color.toLowerCase());
+ return color ? Color(color.toLowerCase()) : Color("transparent");
} catch (e) {
console.log("COLOR error:", e);
return Color("red");
@@ -599,7 +599,7 @@ export function getWordAtPoint(elem: any, x: number, y: number): string | undefi
range.selectNodeContents(elem);
var currentPos = 0;
const endPos = range.endOffset;
- while (currentPos + 1 < endPos) {
+ while (currentPos + 1 <= endPos) {
range.setStart(elem, currentPos);
range.setEnd(elem, currentPos + 1);
const rangeRect = range.getBoundingClientRect();