-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[QUESTIONS] Custom Component disappear on Save (Vue.js) #2690
Comments
Hi @adamwpe ! Script tag importing is disabled by the default editor configuration, which explains why your scripts tags are stripped out by the HTML Parser, setting the grapesjs.init({
// [...]
allowScripts: true,
// [...]
}); Hope this helps :) |
Hi @mcottret Thanks for the reply, but it was already set to true, forgot about that variable :( This is my example init:
Interestingly, If I change the component script from an object to a string: It works!?! Instead of: Is that expected behavior? If so, what's the workaround (Apart from keeping it a string :))? Thanks again for the reply 👍 |
I don't know, according to the docs both approaches should be valid so that might be a bug. I'll try looking into it, unless someone finds an answer in the meantime. Cheers ! |
@adamwpe i believe you are not using the latest version! |
I'm using V 0.16.3: https://cdnjs.cloudflare.com/ajax/libs/grapesjs/0.16.3/grapes.min.js Thanks |
The |
@artf Sorry, not too sure what you mean that it's stored in the JSON. What do I need to do differently? Do I need to append the canvas like this?
or something like this (If so, where do I put the content?):
|
@adamwpe we had something like this in the past i apologize for not seeing it through!
there is no need to extend from dView & dModel in the latest versions. |
Thanks for that, pointed me in the right direction - so he is an example that works for me for rending a Vue Component and it will load back in :), but sure may be useful for someone else:
Thanks for the help everyone! |
Hi All,
I'm trying to test adding some custom Vue.js components to the block manager, and at first appearance, all is well - it renders correctly and vue components are responsive.
But if I save the template, and reload my page, and supply the storageManager with 'gjs-style', 'gjs-components', 'gjs-html', 'gjs-css'.
The custom component no longer renders. It appears the the storageManager removes any script tags???? As if I check my REST GET request, 'gjs-html' does contain the <script> tag.
Before Saving:
After Reloading Loading:
Not too sure something is wrong with my component:
`
editor.BlockManager.add("vueApp", {
label: "Vue App",
category: 'Basic',
id: "default-vue-app",
content: {
script: function() {
`
Have anyone tried using Vue.js components?
The text was updated successfully, but these errors were encountered: