[QUESTION] Add html, css and js to Block Manager
See original GitHub issue[QUESTION]
Hi! I’m retrieving dynamic html,css and js codes from the database. How can I create Blocks with this? Currently, this is my code,
editor.BlockManager.add($aBlock['name'], {
id: $aBlock['name'],
label: $aBlock['name'],
category: $aBlock['category'],
content: $aBlock['html'],
style: $aBlock['css'],
script: $aBlock['css'],
});
But its not working. Please help. Thank you.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
episerver - Insert HTML, CSS and JavaScript in a block
Is it possible to inject a HTML, CSS and JavaScript into a block in EPIServer? I tried to add some HTML and it...
Read more >Add CSS and JS that is not block-related using BEMHTML
Basically I would like to know how to be able to add custom CSS for a webpage that isn't directly block related. For...
Read more >Introducing Runnable JavaScript, CSS, and HTML Code ...
So we've created our own way to embed runnable JavaScript, CSS, and HTML code blocks right in the body of a post.
Read more >Adding custom code to your site - Squarespace Help Center
Ways to add custom code ; Code block (Advanced), Business and Commerce plans. CSS HTML iframes JavaScript. Markdown. Add code to a specific...
Read more >Organizing your CSS - Learn web development | MDN
A good tip is to add a block of comments between logical sections in your stylesheet too, to help locate different sections quickly...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@cristianumali22 your code looks fine and it is not executed before grapesjs initialization because you are passing the reference and not actually calling it! i suggest using the grapesjs cli because it is doing all the setups for you and providing you with a nice and clean environment. Cheers!
Hi @pouyamiralayi , thus, doing,
content: '<div></div><style></style>'
will seperate the HTML from CSS in the download code feature of GrapesJS?Note that in every blocks of code, there is different HTML, CSS and JS. Is the css of, example block_1, will not affect the style of block_2?