mirror of https://github.com/artf/grapesjs.git
2 changed files with 12 additions and 17 deletions
@ -1,29 +1,24 @@ |
|||
const $ = Backbone.$; |
|||
|
|||
module.exports = { |
|||
|
|||
run(editor, sender) { |
|||
var config = editor.Config; |
|||
var pfx = config.stylePrefix; |
|||
var bm = editor.BlockManager; |
|||
var panelC; |
|||
const bm = editor.BlockManager; |
|||
const pn = editor.Panels; |
|||
|
|||
if (!this.blocks) { |
|||
this.blocks = $('<div></div>').get(0); |
|||
bm.render(); |
|||
this.blocks.appendChild(bm.getContainer()); |
|||
var panels = editor.Panels; |
|||
if(!panels.getPanel('views-container')) |
|||
panelC = panels.addPanel({id: 'views-container'}); |
|||
else |
|||
panelC = panels.getPanel('views-container'); |
|||
panelC.set('appendContent', this.blocks).trigger('change:appendContent'); |
|||
const id = 'views-container'; |
|||
const blocks = document.createElement('div'); |
|||
const panels = pn.getPanel(id) || pn.addPanel({id}); |
|||
blocks.appendChild(bm.getContainer()); |
|||
panels.set('appendContent', blocks).trigger('change:appendContent'); |
|||
this.blocks = blocks; |
|||
} |
|||
|
|||
this.blocks.style.display = 'block'; |
|||
}, |
|||
|
|||
stop() { |
|||
if(this.blocks) |
|||
this.blocks.style.display = 'none'; |
|||
const blocks = this.blocks; |
|||
blocks && (blocks.style.display = 'none'); |
|||
} |
|||
}; |
|||
|
|||
Loading…
Reference in new issue