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

Desktop: Fixes #9304: Fix HTML resource links lost when editing notes in the rich text editor (#9435)

This commit is contained in:
Henry Heino
2023-12-06 11:17:16 -08:00
committed by GitHub
parent c0c32a7ac1
commit 92a0964a8d
14 changed files with 125 additions and 17 deletions

View File

@@ -857,7 +857,18 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
const resourcesEqual = resourceInfosEqual(lastOnChangeEventInfo.current.resourceInfos, props.resourceInfos);
if (lastOnChangeEventInfo.current.content !== props.content || !resourcesEqual) {
const result = await props.markupToHtml(props.contentMarkupLanguage, props.content, markupRenderOptions({ resourceInfos: props.resourceInfos }));
const result = await props.markupToHtml(
props.contentMarkupLanguage,
props.content,
markupRenderOptions({
resourceInfos: props.resourceInfos,
// Allow file:// URLs that point to the resource directory.
// This prevents HTML-style resource URLs (e.g. <a href="file://path/to/resource/.../"></a>)
// from being discarded.
allowedFilePrefixes: [props.resourceDirectory],
}),
);
if (cancelled) return;
editor.setContent(awfulBrHack(result.html));