viktassen
PD🧩 Plasmo Developers
•Created by viktassen on 3/15/2024 in #👟framework
MUI styles with PlasmoGetInlineAnchorList
Styles are added only for last shadow-root.
Please tell me how to make it work.
// Plasmo
import createCache from "@emotion/cache";
import { CacheProvider } from "@emotion/react";
import { Button } from "@mui/material";
import type { PlasmoCSConfig, PlasmoGetInlineAnchorList } from "plasmo"
export const config: PlasmoCSConfig = {
matches: ["https://plasmo.com/*"],
};
export const getInlineAnchorList: PlasmoGetInlineAnchorList = async () => {
const anchors = document.querySelectorAll(".myClass")
return Array.from(anchors).map((element) => ({
element,
insertPosition: "beforeend",
}))
};
const styleElement = document.createElement("style")
const styleCache = createCache({
key: "plasmo-mui-cache",
prepend: true,
container: styleElement
})
export const getStyle = () => styleElement const MyButton = () => {
return ( <CacheProvider value={styleCache}> <Button> My Button </Button> </CacheProvider> ) } export default MyButton
export const getStyle = () => styleElement const MyButton = () => {
return ( <CacheProvider value={styleCache}> <Button> My Button </Button> </CacheProvider> ) } export default MyButton
3 replies
PD🧩 Plasmo Developers
•Created by viktassen on 2/15/2024 in #🔰newbie
how to change inlineInsertPosition?
There is no example in docs, and this feature was added on Nov 9, 2023. Please help
2 replies
PD🧩 Plasmo Developers
•Created by viktassen on 11/1/2023 in #🔰newbie
MUI styles are working fine on dev for MUI Modal but its causing issues on production
No errors, works fine when modal opens for a first time, but no styles if opened again. Please help
3 replies