mirror of https://github.com/artf/grapesjs.git
4 changed files with 95 additions and 20 deletions
@ -1,23 +1,44 @@ |
|||||
|
import { createEl } from '../../utils/dom'; |
||||
|
|
||||
export default { |
export default { |
||||
run(editor, sender) { |
open() { |
||||
const bm = editor.BlockManager; |
const { container, editor, bm } = this; |
||||
const pn = editor.Panels; |
|
||||
|
|
||||
if (!this.blocks) { |
if (this.firstRender) { |
||||
bm.render(); |
|
||||
const id = 'views-container'; |
const id = 'views-container'; |
||||
const blocks = document.createElement('div'); |
const pn = editor.Panels; |
||||
const panels = pn.getPanel(id) || pn.addPanel({ id }); |
const panels = pn.getPanel(id) || pn.addPanel({ id }); |
||||
blocks.appendChild(bm.getContainer()); |
panels.set('appendContent', container).trigger('change:appendContent'); |
||||
panels.set('appendContent', blocks).trigger('change:appendContent'); |
if (!bm.getConfig().custom) container.appendChild(bm.render()); |
||||
this.blocks = blocks; |
} |
||||
|
|
||||
|
if (container) container.style.display = 'block'; |
||||
|
}, |
||||
|
|
||||
|
close() { |
||||
|
const { container } = this; |
||||
|
if (container) container.style.display = 'none'; |
||||
|
}, |
||||
|
|
||||
|
run(editor, sender) { |
||||
|
const bm = editor.Blocks; |
||||
|
this.firstRender = !this.container; |
||||
|
this.container = this.container || createEl('div'); |
||||
|
this.editor = editor; |
||||
|
this.bm = bm; |
||||
|
const { container } = this; |
||||
|
bm.__behaviour({ |
||||
|
container |
||||
|
}); |
||||
|
|
||||
|
if (bm.getConfig().custom) { |
||||
|
bm.__trgCustom(); |
||||
} |
} |
||||
|
|
||||
this.blocks.style.display = 'block'; |
this.open(); |
||||
}, |
}, |
||||
|
|
||||
stop() { |
stop() { |
||||
const blocks = this.blocks; |
this.close(); |
||||
blocks && (blocks.style.display = 'none'); |
|
||||
} |
} |
||||
}; |
}; |
||||
|
|||||
Loading…
Reference in new issue