src/project/FileTreeView.js
function (event) {
            if (this.props.entry.get("rename")) {
                event.stopPropagation();
                return;
            }

            if (event.button !== LEFT_MOUSE_BUTTON) {
                return;
            }

            var isOpen = this.props.entry.get("open"),
                setOpen = isOpen ? false : true;

            if (event.metaKey || event.ctrlKey) {
                // ctrl-alt-click toggles this directory and its children
                if (event.altKey) {
                    if (setOpen) {
                        // when opening, we only open the immediate children because
                        // opening a whole subtree could be really slow (consider
                        // a `node_modules` directory, for example).
                        this.props.actions.toggleSubdirectories(this.myPath(), setOpen);
                        this.props.actions.setDirectoryOpen(this.myPath(), setOpen);
                    } else {
                        // When closing, we recursively close the whole subtree.
                        this.props.actions.closeSubtree(this.myPath());
                    }
                } else {
                    // ctrl-click toggles the sibling directories
                    this.props.actions.toggleSubdirectories(this.props.parentPath, setOpen);
                }
            } else {
                // directory toggle with no modifier
                this.props.actions.setDirectoryOpen(this.myPath(), setOpen);
            }
            event.stopPropagation();
            event.preventDefault();
        }
function (event) {
            if (this.props.entry.get("rename")) {
                event.stopPropagation();
                return;
            }

            if (event.button !== LEFT_MOUSE_BUTTON) {
                return;
            }

            var isOpen = this.props.entry.get("open"),
                setOpen = isOpen ? false : true;

            if (event.metaKey || event.ctrlKey) {
                // ctrl-alt-click toggles this directory and its children
                if (event.altKey) {
                    if (setOpen) {
                        // when opening, we only open the immediate children because
                        // opening a whole subtree could be really slow (consider
                        // a `node_modules` directory, for example).
                        this.props.actions.toggleSubdirectories(this.myPath(), setOpen);
                        this.props.actions.setDirectoryOpen(this.myPath(), setOpen);
                    } else {
                        // When closing, we recursively close the whole subtree.
                        this.props.actions.closeSubtree(this.myPath());
                    }
                } else {
                    // ctrl-click toggles the sibling directories
                    this.props.actions.toggleSubdirectories(this.props.parentPath, setOpen);
                }
            } else {
                // directory toggle with no modifier
                this.props.actions.setDirectoryOpen(this.myPath(), setOpen);
            }
            event.stopPropagation();
            event.preventDefault();
        }
function ( event ) { if ( this . props . entry . get ( "rename" ) ) { event . stopPropagation ( ) ; return ; } if ( event . button !== LEFT_MOUSE_BUTTON ) { return ; } var isOpen = this . props . entry . get ( "open" ) , setOpen = isOpen ? false : true ; if ( event . metaKey || event . ctrlKey ) { // ctrl-alt-click toggles this directory and its children if ( event . altKey ) { if ( setOpen ) { // when opening, we only open the immediate children because // opening a whole subtree could be really slow (consider // a `node_modules` directory, for example). this . props . actions . toggleSubdirectories ( this . myPath ( ) , setOpen ) ; this . props . actions . setDirectoryOpen ( this . myPath ( ) , setOpen ) ; } else { // When closing, we recursively close the whole subtree. this . props . actions . closeSubtree ( this . myPath ( ) ) ; } } else { // ctrl-click toggles the sibling directories this . props . actions . toggleSubdirectories ( this . props . parentPath , setOpen ) ; } } else { // directory toggle with no modifier this . props . actions . setDirectoryOpen ( this . myPath ( ) , setOpen ) ; } event . stopPropagation ( ) ; event . preventDefault ( ) ; }
If you click on a directory, it will toggle between open and closed.
If you click on a directory it will toggle between open and closed .