atitor
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]);
});
}
};