Open zzhangjii opened 6 years ago
@zzhangjii @tgeorgeux
I think we should step back and study how other applications handle these types of situations where there are two files involved (the "document" and the "data"). Tableau is a great example of such an app we could study. What are others?
I think of outputting files from Figma/Sketch, save as .fig or Export into various file types. Microsoft Office/GSuite both have separate save and export features as well. I think it's safe to say 'export' is a good option, and possibly give options for how to export.
Currently, the changes in voyager are saved through newly designed 'Save Voyager' button in 'Voyager' menu or toolbar, it kind of conflicts with JupyterLab user's operation habit: since under 'File' menu, Jupyterlab already provided 'Save', 'Save As', 'Save All' commands for users to save work to local files. So, for Voyager, we should follow this design, use those native 'Save' buttons to save the current Voyager status (vl.json form by default) to local files.
Those 'Save' commands rely on each widget's context() function to get the contents. I modified VoyagerPanel's context() function, now the original 'Save' button under File menu can save the changes inside voyager to local vl.json file. But for other file types like csv, this action will put vl.json content into csv file and therefore destroy the original data. So, right now I added another logic in context() function to determine if a file is vl.json, if it's not, then the 'Save' command will not actually do anything.
My current solution is not ideal, any suggestions? @ellisonbg