File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed
theme/default/lib/markdown Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,23 @@ export default class Canvas extends PureComponent {
24
24
</ code >
25
25
</ pre >
26
26
) ;
27
+ const isPreview = / ^ ( h t m l | h t m ) $ / . test ( this . props . language ) ;
28
+
27
29
if ( / ^ _ _ d o m e _ _ / . test ( this . props . value ) ) {
28
30
return (
29
31
< div className = { styles . demo } >
30
- < div className = { styles . demoBody } id = { this . playerId } >
31
- { / ^ ( h t m l | h t m ) $ / . test ( this . props . language ) && < div dangerouslySetInnerHTML = { { __html : code } } /> }
32
- </ div >
32
+ { isPreview && (
33
+ < div className = { styles . demoBody } id = { this . playerId } >
34
+ < div dangerouslySetInnerHTML = { { __html : code } } />
35
+ </ div >
36
+ ) }
33
37
{ PreCode ( this . state . height ) }
34
- < div className = { styles . demoControl } onClick = { this . onClick . bind ( this ) } >
38
+ < div
39
+ className = { classNames ( styles . demoControl , {
40
+ [ styles . isPreview ] : ! isPreview && this . state . height !== 0 ,
41
+ } ) }
42
+ onClick = { this . onClick . bind ( this ) }
43
+ >
35
44
{ this . state . height === 0 ? '显示' : '隐藏' } 代码
36
45
</ div >
37
46
</ div >
Original file line number Diff line number Diff line change 13
13
padding : 10px ;
14
14
}
15
15
}
16
+ .demoBody + pre .highlight + .demoControl {
17
+ border-top : 1px solid #d5d5d5 ;
18
+ }
19
+ .isPreview {
20
+ border-top : 1px solid #d5d5d5 ;
21
+ }
16
22
.demoControl {
17
23
padding : 3px 8px ;
18
- cursor : pointer ;
24
+ line-height : 20 px ;
19
25
background-color : rgba (0 ,0 ,0 ,.03 );
20
- border-top : 1 px solid #d5d5d5 ;
26
+ cursor : pointer ;
21
27
}
22
28
}
You can’t perform that action at this time.
0 commit comments