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

Live editing of narrative files #1117

Closed
wants to merge 2 commits into from
Closed

Conversation

jameshadfield
Copy link
Member

This PR introduces a prototype of live editing of narrative files. It's not ready for merge into master [1] but it is usable and I want to surface it now to solicit comments from those currently writing a lot of narratives, cc @emmahodcroft, @cassiawag & @sidneymbell.

Currently it can be run locally (see the readme for instructions) or via https://auspice-dev.herokuapp.com/ (which is currently very slow, see [2]).

It allows you to drag & drop a markdown narrative onto the browser and then edit content in place while seeing the rendered narrative update. This is best explained via a screen-grab:

live-editing-example

This is a prototype. Please see the readme for a list of items which still need implementing (I'm hoping others can help here). This PR starts us on the journey described in #957.

[1] For one, it overwrites the heroku behavior so review apps won't work. See commit message of f1f2ed1 for more details.
[2] Mainly because everything's running in dev mode, so nothing's compressed and fetching large amounts of JSON + JS is slow.

See ./narratives-editor/README.md for overview.
This could be better implementing using heroku config variables to define which app to build. Or by building both and making them available at different addresses.
@jameshadfield jameshadfield temporarily deployed to auspice-auspice-ex-avib-roe5is May 9, 2020 02:04 Inactive
@cassiawag
Copy link
Contributor

cassiawag commented May 9, 2020

@jameshadfield -- this is so cool!! Very nice work on it. I am excited for using this with translations.

Most of the valuable functionality I see is already covered in your to-do list in the readme. In order for this to be really useful for translations, I think integration with GitHub repos is key. Ideally, I could go to the app online, translate a narrative, and then have the GitHub repo automatically update with my translation. Translators vary in tech savvy-ness. Some solely edit on GitHub; some clone the repo and modify locally. Those who know how to use GitHub could copy and paste from their local repo to the online app, but this will be a barrier to uptake for others. Plus, moving the file to a new system is an extra step in the translations workflow. Some might prefer to just edit the markdown file locally and push up to GitHub for preview after as they currently do.

Obviously, if not GitHub integrated, this will still be very useful for writing narratives. While writing, it's easier to screw up syntax, and live preview has more value.

@eharkins
Copy link
Contributor

eharkins commented May 11, 2020

@jameshadfield this is sweet! Happy to take on some of the to-do items, let's chat about it whenever works best for you.

One risk associated with editing in the client (also exists of course when editing on the github UI) is that you can lose your work by leaving the page or refreshing (you also lose your work on one slide when changing to another without first clicking Update). Not sure there are many ways around this, other than implementing some autosave feature (sounds complicated) or just warning users to save their work often.

@tsibley
Copy link
Member

tsibley commented May 11, 2020

@cassiawag One big risk with saving back to GitHub directly is blowing away other edits that happen in the intervening time between one person opening it and saving it. If that situation isn't handled, it's a fairly substantial usability hurdle. If it is handled, it's a fairly substantial technical hurdle.

@emmahodcroft
Copy link
Member

This is so cool James!!

My guess would be barring a big technical solution, we might just need to tell translators to stop and copy/paste slides into Github (or their local repo) whenever they finish a slide - to ensure their work is saved. For some, they might want to do a 'first pass' just translating, then they can drag and drop into this to ensure it all looks the way it should - if copying every slide back is too tedious?

But Cassia definitely better to comment on how the translations work!

@cassiawag
Copy link
Contributor

cassiawag commented May 12, 2020

That's a good concern @trs. I think that's currently a concern with editing translations on GitHub, which groups that do edit on GitHub have mostly worked around by lots of communication about who's working on what when. It's definitely a cumbersome solution though.

@sidneymbell
Copy link
Contributor

This is really fantastic, thanks so much for working on this @jameshadfield!!

Most of my comments are in the to-do list already.

  • I'd echo the autosave issue -- easy to lose work. As a first pass, could we perhaps prompt the user for a local file path at the beginning, and automatically dump updates to that file at some regular interval?

  • Worth noting that any bugs that 'break' narratives in core auspice will become bigger issues in this context with non-technical users (e.g., links at line endings, map zooming, etc).

  • [Semantic] While I like the meaning, the naming may hurt discoverability of this awesome new feature.

@tsibley
Copy link
Member

tsibley commented May 13, 2020

I'd echo the autosave issue -- easy to lose work. As a first pass, could we perhaps prompt the user for a local file path at the beginning, and automatically dump updates to that file at some regular interval?

Not really possible to save directly to a local file path from a web app without user interaction.

As an alternative, though, the editor could save contents to localStorage and load it from there if present/resuming a session.

@trvrb
Copy link
Member

trvrb commented Sep 17, 2020

What about continually saving to a GitHub repo ala https://prose.io/? Or could continually save to S3 via Nextstrain Groups. Idyll uses it's own Idyll.pub API to solve a similar issue.

@sidneymbell
Copy link
Contributor

sidneymbell commented Sep 17, 2020 via email

@jameshadfield
Copy link
Member Author

Thanks for all the comments :)

I've cleaned up the code a bit (it's still very much a prototype) and converted it to a stand-alone app which imports auspice as a dependency. I've improved bits and pieces of the functionality, and fleshed out the to-do list which hopefully I (and other contributors) can tackle piece-by-piece.

You can find the code & future development at https://github.com/nextstrain/auctor.

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

Successfully merging this pull request may close these issues.

None yet

7 participants