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

Is there any possibility of being able to export the displayed map to PNG from VSCode? #20

Closed
damonsk opened this issue Dec 28, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@damonsk
Copy link
Owner

damonsk commented Dec 28, 2023

          Is there any possibility of being able to export the displayed map to PNG from VSCode?  Right now, I have to go to https://onlinewardleymaps.com and paste in my markup from VSCode, then use the web PNG export...Kind of a drag.

Originally posted by @jaxley in damonsk/onlinewardleymaps#71 (comment)

@damonsk damonsk changed the title Is there any possibility of being able to export the displayed map to PNG from VSCode? Right now, I have to go to https://onlinewardleymaps.com and paste in my markup from VSCode, then use the web PNG export...Kind of a drag. Is there any possibility of being able to export the displayed map to PNG from VSCode? Dec 28, 2023
@damonsk damonsk added the enhancement New feature or request label Dec 28, 2023
@dkokic
Copy link

dkokic commented Jan 7, 2024

Also, SVG would be nice. 🤓
I am new to VS Code Extensions and wonder if this could be a good exercise to dive into it.

@damonsk
Copy link
Owner Author

damonsk commented Jan 7, 2024

My thoughts on how this could be achieved..

We have html2canvas which would generate the PNG.

https://github.com/damonsk/onlinewardleymaps/blob/b8ef17c8032587006e236aa2b293c86478c51d97/frontend/src/components/MapEnvironment.js#L293

For SVG it would be the same process but getting the svg markup from the map.

https://github.com/damonsk/onlinewardleymaps/blob/b8ef17c8032587006e236aa2b293c86478c51d97/frontend/src/components/MapEnvironment.js#L303

This example shows how to save a file - https://github.com/microsoft/vscode-extension-samples/blob/94c1b179c75242072e69fff8199d08e2e5ff4335/fsconsumer-sample/src/extension.ts#L71 to write the file.

Another way would be to create a new file tab, and set the text to be that of the svg (which is just xml) and allow the user to save via VSCode.

https://code.visualstudio.com/api/references/vscode-api#WorkspaceEdit - createFile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants