Merge pull request #273 from Razzeee/search

Move current search in channel function to Shift+CTRL+S

Close #270
This commit is contained in:
Yuya Ochiai 2016-09-10 00:04:28 +09:00 committed by GitHub
commit d19df3fc29
5 changed files with 30 additions and 4 deletions

View file

@ -15,7 +15,8 @@ Release date: TBD
- Disabled `eval()` function for security improvements.
- Invalidate cache before load, to make server upgrades easy
- Removed misleading shortcuts from tray menu, as they didn't work
- Ctrl/Command+F puts cursor in search box to search in current channel.
- Ctrl/Command+S puts cursor in search box to search in current team.
- Shift+Ctrl/Command+S puts cursor in search box to search in current channel.
- Add access to settings through tray menu
- Removed unclear desktop notifications when failed to load tabs.
- Reload automatically the failed tab when the computer becomes online.

View file

@ -152,7 +152,8 @@ Below lists menu options (shortcut keys are listed in brackets, `Ctrl` becomes `
- **Copy** (Ctrl+C) - Copies selected text
- **Paste** (Ctrl+V) - Pastes text from clipboard
- **Select All** (Ctrl+A) - Select all text in input box
- **Search in Channel** (Ctrl+F) - Puts cursor in search box to search in current channel
- **Search in Team** (Ctrl+S) - Puts cursor in search box to search in the current team
- **Search in Channel** (Shift+Ctrl+S) - Puts cursor in search box to search in current channel
- **View**
- **Reload** (Ctrl+R) - Reload page from the server
- **Clear Cache and Reload** (Ctrl+Shift+R) - Clear cached content in application and reload page

View file

@ -81,6 +81,12 @@ var MainPage = React.createClass({
webview.send('activate-search-box');
});
// activate search box in current chunnel
ipcRenderer.on('activate-search-box-in-channel', (event) => {
let webview = document.getElementById('mattermostView' + thisObj.state.key);
webview.send('activate-search-box-in-channel');
});
var focusListener = function() {
thisObj.handleOnTeamFocused(thisObj.state.key);
thisObj.refs[`mattermostView${thisObj.state.key}`].focusOnWebView();

View file

@ -142,6 +142,16 @@ function getCurrentChannelString() {
}
ipc.on('activate-search-box', (event) => {
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();
search_box.value = ``; //Clear the input box
});
ipc.on('activate-search-box-in-channel', (event) => {
const search_boxes = document.getElementsByClassName('search-bar'); // should use id
if (search_boxes.length === 0) {
return;

View file

@ -70,13 +70,21 @@ var createTemplate = function(mainWindow, config) {
}, {
role: 'selectall'
}, separatorItem, {
label: 'Search in Channel',
accelerator: 'CmdOrCtrl+F',
label: 'Search in Team',
accelerator: 'CmdOrCtrl+S',
click: (item, focusedWindow) => {
if (focusedWindow) {
focusedWindow.webContents.send('activate-search-box');
}
}
}, {
label: 'Search in Channel',
accelerator: 'Shift+CmdOrCtrl+S',
click: (item, focusedWindow) => {
if (focusedWindow) {
focusedWindow.webContents.send('activate-search-box-in-channel');
}
}
}]
});
template.push({