Git Product home page Git Product logo

Comments (6)

rickerp avatar rickerp commented on June 15, 2024 1

In my case, I am running a content script on a Zoom invitation page. This page, weirdly, doesn't trigger the event DOMContentLoaded. There may be more pages like this.

What I did to load react was to wait, specifically, for a div (that I know will exist), by using a mutation observer, and then load the react.

from material-ui.

brijeshb42 avatar brijeshb42 commented on June 15, 2024

Worked fine for me. I used npx create-chrome-ext to quickly prototype a chrome extension. This was my content script code -

import { createRoot } from 'react-dom/client'
import Typography from '@mui/material/Typography'

const appRoot = document.createElement('div')
appRoot.id = 'ext-root'

document.getElementById('zoom-ui-frame')?.prepend(appRoot)

createRoot(appRoot).render(<Typography variant="h2">Hello From extension</Typography>)

And this is what got added

Screenshot 2024-05-17 at 11 49 32 AM

Let me know if you can share the minimal zip file for your extension that I can use to debug.

from material-ui.

github-actions avatar github-actions commented on June 15, 2024

Since the issue is missing key information and has been inactive for 7 days, it has been automatically closed. If you wish to see the issue reopened, please provide the missing information.

from material-ui.

rickerp avatar rickerp commented on June 15, 2024

@brijeshb42 Do you have the "run_at": "document_start" in the content-script section of the manifest?

from material-ui.

brijeshb42 avatar brijeshb42 commented on June 15, 2024

I checked again with what you said ^. It worked with this as well. I just had to wrap the main code in a DOMContentLoaded event handler since the dom nodes are not ready at document_start.

import { createRoot } from 'react-dom/client'
import Typography from '@mui/material/Typography'

console.log('Hello extensions')

document.addEventListener('DOMContentLoaded', () => {
  const appRoot = document.createElement('div')
  appRoot.id = 'ext-root'

  document.getElementById('zoom-ui-frame')?.prepend(appRoot)

  createRoot(appRoot).render(<Typography variant="h2">Hello From extension</Typography>)
})

from material-ui.

rickerp avatar rickerp commented on June 15, 2024

But I still get the error in @mui / emotion, this was my original logic.

from material-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.