Issue #999Opened April 3, 2018by maha83port0 reactions

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)

lock[bot]September 17, 20190 reactions

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.