Dynamically attach CDN(external resources) to canvas head #grapesjs #attach #cdn #external #resources
Question
Dear artf
I'm trying to add feature to my application, for end user. It's a tool for - Dynamically adding CSS and JS CDN-s. Like in jsFiddle or Codepen, when we add external resources(css/js) CDN-s. That means, that after adding a link for js, or css, it will appear in Canvas iFrames head. Unfortunately I couldn't find any way to do that.
- I can't use canvas: { scripts: ['......'], }, because the end user will be able to add CDN in process of making his tamplate
- I can't append to canvas head, because it's simply won't save it.
So, what to do? Any solutions? Any packages?
@artf
Answers (1)
You if need to save dynamic css/js inside the template you have to append them to the body (eg. editor.addComponents('<script src="...">..')) if you need them outside the template (which manages ONLY the body), like in the <head>, you can append even manually to the canvas but it's up to you storing/loading them to the user
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2667
link element not append in head element in ediot.canvas #firefox #grapesjs
am trying to add google fonts in web-builder to change the font style for that to import am adding cdn in editor the code works in chrome a...
Issue #3083
[Feature]: Highlight drop zones
Hi @artf , How would you recommend highlighting the components on the canvas that the selected block can be dropped into based on draggable...
Issue #3100
Adding external libraries after dragging custom block
Hi, I am customizing GrapesJS by creating components/blocks my users can drag onto the canvas. A number of these blocks depend upon externa...
Issue #1614
[Bug]: adding css variables as style manager property
trying to add css variable to style manager causing error: Uncaught TypeError: Cannot read property 'toUpperCase' of undefined fiddle Am i...
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.