Fill the search box with the current channel name at the shortcut

For #229
This commit is contained in:
Yuya Ochiai 2016-08-16 01:02:56 +09:00
parent 647e396fad
commit e377d33652
2 changed files with 7 additions and 3 deletions

View file

@ -136,7 +136,11 @@ function getCurrentChannelString() {
}
ipc.on('activate-search-box', (event) => {
const search_box = document.getElementsByClassName('search-bar')[0]; // should use id
const search_boxes = document.getElementsByClassName('search-bar'); // should use id
if (search_boxes.length === 0) {
return;
}
const search_box = search_boxes[0];
search_box.focus();
console.log(getCurrentChannelString());
search_box.value = `in:${getCurrentChannelString()} `;
});

View file

@ -70,7 +70,7 @@ var createTemplate = function(mainWindow, config) {
}, {
role: 'selectall'
}, separatorItem, {
label: 'Search in Current Channel',
label: 'Search in Channel',
accelerator: 'CmdOrCtrl+F',
click: (item, focusedWindow) => {
if (focusedWindow) {