Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Simulate indentation of the project tree using some divs #12047

Merged
merged 5 commits into from
Aug 20, 2016

Conversation

ficristo
Copy link
Collaborator

@ficristo ficristo commented Jan 4, 2016

instead of using combinations of padding/margin.

Fixes #10574

@ficristo
Copy link
Collaborator Author

@petetnt @busykai @nethip
Could you take a look?

* @return {ReactComponent} - The resulting div.
*/
function _createThickness(depth) {
return DOM.div({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this div have defined display as inline-block?

Copy link

@itsmunim itsmunim May 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw it is defined in the thickness class, may be we can define it inside the style prop?

@ficristo
Copy link
Collaborator Author

@dibosh Thank you to have looked at it.
I think is better to use a class so extension authors can override it.
I use the style only because I need it to be dynamic.
If there is an agreement to use only the style prop is fine by me.

@ficristo
Copy link
Collaborator Author

@marcelgerber if you have a bit of time could you take a look?

*
* Create an appropriate div based thickness to indent the tree correctly.
*
* @param {int} depth - The depthness of the current node.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, but depthness is no word ;)

@marcelgerber
Copy link
Contributor

LGTM, but I'd like to have someone else have a look at the React code (even though it looks straighforward) since I don't know nothing about React.

@ficristo
Copy link
Collaborator Author

@marcelgerber Thank you.
Maybe @busykai or @petetnt could you take a look?

className: "jstree-icon"
}, " "),
];
var thickness = _createThickness(this.props.depth);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Consecutive vars are usually either separated with a dot or new line

@petetnt
Copy link
Collaborator

petetnt commented Jul 25, 2016

Reviewed this, made a few comments 👍

@ficristo
Copy link
Collaborator Author

ficristo commented Jul 29, 2016

I've updated the PR.
I should note there is still an issue while renaming a file: I would prefer to look at it in a different PR.

*/
function _createThickness(depth) {
return DOM.div({
className: "thickness",
style: {
width: (INDENTATION_WIDTH * depth) + "px"
display: "inline-block",
width: INDENTATION_WIDTH * depth
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unitless value here, does React automatically convert it to px?

@ficristo
Copy link
Collaborator Author

@petetnt I tryed to remove the unit and it worked...
Now I looked at the docs and if you don't specify the unit most of the styles are automatically converted to use px.

@marcelgerber
Copy link
Contributor

@ficristo @petetnt I suppose this is ready to go?

@petetnt
Copy link
Collaborator

petetnt commented Aug 18, 2016

@marcelgerber LGTM, but has merge conflicts after some recent changes.

@ficristo
Copy link
Collaborator Author

I made some changes so to fix the rename case too. So it needs another look.

@marcelgerber
Copy link
Contributor

Renaming a nested folder doesn't really work.
image

@ficristo
Copy link
Collaborator Author

@marcelgerber I fixed that issue, but now when you rename a folder the element with the children (ul) move a little. I wasn't able to find the cause, and I think it is a minor issue.

There is a renameBehavior function that should be prevent the directories to collapse, but seems to not work, that's why I've added some more stopPropagation.
I don't know enough of react to really look at this problem.

@marcelgerber
Copy link
Contributor

You probably didn't see this comment:
As it turns out in #11717, the indentation (and as such, INDENTATION_WIDTH) should only be 10px, and now that it's merged, that's the behaviour on master, too. I think it looks way cleaner.

@marcelgerber
Copy link
Contributor

If you can somehow manage to not apply .jstree-rename-input's top/left rules to the folders, but only to files, we can get rid of the jumping box.

@ficristo
Copy link
Collaborator Author

I noticed another small issue were selecting a folder would result in a blue border.
So I reworked the code for render the folder to be more similar to the one of the files: in the renaming case the html layout is a bit different in the sense the input is not anymore in a link tag.
And then hopefully fix the bouncing behaviour: I applyed a style both to folders and files to which doesn't change anything visibily.

@marcelgerber
Copy link
Contributor

LGTM. Going for it.

@marcelgerber marcelgerber merged commit 23f3eb6 into adobe:master Aug 20, 2016
@ficristo
Copy link
Collaborator Author

Thank you @marcelgerber @petetnt @dibosh for review

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants