File tree Expand file tree Collapse file tree 4 files changed +20
-5
lines changed
Expand file tree Collapse file tree 4 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 66 < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
77 < link rel ='stylesheet ' type ='text/css ' media ='screen ' href ='../../../style/highlight.css '>
88 < link rel ='stylesheet ' type ='text/css ' media ='screen ' href ='../../../style/example.css '>
9+ < script type ="module ">
10+ import JsFiddle from '../../../script/jsfiddle.js' ;
11+ document . getElementById ( 'example-edit-btn' ) . onclick = ( ) => {
12+ let html = `<div id="vizzuCanvas" ></div>` ;
13+ let css = `#vizzuCanvas {
14+ width: 680px;
15+ height: 446px;
16+ }` ;
17+ let code = document . getElementById ( 'script' )
18+ . getElementsByTagName ( 'SCRIPT' ) [ 0 ] . innerText ;
19+ JsFiddle . post ( html , css , code ) ;
20+ }
21+ </ script >
922 </ head >
1023< body >
1124 < noscript >
1225 < p class ="noscript "> To use Vizzu, please enable Javascript.</ p >
1326 </ noscript >
1427 < div id ="vizzuCanvas "> </ div >
1528 < div id ="navigation ">
16- < button id ="example-replay-btn " class ="button " type ="button " onclick ="location.reload() "> ▶ replay</ button >
29+ < button id ="example-replay-btn " class ="button example-btn " type ="button " onclick ="location.reload() "> ▶ replay</ button >
30+ < button id ="example-edit-btn " class ="button example-btn " type ="button "> edit</ button >
1731 </ div >
1832 < div id ="script "> </ div >
1933 < div id ="code "> </ div >
Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ class Example
3434
3535 script = script . replace ( / e x p o r t d e f a u l t t e s t S t e p s ; / , '' ) ;
3636 script = script . replace ( / ( i m p o r t .* ) / , ( match , p1 ) => {
37- this . imports += p1 + '\n' ;
37+ let importLine = p1 . replace ( / f r o m \s + ( [ ' " ] ) / , "from $1https://lib.vizzuhq.com" ) ;
38+ this . imports += importLine + '\n' ;
3839 return '' ;
3940 } ) ;
4041
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ export default class JsFiddle {
33 static post ( html , css , js ) {
44 let form = document . createElement ( "form" ) ;
55 form . method = "POST" ;
6- form . action = "http ://jsfiddle.net/api/post/library/pure/" ;
6+ form . action = "https ://jsfiddle.net/api/post/library/pure/" ;
77 form . target = "_blank" ;
88 let params = {
99 html : html ,
Original file line number Diff line number Diff line change @@ -36,14 +36,14 @@ body {
3636 text-align : center;
3737}
3838
39- # example-replay -btn {
39+ . example-btn {
4040 margin : auto;
4141 margin-top : 1em ;
4242 background-color : # fafafa ;
4343 color : # aaa ;
4444}
4545
46- # example-replay -btn : hover {
46+ . example-btn : hover {
4747 background-color : # ffffff ;
4848 color : # 666 ;
4949 filter : drop-shadow (0px 2px 3px # eee );
You can’t perform that action at this time.
0 commit comments