You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
Mobile: Plugin API: Fix certain renderer plugins fail to load (#13078)
This commit is contained in:
@@ -185,7 +185,7 @@ const useWebViewSetup = (props: Props): SetUpResult<RendererControl> => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let settingsChanged = false;
|
let settingsChanged = false;
|
||||||
const settings: RenderSettings = {
|
const getSettings = (): RenderSettings => ({
|
||||||
...options,
|
...options,
|
||||||
codeTheme: theme.codeThemeCss,
|
codeTheme: theme.codeThemeCss,
|
||||||
// We .stringify the theme to avoid a JSON serialization error involving
|
// We .stringify the theme to avoid a JSON serialization error involving
|
||||||
@@ -220,12 +220,12 @@ const useWebViewSetup = (props: Props): SetUpResult<RendererControl> => {
|
|||||||
return shim.fsDriver().fileAtPath(resolvedPath);
|
return shim.fsDriver().fileAtPath(resolvedPath);
|
||||||
},
|
},
|
||||||
removeUnusedPluginAssets: options.removeUnusedPluginAssets,
|
removeUnusedPluginAssets: options.removeUnusedPluginAssets,
|
||||||
};
|
});
|
||||||
|
|
||||||
await transferResources(options.resources);
|
await transferResources(options.resources);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
settings,
|
getSettings,
|
||||||
getSettingsChanged() {
|
getSettingsChanged() {
|
||||||
return settingsChanged;
|
return settingsChanged;
|
||||||
},
|
},
|
||||||
@@ -234,23 +234,23 @@ const useWebViewSetup = (props: Props): SetUpResult<RendererControl> => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
rerenderToBody: async (markup, options, cancelEvent) => {
|
rerenderToBody: async (markup, options, cancelEvent) => {
|
||||||
const { settings, getSettingsChanged } = await prepareRenderer(options);
|
const { getSettings, getSettingsChanged } = await prepareRenderer(options);
|
||||||
if (cancelEvent?.cancelled) return null;
|
if (cancelEvent?.cancelled) return null;
|
||||||
|
|
||||||
const output = await renderer.rerenderToBody(markup, settings);
|
const output = await renderer.rerenderToBody(markup, getSettings());
|
||||||
if (cancelEvent?.cancelled) return null;
|
if (cancelEvent?.cancelled) return null;
|
||||||
|
|
||||||
if (getSettingsChanged()) {
|
if (getSettingsChanged()) {
|
||||||
return await renderer.rerenderToBody(markup, settings);
|
return await renderer.rerenderToBody(markup, getSettings());
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
},
|
},
|
||||||
render: async (markup, options) => {
|
render: async (markup, options) => {
|
||||||
const { settings, getSettingsChanged } = await prepareRenderer(options);
|
const { getSettings, getSettingsChanged } = await prepareRenderer(options);
|
||||||
const output = await renderer.render(markup, settings);
|
const output = await renderer.render(markup, getSettings());
|
||||||
|
|
||||||
if (getSettingsChanged()) {
|
if (getSettingsChanged()) {
|
||||||
return await renderer.render(markup, settings);
|
return await renderer.render(markup, getSettings());
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user