Open jmfayard opened 5 years ago
Hi! :) Could you please add more description?
@AlexanderPrendota This kotlinplayground.html is rendered like this:
I want to prevent the people writing on http://dev.to to make the mistake to use the wrong link when they embed a code snippet.
Let say the URLs were instead something like
https://pl.kotl.in/owreUFFUG?embedded&theme=darcula&from=3&to=6
https://pl.kotl.in/edit/zYp4eGLeP?edit
Then I could raise an error if they try to use the second URL
Hey. Ah, got it.
Your link https://pl.kotl.in/owreUFFUG?embedded&theme=darcula&from=3&to=6
will redirect on https://play.kotlinlang.org/embed?short=owreUFFUG&embedded&theme=darcula&from=3&to=6
. You can prevent people by /embed
url.
Does it possible?
That solves my problem, thank you @AlexanderPrendota
Hello @AlexanderPrendota
My pull-request for embedding Kotlin Playground snippets is now live in dev.to
For example you can see at this URL
I have two remaining problems:
1) The iframe is vertically too short. Is there a way I can compute the height
of the iframe? Medium.com does it fine
2) I have an escaping problem in my query string. When I write a post with {% kotlin https://pl.kotl.in/m2LoR1KM5?theme=darcula&from=6&to=16 %}
, then Ruby on Rails (which powers dev.to) insists on not allowing &
inside the iframe URL.
<iframe src="https://play.kotlinlang.org/embed?short=owreUFFUG&from&to&theme=darcula&readOnly" allowtransparency="true" scrolling="no" frameborder="0"></iframe>
I have found in Wikipedia https://en.wikipedia.org/wiki/Query_string#Web_forms that the W3C recommands that all web servers support query Elements separated by a semi-colon ;
in addition of &
. Here it means the two URLs would be equivalent:
https://play.kotlinlang.org/embed?short=owreUFFUG&from=3&to=6
https://play.kotlinlang.org/embed?short=owreUFFUG;from=3;to=6
Could this be supported by the Kotlin Playground? That would solve my problem
The problem due to iframe resizing. We will have a look. Thanks!
@jmfayard Do you know dev.to
has API for iframe resizing? I can send some events on editor changes.
for examples, emdedly platform provides resizing for the Medium : https://docs.embed.ly/v1.0/docs/provider-height-resizing
@jmfayard Any updates here?
@AlexanderPrendota I have asked the dev.to team right now here https://github.com/thepracticaldev/dev.to/issues/4011
Thanks!
Hello,
I'm adding support for embedding kotlin playground in https://dev.to
One issue I'm having is that I would like to prevent people from using not the embedded link (from the medium tab) but the link to edit the playground.
Is there a way to distinguish which url is embedded or not?
https://github.com/thepracticaldev/dev.to/pull/3801