You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Electron: Fixes resources being incorrectly auto-deleted when inside an IMG tag
This commit is contained in:
@ -114,9 +114,20 @@ class Note extends BaseItem {
|
||||
static linkedItemIds(body) {
|
||||
// For example: 
|
||||
if (!body || body.length <= 32) return [];
|
||||
const matches = body.match(/\(:\/.{32}\)/g);
|
||||
if (!matches) return [];
|
||||
return matches.map((m) => m.substr(3, 32));
|
||||
let matches = body.match(/\(:\/[a-zA-Z0-9]{32}\)/g);
|
||||
if (!matches) matches = [];
|
||||
matches = matches.map((m) => m.substr(3, 32));
|
||||
|
||||
// For example: <img src=":/fcca2938a96a22570e8eae2565bc6b0b"/>
|
||||
const imgRegex = /<img.*?src=["']:\/([a-zA-Z0-9]{32})["']/g
|
||||
const imgMatches = [];
|
||||
while (true) {
|
||||
const m = imgRegex.exec(body);
|
||||
if (!m) break;
|
||||
imgMatches.push(m[1]);
|
||||
}
|
||||
|
||||
return matches.concat(imgMatches);
|
||||
}
|
||||
|
||||
static async linkedItems(body) {
|
||||
|
Reference in New Issue
Block a user