Skip to content

Commit fab3d99

Browse files
authored
Merge pull request #356 from Coding/middle-click
fix tab label icon height bug and middle click remove tab
2 parents 5a1e409 + 934b5e6 commit fab3d99

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/commons/Tab/TabLabel.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ let TabLabel = observer(({tab, removeTab, activateTab, openContextMenu}) => {
1616
id={tabLabelId}
1717
data-droppable='TABLABEL'
1818
draggable='true'
19-
onClick={e => activateTab(tab.id)}
19+
onClick={e => activateTab(tab.id) }
20+
onMouseUp={e => {e.button === 1 && removeTab(tab.id)}}
2021
onDragStart={e => {
2122
// Chrome 下直接执行 dragStart 会导致立即又出发了 window.dragend, 添加 timeout 以避免无法拖动的情况
2223
setTimeout(() => dnd.dragStart({ type: 'TAB', id: tab.id }), 0)
2324
}}
2425
onContextMenu={e => openContextMenu(e, tab)}
2526
>
2627
{dnd.target.id === tabLabelId ? <div className='tab-label-insert-pos'></div>: null}
27-
{tab.icon ? <div className={tab.icon}></div>: null}
28+
{tab.icon ? <div className={`icon ${tab.icon}`}></div>: null}
2829
<div className='title'>{tab.title}</div>
2930
<div className='control'>
3031
<i className='close' onClick={e => { e.stopPropagation(); removeTab(tab.id) }}>×</i>

app/styles/core-ui/Tab.styl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ $tab-control-width = $tab-height*0.5;
106106
.tab-label-insert-pos {
107107
absolute(top 0px left -2px bottom 0);
108108
}
109+
.fa {
110+
height: $tab-height;
111+
line-height: $tab-height;
112+
}
109113

110114
.title {
111115
text-overflow: ellipsis;
@@ -181,4 +185,3 @@ $tab-control-width = $tab-height*0.5;
181185
display: block;
182186
}
183187
}
184-

0 commit comments

Comments
 (0)