Proper way to replace default editor with a react editor #6117
Replies: 2 comments 1 reply
-
Yes you're trying to render your react component inside the iframe and I believe stitches is adding those styles on top. I guess you'd need to figure out how to apply those styles inside the iframe with stitches. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Found a way to add the css using let stitchesStyleAdded = false;
editor.setCustomRte({
enable(el, rte) {
if (el.getAttribute("data-text-editor")) {
if (!stitchesStyleAdded) {
const styleTag = document.createElement("style");
styleTag.innerHTML = getCssText();
el.ownerDocument.head.appendChild(styleTag);
stitchesStyleAdded = true;
}
}
},
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to replace the default text editor with a custom one that is built using React. The documentation shows how to replace it using a JS function; but in my case, the editor is a react component. What would be the best way to replace the editor in this case?
I was able to make a basic version work using
createRoot().render()
however in this case all of the styles applied to the editor are missing.Here is a basic reproducible demo https://stackblitz.com/edit/vitejs-vite-jjpjyg?file=src%2FApp.jsx
I am using stitches for styling the editor and it looks like the styles are not getting applied even though the proper class names are being added. Is it due to the iframe? Can I do something about this from my side?
Beta Was this translation helpful? Give feedback.
All reactions