aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index 8054245f5..3fffadb6d 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -577,7 +577,7 @@ export function simulateMouseClick(element: Element | null | undefined, x: numbe
export function lightOrDark(color: any) {
const nonAlphaColor = color.startsWith("#") ? (color as string).substring(0, 7) :
- color.startsWith("rgba") ? color.replace(/,.[^,]*\)/, ")").replace("rgba", "rgb") : color;
+ color.startsWith("rgba") ? color.replace(/,.[^,]*\)/, ")").replace("rgba", "rgb") : color;
const col = Color(nonAlphaColor).rgb();
const colsum = (col.red() + col.green() + col.blue());
if (colsum / col.alpha() > 400 || col.alpha() < 0.25) return Colors.DARK_GRAY;
@@ -586,6 +586,7 @@ export function lightOrDark(color: any) {
export function getWordAtPoint(elem: any, x: number, y: number): string | undefined {
+ if (elem.tagName === "INPUT") return "input";
if (elem.nodeType === elem.TEXT_NODE) {
const range = elem.ownerDocument.createRange();
range.selectNodeContents(elem);