diff --git a/web/client/components/TOC/Node.jsx b/web/client/components/TOC/Node.jsx index b5e48e725d..4cef45695c 100644 --- a/web/client/components/TOC/Node.jsx +++ b/web/client/components/TOC/Node.jsx @@ -39,7 +39,8 @@ var Node = React.createClass({ className: React.PropTypes.string, type: React.PropTypes.string, onSort: React.PropTypes.func, - isDraggable: React.PropTypes.bool + isDraggable: React.PropTypes.bool, + animateCollapse: React.PropTypes.bool }, mixins: [SortableMixin], getDefaultProps() { @@ -49,7 +50,8 @@ var Node = React.createClass({ styler: () => {}, className: "", type: 'node', - onSort: null + onSort: null, + animateCollapse: true }; }, renderChildren(filter = () => true) { @@ -66,9 +68,13 @@ var Node = React.createClass({ let expanded = (this.props.node.expanded !== undefined) ? this.props.node.expanded : true; let prefix = this.props.type; const nodeStyle = assign({}, this.props.style, this.props.styler(this.props.node)); + let collapsible = expanded ? this.renderChildren((child) => child && child.props.position === 'collapsible') : []; + if (this.props.animateCollapse) { + collapsible = {collapsible}; + } let content = (
{this.renderChildren((child) => child && child.props.position !== 'collapsible')} - {expanded ? this.renderChildren((child) => child && child.props.position === 'collapsible') : []} + {collapsible}
); return this.props.isDraggable ? this.renderWithSortable(content) : content; }