You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-24 23:26:50 +02:00
Desktop, Mobile: Fixes #2357: Fix slow rendering and memory leak issues with Katex notes
This commit is contained in:
@ -101,7 +101,7 @@ class NoteBodyViewer extends Component {
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
${assetsToHeaders(result.pluginAssets)}
|
||||
${assetsToHeaders(result.pluginAssets, { asHtml: true })}
|
||||
</head>
|
||||
<body>
|
||||
${html}
|
||||
|
@ -1,18 +1,28 @@
|
||||
// Utility function to convert the plugin assets to a list of LINK or SCRIPT tags
|
||||
// that can be included in the HEAD tag.
|
||||
function assetsToHeaders(pluginAssets) {
|
||||
const headers = [];
|
||||
function assetsToHeaders(pluginAssets, options = null) {
|
||||
options = Object.assign({}, { asHtml: false }, options);
|
||||
|
||||
const headers = {};
|
||||
for (let i = 0; i < pluginAssets.length; i++) {
|
||||
const asset = pluginAssets[i];
|
||||
if (asset.mime === 'text/css') {
|
||||
headers.push(`<link rel="stylesheet" href="pluginAssets/${asset.name}">`);
|
||||
headers[asset.name] = `<link rel="stylesheet" href="pluginAssets/${asset.name}">`;
|
||||
} else if (asset.mime === 'application/javascript') {
|
||||
// NOT TESTED!!
|
||||
headers.push(`<script type="application/javascript" src="pluginAssets/${asset.name}"></script>`);
|
||||
headers[asset.name] = `<script type="application/javascript" src="pluginAssets/${asset.name}"></script>`;
|
||||
}
|
||||
}
|
||||
|
||||
return headers.join('\n');
|
||||
if (options.asHtml) {
|
||||
let output = [];
|
||||
for (let name in headers) {
|
||||
output.push(headers[name]);
|
||||
}
|
||||
return output.join('');
|
||||
}
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
module.exports = assetsToHeaders;
|
||||
|
@ -114,7 +114,7 @@ class InteropService_Exporter_Html extends InteropService_Exporter_Base {
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
${assetsToHeaders(result.pluginAssets)}
|
||||
${assetsToHeaders(result.pluginAssets, { asHtml: true })}
|
||||
<title>${escapeHtml(item.title)}</title>
|
||||
</head>
|
||||
<body>
|
||||
|
Reference in New Issue
Block a user