mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-11-03 21:43:18 +00:00 
			
		
		
		
	Avoid multiple webviews show at the same time.
This commit is contained in:
		@@ -12,7 +12,7 @@ class WebView extends BaseComponent {
 | 
			
		||||
	constructor(params) {
 | 
			
		||||
		super();
 | 
			
		||||
	
 | 
			
		||||
        const {$root, url, index, name, onTitleChange, nodeIntegration} = params;
 | 
			
		||||
        const {$root, url, index, name, isActive, onTitleChange, nodeIntegration} = params;
 | 
			
		||||
        this.$root = $root;
 | 
			
		||||
        this.index = index;
 | 
			
		||||
        this.name = name;
 | 
			
		||||
@@ -22,6 +22,7 @@ class WebView extends BaseComponent {
 | 
			
		||||
        this.onTitleChange = onTitleChange;
 | 
			
		||||
        this.zoomFactor = 1.0;
 | 
			
		||||
        this.loading = false;
 | 
			
		||||
		this.isActive = isActive;
 | 
			
		||||
        this.domainUtil = new DomainUtil();
 | 
			
		||||
        this.systemUtil = new SystemUtil();
 | 
			
		||||
        this.badgeCount = 0;
 | 
			
		||||
@@ -93,6 +94,9 @@ class WebView extends BaseComponent {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    show() {
 | 
			
		||||
		// Do not show WebView if another tab was selected and this tab should be in background.
 | 
			
		||||
		if (!this.isActive()) return;
 | 
			
		||||
 | 
			
		||||
        this.$el.classList.remove('disabled');
 | 
			
		||||
        this.focus()
 | 
			
		||||
        this.loading = false;
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,7 @@ class ServerManagerView {
 | 
			
		||||
			index: index,
 | 
			
		||||
			url: server.url,
 | 
			
		||||
			name: server.alias,
 | 
			
		||||
			isActive: () => {return index == this.activeTabIndex},
 | 
			
		||||
			onTitleChange: this.updateBadge.bind(this),
 | 
			
		||||
			nodeIntegration: false
 | 
			
		||||
		}));
 | 
			
		||||
@@ -93,6 +94,7 @@ class ServerManagerView {
 | 
			
		||||
			index: this.settingsTabIndex,
 | 
			
		||||
			url: url,
 | 
			
		||||
			name: "Settings",
 | 
			
		||||
			isActive: () => {return this.settingsTabIndex == this.activeTabIndex},
 | 
			
		||||
			onTitleChange: this.updateBadge.bind(this),
 | 
			
		||||
			nodeIntegration: true
 | 
			
		||||
		}));
 | 
			
		||||
@@ -116,8 +118,8 @@ class ServerManagerView {
 | 
			
		||||
 | 
			
		||||
		this.tabs[index].activate();
 | 
			
		||||
 | 
			
		||||
		this.webviews[index].load();
 | 
			
		||||
		this.activeTabIndex = index;
 | 
			
		||||
		this.webviews[index].load();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	updateBadge() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user