Merge pull request #171 from adrianvoica/master
Button and double-click tab bar for adding a new tab.
This commit is contained in:
commit
b7a2b8ca2b
5 changed files with 50 additions and 2 deletions
|
@ -66,6 +66,8 @@
|
|||
"ignoreFiles": "node_modules",
|
||||
|
||||
//Crazy? You might like Vim keybindings. Only takes effect on restart
|
||||
"emulateVim": false
|
||||
"emulateVim": false,
|
||||
|
||||
//Whether to show the "New file" tab button on the tab bar;
|
||||
"showNewTabButton": true
|
||||
}
|
|
@ -87,5 +87,28 @@
|
|||
color: @foreground;
|
||||
}
|
||||
}
|
||||
|
||||
&.newtab {
|
||||
width: 40px;
|
||||
opacity: .25;
|
||||
max-width: 40px;
|
||||
background: none;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
background: radial-gradient(ellipse 200px 25px at top center, lighten(@background, 15%), darken(@background, 10%));
|
||||
}
|
||||
|
||||
a {
|
||||
padding: 1px 0;
|
||||
}
|
||||
|
||||
.big-label {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
color: @accent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,9 +6,10 @@ define([
|
|||
"editor",
|
||||
"command",
|
||||
"storage/settingsProvider",
|
||||
"util/template!templates/newTabButton.html",
|
||||
"aceBindings"
|
||||
],
|
||||
function(state, addRemove, switching, bindEvents, editor, command, Settings) {
|
||||
function(state, addRemove, switching, bindEvents, editor, command, Settings, inflate) {
|
||||
|
||||
/*
|
||||
|
||||
|
@ -42,6 +43,9 @@ define([
|
|||
}
|
||||
tabContainer.append(element);
|
||||
});
|
||||
if (Settings.get("user").showNewTabButton === true) {
|
||||
tabContainer.append(inflate.get("templates/newTabButton.html"));
|
||||
}
|
||||
setTimeout(function() {
|
||||
//wait for render before triggering the enter animation
|
||||
tabContainer.findAll(".enter").forEach(function(element) { element.removeClass("enter") });
|
||||
|
|
|
@ -113,6 +113,15 @@ define([
|
|||
M.serial(toClose, addRemove.remove);
|
||||
};
|
||||
|
||||
var enableDblClickNewTab = function() {
|
||||
var tabContainer = document.find(".tabs");
|
||||
tabContainer.on("dblclick", function(e) {
|
||||
e.preventDefault();
|
||||
if (e.button == 0)
|
||||
command.fire("session:new-file");
|
||||
});
|
||||
};
|
||||
|
||||
command.on("session:close-to-right", closeTabsRight);
|
||||
|
||||
contextMenus.register("Close", "closeTab", "tabs/:id", function(args) {
|
||||
|
@ -125,6 +134,7 @@ define([
|
|||
return function() {
|
||||
enableTabDragDrop();
|
||||
enableTabMiddleClick();
|
||||
enableDblClickNewTab();
|
||||
};
|
||||
|
||||
});
|
9
templates/newTabButton.html
Normal file
9
templates/newTabButton.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<span
|
||||
class="tab newtab"
|
||||
>
|
||||
<a
|
||||
class="big-label"
|
||||
command="session:new-file"
|
||||
title="Create a new file"
|
||||
>+</a>
|
||||
</span>
|
Loading…
Reference in a new issue