vscode-drawio icon indicating copy to clipboard operation
vscode-drawio copied to clipboard

Make .dio.svg content diff friendly

Open Speedy37 opened this issue 4 years ago • 7 comments

Currently the draw.io xml data is stored in base64 format within the content attribute of the svg element.

It would be nice to have an option to store this data directly in xml (svg is xml) within the svg.

For example we could that information within the metadata element

<svg>
   <metadata>
     <mxfile ...>
         ...
     </mxfile>
   </metadata>
   ...
</svg>

There is two ways to do this task:

  • Preprocess/postprocess svg input/output (slower but easy to implement)
  • Extract the metadata, hack into draw.io svg+xml extraction process (faster but hard to implement)

It can also be a mix of both as extracting the metadata is an easy task.

Speedy37 avatar Aug 11 '20 14:08 Speedy37

Nice idea! However, I think this should

  1. either be implemented in draw.io itself (maybe we can open an issue in their repo?)
  2. or with forward compatibility so that the web app can still open such a file. This could be achieved by keeping the content attribute as a fall back, along your proposed metadata elemetn.

I want to avoid creating an incompatible format. Also, are you sure that no SVG processing tool interprets your proposed metadata element?

hediet avatar Aug 11 '20 15:08 hediet

Upstreaming changes to the encoding/decoding step to draw.io seems the best way to proceed.

Changes should be minimal and would only requires a new option to the message API.

Depending on how my free time goes this week, I might find some time to allocate experimenting with this approach.

Speedy37 avatar Aug 11 '20 15:08 Speedy37

Did you find time / manage to get something working? ;)

hediet avatar Aug 27 '20 00:08 hediet

Not yet

Speedy37 avatar Aug 27 '20 17:08 Speedy37

Btw. if you have paypal or github sponsors, I can share some of the amount I get from github sponsors with you for your work on this extension ;)

hediet avatar Aug 27 '20 17:08 hediet

Thx for the proposition, but for now this is a hobby :)

Speedy37 avatar Aug 27 '20 22:08 Speedy37

I agree in that this is an upstream issue. However this is probably more involved than you think as SVG does not support any element (to my knowledge). Therefore a new namespace would have to be defined and declared. What I am doing currently is saving the File as uncompressed XML which seems to do the job just fine.

septatrix avatar Feb 27 '21 12:02 septatrix