XuluWarrior / swagger-editor-offline

A cross-platform desktop version of swagger-editor
MIT License
12 stars 2 forks source link

Allow to open files from and save them to Filesystem #1

Open bkmeneguello opened 6 years ago

bkmeneguello commented 6 years ago

I think it's possible to hack into "swagger-editor" to import a file (and its dependencies) from FileSystem API, them save it to the same API. If you look at topbar.jsx#L64 'll notice that it only calls this.props.specActions.updateSpec(YAML.safeDump(YAML.safeLoad(textFromFileLoaded))) with textFromFileLoaded from the (obviously) loaded file. If you add a menu bar and implement an Electron's load file dialog and feed the editor with this data, it should be nicely integrated with local FS, then a simple "Save" action could overwrite the file and (maybe) some fsnotifier could sync the editor when some external editor changes the same content.

XuluWarrior commented 2 months ago

It's been a long time coming. (A very long time). But I've finally come back to this project and added the file actions to the Electron menu bar.

https://github.com/XuluWarrior/swagger-editor-offline/releases/tag/v0.2.0

So far these (mostly) mimic the ones available in the browser window. The exception being I rolled up the "convert to" logic into a choice of format in the Save As dialog.

So no "Save" option yet. And no monitoring the filesystem. I'll work on "Save" next