1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Desktop: Fix images fail to render in the preview pane for HTML notes (#10806)

This commit is contained in:
Henry Heino
2024-08-02 06:47:43 -07:00
committed by GitHub
parent e5c8b4bb66
commit 9dbd481f28
10 changed files with 102 additions and 28 deletions

View File

@@ -92,7 +92,7 @@ export default class HtmlToHtml implements MarkupRenderer {
...options,
};
const cacheKey = md5(escape(JSON.stringify({ markup, options })));
const cacheKey = md5(escape(JSON.stringify({ markup, options, baseUrl: this.resourceBaseUrl_ })));
let html = this.cache_.value(cacheKey);
if (!html) {
@@ -100,11 +100,10 @@ export default class HtmlToHtml implements MarkupRenderer {
allowedFilePrefixes: options.allowedFilePrefixes,
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
html = htmlUtils.processImageTags(html, (data: any) => {
html = htmlUtils.processImageTags(html, (data) => {
if (!data.src) return null;
const r = utils.imageReplacement(this.ResourceModel_, data.src, options.resources, this.resourceBaseUrl_, options.itemIdToUrl);
const r = utils.imageReplacement(this.ResourceModel_, data, options.resources, this.resourceBaseUrl_, options.itemIdToUrl);
if (!r) return null;
if (typeof r === 'string') {