Create CSUI root containers programmatically
I've read the page about the life cycle of Plasmo CSUI but I'm still not sure how I could create root containers (and render a component inside it) programmatically rather than declaratively.
For my extension I want to append inline CSUI to certain DOM elements, but these are sometimes removed from the DOM and added again at certain circumstances.
I'm getting messages from my BGSW which should trigger a search for a list of these target anchors, followed by rendering new CSUI where necessary.
Is something like that possible?
3 Replies
You can simply make a
.ts
file, and manually import react/react-dom and do your bidding as needed
Only .tsx
files are treated as CSUI, so .ts
file can import a .tsx
file and you can do your custom mounting as needed - note that .ts CS will not receive any CSUI related runtime hook such as getStyles etc..., you will just need to DIY them allThanks for the quick help. I managed to do what I wanted with your tip.
For anyone who is interested how I did it:
Gave +1 Rep to @louisgv