File tree Expand file tree Collapse file tree 8 files changed +55
-3
lines changed Expand file tree Collapse file tree 8 files changed +55
-3
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ export interface RendererMessage {
8383 "update-realm-icon" : ( serverURL : string , iconURL : string ) => void ;
8484 "update-realm-name" : ( serveRURL : string , realmName : string ) => void ;
8585 "webview-reload" : ( ) => void ;
86+ "exit-settings" : ( ) => void ;
8687 zoomActualSize : ( ) => void ;
8788 zoomIn : ( ) => void ;
8889 zoomOut : ( ) => void ;
Original file line number Diff line number Diff line change @@ -86,6 +86,17 @@ td:nth-child(odd) {
8686 text-rendering : optimizeLegibility;
8787}
8888
89+ .exit-sign {
90+ float : right;
91+ position : relative;
92+ top : 1px ;
93+ margin-left : 3px ;
94+ font-size : 2rem ;
95+ line-height : 1 ;
96+ font-weight : 600 ;
97+ cursor : pointer;
98+ }
99+
89100# content {
90101 display : flex;
91102 height : 100% ;
Original file line number Diff line number Diff line change @@ -927,6 +927,22 @@ class ServerManagerView {
927927 } ) ;
928928 }
929929
930+ ipcRenderer . on ( "exit-settings" , ( ) => {
931+ let lastActiveServerTabIndex = - 1 ;
932+
933+ for ( const tab of this . tabs ) {
934+ if ( tab . props . role === "server" ) {
935+ lastActiveServerTabIndex = tab . props . tabIndex ;
936+ }
937+ }
938+
939+ console . log ( typeof this . tabs [ lastActiveServerTabIndex ] ) ;
940+ if ( lastActiveServerTabIndex >= 0 ) {
941+ console . log ( "Tab to be focussed" ) ;
942+ this . tabs [ lastActiveServerTabIndex ] . webview . focus ( ) ;
943+ }
944+ } ) ;
945+
930946 ipcRenderer . on (
931947 "permission-request" ,
932948 (
Original file line number Diff line number Diff line change @@ -81,3 +81,10 @@ export function generateSelectHTML(
8181export function reloadApp ( ) : void {
8282 ipcRenderer . send ( "forward-message" , "reload-viewer" ) ;
8383}
84+
85+ export function exitSettings ( ) : void {
86+ const exitButton = document . querySelector ( ".exit-sign" ) ! ;
87+ exitButton . addEventListener ( "click" , async ( ) => {
88+ ipcRenderer . send ( "forward-message" , "exit-settings" ) ;
89+ } ) ;
90+ }
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import * as t from "../../../../common/translation-util";
33import { ipcRenderer } from "../../typed-ipc-renderer" ;
44import * as DomainUtil from "../../utils/domain-util" ;
55
6- import { reloadApp } from "./base-section" ;
6+ import { exitSettings , reloadApp } from "./base-section" ;
77import { initFindAccounts } from "./find-accounts" ;
88import { initServerInfoForm } from "./server-info-form" ;
99
@@ -17,6 +17,7 @@ export function initConnectedOrgSection(props: ConnectedOrgSectionProps): void {
1717 const servers = DomainUtil . getDomains ( ) ;
1818 props . $root . innerHTML = html `
1919 < div class ="settings-pane " id ="server-settings-pane ">
20+ < span class ="exit-sign "> ×</ span >
2021 < div class ="page-title "> ${ t . __ ( "Connected organizations" ) } </ div >
2122 < div class ="title " id ="existing-servers ">
2223 ${ t . __ ( "All the connected orgnizations will appear here." ) }
@@ -32,6 +33,8 @@ export function initConnectedOrgSection(props: ConnectedOrgSectionProps): void {
3233 </ div >
3334 ` . html ;
3435
36+ exitSettings ( ) ;
37+
3538 const $serverInfoContainer = document . querySelector (
3639 "#server-info-container" ,
3740 ) ! ;
Original file line number Diff line number Diff line change @@ -14,7 +14,11 @@ import * as t from "../../../../common/translation-util";
1414import supportedLocales from "../../../../translations/supported-locales.json" ;
1515import { ipcRenderer } from "../../typed-ipc-renderer" ;
1616
17- import { generateSelectHTML , generateSettingOption } from "./base-section" ;
17+ import {
18+ exitSettings ,
19+ generateSelectHTML ,
20+ generateSettingOption ,
21+ } from "./base-section" ;
1822
1923const { app, dialog, session} = remote ;
2024const currentBrowserWindow = remote . getCurrentWindow ( ) ;
@@ -26,6 +30,7 @@ interface GeneralSectionProps {
2630export function initGeneralSection ( props : GeneralSectionProps ) : void {
2731 props . $root . innerHTML = html `
2832 < div class ="settings-pane ">
33+ < span class ="exit-sign "> ×</ span >
2934 < div class ="title "> ${ t . __ ( "Appearance" ) } </ div >
3035 < div id ="appearance-option-settings " class ="settings-card ">
3136 < div class ="setting-row " id ="tray-option ">
@@ -211,6 +216,7 @@ export function initGeneralSection(props: GeneralSectionProps): void {
211216 </ div >
212217 ` . html ;
213218
219+ exitSettings ( ) ;
214220 updateTrayOption ( ) ;
215221 updateBadgeOption ( ) ;
216222 updateSilentOption ( ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import {html} from "../../../../common/html";
33import * as t from "../../../../common/translation-util" ;
44import { ipcRenderer } from "../../typed-ipc-renderer" ;
55
6- import { generateSettingOption } from "./base-section" ;
6+ import { exitSettings , generateSettingOption } from "./base-section" ;
77
88interface NetworkSectionProps {
99 $root : Element ;
@@ -12,6 +12,7 @@ interface NetworkSectionProps {
1212export function initNetworkSection ( props : NetworkSectionProps ) : void {
1313 props . $root . innerHTML = html `
1414 < div class ="settings-pane ">
15+ < span class ="exit-sign "> ×</ span >
1516 < div class ="title "> ${ t . __ ( "Proxy" ) } </ div >
1617 < div id ="appearance-option-settings " class ="settings-card ">
1718 < div class ="setting-row " id ="use-system-settings ">
@@ -55,6 +56,8 @@ export function initNetworkSection(props: NetworkSectionProps): void {
5556 </ div >
5657 ` . html ;
5758
59+ exitSettings ( ) ;
60+
5861 const $proxyPAC : HTMLInputElement = document . querySelector (
5962 "#proxy-pac-option .setting-input-value" ,
6063 ) ! ;
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import {html} from "../../../../common/html";
22import * as t from "../../../../common/translation-util" ;
33import * as LinkUtil from "../../utils/link-util" ;
44
5+ import { exitSettings } from "./base-section" ;
6+
57interface ShortcutsSectionProps {
68 $root : Element ;
79}
@@ -12,6 +14,7 @@ export function initShortcutsSection(props: ShortcutsSectionProps): void {
1214
1315 props . $root . innerHTML = html `
1416 < div class ="settings-pane ">
17+ < span class ="exit-sign "> ×</ span >
1518 < div class ="settings-card tip ">
1619 < p >
1720 < b > < i class ="material-icons md-14 "> settings</ i > ${ t . __ ( "Tip" ) } : </ b
@@ -222,6 +225,8 @@ export function initShortcutsSection(props: ShortcutsSectionProps): void {
222225 </ div >
223226 ` . html ;
224227
228+ exitSettings ( ) ;
229+
225230 const link = "https://zulip.com/help/keyboard-shortcuts" ;
226231 const externalCreateNewOrgElement =
227232 document . querySelector ( "#open-hotkeys-link" ) ! ;
You can’t perform that action at this time.
0 commit comments