How to get the canvas wrapper rows, columns & controls details within the JSON data format?
Question
Hi, Thanks for your plugin. how can i get the dropped controls, rows & columns information like json data while click the save button. Herewith i have attached my code. kindly do the needful?
mounted () {
this.editor = grapesjs.init({
container: '#gjs',
plugins: ['gjs-preset-webpage', 'gjs-blocks-basic'],
pluginsOpts: {
'gjs-blocks-basic': {
blocks: ['column1', 'column2', 'column3', 'column3-7', 'text', 'link', 'image', 'video', 'map'],
}
},
contentTypeJson: true,
// canvas: {
// styles: ['https://unpkg.com/element-ui/lib/theme-chalk/index.css'],
// scripts: ['https://unpkg.com/element-ui/lib/index.js']
// }
})
this.editor.Panels.addButton('options', {
id: 'saveBtn',
className: 'fa fa-floppy-o',
command: 'save-db',
attributes: {
'title': 'Save',
'data-tooltip-pos': 'bottom',
},
})
this.editor.Commands.add('save-db', {
run: function (editor, sender) {
editor.store()
sender && sender.set('active')
editor.on('storage:store', function (e) {
console.log('Stored ', e.components)
})
// editor.on('storage:load', function (e) {
// console.log('Loaded ', e)
// })
}
})
// console.log(storageManager)
// let storageManager = this.editor.StorageManager
// storageManager.add('local2', {
// store: function (data, clb) {
// for (let key in data) {
// console.log(key, data[key])
// }
// }
// })
}
Answers (2)
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.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1525
How to get data from forms in grapesjs
Hello All, I am using Forms block in grapejs and using grapesjs with angular 6. but i am not getting that how can i get data from forms whi...
Issue #898
editor.getHtml() outside the iframe of grapesjs.
How should I get the getHtml() outside the grapesjs editor. I have a save button outside the iframe of editor. I am not getting the current...
Issue #580
[Question] Any/Trigger event when any block is dropped inside canvas?
Hey, How can I trigger some event when any new block or content inside canvas is updated? Something like editor.onCanvasUpdate() Thanks!
Issue #1312
Submission of form in grapesjs
Hi, You build such a beautiful editor with forms and social icons with all stuff thanks for your great work. I build a form with grapesjs h...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.