Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import template with <scrip> #36

Open
nuvolettablu opened this issue Apr 22, 2024 · 2 comments
Open

Cannot import template with <scrip> #36

nuvolettablu opened this issue Apr 22, 2024 · 2 comments

Comments

@nuvolettablu
Copy link

When importing a template that contains a script, the script portion is not imported. Even when using the "code" module, the result is the same.

This is despite enabling the allowScripts configuration option when initializing your GrapesJS editor.

const editor = grapesjs.init({
    ... // the rest of your GrapesJS config
    allowScripts: 1,
});

Any ideas?
Thanks.
S.

@quentin-bettoum
Copy link

quentin-bettoum commented May 20, 2024

This allowScripts parameter has apparently been deprecated.

You should try this:

grapesjs.init({
  ...
  parser: {
    optionsHtml: {
      allowScripts: true,
    },
  },
});

@Baki995
Copy link

Baki995 commented Nov 26, 2024

I fixed it with this configuration

const editor = grapesjs.init({

...
allowScripts: 1,
plugins: [
    'grapesjs-custom-code'
],
pluginsOpts: {
    placeholderScript: '',
}

});

And in my component added this
editor.Components.removeType('script');

Because this package remove any script (https://github.com/GrapesJS/components-custom-code/blob/master/src/components.ts#L15)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants