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

Desktop: Fixes #1425 (probably): Fix display of images when using VSCode as external editor

This commit is contained in:
Laurent Cozic
2019-04-20 21:12:19 +01:00
parent 4ef05272c4
commit 220f5d0967
2 changed files with 9 additions and 4 deletions

View File

@ -6,7 +6,7 @@ const Resource = require('lib/models/Resource.js');
const Setting = require('lib/models/Setting.js');
const { shim } = require('lib/shim.js');
const { pregQuote } = require('lib/string-utils.js');
const { toSystemSlashes } = require('lib/path-utils.js');
const { toSystemSlashes, toFileProtocolPath } = require('lib/path-utils.js');
const { time } = require('lib/time-utils.js');
const { _ } = require('lib/locale.js');
const ArrayUtils = require('lib/ArrayUtils.js');
@ -177,14 +177,14 @@ class Note extends BaseItem {
const id = resourceIds[i];
const resource = await Resource.load(id);
if (!resource) continue;
body = body.replace(new RegExp(':/' + id, 'gi'), toSystemSlashes(Resource.fullPath(resource)));
body = body.replace(new RegExp(':/' + id, 'gi'), toFileProtocolPath(Resource.fullPath(resource)));
}
return body;
}
static async replaceResourceExternalToInternalLinks(body) {
const reString = pregQuote(toSystemSlashes(Resource.baseDirectoryPath() + '/')) + '[a-zA-Z0-9\.]+';
const reString = pregQuote(toFileProtocolPath(Resource.baseDirectoryPath() + '/')) + '[a-zA-Z0-9\.]+';
const re = new RegExp(reString, 'gi');
body = body.replace(re, (match) => {
const id = Resource.pathToId(match);