BOCOVO / db-schema-visualizer

A Visual Studio Code extension to visualize database schemas as Entity Relationship Diagrams (ERD) from DBML or Prisma files directly within the editor.
MIT License
63 stars 7 forks source link

Implementing the saving of the diagram as an image #67

Open BOCOVO opened 1 month ago

BOCOVO commented 1 month ago

Implementing the saving of the diagram as an image

This issue is about saving of the diagram as an image in a file.

The user flow

To implement that, we will add a new button to the toolbar. When the user clicks on this button, the VsCode saving dialog should be open and asks him where to save the file. When the user selects a location, the image will be saved in the location.

Some documentation

  1. How to open the VsCode saving dialogs Here is the documentation : https://code.visualstudio.com/api/references/vscode-api#:~:text=or%20undefined.-,showSaveDialog,-(options%3F An usage example : https://github.com/Durandal14/vscode-extension-dbml-viewer/blob/main/src/extension.ts#L118C37-L118C51

  2. How to generate the image Since the plugin uses Konva.js we that use the provided method for create image. Here is the documentation : https://konvajs.org/api/Konva.Node.html#toImage:~:text=()%3B-,toDataURL(config),-Creates%20a%20composite

    We will keep the image as PNG

    We need to make sure we capture only those parts of the scene that have a drawing.

  3. Some indication about the code


hi @ayushsaini12

AleDiazACTIU commented 3 weeks ago

When can we expect the release version so that we can export .png, .svg or .pdf?

ayushsaini12 commented 3 weeks ago

currently a little busy with work and festivals give me few weeks will be updating you soon