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

Add vscode.env.webviewResourceRoot API #75741

Merged
merged 1 commit into from
Jun 19, 2019
Merged

Conversation

mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Jun 19, 2019

Fixes #72155

Adds a constant to the api that tracks the root path for resources inside of webviews. This is required because we will not be able to use vscode-resource: uris on the web. Our current approach is to rewrite the html we are given but there are almost certainly going to be cases where we don't get this quite right.

Adopts the new api for the markdown preview

Fixes #72155

Adds a constant to the api that tracks the root path for resources inside of webviews. This is required because we will not be able to use `vscode-resource:` uris on the web. Our current approach is to rewrite the html we are given but there are almost certainly going to be cases where we don't get this quite right.

Adopts the new api for the markdown preview
@mjbvz mjbvz added this to the June 2019 milestone Jun 19, 2019
@mjbvz mjbvz self-assigned this Jun 19, 2019
@mjbvz mjbvz merged commit 535c9d5 into master Jun 19, 2019
@@ -84,7 +86,7 @@ export class MarkdownContentProvider {
data-state="${escapeAttribute(JSON.stringify(state || {}))}">
<script src="${this.extensionResourcePath('pre.js')}" nonce="${nonce}"></script>
${this.getStyles(sourceUri, nonce, config, state)}
<base href="${markdownDocument.uri.with({ scheme: 'vscode-resource' }).toString(true)}">
<base href="${toResoruceUri(markdownDocument.uri)}">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem discussed here #74332 (comment) is because of the change in this line.

// before, <base>'s href were a string
markdownDocument.uri.with({ scheme: 'vscode-resource' }).toString(true) === "vscode-resource://desktop-9su47m5/test-vscode-issue/test.md"
// here, it has two slashes: ----------------------------------------------------------------^^

// after, <base>'s href is an object
toResoruceUri(markdownDocument.uri) === { $mid: 1, path: "/test-vscode-issue/test.md", scheme: "vscode-resource" }
toResoruceUri(markdownDocument.uri).toString() === "vscode-resource:/test-vscode-issue/test.md"
// the missing stash is coming from here: --------------------------^

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't just the missing slash, it is loosing the URI's authority too ("desktop-9su47m5" in this example).

@mjbvz mjbvz deleted the dev/mjbvz/webviewResourceRoot branch July 2, 2019 18:29
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose vscode-resource helper or constant in API
2 participants