Skip to content

Commit 33a0f09

Browse files
authored
[Backport 1.9] COMPASS 1743 🐛 Open all links with the system browser (#1224) (#1225)
* COMPASS 1743 🐛 Open all links with the system browser Includes intercom links. Also means we can drop the shell.openExternal overrides, used in many <InfoSprinkle> cases, at a later date. * 🎨 e -> event https://github.com/ryanmcdermott/clean-code-javascript#avoid-mental-mapping It's also recommended in: https://github.com/electron/electron/blob/master/docs/api/web-contents.md#event-new-window
1 parent f69e1c3 commit 33a0f09

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/window-manager.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,14 @@ var createWindow = module.exports.create = function(opts) {
181181
detach: true
182182
});
183183
}
184+
185+
/**
186+
* Open all external links in the system's web browser.
187+
*/
188+
_window.webContents.on('new-window', function(event, url) {
189+
event.preventDefault();
190+
electron.shell.openExternal(url);
191+
});
184192
return _window;
185193
};
186194

0 commit comments

Comments
 (0)