vditor
Version:
♏ 易于使用的 Markdown 编辑器,为适配不同的应用场景而生
11 lines (10 loc) • 404 B
text/typescript
export const setHeaders = (vditor: IVditor, xhr: XMLHttpRequest) => {
if (vditor.options.upload.setHeaders) {
vditor.options.upload.headers = vditor.options.upload.setHeaders();
}
if (vditor.options.upload.headers) {
Object.keys(vditor.options.upload.headers).forEach((key) => {
xhr.setRequestHeader(key, vditor.options.upload.headers[key]);
});
}
};