Merged
Conversation
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
lmcarreiro
reviewed
Jun 23, 2019
| <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)}"> |
Contributor
There was a problem hiding this comment.
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: --------------------------^
Contributor
There was a problem hiding this comment.
It isn't just the missing slash, it is loosing the URI's authority too ("desktop-9su47m5" in this example).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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