渲染问题bugfix

This commit is contained in:
xiaoqi.cxq 2023-06-29 22:24:07 +08:00
parent d175557ab9
commit 57931b9db2
2 changed files with 4 additions and 4 deletions

View File

@ -217,8 +217,8 @@ const editorSvc = Object.assign(new Vue(), editorSvcDiscussions, editorSvcUtils,
];
Array.prototype.slice.call(sectionPreviewElt.getElementsByTagName('a')).forEach((aElt) => {
const url = aElt.attributes.href.nodeValue;
if (url.indexOf('http://') >= 0 || url.indexOf('https://') >= 0 || url.indexOf('#') >= 0) {
const url = aElt.attributes && aElt.attributes.href && aElt.attributes.href.nodeValue;
if (!url || url.indexOf('http://') >= 0 || url.indexOf('https://') >= 0 || url.indexOf('#') >= 0) {
return;
}
aElt.href = 'javascript:void(0);'; // eslint-disable-line no-script-url

View File

@ -93,8 +93,8 @@ export default {
// 替换相对路径图片为blob图片
const imgs = Array.prototype.slice.call(containerElt.getElementsByTagName('img')).map((imgElt) => {
let uri = imgElt.attributes.src.nodeValue;
if (uri.indexOf('http://') !== 0 && uri.indexOf('https://') !== 0) {
let uri = imgElt.attributes && imgElt.attributes.href && imgElt.attributes.href.nodeValue;
if (uri && uri.indexOf('http://') !== 0 && uri.indexOf('https://') !== 0) {
uri = decodeURIComponent(uri);
imgElt.removeAttribute('src');
return { imgElt, uri };