Merge pull request #258 from mattermost/experiment/search-box
CTRL/CMD+F on Desktop app puts cursor in Mattermost search box filtered to channel Close #229
This commit is contained in:
@@ -14,6 +14,7 @@ Release date: TBD
|
||||
- Reload only the selected tab and keep its URL on "Reload" and "Clear Cache and Reload".
|
||||
- Disabled `eval()` function for security improvements.
|
||||
- Invalidate cache before load, to make server upgrades easy
|
||||
- Ctrl/Command+F puts cursor in search box to search in current channel.
|
||||
|
||||
#### Windows
|
||||
- Update Mattermost icon for desktop notifications in Windows 10.
|
||||
|
@@ -149,6 +149,7 @@ 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
|
||||
- **View**
|
||||
- **Reload** (Ctrl+R) - Reload page from the server
|
||||
- **Clear Cache and Reload** (Ctrl+Shift+R) - Clear cached content in application and reload page
|
||||
|
@@ -75,6 +75,12 @@ var MainPage = React.createClass({
|
||||
this.refs[`mattermostView${this.state.key}`].clearCacheAndReload();
|
||||
});
|
||||
|
||||
// activate search box in current tab
|
||||
ipcRenderer.on('activate-search-box', (event) => {
|
||||
let webview = document.getElementById('mattermostView' + thisObj.state.key);
|
||||
webview.send('activate-search-box');
|
||||
});
|
||||
|
||||
var focusListener = function() {
|
||||
var webview = document.getElementById('mattermostView' + thisObj.state.key);
|
||||
webview.focus();
|
||||
|
@@ -127,3 +127,20 @@ notification.override({
|
||||
ipc.sendToHost('onNotificationClick');
|
||||
}
|
||||
});
|
||||
|
||||
// get the last of href for the current channel in the sidebar.
|
||||
function getCurrentChannelString() {
|
||||
const active_channel_link = document.querySelector('.active a.sidebar-channel');
|
||||
const url_elements = active_channel_link.href.split('/');
|
||||
return url_elements[url_elements.length - 1];
|
||||
}
|
||||
|
||||
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 = `in:${getCurrentChannelString()} `;
|
||||
});
|
||||
|
@@ -69,7 +69,15 @@ var createTemplate = function(mainWindow, config) {
|
||||
role: 'paste'
|
||||
}, {
|
||||
role: 'selectall'
|
||||
}, ]
|
||||
}, separatorItem, {
|
||||
label: 'Search in Channel',
|
||||
accelerator: 'CmdOrCtrl+F',
|
||||
click: (item, focusedWindow) => {
|
||||
if (focusedWindow) {
|
||||
focusedWindow.webContents.send('activate-search-box');
|
||||
}
|
||||
}
|
||||
}]
|
||||
});
|
||||
template.push({
|
||||
label: '&View',
|
||||
|
Reference in New Issue
Block a user