Skip to content

Commit 7c73d4b

Browse files
committed
remove fid from Appear
1 parent d60b019 commit 7c73d4b

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ The element tags are the bread and butter of your slide content. Most of these t
216216
217217
####\<Appear />
218218
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.
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.
220220
221221
####\<BlockQuote />, \<Quote/> and \<Cite /> (Base)
222222

src/appear.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import _ from "lodash";
55
const Appear = React.createClass({
66
mixins: [tweenState.Mixin],
77
propTypes: {
8-
children: React.PropTypes.node,
9-
fid: React.PropTypes.string.isRequired
8+
children: React.PropTypes.node
109
},
1110
contextTypes: {
1211
flux: React.PropTypes.object,
@@ -28,8 +27,9 @@ const Appear = React.createClass({
2827
},
2928
_storeChange(state) {
3029
const slide = this.context.slide;
30+
const fragment = React.findDOMNode(this.refs.fragment);
3131
const key = _.findKey(state.fragments[slide], {
32-
"id": this.props.fid
32+
"id": parseInt(fragment.dataset.fid)
3333
});
3434
if (slide in state.fragments && state.fragments[slide].hasOwnProperty(key)) {
3535
this.setState({
@@ -52,7 +52,7 @@ const Appear = React.createClass({
5252
opacity: this.getTweeningValue("opacity")
5353
};
5454
return (
55-
<div style={styles} className="fragment" data-fid={this.props.fid}>
55+
<div style={styles} className="fragment" ref="fragment">
5656
{this.props.children}
5757
</div>
5858
);

src/slide.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ const Slide = React.createClass({
5252
const slide = React.findDOMNode(this.refs.slide);
5353
const frags = slide.querySelectorAll(".fragment");
5454
if (frags && frags.length) {
55-
Array.prototype.slice.call(frags, 0).forEach((frag) => {
55+
Array.prototype.slice.call(frags, 0).forEach((frag, i) => {
56+
frag.dataset.fid = i;
5657
this.context.flux.actions.SlideActions.addFragment({
5758
slide: this.props.slideIndex,
58-
id: frag.dataset.fid,
59+
id: i,
5960
visible: false
6061
});
6162
});

0 commit comments

Comments
 (0)