fix: 章节内容存在多张图片和文本时,web服务书架中读书无法正确渲染图片 (#5125)
Co-authored-by: 17683954109@163.com <17683954109@163.com>
This commit is contained in:
co-authored by
17683954109@163.com <17683954109@163.com>
parent
452dfef95b
commit
dfc9ff9b31
@@ -305,6 +305,11 @@ const getContent = (index: number, reloadChapter = true, chapterPos = 0) => {
|
|||||||
if (res.data.isSuccess) {
|
if (res.data.isSuccess) {
|
||||||
const data = res.data.data
|
const data = res.data.data
|
||||||
const content = data.split(/\n+/)
|
const content = data.split(/\n+/)
|
||||||
|
for (let i = 0; i < content.length; i++) {
|
||||||
|
if (!/^\s*<img[^>]*src[^>]+>$/.test(content[i])) {
|
||||||
|
content[i] = content[i].replaceAll('img src="', `img src="/image?url=${bookUrl}&path=`);
|
||||||
|
}
|
||||||
|
}
|
||||||
chapterData.value.push({ index, content, title })
|
chapterData.value.push({ index, content, title })
|
||||||
if (reloadChapter) toChapterPos(chapterPos)
|
if (reloadChapter) toChapterPos(chapterPos)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user