Initializing Canvas Scripts and Styles dynamically
Hi @inventorbit for such a case you should manipulate directly the canvas document
Read full answer below āQuestion
Hello Grapejs team, Thanks for this wonderful project saved my time and so far I had great experience with integration and your community support. I want to load Canvas Styles and Scripts after the page is loaded from DB (Rest API) canvas: { styles: ['https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css'], scripts: ['https://code.jquery.com/jquery-3.3.1.slim.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js'] } Is it possible to load this dynamically like editor.Canv...
Answers (2)
Hi @inventorbit for such a case you should manipulate directly the canvas document
const scriptEl = document.createElement('script');
scriptEl.src = '...';
editor.Canvas.getDocument().head.appendChild(scriptEl);
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1123
[QUESTION] Onload event inside template
Hi! I have a problem with some templates. This template has some scripts running after the page is loaded. When this templates is loaded by...
Issue #1329
Question: How to use same CSS for Multiple pages
Hello Grapejs Team, We've been working on Multi-page Website Builder. For each project there will be multiple html pages with single common...
Issue #444
How to load css link into the head tag?
Hello, First of all, thanks for contributing such an amazing js framework. I am very new to grapesjs. And github too. https://github.com/ar...
Issue #1059
[Question]: Load html content from a file dynamically
Hi, I need to load content from a html file from server onto editor after or while initializing editor. How this can be implemented? HTML w...
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.