“Drop event not firing in dynamic list – Svelte” 可以直接保留不翻译。

huangapple go评论62阅读模式
英文:

Drop event not firing in dynamic list - Svelte

问题

以下是您要翻译的内容:

"I have a dynamic list of contenteditables rendered in Svelte and want to be able to drag them to resort them but on:drop or on:dragover both don't seem to be firing. I was thinking it was because it thinks I am trying to drop it on the children elements but if I move those events to a child it still doesn't fire or show the correct cursor.

<div
  on:dragover|preventDefault={handleDragOver}
  on:dragenter|preventDefault={handleDragEnter}
  on:drop={handleDrop}
>
  <div
    on:dragstart={handleDragStart}
    on:dragend={handleDragEnd}
    draggable="true"
  >
    /* Child div here that looks like list bullet (where I want the user to hover to begin dragging */
    /* contenteditable div here */
  </div>
</div>

There is nothing actually happening in the functions each event is calling except a console.log() to see if it is firing. The events on the draggable div fire fine, but on the parent div I want it to drop to no events are fired. What am I missing?

Thanks in advance"

英文:

I have a dynamic list of contenteditables rendered in Svelte and want to be able to drag them to resort them but on:drop or on:dragover both don't seem to be firing. I was thinking it was because it thinks I am trying to drop it on the children elements but if I move those events to a child it still doesn't fire or show the correct cursor.

&lt;div
  on:dragover|preventDefault={handleDragOver}
  on:dragenter|preventDefault={handleDragEnter}
  on:drop={handleDrop}
&gt;
  &lt;div
    on:dragstart={handleDragStart}
    on:dragend={handleDragEnd}
    draggable=&quot;true&quot;
  &gt;
    /* Child div here that looks like list bullet (where I want the user to hover to begin dragging */
    /* contenteditable div here */
  &lt;/div&gt;
&lt;/div&gt;

There is nothing actually happening in the functions each event is calling except a console.log() to see if it is firing. The events on the draggable div fire fine, but on the parent div I want it to drop to no events are fired. What am I missing?

Thanks in advance

答案1

得分: 1

在这种情况下的问题是Tauri。我需要在tauri.conf.json文件中的"windows"下将fileDropEnabled设置为false。

英文:

The problem in this case was Tauri. I needed to set fileDropEnabled to false in tauri.conf.json under "windows".

huangapple
  • 本文由 发表于 2023年3月12日 10:40:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75710786.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定