CKEditor 4.5 filetools,如何设置XHR.withCredentials = true,

scb*_*scb 5 ckeditor

在 CKEditor 4.5 beta 中,filetools 插件在使用跨域上传 url 时无法设置 cookie,为了使 CORS 启用 cookie,我们需要在启动 XHR 上传时设置XHR.withCredentials = true

如何在 CKEditor 4.5 的 filetools 插件中设置 XHR 属性。

ade*_*ura 5

您可以通过侦听fileUploadRequest 事件来访问 XHR 对象,然后您可以将withCredentials标志设置为true.

editor.on( 'fileUploadRequest', function( evt ) {
    var xhr = evt.data.fileLoader.xhr;

    xhr.withCredentials = true;
} );
Run Code Online (Sandbox Code Playgroud)

在此处获得工作开发示例。