-
Notifications
You must be signed in to change notification settings - Fork 47.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSFiddle integration #30
Conversation
This is a small snippet that exploits the fact that we can run custom script on jsfiddle before the Javascript1.7 transpiler is executed. We change the script type to text/jsx to run our transpiler pipeline instead. http://facebook.github.io/react/js/JSFiddleIntegration.js
@jeffreylin can you take this one for CDN stuff? |
FWIW, I think the selector is fragile - In the languages selector on the left in jsfiddle, you can pick between JS, JS1.7, and Coffeescript - I think this script only works for the JS1.7 option... I wouldn't merge this unless we're sure this works on al "language" options or at least the one out of the box w/ a message - tbh I think the one out of the box is regular JS and not JS1.7. |
@petehunt sure thing |
We can't make it work with the default language unfortunately. It is a <script> tag that executes automatically. We need to use Javascript1.7 or CoffeeScript. The goal is to provide a HelloWorld JSFiddle that people can modify and fork that is properly configured. |
This might be OK to do short term, but we should do our best to get JSX to a point where we can ask to add JSX to the language choices. |
This would be ideal indeed, but meanwhile this is a working solution |
Let me update it so we have to put /** @jsx React.DOM */ in the code instead of having the script automatically inserting it. |
Okay cool - I guess as long we tell people to fork off that JSFiddle, it should be good. =D Maybe add an alert("Requires the Javascript 1.7 language in JSFiddle.") to the script if it can't find the script tag - just incase people copy pasta the script src. |
Now using .replace instead of hardcoded numbers for readability I had a version without document.querySelector but JSFiddle doesn't work for IE7 and IE8 :x
http://jsfiddle.net/vjeux/25Rhk/ Here's how the new base fiddle |
Using JS1.7 we lose syntax highlighting unfortunately. We can already make it work with the normal Javascript but since the code is executed it displays a javascript error every time you run it. I haven't found a way to make that parsing error go away without also losing syntax highlighting :( |
I just mailed Piotr Zalewa the author of JSFiddle about the issue. |
Ping |
@zpao where should this file live? Definitely not docs/js. Maybe docs/_js |
This lgtm - I can just toss it on fb.me if you want - lmk what URI you want. Also fwiw, it doesn't have to be the final version - we can always change where the fb.me URI points. |
Something like: http://fb.me/react-js-fiddle-integration.js I don't really care about the name as long as you give me the final url |
Thanks! |
@vjeux - cool - uploaded to http://fb.me/react-js-fiddle-integration.js - appears to work! =] http://jsfiddle.net/MmRXB/2/ |
@vjeux can you send out a pull to add this to the docs somewhere? |
Added React.forwardRef support to react-reconciler based renders and the SSR partial renderer.
Added React.forwardRef support to react-reconciler based renders and the SSR partial renderer.
This is a small snippet that exploits the fact that we can run custom script on jsfiddle before the Javascript1.7 transpiler is executed. We change the script type to text/jsx to run our transpiler pipeline instead.
http://facebook.github.io/react/js/JSFiddleIntegration.js