[question] how to add script for all widgets(like protectedCss)
Question
I want to add some functions for all components accessible. when initialize editor, there is a option like protectedCss. Isn't there a way javascript like above?
Answers (3)
You can initialize custom js in the canvas in this way:
const editor = grapesjs.init({
...
canvas: {
scripts: ['https://.../script.js']
}
});
Thank you. Btw what I want to need is inline javascirpt. not external link... regards.
In that case, I suggest you access the document of the iframe and to append manually the inline script (to get the document use editor.Canvas.getDocument())
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2404
Question: how to observe children changes in component
Is there an easy way to subscribe/listen to changes in the components/children of my custom component type? Perhaps an event I can subscrib...
Issue #2950
Edit panels styles (rookie question)
Hi all, I would like to get some guidance about the code I should add/edit in order to change the way panels look. In general, I will need...
Issue #1632
[QUESTION] control table cell (add row, column..)
Hello. I want to dev some of feature to control the table. There are many feature for table the other editor like add columns, rows, set co...
Issue #1066
[QUESTION] Get content with inline CSS
I've been looking for some explanation and I found that some email clients blocks CSS... I would like to know if is there some way to get e...
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.