Ju99ernaut/grapesjs-template-manager

Create button is not working. Unable to create new template.

NagarRahul opened this issue · 1 comments

image

I am using this code-
head>


<script src="https://unpkg.com/grapesjs"></script>
<script src="https://unpkg.com/grapesjs-template-manager"></script>

<script> const editor = grapesjs.init({ container: '#gjs', height: '100%', fromElement: true, storageManager: { type: 'indexeddb', // ... }, plugins: ['grapesjs-template-manager'], });
    // Running commands from panels
    const pn = editor.Panels;
    const panelOpts = pn.addPanel({
        id: 'options'
    });
    panelOpts.get('buttons').add([{
        attributes: {
            title: 'Open Templates'
        },
        className: 'fa fa-file-o',
        command: 'open-templates',//Open modal 
        id: 'open-templates'
    }, {
        attributes: {
            title: 'Save As Template'
        },
        className: 'fa fa-archive',
        command: 'save-as-template',//Save page as template
        id: 'save-as-template'
    }, {
        attributes: {
            title: 'Delete Template'
        },
        className: 'fa fa-trash-o',
        command: 'delete-template',//Delete open page or template
        id: 'delete-templates'
    }, {
        attributes: {
            title: 'Take Screenshot'
        },
        className: 'fa fa-camera',
        command: 'take-screenshot',//Take an image of the canvas
        id: 'take-screenshot'
    }]);
</script> @Ju99ernaut @tboulogne @walking-dev 

The create button should only work if you've got a template selected, since you don't have any templates yet you should be prompted to create a blank template. Anyways I'm no longer maintaining the grapesjs-template-manager plugin so I won't be able to provide a fix on the version you're using if this is a bug, the plugin has been renamed and newer versions are now named grapesjs-project-manager since they make use of the new page manager api.

I'd recommend using the grapesjs-project-manager version of the plugin.