grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

insert element or block inside parent element

Open vladbpython opened this issue 8 years ago • 3 comments

Good day, i have component, have block

editor.BlockManager.add("bootstrap-container", {
     attributes: {class: "gjs-fonts gjs-f-b1 gjs-block gjs-one-bg gjs-four-color-h"},
     category: "test",
     label: "Test",
     content: '<div class="container" style="min-height:10px;"></div>'
   });

i have Trait on listen changes, how can I add "h1 " inside that block "'<div class="container" style="min-height:10px;"></div>". How to add tag inside this model like:

doStuff(){
                 var coll = this.collection;
                 var at = coll.indexOf(this)
                  coll.add('<h1>Hello world</h1>', { at });
}

vladbpython avatar Apr 12 '18 13:04 vladbpython

Given the current model you can add other components in this way model.components('<h1>Hello world</h1>')

artf avatar Apr 14 '18 12:04 artf

@vladbpython hi,do you solve this problem?i also want to know how to drag one element into parent element.

ionic666 avatar May 08 '18 02:05 ionic666

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.

lock[bot] avatar Sep 17 '19 16:09 lock[bot]