auto-webmcp 0.3.10 → 0.3.12

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.
@@ -1338,7 +1338,22 @@ function fillAriaField(el, value) {
1338
1338
  const sel = window.getSelection();
1339
1339
  sel?.removeAllRanges();
1340
1340
  sel?.addRange(range);
1341
- document.execCommand("insertText", false, String(value ?? ""));
1341
+ let handled = false;
1342
+ try {
1343
+ const dt = new DataTransfer();
1344
+ dt.setData("text/plain", String(value ?? ""));
1345
+ const ev = new ClipboardEvent("paste", {
1346
+ bubbles: true,
1347
+ cancelable: true,
1348
+ composed: true,
1349
+ clipboardData: dt
1350
+ });
1351
+ handled = !htmlEl.dispatchEvent(ev);
1352
+ } catch {
1353
+ }
1354
+ if (!handled) {
1355
+ document.execCommand("insertText", false, String(value ?? ""));
1356
+ }
1342
1357
  } else {
1343
1358
  el.dispatchEvent(new Event("input", { bubbles: true }));
1344
1359
  el.dispatchEvent(new Event("change", { bubbles: true }));
@@ -1675,21 +1690,23 @@ async function scanOrphanInputs(config) {
1675
1690
  console.log(`[auto-webmcp] orphan: using disabled submit button as reference: "${submitBtn.textContent?.trim()}"`);
1676
1691
  }
1677
1692
  if (!submitBtn) {
1678
- const containerBtns = Array.from(container.querySelectorAll("button")).filter((b) => {
1693
+ const containerBtns = Array.from(
1694
+ container.querySelectorAll('button, [role="button"]')
1695
+ ).filter((b) => {
1679
1696
  const r = b.getBoundingClientRect();
1680
- return r.width > 0 && r.height > 0 && !b.disabled && SUBMIT_TEXT_RE.test(b.textContent ?? "");
1697
+ return r.width > 0 && r.height > 0 && !b.disabled && b.getAttribute("aria-disabled") !== "true" && SUBMIT_TEXT_RE.test(b.textContent ?? "");
1681
1698
  });
1682
1699
  submitBtn = containerBtns[containerBtns.length - 1] ?? null;
1683
1700
  if (submitBtn)
1684
1701
  console.log(`[auto-webmcp] orphan: using text-matched button in container: "${submitBtn.textContent?.trim()}"`);
1685
1702
  }
1686
1703
  if (!submitBtn) {
1687
- const pageBtns = Array.from(document.querySelectorAll("button")).filter(
1688
- (b) => {
1689
- const r = b.getBoundingClientRect();
1690
- return r.width > 0 && r.height > 0 && SUBMIT_TEXT_RE.test(b.textContent ?? "");
1691
- }
1692
- );
1704
+ const pageBtns = Array.from(
1705
+ document.querySelectorAll('button, [role="button"]')
1706
+ ).filter((b) => {
1707
+ const r = b.getBoundingClientRect();
1708
+ return r.width > 0 && r.height > 0 && b.getAttribute("aria-disabled") !== "true" && SUBMIT_TEXT_RE.test(b.textContent ?? "");
1709
+ });
1693
1710
  submitBtn = pageBtns[pageBtns.length - 1] ?? null;
1694
1711
  if (submitBtn)
1695
1712
  console.log(`[auto-webmcp] orphan: using page-wide fallback submit button: "${submitBtn.textContent?.trim()}"`);