Issue #2254Opened September 9, 2019by eltoredo0 reactions

[QUESTION] New command with a header runs itself?

Question

Hello,

I would like to ask wether my code is ugly and makes my localhost version do something bad or I'm not using the commands add correctly. To be more accurate, wherever I put the 'header index.php', even in an event that shouldn't be executed by itself, I will still be headed to index.php whenever I go on my grapesjs editor.

Code SnippetTEXT
This is my code:

`editor.Panels.addButton('devices-c', [{ 
    	id: 'go-home', 
    	className: 'fa fa-home', 
        command: 'go-home',
    	attributes: { 
    		title: 'Go home' 
    	} 
    },]);`

`editor.Commands.add('go-home', {
        run: function(em, sender) {
            sender && sender.set('active');
            <?php header('Location: ./index.php'); ?>
        }
    });`

Moreover, I'd like to know how to add the button WHERE I want and not next to the devices buttons, I didn't find any answer on this!

Thanks for reading,
Tanguy.

Answers (0)

No answers yet.

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.