TinyMCE 内联拖放图像上传不起作用 [英] TinyMCE Inline Drag and Drop Image Upload Not Working

查看:106
本文介绍了TinyMCE 内联拖放图像上传不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将一个 TinyMCE 编辑器的工作实例与拖放图像上传放在一起,如果将图像放入 TinyMCE 编辑器(或粘贴),它将触发将图像上传到服务器,并且该图像现在会在编辑器中.

I had put together a working instance of a TinyMCE editor with drag and drop image upload where if an image is dropped into the TinyMCE editor (or pasted) it would trigger an upload to the server with the image and said image would now be in the editor.

该功能突然停止工作.我得到的只是这个错误消息:不支持丢弃的文件类型"

That functionality suddenly stopped working. All I get is this error message: "Dropped file type is not supported"

此外,TinyMCE 网站上的该功能示例似乎也不再适用于相同的错误消息.

In addition it seems that the example of that functionality on the TinyMCE website also no longer works with the same error message.

浏览器或 TinyMCE 代码是否有任何更改导致它停止工作?即使 TinyMCE 版本未受影响,如果它突然停止工作,这似乎与 TinyMCE 代码无关.

Was there a change in either browsers or the TinyMCE code that made this stop working? It seems to be something not TinyMCE code related if it suddenly stopped working even though the TinyMCE version was untouched.

粘贴似乎有效,粘贴后图像上传成功.但是拖放仍然失败.这是直接拖放到编辑器中,而不是拖放到工作正常的上传图片对话框中.

Paste appears to work, and the image uploads successfully when pasted. However drag and drop still fails. This is dragging and dropping directly into the editor not into the upload image dialog which works fine.

推荐答案

我认为您的问题可能与自 TinyMCE 5.4 以来存在的 block_unsupported_drop 选项有关,请参阅 https://www.tiny.cloud/docs/configure/file-image-upload/#block_unsupported_drop.

I think your problem might be related to the block_unsupported_drop option that exists since TinyMCE 5.4, see https://www.tiny.cloud/docs/configure/file-image-upload/#block_unsupported_drop.

我注意到了与您相同的问题(不支持丢弃的文件类型" 通知)并验证了如果我将 block_unsupported_drop 设置为 false(内联模式下的 TinyMCE 5.5).

I noticed the same problem as you ("Dropped file type is not supported" notification) and verified it no longer exists for me if I set block_unsupported_drop to false (TinyMCE 5.5 in inline mode).

这是 TinyMCE 中的相关代码:

That's the relevant code in TinyMCE: https://github.com/tinymce/tinymce/blob/91e7f357ca8db3aeaa6f48c7efa97eb8c5c39fbb/modules/tinymce/src/core/main/ts/DragDropOverrides.ts#L281-L297

老实说,我不太明白在什么情况下可能需要防止删除,但看起来这个选项是作为删除图像后浏览器导航错误修复的一部分引入的(https://github.com/tinymce/tinymce/commit/c0205609360a1adb7e3d9061f043009b686a8ca1366c5如果您了解更多信息,请告诉我.

To be honest, I don't quite understand under what circumstances preventing the drop might be required, but it looks like the option was introduced as part of a fix for faulty browser navigation after dropping images (https://github.com/tinymce/tinymce/commit/c020562dadb7e3d9061f043009b686a8ca1366c5). Let me know if you find out more.

这篇关于TinyMCE 内联拖放图像上传不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆