Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复外部文件拖拽在firefox浏览器或自定义handler时无法工作 #1098

Merged
merged 1 commit into from
Oct 23, 2021

Conversation

myml
Copy link
Contributor

@myml myml commented Oct 21, 2021

firefox浏览器的文件拖拽事件types属性为["application/x-moz-file","Files"]
在代码中使用types[0]="Files"判断是否为文件拖拽,这导致在firefox上无法识别文件拖拽

因为判断了url为空则不执行传,当使用upload.handler自定义上传处理函数,文件拖拽无法正常工作。

firefox浏览器的文件拖拽事件types属性为["application/x-moz-file","Files"]
在代码中使用types[0]="Files"判断是否为文件拖拽,这导致在firefox上无法识别文件拖拽

因为判断了url为空则不执行上传,当使用upload.handler自定义上传处理函数,文件拖拽无法正常工作.
@@ -1410,7 +1410,7 @@ export const paste = async (vditor: IVditor, event: (ClipboardEvent | DragEvent)
processPaste(vditor, vditor.lute.HTML2Md(tempElement.innerHTML).trimRight());
}
vditor.outline.render(vditor);
} else if (files.length > 0 && vditor.options.upload.url) {
} else if (files.length > 0 && (vditor.options.upload.url||vditor.options.upload.handler)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有 url ,有 handler 也没有用吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handler并不需要url配置呀,handler里可以用任意方式上传文件,比如我就是在handler里用angular的httpclient上传文件再把文件地址插入到编辑器中。

@Vanessa219 Vanessa219 merged commit 3ad31a0 into Vanessa219:dev Oct 23, 2021
@Vanessa219 Vanessa219 added this to the 3.8 milestone Oct 23, 2021
Vanessa219 added a commit that referenced this pull request Oct 23, 2021
izgzhen pushed a commit to chafan-dev/vditor that referenced this pull request Dec 11, 2021
firefox浏览器的文件拖拽事件types属性为["application/x-moz-file","Files"]
在代码中使用types[0]="Files"判断是否为文件拖拽,这导致在firefox上无法识别文件拖拽

因为判断了url为空则不执行上传,当使用upload.handler自定义上传处理函数,文件拖拽无法正常工作.
izgzhen pushed a commit to chafan-dev/vditor that referenced this pull request Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants