{"action":"closed","issue":{"url":"https://api.github.com/repos/artf/grapesjs/issues/931","repository_url":"https://api.github.com/repos/artf/grapesjs","labels_url":"https://api.github.com/repos/artf/grapesjs/issues/931/labels{/name}","comments_url":"https://api.github.com/repos/artf/grapesjs/issues/931/comments","events_url":"https://api.github.com/repos/artf/grapesjs/issues/931/events","html_url":"https://github.com/artf/grapesjs/issues/931","id":303247645,"number":931,"title":"[Question] Problems saving to DB","user":{"login":"altemberg","id":4732718,"avatar_url":"https://avatars2.githubusercontent.com/u/4732718?v=4","gravatar_id":"","url":"https://api.github.com/users/altemberg","html_url":"https://github.com/altemberg","followers_url":"https://api.github.com/users/altemberg/followers","following_url":"https://api.github.com/users/altemberg/following{/other_user}","gists_url":"https://api.github.com/users/altemberg/gists{/gist_id}","starred_url":"https://api.github.com/users/altemberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/altemberg/subscriptions","organizations_url":"https://api.github.com/users/altemberg/orgs","repos_url":"https://api.github.com/users/altemberg/repos","events_url":"https://api.github.com/users/altemberg/events{/privacy}","received_events_url":"https://api.github.com/users/altemberg/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-07T20:27:50Z","updated_at":"2018-03-08T13:31:13Z","closed_at":"2018-03-08T13:31:13Z","author_association":"NONE","body":"Hi,\r\n\r\nI'm having some problems saving the template in the database and I'm not exactly sure why this is happening.\r\n\r\nI've read all the issues here and still can not save, there are always 3 things: Save it blank, save the array value or save a JSON with tens of bars between each value.\r\n\r\nMy code looks like this:\r\n```\r\nvar editor  = grapesjs.init({\r\n...\r\nstorageManager: {\r\n    type: 'remote',\r\n    stepsBeforeSave: 10,\r\n    autosave: false,\r\n    urlStore: \"http://domain.com/api/save\",\r\n    urlLoad: \"http://domain.com/api/load\",\r\n    contentTypeJson: true,\r\n  },\r\n});\r\n\r\neditor.Panels.addButton('options',\r\n  [{\r\n    id: 'save-db',\r\n    className: 'fa fa-floppy-o',\r\n    command: 'save-db',\r\n    attributes: {title: 'Save DB'}\r\n  }]\r\n);\r\n\r\neditor.Commands.add('save-db', {\r\n  run: function(editor, sender){\r\n    sender && sender.set('active',0);\r\n    editor.store();\r\n    editor.on('storage:load', function(e) {\r\n      console.log('Loaded ', e);\r\n    });\r\n    editor.on('storage:store', function(e) {\r\n      console.log('Stored ', e);\r\n    });\r\n  }\r\n});\r\n\r\n// I have also tried this and some other ways\r\n// editor.Commands.add('save-db', {\r\n//   run: function(editor, sender){\r\n//     sender && sender.set('active',0);\r\n//     const RemoteStorage = editor.StorageManager.get('remote');\r\n//     RemoteStorage.set('params', {\r\n//       code: editor.store()\r\n//       // other parameters\r\n//     });\r\n//     editor.store();\r\n//     editor.on('storage:load', function(e) {\r\n//       console.log('Loaded ', e);\r\n//     });\r\n//     editor.on('storage:store', function(e) {\r\n//       console.log('Stored ', e);\r\n//     });\r\n//   }\r\n\r\n});\r\n```\r\n\r\nWhen it is saved that way it returns on the console, I believe everything is correct and I have some problem just saving the codes, because I inserted some parameters and I can save them in the DB without any problem.\r\n![console.log storage:store Printscreen](https://prnt.sc/io8b2y)"}}
{"actor":{"display_login":"artf"}}