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.38k stars 4.06k forks source link

[QUESTION] How do I block the insertion of a block inside another block? #2577

Closed dskarasev closed 4 years ago

dskarasev commented 4 years ago

Please tell me how do I prevent inserting a block inside another block? I use the editor to create the internal structure of an article for a WEB site. Grapejs building blocks are not used. All custom blocks are added via the configuration editor.BlockManager.add I will be grateful if you can tell me how to do that. Thanks!

pouyamiralayi commented 4 years ago

@dskarasev you can define custom component type and control the dragging using draggable property:

model: {
    // Default properties
    defaults: {
      tagName: 'input',
      draggable: 'form, form *', // Can be dropped only inside `form` elements
      droppable: false, // Can't drop other elements inside
    }
  }

Cheers!