GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.37k stars 4.05k forks source link

Script tag on component after save and reload runs infinit #348

Closed sonnylloyd closed 7 years ago

sonnylloyd commented 7 years ago

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 . 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, });

sonnylloyd commented 7 years ago

Sorry head was in the clouds yesterday. i placed the script tag in the wrong place

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.