mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-11-04 05:53:21 +00:00 
			
		
		
		
	🐛 open images in default browser
This commit is contained in:
		@@ -9,9 +9,7 @@ const JsonDB = require('node-json-db');
 | 
			
		||||
const SpellChecker = require('simple-spellchecker');
 | 
			
		||||
const tray = require('./tray');
 | 
			
		||||
const appMenu = require('./menu');
 | 
			
		||||
const link = require('./link-helper');
 | 
			
		||||
 | 
			
		||||
const {linkIsInternal} = link;
 | 
			
		||||
const {linkIsInternal, skipImages} = require('./link-helper');
 | 
			
		||||
 | 
			
		||||
const db = new JsonDB(app.getPath('userData') + '/domain.json', true, true);
 | 
			
		||||
const data = db.getData('/');
 | 
			
		||||
@@ -196,11 +194,7 @@ app.on('ready', () => {
 | 
			
		||||
	// });
 | 
			
		||||
 | 
			
		||||
	page.on('new-window', (event, url) => {
 | 
			
		||||
		if (mainWindow.useDefaultWindowBehaviour) {
 | 
			
		||||
			mainWindow.useDefaultWindowBehaviour = false;
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		if (linkIsInternal(checkWindowURL(), url)) {
 | 
			
		||||
		if (linkIsInternal(checkWindowURL(), url) && url.match(skipImages) === null) {
 | 
			
		||||
			event.preventDefault();
 | 
			
		||||
			return mainWindow.loadURL(url);
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,9 @@ function linkIsInternal(currentUrl, newUrl) {
 | 
			
		||||
	return currentDomain === newDomain;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// We'll be needing this to open images in default browser
 | 
			
		||||
const skipImages = '.jpg|.gif|.png|.jpeg|.JPG|.PNG';
 | 
			
		||||
 | 
			
		||||
exports = module.exports = {
 | 
			
		||||
	linkIsInternal
 | 
			
		||||
	linkIsInternal, skipImages
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user