Skip to content

Commit

Permalink
Merge pull request #17 from zouhangwithsweet/fix-insert-root
Browse files Browse the repository at this point in the history
chore: update content insert to root
  • Loading branch information
zouhangwithsweet authored Aug 10, 2024
2 parents 72aed65 + 0cbf563 commit 0d42ccb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions entrypoints/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default defineContentScript({
runAt: 'document_end',
main(ctx) {
const ui = createIntegratedUi(ctx, {
tag: 'fubukicss',
position: 'inline',
onMount: (root) => {
// Append children to the container
Expand All @@ -19,12 +20,8 @@ export default defineContentScript({
styleEl.setAttribute('rel', 'stylesheet')
styleEl.setAttribute('href', browser.runtime.getURL('assets/injected.css' as any))

container.appendChild(styleEl)
container.appendChild(script)

container.classList.add('fubuki-css')

root.appendChild(container)
root.appendChild(styleEl)
root.appendChild(script)
},
})

Expand Down
2 changes: 1 addition & 1 deletion entrypoints/injected/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ export default defineUnlistedScript(() => {
const app = document.createElement('div')
const root = ReactDOM.createRoot(app)
root.render(<App />)
document.querySelector('.fubuki-css')!.append(app)
document.querySelector('fubukicss')!.append(app)
}
})

0 comments on commit 0d42ccb

Please sign in to comment.