[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)
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/
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 #1009
[Question] Richtext editor for trait
Is there way to have richtext box for trait. We want to user to insert rich text for trait and not sure how can we do it. We have below use...
Issue #1864
[QUESTION] Best way to listen to changes on the final HTML?
Hi, I just had a quick question because I could not figure out how to do it or did not find an issue related to it. I am just trying to cal...
Issue #923
[Question]: Add a select-option to toolbar
I have read the code and only I could find out that there is only a list of ToolbarButton associated with the toolbar. I have a special tra...
Issue #1167
[QUESTION] export options
Hi @artf, Are there any other export options than HTML/CSS ? I'm thinking of a way to directly load the configuration from a remote server...
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.