Issue #2274✓ SolvedOpened September 17, 2019by tom-sherman4 reactions

How to load children of a readonly component?

Quick answerby pouyamiralayi2

hi there! you can set draggable property of the target component this way: this way, it will only be draggable inside the Slot. the same can be done for readonly type. if you need further help for your specific case, i would appreciate a fiddle. cheers.

Read full answer below ↓

Question

I'm trying to mount a readonly component (draggable, droppable etc all set to false) and allow the user to edit child components inside.

For example if I have the following content

<div class="wrapper">
  <header>A header</header>

  <div>
    EDIT ME
  </div>

  <footer>A footer</footer>
</div>

I want to load all of this content inside of the component, and allow the user to drag new blocks where it would say "EDIT ME"

Answers (3)

👍 Most helpfulpouyamiralayiSeptember 18, 2019

hi there! you can set draggable property of the target component this way: this way, it will only be draggable inside the Slot. the same can be done for readonly type. if you need further help for your specific case, i would appreciate a fiddle. cheers.

pouyamiralayiSeptember 18, 2019

Hi there! if you mean injecting the component into the editor without user interactions, you can use: more on this hereallow the user to drag new blocks where it would say "EDIT ME" if you mean making the readonly component editable again, it is achievable this way: more on this here cheers!

tom-shermanSeptember 18, 2019

@pouyamiralayi Thanks! I've implemented a Slot component and overriding the attributes inside of the init method The issue I'm having now is that the use is able to drag an item above the readonly header for example. Is there a way to prevent this behaviour? I want to prevent items being dropped be...

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 →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.