File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -17,21 +17,15 @@ function cleanCodePenData(data) {
17
17
18
18
function createCodePen ( data ) {
19
19
20
- var JSONstring =
21
- JSON . stringify ( data )
22
- // Quotes will screw up the JSON
23
- . replace ( / " / g, """ ) // careful copy and pasting, I had to use a zero-width space here to get markdown to post this.
24
- . replace ( / ' / g, "'" ) ;
25
-
20
+ var JSONstring = JSON . stringify ( data ) ;
26
21
27
22
var form = '<form action="https://codepen.io/pen/define" method="POST" target="_blank">' +
28
- '<input type="hidden" name="data" value=\'' +
29
- JSONstring +
30
- '\'>' +
23
+ '<input type="hidden" name="data">' +
31
24
'</form>' ;
32
25
33
26
var div = document . createElement ( "div" ) ;
34
27
div . innerHTML = form ;
28
+ div . firstChild . firstChild . value = JSONstring ;
35
29
document . body . appendChild ( div ) ;
36
30
div . firstChild . submit ( ) ;
37
31
setTimeout ( function ( ) {
@@ -123,6 +117,7 @@ module.exports = function() {
123
117
var jsAsModule = "<script type=\"module\">\n" + data . js + "\n</script>" ;
124
118
data . html = data . html ? data . html + "\n\n" + jsAsModule : jsAsModule ;
125
119
data . js = "" ;
120
+ data . editors = "1001" ; // HTML, Result, & Console
126
121
}
127
122
if ( data ) {
128
123
cleanCodePenData ( data ) ;
Original file line number Diff line number Diff line change @@ -63,14 +63,14 @@ describe("bit-docs-html-codepen-link", function() {
63
63
html : '<my-app></my-app>\n\n<script type="module">\nimport { Component } from "//unpkg.com/can@^5.0.0-pre.1/core.mjs";\nComponent\n</script>' ,
64
64
js : '' ,
65
65
js_module : true ,
66
- editors : '1011 ' ,
66
+ editors : '1001 ' ,
67
67
css : 'my-app {color: "green";}'
68
68
} ,
69
69
{
70
70
html : '<script type="module">\nimport {DefineMap} from "//unpkg.com/can@^5.0.0-pre.1/core.mjs";\nconsole.log( myCounter.count ) //-> 1\n</script>' ,
71
71
js : '' ,
72
72
js_module : true ,
73
- editors : '0011 '
73
+ editors : '1001 '
74
74
}
75
75
] ) ;
76
76
You can’t perform that action at this time.
0 commit comments