1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Desktop: Fixes #2968: Trying to resource path issue in WYSIWYG editor

This commit is contained in:
Laurent Cozic
2020-04-13 22:55:24 +00:00
parent 6164e2d8eb
commit 2050889590
4 changed files with 66 additions and 4 deletions

View File

@ -162,10 +162,12 @@ class Note extends BaseItem {
const id = resourceIds[i];
const resource = await Resource.load(id);
if (!resource) continue;
const resourcePath = options.useAbsolutePaths ? Resource.fullPath(resource) : Resource.relativePath(resource);
const resourcePath = options.useAbsolutePaths ? `file://${Resource.fullPath(resource)}` : Resource.relativePath(resource);
body = body.replace(new RegExp(`:/${id}`, 'gi'), resourcePath);
}
this.logger().info('replaceResourceInternalToExternalLinks result', body);
return body;
}
@ -176,8 +178,8 @@ class Note extends BaseItem {
const pathsToTry = [];
if (options.useAbsolutePaths) {
pathsToTry.push(Setting.value('resourceDir'));
pathsToTry.push(shim.pathRelativeToCwd(Setting.value('resourceDir')));
pathsToTry.push(`file://${Setting.value('resourceDir')}`);
pathsToTry.push(`file://${shim.pathRelativeToCwd(Setting.value('resourceDir'))}`);
} else {
pathsToTry.push(Resource.baseRelativeDirectoryPath());
}
@ -193,6 +195,8 @@ class Note extends BaseItem {
});
}
this.logger().info('replaceResourceExternalToInternalLinks result', body);
return body;
}