简体   繁体   中英

C# Blazor - Draggable stops ability to highlight text

I have something like the following:

<div class="outer" ondragover="event.preventDefault();">
  @foreach (CustomObject o in ObjectList)
  {
     <div draggable="true" @key="o.Rank" @ondrag="@(()=> StartDrag(o))" @ondrop="@(()=> Drop(o))" class="inner">
        <textarea></textarea>
        <input type="text">
        <button></button>
        <textarea></textarea>
     </div>
  }
</div>

I want to be able to drag and drop the whole section but the problem is that it stops allowing the highlighting of text within a text area or text box.

Is there a good way of allowing for highlighting of text and being able to drag/drop everything?

Try using these settings on inner elements

<div draggable="true" @key="o.Rank" @ondrag="@(()=> StartDrag(o))" @ondrop="@(()=> Drop(o))" class="inner">
           <textarea draggable="true"
           ondragstart="event.preventDefault();
                        event.stopPropagation();"></textarea>     
        <input type="text" draggable="true"
           ondragstart="event.preventDefault();
                        event.stopPropagation();">
        <button draggable="true"
           ondragstart="event.preventDefault();
                        event.stopPropagation();"></button>
        <textarea draggable="true"
           ondragstart="event.preventDefault();
                        event.stopPropagation();"></textarea>
     
     </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM