CDN And Script on Editor #6205
Unanswered
templeajuzie
asked this question in
Q&A
Replies: 2 comments 2 replies
-
The |
Beta Was this translation helpful? Give feedback.
2 replies
-
Here's a live demo vid1.mp4 |
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 currently working on a NextJS project where I’m using GrapesJS as the core tool for building templates and I am impressed with the flexibility and power grapejs offers.
However, I’ve encountered a challenge while integrating CDN into GrapesJS, for example, preline script cdn. I would appreciate your guidance on the correct way to add this feature.
i tried this method,
const editor = grapesjs.init({
fromElement: true, // Allow components from HTML
container: "#editor",
canvas: {
scripts: [
{
src: "https://cdn.jsdelivr.net/npm/preline@2.5.0/dist/preline.min.js",
type: "module",
},
],
},
})
and but method,
const editor = grapesjs.init({
fromElement: true, // Allow components from HTML
container: "#editor",
canvas: {
scripts: [
"https://cdn.jsdelivr.net/npm/preline@2.5.0/dist/preline.min.js",
],
},
})
but the functionality is not working.
Also when I inject a script through block manager, that shows alert("hello") when draged to the editor, it will work, but when I save the data to my db and refresh the editor, the loaded data coming into the canvas will no longer have the functionality of the alert.
Beta Was this translation helpful? Give feedback.
All reactions