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

Saving should trigger a file download #20

Closed
Lonami opened this issue Jul 26, 2018 · 6 comments
Closed

Saving should trigger a file download #20

Lonami opened this issue Jul 26, 2018 · 6 comments
Labels
enhancement New feature or request

Comments

@Lonami
Copy link

Lonami commented Jul 26, 2018

This is not an issue, nor appropriated for the Vim mailing list. However, since this is basically a version of Vim for the web it would make sense to offer some of the features you would expect from a web editor, such as saving. The :w command could for example trigger a file download. Likewise, opening a file could ask the user to select a file to upload.

@rhysd
Copy link
Owner

rhysd commented Jul 28, 2018

I agree. But vim.wasm is not in the phase for now. I'm now trying to fix/improve base implementations to make vim.wasm run faster/more robustly. I want to extend fundamental features like :write you're pointing after current fixes are done.
Anyway, thank you for reporting this. To keep your idea in my mind, I'll label this issue as 'enhancement'.

@rhysd rhysd added the enhancement New feature or request label Jul 28, 2018
@HVCode
Copy link

HVCode commented Aug 11, 2018

i was going to ask something like this, so my question is how can i get what i write?, i mean if i want to use what i write for an API, for example

@rhysd
Copy link
Owner

rhysd commented Aug 12, 2018

Possible implementation would be:

  1. Implement a JavaScript function which is supposed to be called at writing a file. In the function, we can show dialog or do something.
  2. In C, :write is implemented in do_write() function of ex_cmds.c. Call above JavaScript function in do_write() with the file name and the buffer content

@rhysd
Copy link
Owner

rhysd commented Jun 20, 2019

After some thoughts, I implemented :export special command to download current buffer or specific file at 4c81d4c.

I did not hook :write because browser does not overwrite existing file (e.g. when downloading foo.txt twice, foo (1).txt is downloaded at second time). Each :write generates a new file and it would be annoying.

@rhysd rhysd closed this as completed Jun 20, 2019
@rhysd
Copy link
Owner

rhysd commented Jun 20, 2019

Here is a screenshot.

tmp

@Lonami
Copy link
Author

Lonami commented Jun 20, 2019

Cool, good job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants