mirror of
https://gitee.com/mafgwo/stackedit
synced 2024-11-16 11:42:23 +08:00
渲染问题bugfix
This commit is contained in:
parent
d175557ab9
commit
57931b9db2
|
@ -217,8 +217,8 @@ const editorSvc = Object.assign(new Vue(), editorSvcDiscussions, editorSvcUtils,
|
||||||
];
|
];
|
||||||
|
|
||||||
Array.prototype.slice.call(sectionPreviewElt.getElementsByTagName('a')).forEach((aElt) => {
|
Array.prototype.slice.call(sectionPreviewElt.getElementsByTagName('a')).forEach((aElt) => {
|
||||||
const url = aElt.attributes.href.nodeValue;
|
const url = aElt.attributes && aElt.attributes.href && aElt.attributes.href.nodeValue;
|
||||||
if (url.indexOf('http://') >= 0 || url.indexOf('https://') >= 0 || url.indexOf('#') >= 0) {
|
if (!url || url.indexOf('http://') >= 0 || url.indexOf('https://') >= 0 || url.indexOf('#') >= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
aElt.href = 'javascript:void(0);'; // eslint-disable-line no-script-url
|
aElt.href = 'javascript:void(0);'; // eslint-disable-line no-script-url
|
||||||
|
|
|
@ -93,8 +93,8 @@ export default {
|
||||||
|
|
||||||
// 替换相对路径图片为blob图片
|
// 替换相对路径图片为blob图片
|
||||||
const imgs = Array.prototype.slice.call(containerElt.getElementsByTagName('img')).map((imgElt) => {
|
const imgs = Array.prototype.slice.call(containerElt.getElementsByTagName('img')).map((imgElt) => {
|
||||||
let uri = imgElt.attributes.src.nodeValue;
|
let uri = imgElt.attributes && imgElt.attributes.href && imgElt.attributes.href.nodeValue;
|
||||||
if (uri.indexOf('http://') !== 0 && uri.indexOf('https://') !== 0) {
|
if (uri && uri.indexOf('http://') !== 0 && uri.indexOf('https://') !== 0) {
|
||||||
uri = decodeURIComponent(uri);
|
uri = decodeURIComponent(uri);
|
||||||
imgElt.removeAttribute('src');
|
imgElt.removeAttribute('src');
|
||||||
return { imgElt, uri };
|
return { imgElt, uri };
|
||||||
|
|
Loading…
Reference in New Issue
Block a user