channel-worker 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/command-poller.js +9 -2
- package/package.json +1 -1
package/lib/command-poller.js
CHANGED
|
@@ -591,6 +591,7 @@ class CommandPoller {
|
|
|
591
591
|
// Focus target element via CDP mouse click (trusted event)
|
|
592
592
|
const rawSel = (focus_selector || '');
|
|
593
593
|
const isXpath = rawSel.startsWith('xpath:');
|
|
594
|
+
const isTallest = rawSel === 'tallest_editor';
|
|
594
595
|
const sel = rawSel.replace('xpath:', '').replace(/'/g, "\\'").replace(/"/g, '\\"');
|
|
595
596
|
|
|
596
597
|
// Get element bounding box
|
|
@@ -598,7 +599,13 @@ class CommandPoller {
|
|
|
598
599
|
expression: `
|
|
599
600
|
(function() {
|
|
600
601
|
let el = null;
|
|
601
|
-
if (${
|
|
602
|
+
if (${isTallest}) {
|
|
603
|
+
// Find tallest contenteditable editor (for "Describe your reel" etc.)
|
|
604
|
+
let maxH = 0;
|
|
605
|
+
document.querySelectorAll('[contenteditable="true"], [role="textbox"]').forEach(e => {
|
|
606
|
+
if (e.offsetHeight > maxH) { maxH = e.offsetHeight; el = e; }
|
|
607
|
+
});
|
|
608
|
+
} else if (${isXpath} && '${sel}') {
|
|
602
609
|
el = document.evaluate("${sel}", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
603
610
|
} else if ('${sel}') {
|
|
604
611
|
el = document.querySelector('${sel}');
|
|
@@ -613,7 +620,7 @@ class CommandPoller {
|
|
|
613
620
|
}
|
|
614
621
|
if (!el) return null;
|
|
615
622
|
const rect = el.getBoundingClientRect();
|
|
616
|
-
return { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2, tag: el.tagName, aria: (el.getAttribute('aria-label') || '').substring(0, 30) };
|
|
623
|
+
return { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2, tag: el.tagName, aria: (el.getAttribute('aria-label') || '').substring(0, 30), height: el.offsetHeight };
|
|
617
624
|
})()
|
|
618
625
|
`,
|
|
619
626
|
returnByValue: true,
|