You've already forked joplin
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:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user