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.
@@ -1319,7 +1319,22 @@ function fillAriaField(el, value) {
1319
1319
  const sel = window.getSelection();
1320
1320
  sel?.removeAllRanges();
1321
1321
  sel?.addRange(range);
1322
- document.execCommand("insertText", false, String(value ?? ""));
1322
+ let handled = false;
1323
+ try {
1324
+ const dt = new DataTransfer();
1325
+ dt.setData("text/plain", String(value ?? ""));
1326
+ const ev = new ClipboardEvent("paste", {
1327
+ bubbles: true,
1328
+ cancelable: true,
1329
+ composed: true,
1330
+ clipboardData: dt
1331
+ });
1332
+ handled = !htmlEl.dispatchEvent(ev);
1333
+ } catch {
1334
+ }
1335
+ if (!handled) {
1336
+ document.execCommand("insertText", false, String(value ?? ""));
1337
+ }
1323
1338
  } else {
1324
1339
  el.dispatchEvent(new Event("input", { bubbles: true }));
1325
1340
  el.dispatchEvent(new Event("change", { bubbles: true }));
@@ -1656,21 +1671,23 @@ async function scanOrphanInputs(config) {
1656
1671
  console.log(`[auto-webmcp] orphan: using disabled submit button as reference: "${submitBtn.textContent?.trim()}"`);
1657
1672
  }
1658
1673
  if (!submitBtn) {
1659
- const containerBtns = Array.from(container.querySelectorAll("button")).filter((b) => {
1674
+ const containerBtns = Array.from(
1675
+ container.querySelectorAll('button, [role="button"]')
1676
+ ).filter((b) => {
1660
1677
  const r = b.getBoundingClientRect();
1661
- return r.width > 0 && r.height > 0 && !b.disabled && SUBMIT_TEXT_RE.test(b.textContent ?? "");
1678
+ return r.width > 0 && r.height > 0 && !b.disabled && b.getAttribute("aria-disabled") !== "true" && SUBMIT_TEXT_RE.test(b.textContent ?? "");
1662
1679
  });
1663
1680
  submitBtn = containerBtns[containerBtns.length - 1] ?? null;
1664
1681
  if (submitBtn)
1665
1682
  console.log(`[auto-webmcp] orphan: using text-matched button in container: "${submitBtn.textContent?.trim()}"`);
1666
1683
  }
1667
1684
  if (!submitBtn) {
1668
- const pageBtns = Array.from(document.querySelectorAll("button")).filter(
1669
- (b) => {
1670
- const r = b.getBoundingClientRect();
1671
- return r.width > 0 && r.height > 0 && SUBMIT_TEXT_RE.test(b.textContent ?? "");
1672
- }
1673
- );
1685
+ const pageBtns = Array.from(
1686
+ document.querySelectorAll('button, [role="button"]')
1687
+ ).filter((b) => {
1688
+ const r = b.getBoundingClientRect();
1689
+ return r.width > 0 && r.height > 0 && b.getAttribute("aria-disabled") !== "true" && SUBMIT_TEXT_RE.test(b.textContent ?? "");
1690
+ });
1674
1691
  submitBtn = pageBtns[pageBtns.length - 1] ?? null;
1675
1692
  if (submitBtn)
1676
1693
  console.log(`[auto-webmcp] orphan: using page-wide fallback submit button: "${submitBtn.textContent?.trim()}"`);