Issue #1011Opened April 6, 2018by pg16710 reactions

[Question] Does grapejs provide variable selection in the UI

Question

I have just come across grapejs and it looks amazing but I cannot find good information on how to manage variables.

Is there are a way to give grapejs a list of allowed variables so the user can insert them easily through the UI when creating a template (editing text) or do they have to just type in the variable syntax where they need it, or am I expected to extend grapejs to add this functionality?

I could not see this feature in either of the demos and cannot see it mentioned in the documentation though I assumed it would be a fundamental feature.

thanks.

Answers (2)

artfApril 8, 20180 reactions

There is no such a built-in feature but you can easily extend grapesjs for it. If you're looking for the usage of variables during the text editing this snippet might help you.

You can also make use of Blocks to create draggable variables, eg:

editor.BlockManager.add('my-var-block', {
  label: 'Simple variable',
  content: '{{ SOME_VAR_EXAMPLE }}',
});

or even mixing them with custom Components to display variables differently inside the canvas. Quick example https://jsfiddle.net/jhf0rsbj/

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.