Add legacy JSFiddle files (#11030)
* Add legacy JSFiddle files * Exclude from Prettier
Dan Abramov committed
Oct 2, 2017 at 16:48 UTC
2fdb84d999d4041b2a0fd890121d949c1a672772
3 files changed
+29
-1
scripts/prettier/index.js
+5
-1
@@ -34,7 +34,11 @@ const defaultOptions = {
34
const config = {
35
default: {
36
patterns: ['src/**/*.js', 'www/**/*.js'],
37
- ignore: ['**/third_party/**', '**/node_modules/**'],
37
+ ignore: [
38
+ '**/third_party/**',
39
+ '**/node_modules/**',
40
+ '**/jsfiddle-integration*.js',
41
+ ],
42
},
43
scripts: {
44
patterns: ['scripts/**/*.js', 'fixtures/**/*.js'],
www/static/js/jsfiddle-integration-babel.js
new
+12
@@ -0,0 +1,12 @@
1
+// Do not delete or move this file.
2
+// Many fiddles reference it so we have to keep it here.
3
+(function() {
4
+ var tag = document.querySelector(
5
+ 'script[type="application/javascript;version=1.7"]'
6
+ );
7
+ if (!tag || tag.textContent.indexOf('window.onload=function(){') !== -1) {
8
+ alert('Bad JSFiddle configuration, please fork the original React JSFiddle');
9
+ }
10
+ tag.setAttribute('type', 'text/babel');
11
+ tag.textContent = tag.textContent.replace(/^\/\/<!\[CDATA\[/, '');
12
+})();
\ No newline at end of file
www/static/js/jsfiddle-integration.js
new
+12
@@ -0,0 +1,12 @@
1
+// Do not delete or move this file.
2
+// Many fiddles reference it so we have to keep it here.
3
+(function() {
4
+ var tag = document.querySelector(
5
+ 'script[type="application/javascript;version=1.7"]'
6
+ );
7
+ if (!tag || tag.textContent.indexOf('window.onload=function(){') !== -1) {
8
+ alert('Bad JSFiddle configuration, please fork the original React JSFiddle');
9
+ }
10
+ tag.setAttribute('type', 'text/jsx;harmony=true');
11
+ tag.textContent = tag.textContent.replace(/^\/\/<!\[CDATA\[/, '');
12
+})();