Skip to content

Commit

Permalink
Fix URL path for output renderer scripts (#12976)
Browse files Browse the repository at this point in the history
* fixed path for downloading output renderer scripts from

Signed-off-by: Jonah Iden <[email protected]>

* fixed importing of renderer script

Signed-off-by: Jonah Iden <[email protected]>

---------

Signed-off-by: Jonah Iden <[email protected]>
  • Loading branch information
jonah-iden authored Oct 12, 2023
1 parent f1056b3 commit c625ba1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ export async function outputWebviewPreload(ctx: PreloadContext): Promise<void> {
if (this.rendererApi) {
return this.rendererApi;
}

const rendererModule = await __import(this.data.entrypoint.uri) as { activate: rendererApi.ActivationFunction };
const baseUri = window.location.href.replace(/\/webview\/index\.html.*/, '');
const rendererModule = await __import(`${baseUri}/${this.data.entrypoint.uri}`) as { activate: rendererApi.ActivationFunction };
this.rendererApi = await rendererModule.activate(this.createRendererContext());
return this.rendererApi;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { PluginViewRegistry } from './view/plugin-view-registry';
import { PluginCustomEditorRegistry } from './custom-editors/plugin-custom-editor-registry';
import {
PluginContribution, IndentationRules, FoldingRules, ScopeMap, DeployedPlugin,
GrammarsContribution, EnterAction, OnEnterRule, RegExpOptions, getPluginId
GrammarsContribution, EnterAction, OnEnterRule, RegExpOptions, PluginPackage
} from '../../common';
import {
DefaultUriLabelProviderContribution,
Expand Down Expand Up @@ -416,7 +416,7 @@ export class PluginContributionHandler {
if (contributions.notebookRenderer) {
for (const renderer of contributions.notebookRenderer) {
pushContribution(`notebookRenderer.${renderer.id}`,
() => this.notebookRendererRegistry.registerNotebookRenderer(renderer, `/hostedPlugin/${getPluginId(plugin.metadata.model)}`)
() => this.notebookRendererRegistry.registerNotebookRenderer(renderer, PluginPackage.toPluginUrl(plugin.metadata.model, ''))
);
}
}
Expand Down

0 comments on commit c625ba1

Please sign in to comment.