forked from Gitlink/forgeplus-react
修复下载word中不带图片的问题
This commit is contained in:
parent
7d37a565b3
commit
5459f76349
|
@ -38,7 +38,19 @@ class ExportWord extends Component {
|
||||||
body: '<body>_body_</body>',
|
body: '<body>_body_</body>',
|
||||||
};
|
};
|
||||||
|
|
||||||
const activeDoc = document.getElementById(wordId).cloneNode(true); // 获取 dom 节点
|
const activeDoc = document.getElementById(wordId); // 获取 dom 节点
|
||||||
|
|
||||||
|
if(activeDoc.querySelector(".markdown-body")){
|
||||||
|
let imgNode =activeDoc.querySelectorAll('.markdown-body img');
|
||||||
|
if(imgNode.length){
|
||||||
|
for(const item of imgNode){
|
||||||
|
let itemSrc=item.getAttribute('src');
|
||||||
|
if(itemSrc.indexOf('http')===-1){
|
||||||
|
item.setAttribute('src',location.origin+itemSrc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 默认样式
|
// 默认样式
|
||||||
const defaultStyle = '.text-div{ text-decoration: underline; margin-right: 15px; } .textarea-div{ text-decoration: underline; } table td,table th{padding: 6px 13px;border: 1px solid #ddd;} table{border-collapse: collapse;}';
|
const defaultStyle = '.text-div{ text-decoration: underline; margin-right: 15px; } .textarea-div{ text-decoration: underline; } table td,table th{padding: 6px 13px;border: 1px solid #ddd;} table{border-collapse: collapse;}';
|
||||||
|
|
Loading…
Reference in New Issue