[Question]: How to load external javascript,i tried all methods,Useless
Question
I write html strings as blocks, and need to introduce a lot of external scripts and styles, but I tried all the methods, when I drag the block to the canvas, the script does not take effect, but styles can be loaded,I hope to get help。
1.
Load by appendchild

init load by canvas:{scripts:[...]}

who can help me?
Answers (2)
@sizhousama I am loading scripts/stylesheets via canvas while initializing grapesjs editor and it works for me.
canvas: {
scripts: ['https://unpkg.com/abc.js'],
styles: ['https://unpkg.com/abc/dist/css/abc.min.css'],
},
More details can be found here. Hope it helps!
The console shows loaded

Related Questions and Answers
Continue research with similar issue discussions.
Issue #1086
[Question] What is the way to generate component with external javascript?
It seems I should not ask such question, but I did spend a lot time to search, could not get a good guide on this. I want to create a FB bl...
Issue #2302
How to get the external plugin CSS, JS and HTML through GrapesJS export feature?
I have used an external plugin javascript version of @fullCalendar into the GrapesJS. I am able to render the calendar on the canvas but I...
Issue #1875
[QUESTION] ID changes when importing html or passing html in components prop in config.
Hi, I built a component and block that I can drag and drop in the canvas. My issue is that some styles rely on the ID. I know this might no...
Issue #1526
[QUESTION] how to make fullscreen command
Hi, unfortunately I do not find documentation and can't manage to get it understand from code: I know there is a built-in command 'fullscre...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.