1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Merge branch 'release-3.1' into dev

This commit is contained in:
Laurent Cozic
2024-11-04 20:33:15 +00:00
30 changed files with 435 additions and 107 deletions

View File

@ -29,6 +29,7 @@ export default class NoteTextViewerComponent extends React.Component<Props, any>
private webviewRef_: React.RefObject<HTMLIFrameElement>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
private webviewListeners_: any = null;
private removePluginAssetsCallback_: RemovePluginAssetsCallback|null = null;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
@ -110,7 +111,7 @@ export default class NoteTextViewerComponent extends React.Component<Props, any>
window.addEventListener('message', this.webview_message);
}
public destroyWebview() {
private destroyWebview() {
const wv = this.webviewRef_.current;
if (!wv || !this.initialized_) return;
@ -194,14 +195,13 @@ export default class NoteTextViewerComponent extends React.Component<Props, any>
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
public setHtml(html: string, options: SetHtmlOptions) {
const protocolHandler = bridge().electronApp().getCustomProtocolHandler();
// Grant & remove asset access.
if (options.pluginAssets) {
this.removePluginAssetsCallback_?.();
const protocolHandler = bridge().electronApp().getCustomProtocolHandler();
const pluginAssetPaths: string[] = options.pluginAssets.map((asset) => asset.path);
const assetAccesses = pluginAssetPaths.map(
path => protocolHandler.allowReadAccessToFile(path),
@ -216,7 +216,10 @@ export default class NoteTextViewerComponent extends React.Component<Props, any>
};
}
this.send('setHtml', html, options);
this.send('setHtml', html, {
...options,
mediaAccessKey: protocolHandler.getMediaAccessKey(),
});
}
// ----------------------------------------------------------------