Avoid page reload when loading URIs passed in from other apps
This commit is contained in:
parent
499fa1214f
commit
38ea41775b
2 changed files with 6 additions and 6 deletions
|
@ -95,6 +95,10 @@ var App = React.createClass({
|
||||||
this.alertError(event.detail);
|
this.alertError(event.detail);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on('open-uri-requested', (event, uri) => {
|
||||||
|
this.openUri(uri);
|
||||||
|
});
|
||||||
|
|
||||||
//open links in external browser and skip full redraw on changing page
|
//open links in external browser and skip full redraw on changing page
|
||||||
document.addEventListener('click', (event) => {
|
document.addEventListener('click', (event) => {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
|
@ -152,7 +156,7 @@ var App = React.createClass({
|
||||||
pageArgs: term
|
pageArgs: term
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onSubmit: function(uri) {
|
openUri: function(uri) {
|
||||||
this._storeHistoryOfNextRender = true;
|
this._storeHistoryOfNextRender = true;
|
||||||
this.setState({
|
this.setState({
|
||||||
address: uri,
|
address: uri,
|
||||||
|
@ -275,7 +279,7 @@ var App = React.createClass({
|
||||||
this._fullScreenPages.includes(this.state.viewingPage) ?
|
this._fullScreenPages.includes(this.state.viewingPage) ?
|
||||||
mainContent :
|
mainContent :
|
||||||
<div id="window">
|
<div id="window">
|
||||||
<Header onSearch={this.onSearch} onSubmit={this.onSubmit} address={address} wunderBarIcon={wunderBarIcon} viewingPage={this.state.viewingPage} />
|
<Header onSearch={this.onSearch} onSubmit={this.openUri} address={address} wunderBarIcon={wunderBarIcon} viewingPage={this.state.viewingPage} />
|
||||||
<div id="main-content">
|
<div id="main-content">
|
||||||
{mainContent}
|
{mainContent}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,10 +19,6 @@ window.addEventListener('contextmenu', (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on('open-uri-requested', (event, uri) => {
|
|
||||||
window.location.href = `?show=${uri}`;
|
|
||||||
});
|
|
||||||
|
|
||||||
let init = function() {
|
let init = function() {
|
||||||
window.lbry = lbry;
|
window.lbry = lbry;
|
||||||
window.lighthouse = lighthouse;
|
window.lighthouse = lighthouse;
|
||||||
|
|
Loading…
Add table
Reference in a new issue