You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
All: Fixes #968: Export resources specified with a title
This commit is contained in:
@ -6,6 +6,7 @@ const Setting = require('lib/models/Setting.js');
|
||||
const { shim } = require('lib/shim.js');
|
||||
const { time } = require('lib/time-utils.js');
|
||||
const { _ } = require('lib/locale.js');
|
||||
const ArrayUtils = require('lib/ArrayUtils.js');
|
||||
const moment = require('moment');
|
||||
const lodash = require('lodash');
|
||||
|
||||
@ -110,12 +111,19 @@ class Note extends BaseItem {
|
||||
}
|
||||
|
||||
static linkedItemIds(body) {
|
||||
// For example: 
|
||||
if (!body || body.length <= 32) return [];
|
||||
|
||||
// For example: 
|
||||
let matches = body.match(/\(:\/[a-zA-Z0-9]{32}\)/g);
|
||||
if (!matches) matches = [];
|
||||
matches = matches.map((m) => m.substr(3, 32));
|
||||
|
||||
// For example: 
|
||||
let matches2 = body.match(/\(:\/[a-zA-Z0-9]{32}\s(.*?)\)/g);
|
||||
if (!matches2) matches2 = [];
|
||||
matches2 = matches2.map((m) => m.substr(3, 32));
|
||||
matches = matches.concat(matches2)
|
||||
|
||||
// For example: <img src=":/fcca2938a96a22570e8eae2565bc6b0b"/>
|
||||
const imgRegex = /<img.*?src=["']:\/([a-zA-Z0-9]{32})["']/g
|
||||
const imgMatches = [];
|
||||
@ -125,7 +133,7 @@ class Note extends BaseItem {
|
||||
imgMatches.push(m[1]);
|
||||
}
|
||||
|
||||
return matches.concat(imgMatches);
|
||||
return ArrayUtils.unique(matches.concat(imgMatches));
|
||||
}
|
||||
|
||||
static async linkedItems(body) {
|
||||
|
Reference in New Issue
Block a user