r-wasm / webr

The statistical language R compiled to WebAssembly via Emscripten, for use in web browsers and Node.

Home Page:https://docs.r-wasm.org/webr/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider adding "Share" feature to webR REPL

coatless opened this issue · comments

It would be the bee's knees for demo purposes if the webR REPL editor could receive the "Share" feature that the shinylive editor has. Perhaps add it next to the save button in the editor?

Mockup of the webR REPL environment with a 'share' button present

I think this could be taken out from the ShareModal.tsx (for the popup), share.ts (for encoding), and App.tsx (for loading)

Happy to try my hand at this given the other awesome work going on.

@coatless I've made something like that here, it's my attempt at a minimal IDE + embedded BI component.

I'm doing it all in R/Shiny though! Depending on when you look at this link I've been sharing in 2 ways currently, 1) sketchy way POST json object to API with a base64 encoded string + md5 hash of that string (how I currently do it). This is good in that it allows for very large strings of code, but bad in that my API could be abused in its current state. 2) Don't POST anything just use the base64 encoded string... should be good for well over 1000 lines of code (what I'm going to do now).

A delayed copy of the source code can be found here. Working on transitioning from a mostly closed source github to an open source one, so sorry for the delay.

Hi @coatless,

I agree, this would be a great feature to have. Another thing that the shinylive editor is able to do that would be useful here is interacting with the GitHub API and loading code via a gist ID encoded in the URL - see, for example, https://shinylive.io/py/editor/#gist=e62218aa28bf26e785fc6cb99efe8efe

Yes, do feel free to work on this and submit a PR, if you'd like.

@seanbirchall nice work on the shiny app & deploying via shinylive! Cool to see an IDE created in Shiny!

@georgestagg okidokie; I'll probably send over a PR this weekend. (I may also port in the resize window feature as well 😄 )