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 'open image' context in markdown preview #234649

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

notoriousmango
Copy link

resolve #184553

This pull request aims to check whether an img.src is local or not, given that a local src attribute is automatically changed to a URI internally.
I've utilized the fact that any non-local src attribute will not be altered, providing a basis for differentiation.
I'm open to any suggestions for better ways to achieve this.

@notoriousmango
Copy link
Author

@microsoft-github-policy-service agree

Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

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

Thanks for taking a look. Looks good overall, mainly just want to keep most of the code in the command itself

@@ -679,6 +686,12 @@ export class DynamicMarkdownPreview extends Disposable implements IManagedMarkdo
});
}

openImage(imagePath: string): void {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's move this code into the command. The second argument to vscode.open is a ViewColumn if you need to open in a specific editor group


public execute(args: { resource: string, imageSource: string }) {
const source = vscode.Uri.parse(args.resource);
const { fsPath } = vscode.Uri.parse(args.imageSource);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Keep this as a uri. Otherwise it will only work for file: images

@mjbvz mjbvz added this to the November 2024 milestone Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

markdown preview: allow opening images in a new editor
2 participants