notadd / neditor

基于 ueditor的更现代化的富文本编辑器,支持HTTPS
https://demo.neditor.notadd.com/
MIT License
1.91k stars 267 forks source link

涂鸦上传报错解决办法 #122

Closed Skqing closed 5 years ago

Skqing commented 5 years ago

Neditor-2.1.16 涂鸦上传遇到错误如下:

jquery.min.js:4 Uncaught TypeError: Illegal invocation
    at e (jquery.min.js:4)
    at Gb (jquery.min.js:4)
    at Function.n.param (jquery.min.js:4)
    at Function.ajax (jquery.min.js:4)
    at Object.uploadScraw (neditor.service.js:174)
    at exec (scrawl.js:644)
    at baidu.editor.ui.Dialog.dialog.onok (scrawl.html:92)
    at baidu.editor.ui.Dialog.onclose (neditor.all.js:30112)
    at baidu.editor.ui.Dialog.fireEvent (neditor.all.js:1719)
    at baidu.editor.ui.Dialog.close (neditor.all.js:30506)

解决方法为,在neditor.service.js178行增加配置: 原来:

$.ajax({
                url: url,
                type: 'POST',
                data: formData
            })

修改后:

$.ajax({
                url: url,
                type: 'POST',
                //ajax2.0可以不用设置请求头,但是jq帮我们自动设置了,这样的话需要我们自己取消掉
                contentType: false,
                //取消帮我们格式化数据,是什么就是什么
                processData: false,
                data: formData
            })

亲测有效!

Skqing commented 5 years ago

已修复 Release for v2.1.17