JoelOtter / kajero

Interactive JavaScript notebooks with clever graphing
Other
1.87k stars 110 forks source link

A way to make the notebook "readonly" #49

Open jdarling opened 8 years ago

jdarling commented 8 years ago

I've noticed that once you publish the notebook its still has the editor built in. Would be nice if the notebook could be made readonly where you could execute the code on the page, but not edit the contents. I realize that the edits don't persist to other users, but I'd hate to have my PM try to use this :D

JoelOtter commented 8 years ago

I decided quite early on in this project that I didn't want to make read-only notebooks - I think being able to edit the code and mess around with it is a core feature. 😄 I also think every public notebook should be fork-able.

Obviously if you're using it internally, though, that's a different story. My recommendation would be for you to just fork it and disable the edit button - this should be really easy to do, and I'll be hanging out on the Gitter chat so can totally help out.

Alternately, as a compromise, we could potentially have it so that if you have readonly: true in the front-matter at the top of the Markdown document, the edit button doesn't get shown. I probably won't add this to the UI unless there's a huge demand for it, as I think it goes against one of the project's core features, but for internal use it might be helpful.

What do you think?

jdarling commented 8 years ago

If there were a way to embed the component part (see #48) then a simple flag on the component saying readonly={true} would suffice. It would be interesting to set readonly: true at the top of the document, as then you would have to have a flag on the editor to say "ignore readonly" :D But I like where your going.