功能:禁止用户拖拽内容进编辑器
#303
-
需求描述因为我是用了customPaste过滤用户的输入,但是用户可以拖拽一些文字图片进编辑器,拖拽的内容不会通过customPaste过滤,像请教一下怎么禁止拖拽内容进入编辑器 相关 issue |
Beta Was this translation helpful? Give feedback.
Answered by
cycleccc
Oct 29, 2024
Replies: 2 comments
-
拖拽的逻辑在这里处理,针对你的这个情况可能需要另开放一个配置控制禁止拖拽。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
根据容器 id 自行禁止拖拽事件如: document.getElementById('editor-text-area').addEventListener(
'drop',
(e) => {
e.preventDefault();
e.stopPropagation();
},
{ capture: true }
);
document.getElementById('editor-text-area').addEventListener(
'dragover',
(e) => {
e.preventDefault();
e.stopPropagation();
},
{ capture: true }
); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
cycleccc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
根据容器 id 自行禁止拖拽事件如: