Edit Template into Database, need help with urlLoad
Question
@arthuralmeidap @artf @cmcintosh
I am trying to edit a existing template in the database,
I am unable to send the template data and id to the view
var id = '<?php echo $this->uri->segment(4); ?>';
var editor = grapesjs.init
({
height: '100%',
container : '#gjs',
plugins: ['gjs-preset-newsletter'],
storageManager:
{
type: 'remote',
autosave: false,
//urlStore: 'dragdrop/edit/id',
urlLoad: 'dragdrop/edit/id',
contentTypeJson: true,
},
});
editor.Panels.addButton
('options',
[{
id: 'save-db',
className: 'fa fa-floppy-o',
command: 'save-db',
attributes: {title: 'Draft'}
}]
);
// Add the command
editor.Commands.add
('save-db',
{
run: function(editor, sender)
{
sender && sender.set('active'); // turn off the button
editor.store();
alert('Draft');
// editor.on('storage:load', function(e) {
// console.log('Loaded ', e);
// });
// editor.on('storage:store', function(e) {
// console.log('Stored ', e);
// });
}
});
I have this structure in my db :
<table style="width:100%"> <tr> <th>id</th> <th>template-name</th> <th>template-data</th> </tr> <tr> <td>1</td> <td>first</td> <td>{"gjs-assets":"[]","gjs-css":"*{box-sizing: border-box;}body{margin:0;}","gjs-styles":"[]","gjs-html":"\"components\":[]},</td> </tr> </table>Answers (2)
@mekamleshk we're already talking about this here #368 there is no need to create another issue with the same content, thanks
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 #384
Create and Edit Template into Database
This is my code to Create a new template and insert the inline html with style into the database : I am able to insert the template-data in...
Issue #873
[Need help]: After using urlLoad from storage manager impossible to change component with Traits
Hello, I am save template to db and after loading from db impossible to change component with Traits. Video example on countdown: https://y...
Issue #387
Want to save template name
Hi @artf @sonnylloyd @arthuralmeidap @cmcintosh I am trying to store template name, but not sure how to pass the template name along with t...
Issue #1761
[Question] how to defined textNoElement value after grapesjs.init
Hi, I try to define the values for textNoElement after I was initialized a grapesjs. but it not reflected in grapesjs UI. can anyone please...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.