Issue #348Opened September 28, 2017by sonnylloyd0 reactions

Script tag on component after save and reload runs infinit

Question

Code SnippetTEXT
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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.