fix-修复编译问题

This commit is contained in:
tangly1024.com
2023-06-16 17:06:56 +08:00
parent 112f003d29
commit 20917b47a4
3 changed files with 36 additions and 36 deletions

View File

@@ -5,7 +5,7 @@ import BLOG from '@/blog.config'
* @param {*} image
*/
const compressImage = (image) => {
if (image.indexOf(BLOG.NOTION_HOST) === 0) {
if (image && image.indexOf(BLOG.NOTION_HOST) === 0) {
return image + '&width=200'
}
}
@@ -21,23 +21,17 @@ const mapImgUrl = (img, block, type = 'block') => {
return ret
}
// 相对目录则视为notion的自带图片
if (img.startsWith('/')) ret = BLOG.NOTION_HOST + img
if (img.startsWith('/')) {
ret = BLOG.NOTION_HOST + img
}
// 书签的地址本身就是永久链接,无需处理
if (!ret && block?.type === 'bookmark') {
ret = img
}
// notion永久图床地址
if (!ret && img.indexOf('secure.notion-static.com') > 0 && (BLOG.IMG_URL_TYPE === 'Notion' || type !== 'block')) {
ret = BLOG.NOTION_HOST + '/image/' + encodeURIComponent(img) + '?table=' + type + '&id=' + block.id
if (!ret && ret !== null && ret.indexOf('secure.notion-static.com') > 0 && (BLOG.IMG_URL_TYPE === 'Notion' || type !== 'block')) {
ret = BLOG.NOTION_HOST + '/image/' + encodeURIComponent(ret) + '?table=' + type + '&id=' + block.id
}
// 剩余的是第三方图片url或emoji
if (!ret) {
ret = img
}
return ret
}