1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Desktop: Fixes #1425: Improved handling of images when using external editor, so that it works in Atom, VSCode and Typora

This commit is contained in:
Laurent Cozic
2019-05-11 11:46:13 +01:00
parent 91ecab51c5
commit b702b0b40c
7 changed files with 36 additions and 16 deletions

View File

@@ -177,14 +177,15 @@ class Note extends BaseItem {
const id = resourceIds[i];
const resource = await Resource.load(id);
if (!resource) continue;
body = body.replace(new RegExp(':/' + id, 'gi'), toFileProtocolPath(Resource.fullPath(resource)));
const resourcePath = Resource.relativePath(resource)
body = body.replace(new RegExp(':/' + id, 'gi'), resourcePath); //toFileProtocolPath(Resource.fullPath(resource)));
}
return body;
}
static async replaceResourceExternalToInternalLinks(body) {
const reString = pregQuote(toFileProtocolPath(Resource.baseDirectoryPath() + '/')) + '[a-zA-Z0-9\.]+';
const reString = pregQuote(toFileProtocolPath(Resource.baseRelativeDirectoryPath() + '/')) + '[a-zA-Z0-9\.]+';
const re = new RegExp(reString, 'gi');
body = body.replace(re, (match) => {
const id = Resource.pathToId(match);