mdx-editor / editor

A rich text editor React component for markdown
https://mdxeditor.dev
MIT License
1.91k stars 145 forks source link

[BUG] Remove dropEffect/effectAllowed when drag is not permitted #551

Open rissois opened 2 months ago

rissois commented 2 months ago

Note: this is related to PR #549, which is currently under review.

When no imageUploadHandler is provided, users are blocked from dropping file system images into the document. However, the UX still includes the (+) dropEffect. The solution should look something like:

if (event.dataTransfer) {
  event.dataTransfer.dropEffect = "none"
  event.dataTransfer.effectAllowed = "none"
}

Unfortunately, Lexical only seems to expose the DRAGOVER_COMMAND, and does not have a dragenter. I believe both are required to eliminate the effect, unless I am mistaken.

petyosi commented 2 months ago

That would be a nice enhancement. If you have the capacity, you can open a PR in the Lexical project, from my experience they are quite welcoming to such changes.