mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
25 lines
661 B
TypeScript
25 lines
661 B
TypeScript
|
import { PluginStates } from '../reducer';
|
||
|
import { ExtraRendererRule } from 'lib/joplin-renderer/MdToHtml';
|
||
|
|
||
|
export default function contentScriptsToRendererRules(plugins:PluginStates):ExtraRendererRule[] {
|
||
|
const output:ExtraRendererRule[] = [];
|
||
|
|
||
|
for (const pluginId in plugins) {
|
||
|
const plugin = plugins[pluginId];
|
||
|
for (const scriptType in plugin.contentScripts) {
|
||
|
const contentScripts = plugin.contentScripts[scriptType];
|
||
|
for (const contentScript of contentScripts) {
|
||
|
|
||
|
const loadedModule = require(contentScript.path).default;
|
||
|
|
||
|
output.push({
|
||
|
id: contentScript.id,
|
||
|
module: loadedModule({}),
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return output;
|
||
|
}
|