diff --git a/chrome-extension/manifest.js b/chrome-extension/manifest.js index 99ed5bb..50a0c2f 100755 --- a/chrome-extension/manifest.js +++ b/chrome-extension/manifest.js @@ -42,14 +42,6 @@ const manifest = deepmerge( js: ['content/index.iife.js'], run_at: 'document_start', }, - { - matches: ['http://*/*', 'https://*/*', ''], - js: ['content-ui/index.iife.js'], - }, - { - matches: ['http://*/*', 'https://*/*', ''], - css: ['content.css'], - }, ], devtools_page: 'devtools/index.html', web_accessible_resources: [ diff --git a/pages/content-ui/src/App.tsx b/pages/content-ui/src/App.tsx index 285dc73..1b523d7 100644 --- a/pages/content-ui/src/App.tsx +++ b/pages/content-ui/src/App.tsx @@ -1,14 +1,3 @@ -import { useEffect } from 'react'; -// import { Button } from '@extension/ui'; -// import { useStorage } from '@extension/shared'; -// import { exampleThemeStorage } from '@extension/storage'; - export default function App() { - // const theme = useStorage(exampleThemeStorage); - - useEffect(() => { - console.log('content ui loaded'); - }, []); - - return
; + return null; } diff --git a/pages/content-ui/src/index.tsx b/pages/content-ui/src/index.tsx index ad1aada..4c5de5b 100644 --- a/pages/content-ui/src/index.tsx +++ b/pages/content-ui/src/index.tsx @@ -1,33 +1 @@ -import { createRoot } from 'react-dom/client'; -import App from '@src/App'; -import tailwindcssOutput from '../dist/tailwind-output.css?inline'; - -const root = document.createElement('div'); -root.id = 'chrome-extension-boilerplate-react-vite-content-view-root'; - -document.body.append(root); - -const rootIntoShadow = document.createElement('div'); -rootIntoShadow.id = 'shadow-root'; - -const shadowRoot = root.attachShadow({ mode: 'open' }); - -if (navigator.userAgent.includes('Firefox')) { - /** - * In the firefox environment, adoptedStyleSheets cannot be used due to the bug - * @url https://bugzilla.mozilla.org/show_bug.cgi?id=1770592 - * - * Injecting styles into the document, this may cause style conflicts with the host page - */ - const styleElement = document.createElement('style'); - styleElement.innerHTML = tailwindcssOutput; - shadowRoot.appendChild(styleElement); -} else { - /** Inject styles into shadow dom */ - const globalStyleSheet = new CSSStyleSheet(); - globalStyleSheet.replaceSync(tailwindcssOutput); - shadowRoot.adoptedStyleSheets = [globalStyleSheet]; -} - -shadowRoot.appendChild(rootIntoShadow); -createRoot(rootIntoShadow).render(); +// content-ui: no visible UI injected into host pages diff --git a/tests/e2e/specs/page-content-ui.test.ts b/tests/e2e/specs/page-content-ui.test.ts deleted file mode 100644 index 50fbb13..0000000 --- a/tests/e2e/specs/page-content-ui.test.ts +++ /dev/null @@ -1,8 +0,0 @@ -describe('Content UI Injection', () => { - it('should locate the injected content UI div', async () => { - await browser.url('https://www.example.com'); - - const contentDiv = await $('#chrome-extension-boilerplate-react-vite-content-view-root').getElement(); - await expect(contentDiv).toBeDisplayed(); - }); -});