Skip to content

Allow to specify Min Height - Needed for big projects #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.0
* Add support for atom 1.18.0


## 0.2.3
* Show modified status

Expand Down
2 changes: 2 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Updated version: Copyright (c) 2016 Gordienco Sergiu

Copyright (c) 2014 Dominic Adelaar

Permission is hereby granted, free of charge, to any person obtaining
Expand Down
3 changes: 3 additions & 0 deletions lib/tree-view-open-files-pane-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class TreeViewOpenFilesPaneView
@pane = pane

@paneSub.add pane.observeItems (item) =>
if !item.getPath?()
return
@container.parentElement.parentElement.setAttribute("data-is-pane-active", "true")
listItem = document.createElement('li')
listItem.classList.add('file', 'list-item')
listItem.setAttribute('is', 'tree-view-file')
Expand Down
36 changes: 31 additions & 5 deletions lib/tree-view-open-files-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,26 @@ class TreeViewOpenFilesView
constructor: (serializeState) ->
# Create root element
@element = document.createElement('div')
@elementHolder = document.createElement('div')
@element.classList.add('tree-view-open-files')
@element.classList.add('tree-view')
@elementHolder.classList.add('tree-view-open-files-holder')
element = @element
elementHolder = @elementHolder

f = ->
if !elementHolder.parentElement and element.parentElement
element.parentElement.insertBefore elementHolder, element
elementHolder.style.height = element.innerHeight + "px"
s = elementHolder.getBoundingClientRect()
if s
element.style.width = s.width + 'px'
if elementHolder.parentElement
element.style.top = elementHolder.parentElement.getBoundingClientRect().top + 'px'
element.style.left = s.left + 'px'
return

setInterval f, 100
@groups = []
@paneSub = new CompositeDisposable
@paneSub.add atom.workspace.observePanes (pane) =>
Expand All @@ -19,8 +38,13 @@ class TreeViewOpenFilesView
@removeTabGroup pane
@paneSub.add destroySub

@configSub = atom.config.observe 'tree-view-open-files.maxHeight', (maxHeight) =>
@configSub = atom.config.observe 'tree-view-open-files-updated.maxHeight', (maxHeight) =>
@element.style.maxHeight = if maxHeight > 0 then "#{maxHeight}px" else 'none'
@elementHolder.style.maxHeight = if maxHeight > 0 then "#{maxHeight}px" else 'none'

@configSub = atom.config.observe 'tree-view-open-files-updated.minHeight', (minHeight) =>
@element.style.minHeight = if minHeight > 0 then "#{minHeight}px" else 'none'
@elementHolder.style.minHeight = if minHeight > 0 then "#{minHeight}px" else 'none'

addTabGroup: (pane) ->
group = new TreeViewOpenFilesPaneView
Expand Down Expand Up @@ -50,9 +74,11 @@ class TreeViewOpenFilesView
@show()

hide: ->
@element.remove()

# @element.remove()
Array::slice.call(treeView.treeView.list.parentElement.querySelector('.tree-view-open-files')).forEach (node) ->
node.parentElement.removeChild node
return
show: ->
requirePackages('tree-view').then ([treeView]) =>
treeView.treeView.find('.tree-view-scroller').css 'background', treeView.treeView.find('.tree-view').css 'background'
treeView.treeView.prepend @element
# treeView.treeView.find('.tree-view-scroller').css 'background', treeView.treeView.find('.tree-view').css 'background'
treeView.treeView.list.parentElement.insertBefore @element , treeView.treeView.list
5 changes: 5 additions & 0 deletions lib/tree-view-open-files.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ module.exports =
default: 250
min: 0
description: 'Maximum height of the list before scrolling is required. Set to 0 to disable scrolling.'
minHeight:
type: 'integer'
default: 0
min: 0
description: 'Minimum height of the list. Set to 0 to disable scrolling.'

activate: (state) ->
requirePackages('tree-view').then ([treeView]) =>
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "tree-view-open-files",
"name": "tree-view-open-files-updated",
"main": "./lib/tree-view-open-files",
"version": "0.3.0",
"description": "Show open files in a list above the tree view.",
"repository": "https://github.com/postcasio/tree-view-open-files",
"version": "1.1.0",
"description": "Show open files in a list above the tree view. Added additional functions.",
"repository": "https://github.com/sergiu-gordienco/tree-view-open-files",
"license": "MIT",
"engines": {
"atom": ">=1.1.0"
Expand Down
16 changes: 15 additions & 1 deletion styles/tree-view-open-files.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
@import "ui-variables";

.tree-view-open-files {
border-bottom: 1px solid rgba(128, 128, 128, 0.25);
}
.tree-view-open-files > ul {
display: none;
}

.tree-view-open-files > ul[data-is-pane-active="true"] {
display: block;
}

.tree-view-open-files {
position: fixed;
top: 20px;

> .list-tree {
width: 100%;
overflow: auto;
Expand All @@ -11,8 +25,8 @@

overflow: auto;
flex: 0 0 1;
position: relative;
order: 0;
z-index: 2;

.close-open-file {
background: none;
Expand Down