mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
9289dbdf77
* Refactoring MdToHtml to avoid manually rendering tokens * Minor fix * Fixed loading of resources * Handle clicking on checkboxes * Added back Katex support * Fixed issues with Katex and note rendering * Added back support for links * Restored code block highlighting support * clean up * Applying update to mobile * Fixed handling of links and cleaned up to share more code between mobile and desktop * Restored content caching and improved handling of additional assets * Clean up and a few fixes * Applied more updates to mobile and added code highlighting support
27 lines
936 B
JavaScript
27 lines
936 B
JavaScript
// React Native WebView cannot load external JS files, however it can load
|
|
// arbitraty JS via the injectedJavaScript property. So we use this to load external
|
|
// files: First here we convert the JS file to a plain string, and that string
|
|
// is then loaded by eg. the Mermaid plugin, and finally injected in the WebView.
|
|
|
|
const fs = require('fs-extra');
|
|
|
|
const cwd = process.cwd();
|
|
const outputDir = cwd + '/lib/rnInjectedJs';
|
|
const rnDir = __dirname + '/../ReactNativeClient';
|
|
|
|
async function copyJs(name, filePath) {
|
|
const js = await fs.readFile(filePath, 'utf-8');
|
|
const json = 'module.exports = ' + JSON.stringify(js) + ';';
|
|
const outputPath = outputDir + '/' + name + '.js';
|
|
await fs.writeFile(outputPath, json);
|
|
}
|
|
|
|
async function main(argv) {
|
|
await fs.mkdirp(outputDir);
|
|
await copyJs('webviewLib', rnDir + '/lib/MdToHtml/webviewLib.js');
|
|
}
|
|
|
|
main(process.argv).catch((error) => {
|
|
console.error(error);
|
|
process.exit(1);
|
|
}); |