viebel / klipse

Klipse is a JavaScript plugin for embedding interactive code snippets in tech blogs.
http://blog.klipse.tech/
GNU General Public License v3.0
3.11k stars 148 forks source link

Save Work #285

Closed JimLynchCodes closed 6 years ago

JimLynchCodes commented 7 years ago

It would be awesome to save your current session to a text name, even if it's only saved to local storage. ;)

viebel commented 7 years ago

Hello @JimTheMan, Can you provide more details about your use case?

shipstar commented 6 years ago

I'll chime in with a related use case -- We're trying to use klipse for a couple simple problems related to a job application. We thought an in-browser editor with live evaluation would be a better experience for small, quick, FizzBuzz-level problems than uploading files or copy/pasting into a textarea. (We are still testing this hypothesis!)

I'm trying to embed klipse in a form so that the user can edit and run their solution rapidly, then submit when they solve the problem. I need to get access to the data inside the editor to submit to the backend, but I haven't found the right hooks into klipse/CodeMirror to make that happen.

re: Jim's case, we've also talked about saving incremental progress along the way, either via AJAX call or localStorage.

Is this possible with the current version of klipse?

(In case it helps, we are primarily evaluating Ruby, Python, and JavaScript/React at this time.)

JimLynchCodes commented 6 years ago

Currently when I open a new tab and navigate to app.klipse.tech it opens a fresh project with no way to get back to my previous works. When I originally opened this issue I was thinking of having like a library of my works. I think what @shipstar is describing sounds more like saving off forks of an individual project, which is cool too. Both features I think are similar to things they do in plunkr.

viebel commented 6 years ago

@JimTheMan for app.klipse.tech, we can share a snippet thru URL parameter or github gist. Using Ctrl-R or Ctrl-S. See http://blog.klipse.tech/clojure/2016/03/27/klipse-manual.html

viebel commented 6 years ago

@shipstar for your use case, Klipse supports loading code from a github gist. But the user has to manually create the gist. We could add a button that saves a Klipse snippet into a github gist.

viebel commented 6 years ago

@shipstar please open a new issue for this use case.

JimLynchCodes commented 6 years ago

Yes, but then I need to store and manage all these humongous URLs myself. :)

On Dec 19, 2017 2:34 AM, "Yehonathan Sharvit" notifications@github.com wrote:

@JimTheMan https://github.com/jimtheman for app.klipse.tech, we can share a snippet thru URL parameter or github gist. Using Ctrl-R or Ctrl-S. See http://blog.klipse.tech/clojure/2016/03/27/klipse-manual.html

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/viebel/klipse/issues/285#issuecomment-352662682, or mute the thread https://github.com/notifications/unsubscribe-auth/AFGys5ZFZiYOYZMK0cVIL1zuwC943UCyks5tB2bzgaJpZM4QSpaI .

panozzaj commented 6 years ago

As context for @shipstar's comment (we work together) we ended up looking at the klipse_editors global and it has the raw code as, say klipse_editors[0].getValue(). I couldn't get the onChange handler working, but we could theoretically hook into that to persist the value of the editor to the backend. Right now we're relying on a manual save and a periodic sync to the backend, which works for now. I think our immediate concern is addressed. Hope this helps!

viebel commented 6 years ago

@panozzaj Can you give more details about the periodic sync to the backend? Can you show a demo of your app?

panozzaj commented 6 years ago

It is an AJAX post request to the backend triggered by a setInterval. You could probably also store to localstorage instead of the backend in the same way.

On Dec 20, 2017 01:33, "Yehonathan Sharvit" notifications@github.com wrote:

@panozzaj https://github.com/panozzaj Can you give more details about the periodic sync to the backend? Can you show a demo of your app?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/viebel/klipse/issues/285#issuecomment-352977638, or mute the thread https://github.com/notifications/unsubscribe-auth/AADHsES9QvvoTSpAtFNq8QiwCbKZNMZoks5tCKpQgaJpZM4QSpaI .

viebel commented 6 years ago

@panozzaj Is your app live? Can you share the url?

JimLynchCodes commented 6 years ago

Just to throw my point zero two dollars in as a user I would prefer a db to localstorage so that I can have a list of "Jim's saved clojure klipses" that can be accessed from all my various devices (especially my hexagon-shaped phone). :)