@@ -75,6 +75,12 @@ var MainPage = React.createClass({
|
|||||||
this.refs[`mattermostView${this.state.key}`].clearCacheAndReload();
|
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 focusListener = function() {
|
||||||
var webview = document.getElementById('mattermostView' + thisObj.state.key);
|
var webview = document.getElementById('mattermostView' + thisObj.state.key);
|
||||||
webview.focus();
|
webview.focus();
|
||||||
|
@@ -127,3 +127,16 @@ notification.override({
|
|||||||
ipc.sendToHost('onNotificationClick');
|
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_box = document.getElementsByClassName('search-bar')[0]; // should use id
|
||||||
|
search_box.focus();
|
||||||
|
console.log(getCurrentChannelString());
|
||||||
|
});
|
||||||
|
@@ -69,7 +69,15 @@ var createTemplate = function(mainWindow, config) {
|
|||||||
role: 'paste'
|
role: 'paste'
|
||||||
}, {
|
}, {
|
||||||
role: 'selectall'
|
role: 'selectall'
|
||||||
}, ]
|
}, separatorItem, {
|
||||||
|
label: 'Search in Current Channel',
|
||||||
|
accelerator: 'CmdOrCtrl+F',
|
||||||
|
click: (item, focusedWindow) => {
|
||||||
|
if (focusedWindow) {
|
||||||
|
focusedWindow.webContents.send('activate-search-box');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
});
|
});
|
||||||
template.push({
|
template.push({
|
||||||
label: '&View',
|
label: '&View',
|
||||||
|
Reference in New Issue
Block a user