Browse Source

fix: CSS showing into XML page (#761)

Ahmad Kholid 2 years ago
parent
commit
d7485746df
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/content/commandPalette/index.js

+ 9 - 0
src/content/commandPalette/index.js

@@ -1,3 +1,4 @@
+import browser from 'webextension-polyfill';
 import initApp from './main';
 import initApp from './main';
 import injectAppStyles from '../injectAppStyles';
 import injectAppStyles from '../injectAppStyles';
 
 
@@ -21,6 +22,14 @@ export default async function () {
     const isMainFrame = window.self === window.top;
     const isMainFrame = window.self === window.top;
     if (!isMainFrame) return;
     if (!isMainFrame) return;
 
 
+    const isInvalidURL = /.(json|xml)$/.test(window.location.pathname);
+    if (isInvalidURL) return;
+
+    const { automaShortcut } = await browser.storage.local.get(
+      'automaShortcut'
+    );
+    if (Array.isArray(automaShortcut) && automaShortcut.length === 0) return;
+
     await pageLoaded();
     await pageLoaded();
 
 
     const instanceExist = document.querySelector('automa-palette');
     const instanceExist = document.querySelector('automa-palette');