Issue #2552✓ SolvedOpened February 6, 2020by kickbk2 reactions

Only allow one component to be dropped

Quick answerby pouyamiralayi2

#25151 #25152

Read full answer below ↓

Question

Sorry for the newbie question, but say I have a text field component and I only want to allow the user to drop a specific number of them into the canvas, say just one. How do I limit it? Perhaps a way that shows an alert to explain they cannot add another text field component to the canvas unless they remove the existing one?

Answers (2)

👍 Most helpfulpouyamiralayiFebruary 13, 2020
kickbkFebruary 6, 2020

So I have a very ugly solution right now: This basically looks whether the component is in the canvas on load. If it is then it hides the draggable component button - Here I could use a better way to hide the button - how? I can get to the component with const form = editor.BlockManager.get('form')...

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.