Is it possible to include an external stylesheet in the grapesjs canvas?
Please ignore. I ended up injecting the stylesheet link using javascript into Grapes' canvas' iframe // insert external stylesheet into the grapesjs window var iframes = Utilities_GetElementsByClass("gjs-frame", "IFRAME", document.body); for (var i=0; i<iframes.length; i++) { var iframe = iframes[i]; var doc = iframe....
Read full answer below βQuestion
We want to create some custom components whose style changes according to an external theme css (there can be different themes), and we want those styles to appear in the canvas while editing.
Answers (3)
Please ignore. I ended up injecting the stylesheet link using javascript into Grapes' canvas' iframe // insert external stylesheet into the grapesjs window var iframes = Utilities_GetElementsByClass("gjs-frame", "IFRAME", document.body); for (var i=0; i<iframes.length; i++) { var iframe = iframes[i...
You can inject scripts/styles via canvas config option
const editor = grapesjs.init({
...
canvas: {
styles: ['https://...', '...'],
scripts: ['https://...'],
}
});
Thanks!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #966
[QUESTION] How to load external CSS file into Grapes Editor?
Hey, During my editor = grapesjs.init(), I want to load an external CSS file into the canvas using @import url(...). So when I use my custo...
Issue #1807
GrapeJs framework breaks on adding external stylesheet
When i add my external stylesheet using the grapesjs framework no more works. How can I have the style sheet as well as the grapesjs framew...
Issue #460
When the component's view modifies the HTML, text components are no longer editable
I'm trying to build a custom component that contains some lorem ipsum text in the content, for editing once it's on the canvas. But I also...
Issue #859
[QUESTIONS] Change canvas style
Hi there, I have some question about canvas style, in this case i have config like this. By default i use css with name builder-desktop.css...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins βPremium plugins ship with support, regular updates, and production-ready features β save days of integration work.
Browse premium plugins βRelated tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.