Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert "Remove leading slash of webview route ..." #6279

Merged
merged 1 commit into from
Sep 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/plugin-ext-vscode/src/node/plugin-vscode-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const doInitialization: BackendInitializationFn = (apiFactory: PluginAPIF
// redefine property
Object.defineProperty(panel.webview, 'html', {
set: function (html: string): void {
const newHtml = html.replace(new RegExp('vscode-resource:/', 'g'), 'webview/');
const newHtml = html.replace(new RegExp('vscode-resource:/', 'g'), '/webview/');
this.checkIsDisposed();
if (this._html !== newHtml) {
this._html = newHtml;
Expand All @@ -74,7 +74,7 @@ export const doInitialization: BackendInitializationFn = (apiFactory: PluginAPIF
const originalPostMessage = panel.webview.postMessage;
panel.webview.postMessage = (message: any): PromiseLike<boolean> => {
const decoded = JSON.stringify(message);
const newMessage = decoded.replace(new RegExp('vscode-resource:/', 'g'), 'webview/');
const newMessage = decoded.replace(new RegExp('vscode-resource:/', 'g'), '/webview/');
return originalPostMessage.call(panel.webview, JSON.parse(newMessage));
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class ThemeRulesService {
path = this.isDark() ? value.dark : value.light;
}
if (path.startsWith('/')) {
path = `webview${path}`;
path = `/webview${path}`;
}
cssRules.push(`.webview-icon.${key}-file-icon::before { background-image: url(${path}); }`);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/plugin/webviews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class WebviewImpl implements theia.Webview {
this.checkIsDisposed();
// replace theia-resource: content in the given message
const decoded = JSON.stringify(message);
let newMessage = decoded.replace(new RegExp('theia-resource:/', 'g'), 'webview/');
let newMessage = decoded.replace(new RegExp('theia-resource:/', 'g'), '/webview/');
if (this._options && this._options.localResourceRoots) {
newMessage = this.filterLocalRoots(newMessage, this._options.localResourceRoots);
}
Expand Down Expand Up @@ -191,7 +191,7 @@ export class WebviewImpl implements theia.Webview {
}

set html(html: string) {
let newHtml = html.replace(new RegExp('theia-resource:/', 'g'), 'webview/');
let newHtml = html.replace(new RegExp('theia-resource:/', 'g'), '/webview/');
if (this._options && this._options.localResourceRoots) {
newHtml = this.filterLocalRoots(newHtml, this._options.localResourceRoots);
}
Expand Down