Script tag on component after save and reload runs infinit
Question
I am in the middle of working on some custom components/blocks. To achieve this i have been using the api docs and using your grapejs plugins as examples. This file in particular [https://github.com/artf/grapesjs-navbar/blob/master/src/components.js](url) . The issue i have is on save and reloading of the page. the script tag runs infinity. Here is my code just in case its me.
` domc.addType('iconbox', {
model: defaultModel.extend({
defaults: Object.assign({}, defaultModel.prototype.defaults, {
draggable: '.col',
droppable: false,
copyable: false,
removable: false,
script: function () {
console.log('script is called');
},
traits: [{
type: 'select',
label: 'Choose Icon',
name: 'choose-icon',
options: c.iconList,
},
{
type: 'textbox',
label: 'description',
name: 'description',
value: c.description
},
{
type: 'select',
label: 'Title Tag',
name: 'title-tag',
options: c.titeTags,
}
]
}),
},
{
isComponent: function(el) {
if (hasClass(el, 'btsc-iconbox')) {
return {
type: 'iconbox'
};
}
},
}),
// Define the View
view: defaultType.view,
});`Answers (0)
No answers yet.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #792
Script property using function don't work with blocks
In Components & JS docs there's this example: This works perfectly. But I couldn't use a function instead of a string in script, as is said...
Issue #774
Mimic customRTE behavior when parsing content
Hi @artf, I'd like to replicate this behavior when calling editor.setComponents("<div>This is a text component. <span style='font-size: 20p...
Issue #1786
Not able to add the random id to the custom blocks i am adding
WARNING READ and FOLLOW next 5 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Issue #1718
QUESTION The name entered in the Traits for checkbox label is not getting updated to my html custom components.
WARNING READ and FOLLOW next 5 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
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.