You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plasmo is cool in general but WAY too complex to make custom things. I want to inject code into a website and keep the original website style.
With ShadowDOM:
import type { PlasmoCSConfig, PlasmoGetInlineAnchor } from "plasmo"
export const config: PlasmoCSConfig = {
matches: ["https://example.com/*"]
}
export const getInlineAnchor: PlasmoGetInlineAnchor = () =>
document.querySelector(
"#app > div > div > div"
)
function ContentScript() {
return <button>Hi</button>
}
export default ContentScript
Without ShadowDOM:
import { Button } from "@fluentui/react-components"
import type { PlasmoCSConfig, PlasmoRender } from "plasmo"
export const config: PlasmoCSConfig = {
matches: ["https://example.com/*"]
}
export const getRootContainer = () =>
new Promise((resolve) => {
const checkInterval = setInterval(() => {
const rootContainerParent = document.querySelector(
"#app > div > div > div"
)
if (rootContainerParent) {
clearInterval(checkInterval)
const rootContainer = document.createElement("div")
rootContainerParent.appendChild(rootContainer)
resolve(rootContainer)
}
}, 137)
})
export const render: PlasmoRender<any> = async ({
anchor, // the observed anchor, OR document.body.
createRootContainer // This creates the default root container
}) => {
const rootContainer = await createRootContainer()
const root = // HOW TO CREATE THAT ROOT????
root.render(
<ContentScript/>
)
}
function ContentScript() {
return <button>Hi</button>
}
export default ContentScript
This became a way larger code, that, IMHO, unjustified. Plus the fact that I need a custom render, because I don't want overlay, and it uses it as default, and I don't know how to create the root element, since there is no documentation for that.
Why not make the RootContainer customization more friendly? For example, I would like to see something like:
import type { PlasmoCSConfig, PlasmoGetInlineAnchor } from "plasmo"
export const config: PlasmoCSConfig = {
matches: ["https://example.com/*"]
}
export const RootContainerElement = () => document.createElement('div`);
export const getInlineAnchor: PlasmoGetInlineAnchor = () =>
document.querySelector(
"#app > div > div > div"
)
function ContentScript() {
return <button>Hi</button>
}
export default ContentScript
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Plasmo is cool in general but WAY too complex to make custom things. I want to inject code into a website and keep the original website style.
With ShadowDOM:
Without ShadowDOM:
This became a way larger code, that, IMHO, unjustified. Plus the fact that I need a custom render, because I don't want overlay, and it uses it as default, and I don't know how to create the root element, since there is no documentation for that.
Why not make the RootContainer customization more friendly? For example, I would like to see something like:
What we need more than this? :)
Beta Was this translation helpful? Give feedback.
All reactions