react-chrome-extension | Boilerplate ReactJs Chrome Extension | Router library
kandi X-RAY | react-chrome-extension Summary
kandi X-RAY | react-chrome-extension Summary
This is meant to be a starting point for ReactJS chrome extensions. A react-router example can be found in the react-router branch.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Start the application
react-chrome-extension Key Features
react-chrome-extension Examples and Code Snippets
Community Discussions
Trending Discussions on react-chrome-extension
QUESTION
When trying to use Semantic UI in a React based Chrome Extension (started with a boilerplate available from this repo), the Semantic UI CSS gets imported through index.js and ends up in the final build, however none of it seems to actually apply when you go to use any of the Semantic UI components. The CSS seems to appear in the final build, but never gets picked up for whatever reason.
It is important to note that the extension injects a div onto the website it's being used on and uses that div as a root div for React to render its components into. The typical popup that is used for chrome extensions is not currently being used for this extension (and hence makes no use of an HTML file to try and use the CDN version of semantic either).
What is even weirder, is that if you blanket copy-paste all of the CSS from node_modules/semantic-ui-css/semantic.css
into public/css/root.css
the styles get pulled through and actually do work, however this isn't a long-term solution.
So far I've tried importing semantic-ui-css into different parts of the extension, but to no avail. It's entirely possible that it is not working properly due to the webpack configuration (which is exactly the same as in the boilerplate), but I'm not entirely sure what to look for.
Any help with this would be greatly appreciated.
...ANSWER
Answered 2021-Jul-26 at 11:05We had this exact same issue when creating our chrome extension in react using the described boilerplate code.
What you need to do is specifically add the 'app.css' and 'content.css' into the manifest. The actual path to these files is the post-build location, not the pre-build location so for content.css it will be
QUESTION
I'm absolutly new to react and javascript and my problem is that the modal window which holds my react app, which is a chrome extension, gets injected to the DOM every time I click the extension-icon, resulting in strange rendering issues.
(The div with my modal window inside, gets added each time to the DOM when I click the icon).
Result looks like this:
modal Window injected multiple times after clicking icon multiple times
I would like to change it in a way that my component only gets added once to the DOM and on click should only hide/show.
My project is based on the following github project: https://github.com/upmostly/react-chrome-extension
I use the same manifest.json (you can find in public folder on the github link), the same background.js (also in public folder) and the same index.html (found in the src folder) as the project, I only changed the content of the React Components for my personal project.
I would be very happy to find some help here.
Best regards
Tobias
...ANSWER
Answered 2021-Jan-18 at 13:51thank you to wOxxOm, who gave me an idea on how to do it. I changed the call of the main function in content.js to:
QUESTION
I am trying to build a react chrome extension. I started off with the simple project found here. In its structure, the popup is contained in Modal.js and I would like to include an image in it which is contained in the project. However, to access that I must use chrome.runtime.getURL("image_file.png")
, which I cannot access in Modal.js, but only in content.js. How should I get the image properly to Modal.js?
This is all activated when the browser action button is pressed, which calls this function within content.js:
...ANSWER
Answered 2020-May-22 at 20:38Figured this out. I don't know if this is the best solution, but it is working for me.
Since I need to access chrome.runtime.getURL
I need to do that from the content script. But I need the value of that in my component which doesn't have access to the chrome api. So I message between them through window events. Here is some example code:
ExampleComponent.js
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-chrome-extension
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page