Browse Source

fix: popup element selector not working on multiple windows

Ahmad Kholid 2 years ago
parent
commit
c2f7a1f3cb
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/popup/pages/Home.vue

+ 8 - 2
src/popup/pages/Home.vue

@@ -291,8 +291,14 @@ function openDashboard(url) {
     window.close();
   });
 }
-function initElementSelector() {
-  initElementSelectorFunc().then(() => {
+async function initElementSelector() {
+  const [tab] = await browser.tabs.query({
+    url: '*://*/*',
+    active: true,
+    currentWindow: true,
+  });
+  if (!tab) return;
+  initElementSelectorFunc(tab).then(() => {
     window.close();
   });
 }