You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-24 23:26:50 +02:00
Plugins: Added support for bi-directional messages in content scripts and webview scripts using postMessage
This commit is contained in:
@ -67,7 +67,7 @@ export default class PluginService extends BaseService {
|
||||
private plugins_: Plugins = {};
|
||||
private runner_: BasePluginRunner = null;
|
||||
|
||||
initialize(appVersion: string, platformImplementation: any, runner: BasePluginRunner, store: any) {
|
||||
public initialize(appVersion: string, platformImplementation: any, runner: BasePluginRunner, store: any) {
|
||||
this.appVersion_ = appVersion;
|
||||
this.store_ = store;
|
||||
this.runner_ = runner;
|
||||
@ -115,6 +115,15 @@ export default class PluginService extends BaseService {
|
||||
return JSON.stringify(settings);
|
||||
}
|
||||
|
||||
public pluginIdByContentScriptId(contentScriptId: string): string {
|
||||
for (const pluginId in this.plugins_) {
|
||||
const plugin = this.plugins_[pluginId];
|
||||
const contentScript = plugin.contentScriptById(contentScriptId);
|
||||
if (contentScript) return pluginId;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private async parsePluginJsBundle(jsBundleString: string) {
|
||||
const scriptText = jsBundleString;
|
||||
const lines = scriptText.split('\n');
|
||||
|
Reference in New Issue
Block a user