File tree 4 files changed +28
-20
lines changed
4 files changed +28
-20
lines changed Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ The element tags are the bread and butter of your slide content. Most of these t
216
216
217
217
####\< Appear />
218
218
219
- This tag does not extend from Base. It's special. Wrapping elements in the appear tag makes them appear/disappear in order in response to navigation.
219
+ This tag does not extend from Base. It's special. Wrapping elements in the appear tag makes them appear/disappear in order in response to navigation. The Appear tag requires adding ` fid ` tags that are unique within a given slide. This requirement will go away in React 0.14.
220
220
221
221
####\< BlockQuote />, \< Quote/> and \< Cite /> (Base)
222
222
Original file line number Diff line number Diff line change @@ -49,17 +49,17 @@ export default class extends React.Component {
49
49
margin = "20px auto" />
50
50
</ Slide >
51
51
< Slide transition = { [ "slide" ] } bgImage = { images . city . replace ( "/" , "" ) } bgDarken = { 0.75 } >
52
- < Appear >
52
+ < Appear fid = "1" >
53
53
< Heading size = { 1 } caps fit textColor = "primary" >
54
54
Full Width
55
55
</ Heading >
56
56
</ Appear >
57
- < Appear >
57
+ < Appear fid = "2" >
58
58
< Heading size = { 1 } caps fit textColor = "tertiary" >
59
59
Adjustable Darkness
60
60
</ Heading >
61
61
</ Appear >
62
- < Appear >
62
+ < Appear fid = "3" >
63
63
< Heading size = { 1 } caps fit textColor = "primary" >
64
64
Background Imagery
65
65
</ Heading >
@@ -96,12 +96,12 @@ export default class extends React.Component {
96
96
</ Slide >
97
97
< Slide transition = { [ "fade" ] } bgColor = "secondary" textColor = "primary" >
98
98
< List >
99
- < ListItem > < Appear > Inline style based theme system</ Appear > </ ListItem >
100
- < ListItem > < Appear > Autofit text</ Appear > </ ListItem >
101
- < ListItem > < Appear > Flexbox layout system</ Appear > </ ListItem >
102
- < ListItem > < Appear > React-Router navigation</ Appear > </ ListItem >
103
- < ListItem > < Appear > PDF export</ Appear > </ ListItem >
104
- < ListItem > < Appear > And...</ Appear > </ ListItem >
99
+ < ListItem > < Appear fid = "1" > Inline style based theme system</ Appear > </ ListItem >
100
+ < ListItem > < Appear fid = "2" > Autofit text</ Appear > </ ListItem >
101
+ < ListItem > < Appear fid = "3" > Flexbox layout system</ Appear > </ ListItem >
102
+ < ListItem > < Appear fid = "4" > React-Router navigation</ Appear > </ ListItem >
103
+ < ListItem > < Appear fid = "5" > PDF export</ Appear > </ ListItem >
104
+ < ListItem > < Appear fid = "6" > And...</ Appear > </ ListItem >
105
105
</ List >
106
106
</ Slide >
107
107
< Slide transition = { [ "slide" ] } bgColor = "primary" >
Original file line number Diff line number Diff line change @@ -16,27 +16,22 @@ const Appear = React.createClass({
16
16
getInitialState ( ) {
17
17
return {
18
18
active : false ,
19
- opacity : 0
19
+ opacity : this . context . export || this . context . overview ? 1 : 0
20
20
} ;
21
21
} ,
22
22
componentDidMount ( ) {
23
23
this . context . flux . stores . SlideStore . listen ( this . _storeChange ) ;
24
24
const slide = this . context . slide ;
25
- this . context . flux . actions . SlideActions . addFragment ( {
26
- slide,
27
- id : this . _reactInternalInstance . _rootNodeID ,
28
- visible : false
29
- } ) ;
30
25
} ,
31
26
componentWillUnmount ( ) {
32
27
this . context . flux . stores . SlideStore . unlisten ( this . _storeChange ) ;
33
28
} ,
34
29
_storeChange ( state ) {
35
30
const slide = this . context . slide ;
36
31
const key = _ . findKey ( state . fragments [ slide ] , {
37
- "id" : this . _reactInternalInstance . _rootNodeID
32
+ "id" : this . props . fid
38
33
} ) ;
39
- if ( state . fragments [ slide ] . hasOwnProperty ( key ) ) {
34
+ if ( slide in state . fragments && state . fragments [ slide ] . hasOwnProperty ( key ) ) {
40
35
this . setState ( {
41
36
active : state . fragments [ slide ] [ key ] . visible
42
37
} , ( ) => {
@@ -57,7 +52,7 @@ const Appear = React.createClass({
57
52
opacity : this . getTweeningValue ( "opacity" )
58
53
} ;
59
54
return (
60
- < div style = { styles } className = "fragment" >
55
+ < div style = { styles } className = "fragment" data-fid = { this . props . fid } >
61
56
{ this . props . children }
62
57
</ div >
63
58
) ;
Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ const Slide = React.createClass({
26
26
styles : React . PropTypes . object ,
27
27
export : React . PropTypes . bool ,
28
28
print : React . PropTypes . bool ,
29
- overview : React . PropTypes . bool
29
+ overview : React . PropTypes . bool ,
30
+ flux : React . PropTypes . object
30
31
} ,
31
32
getInitialState ( ) {
32
33
return {
@@ -47,6 +48,17 @@ const Slide = React.createClass({
47
48
} ,
48
49
componentDidMount ( ) {
49
50
this . setZoom ( ) ;
51
+ const slide = React . findDOMNode ( this . refs . slide ) ;
52
+ const frags = slide . querySelectorAll ( ".fragment" ) ;
53
+ if ( frags && frags . length ) {
54
+ Array . prototype . slice . call ( frags , 0 ) . forEach ( ( frag ) => {
55
+ this . context . flux . actions . SlideActions . addFragment ( {
56
+ slide : this . props . slideIndex ,
57
+ id : frag . dataset . fid ,
58
+ visible : false
59
+ } ) ;
60
+ } )
61
+ }
50
62
window . addEventListener ( "load" , this . setZoom ) ;
51
63
window . addEventListener ( "resize" , this . setZoom ) ;
52
64
} ,
@@ -88,6 +100,7 @@ const Slide = React.createClass({
88
100
} ;
89
101
return (
90
102
< div className = "spectacle-slide"
103
+ ref = "slide"
91
104
style = { [
92
105
styles . outer ,
93
106
this . getStyles ( ) ,
You can’t perform that action at this time.
0 commit comments