mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
bug-fix: image links in reference format will cause crashes
This commit is contained in:
parent
b04a44f82d
commit
d20dc4a0b0
@ -70,6 +70,10 @@ Notice that the sequence number is irrelevant. Markdown will change the sequence
|
|||||||
[Link Text](/url/of/the/link)
|
[Link Text](/url/of/the/link)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Notes**:
|
||||||
|
|
||||||
|
- It is not recommended to use image links in reference format. VNote will not preview those images.
|
||||||
|
|
||||||
### Blockquotes
|
### Blockquotes
|
||||||
```md
|
```md
|
||||||
As VNote suggests:
|
As VNote suggests:
|
||||||
|
@ -71,6 +71,10 @@ __This text will be bold__
|
|||||||
[Link Text](/url/of/the/link)
|
[Link Text](/url/of/the/link)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**注意**:
|
||||||
|
|
||||||
|
- VNote不推荐使用参考式的图片链接。VNote不会预览这些图片。
|
||||||
|
|
||||||
### 块引用
|
### 块引用
|
||||||
```md
|
```md
|
||||||
As VNote suggests:
|
As VNote suggests:
|
||||||
|
@ -189,8 +189,11 @@ QVector<ImageLink> VUtils::fetchImagesFromMarkdownFile(VFile *p_file,
|
|||||||
const VElementRegion ® = regions[i];
|
const VElementRegion ® = regions[i];
|
||||||
QString linkText = text.mid(reg.m_startPos, reg.m_endPos - reg.m_startPos);
|
QString linkText = text.mid(reg.m_startPos, reg.m_endPos - reg.m_startPos);
|
||||||
bool matched = regExp.exactMatch(linkText);
|
bool matched = regExp.exactMatch(linkText);
|
||||||
Q_ASSERT(matched);
|
if (!matched) {
|
||||||
Q_UNUSED(matched);
|
// Image links with reference format will not match.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
QString imageUrl = regExp.capturedTexts()[2].trimmed();
|
QString imageUrl = regExp.capturedTexts()[2].trimmed();
|
||||||
|
|
||||||
ImageLink link;
|
ImageLink link;
|
||||||
|
@ -303,6 +303,10 @@ void VImagePreviewer::fetchImageLinksFromRegions(QVector<ImageLinkInfo> &p_image
|
|||||||
reg.m_endPos - reg.m_startPos));
|
reg.m_endPos - reg.m_startPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (info.m_linkUrl.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if this image link has been previewed previously.
|
// Check if this image link has been previewed previously.
|
||||||
info.m_previewImageID = isImageLinkPreviewed(info);
|
info.m_previewImageID = isImageLinkPreviewed(info);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user