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

Stop attributes from being editable #23

Closed TheDude70 closed 2 years ago

TheDude70 commented 3 years ago

Implemented using this plugin and have it working fine by setting a fixed value for both action and method on the form. When adding the block to the canvas I have disable showing the traits under Settings so the user cannot edit the method and action. However after saving the page and reloading those attributes are now available to be edited. How can I prevent those from showing up under Settings for the form?

I have tried to override the traits and attributes, but to no effect. In the editor.on('load') I have:

editor.DomComponents.addType('form', {
          model: {
            defaults: {
              traits: [],
              attributes: {}
            }
          }
        })
artf commented 2 years ago

I guess the issue here is placing your code in editor.on('load') which is executed once the content is loaded in the editor. Just move your code in a plugin, right after the form one and the component will be extended properly.