GrapesJS / components-forms

Set of form components and blocks for the GrapesJS editor
BSD 3-Clause "New" or "Revised" License
70 stars 58 forks source link

component with a script block #9

Closed kickbk closed 4 years ago

kickbk commented 4 years ago

I am trying to create a component that will run a script on an input type:

domc.addType('myInput', {
    model: inputType.model.extend({
        defaults: {
            ...inputModel.prototype.defaults,
            'custom-name': c.labelMyInputName,
            tagName: 'myInput',
            traits: [...],
            script() {
                console.log("HERE");
            },
        },
    },
    ...

I'm expecting script() to execute, just like you have it on your Slider component, but it doesn't. Am I supposed to define something somewhere else so the script block will work?