Issue #443Opened October 21, 2017by roytang0 reactions

Is it possible to restrict that only one of a certain component can be added to the canvas?

Question

We want to define a custom component that may or may not be added into the HTML, but we want to disallow adding more than one of that component. Can this restriction be done in GrapesJS?

Answers (2)

artfOctober 23, 20170 reactions

Not something built-in, but definitely achievable by using the GrapesJS's API Extremely easy would be adding a listener (eg, change:changesCount), search your component and then apply your logic

editor.on('change:changesCount', () => {
     editor.getComponents().each(model => ...)
})
lock[bot]September 18, 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.