kotlin-playground icon indicating copy to clipboard operation
kotlin-playground copied to clipboard

Add offline mode

Open Hypnosphi opened this issue 6 years ago • 9 comments

This PR adds an ability to opt out of any communications with server.

Possible usecases are: strict content security policy, user data protection, offline support

Hypnosphi avatar Jul 23 '19 12:07 Hypnosphi

Hi! Thanks for your help =) We already have "offline mode". Just use data-highlight-only attribute. So, if u want to prevent all request to server just forbid all requests in web-demo-api file when data-highlight-only is true.

AlexanderPrendota avatar Jul 24 '19 06:07 AlexanderPrendota

Just use data-highlight-only attribute

It sets codemirror to readonly mode

Hypnosphi avatar Jul 24 '19 11:07 Hypnosphi

Do you want to edit code without runnable? What is your point? U can just use plain Codemirror library instead of kotlin-playground.

So, we can add offline attribute and prevent all request to server just forbid all requests in web-demo-api file

AlexanderPrendota avatar Jul 24 '19 11:07 AlexanderPrendota

just use plain Codemirror library instead of kotlin-playground.

I use the //sampleStart///sampleEnd feature

Hypnosphi avatar Jul 24 '19 14:07 Hypnosphi

Okay! Let's patch file with requests instead of adding a lot of conditions in several files) What do u think?

AlexanderPrendota avatar Jul 25 '19 08:07 AlexanderPrendota

@AlexanderPrendota

patch file with requests

You mean, pass offline option to each of the functions in https://github.com/JetBrains/kotlin-playground/blob/master/src/webdemo-api.js ? That wouldn't remove Run button and autocompletion override

Hypnosphi avatar Jul 25 '19 10:07 Hypnosphi

remove Run button

Just add a condition to .monk file

autocompletion

why do you need to override completion method?

AlexanderPrendota avatar Jul 25 '19 11:07 AlexanderPrendota

Just add a condition to .monk file

Done already

why do you need to override completion method?

I need the contrary: avoid overriding default CM autocomplete when it's known to be useless. Same for shortcuts

Hypnosphi avatar Jul 25 '19 12:07 Hypnosphi

Hey! I put a9bb058. So, we dont add editor hints and other options in readonly mode.

AlexanderPrendota avatar Jul 26 '19 08:07 AlexanderPrendota