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

Add Native File System API saving/exporting and opening #388

Merged
merged 8 commits into from Jan 17, 2020

Conversation

@tomayac
Copy link
Collaborator

tomayac commented Jan 16, 2020

Fixes #169

This PR adds Native File System API to Excalidraw. On compatible user agents it will use the new API, on other user agents it will fall back to the legacy approach.

@now

This comment has been minimized.

Copy link

now bot commented Jan 16, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/vjeux/excalidraw/46fhrv325
Preview: https://excalidraw-git-fork-tomayac-nativefs.vjeux.now.sh

@tomayac

This comment has been minimized.

Copy link
Collaborator Author

tomayac commented Jan 16, 2020

To test, make sure you have the approriate flag set.

Before you deploy, make sure you add an actual origin trial token instead of the placeholder.

@vjeux

This comment has been minimized.

Copy link
Collaborator

vjeux commented Jan 16, 2020

I enabled the flag, clicked save and open but I don't see any difference. It seems to open the file picker the exact same way as before. Could you educate me on what is the advantage of the new file system API?

@dwelle

This comment has been minimized.

Copy link
Collaborator

dwelle commented Jan 16, 2020

Actually, before it didn't show a file save dialog during save (at least on Win7). And during open, it narrowed down files to json files, which it now doesn't.

As I understand it, the new FS API should in the long run (but not as of yet) allow saving/reading from a file without having to re-select the file? I.e. it should support ctrl/cmd+s without the dialog, if the scene was previously opened from a given file (same as native apps would) --- or maybe I'm mistaken?

@tomayac

This comment has been minimized.

Copy link
Collaborator Author

tomayac commented Jan 16, 2020

The Native File System API allows for true saving at arbitrary locations, whereas the legacy approach always downloads to the Downloads folder. You also can’t overwrite an existing file.

@tomayac

This comment has been minimized.

Copy link
Collaborator Author

tomayac commented Jan 16, 2020

Writing back to the originally opened file is possible if you keep the file handle. Is this wanted?

@tomayac

This comment has been minimized.

Copy link
Collaborator Author

tomayac commented Jan 16, 2020

Opening should actually filter on .json files. I think it worked fine on macOS, but I didn’t pay attention since I opened from a folder with just one file.

@vjeux

This comment has been minimized.

Copy link
Collaborator

vjeux commented Jan 16, 2020

Thanks, that makes sense! And yeah, I can see the ability to save to a specific location indeed!

I'm supportive of it. Please add the right token and you can merge it.

@tomayac

This comment has been minimized.

Copy link
Collaborator Author

tomayac commented Jan 17, 2020

This now reuses an open file handle, so the flow is super natural (open, edit, save). I also fixed an issue with the open dialog that indeed didn't filter on .json. Now it does. Merging this. 🤞

@tomayac tomayac merged commit 7ddc206 into excalidraw:master Jan 17, 2020
1 check passed
1 check passed
now Deployment has completed
Details
@tomayac tomayac deleted the tomayac:nativefs branch Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.