diff options
author | Chandrika Priya Bogadi <46720139+Chandrika-Priya@users.noreply.github.com> | 2021-10-26 23:03:36 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-26 23:03:36 +0530 |
commit | 1801f98f8e2ca28619608b29bcf623581fa76747 (patch) | |
tree | d2653b410c07e3e5cac5e4bc2465d892e2a8fa9d /src | |
parent | docs: add Chandrika-Priya as a contributor for code (#2145) [skip ci] (diff) | |
download | ferdium-app-1801f98f8e2ca28619608b29bcf623581fa76747.tar.gz ferdium-app-1801f98f8e2ca28619608b29bcf623581fa76747.tar.zst ferdium-app-1801f98f8e2ca28619608b29bcf623581fa76747.zip |
Add feature to display document title along with current title (#2143)
Co-authored by: Rachel Cynthia <rachel883omega@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/services/content/ServiceWebview.js | 20 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 5 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/components/services/content/ServiceWebview.js b/src/components/services/content/ServiceWebview.js index 185d41175..2562c09ce 100644 --- a/src/components/services/content/ServiceWebview.js +++ b/src/components/services/content/ServiceWebview.js | |||
@@ -30,9 +30,14 @@ class ServiceWebview extends Component { | |||
30 | this.webview.view.addEventListener('console-message', e => { | 30 | this.webview.view.addEventListener('console-message', e => { |
31 | debug('Service logged a message:', e.message); | 31 | debug('Service logged a message:', e.message); |
32 | }); | 32 | }); |
33 | this.webview.view.addEventListener('did-navigate', () => { | ||
34 | document.title = `Ferdi - ${this.props.service.name} ${this.props.service.dialogTitle | ||
35 | ? ` - ${this.props.service.dialogTitle}` | ||
36 | : '' | ||
37 | } ${`- ${this.props.service._webview.getTitle()}`}`; | ||
38 | }) | ||
33 | } | 39 | } |
34 | }, | 40 | }) |
35 | ); | ||
36 | } | 41 | } |
37 | 42 | ||
38 | componentWillUnmount() { | 43 | componentWillUnmount() { |
@@ -47,6 +52,12 @@ class ServiceWebview extends Component { | |||
47 | if (this.props.service.isActive) { | 52 | if (this.props.service.isActive) { |
48 | webview.view.blur(); | 53 | webview.view.blur(); |
49 | webview.view.focus(); | 54 | webview.view.focus(); |
55 | window.setTimeout(() => { | ||
56 | document.title = `Ferdi - ${this.props.service.name} ${this.props.service.dialogTitle | ||
57 | ? ` - ${this.props.service.dialogTitle}` | ||
58 | : '' | ||
59 | } ${`- ${this.props.service._webview.getTitle()}`}`; | ||
60 | }, 100); | ||
50 | } else { | 61 | } else { |
51 | debug('Refocus not required - Not active service'); | 62 | debug('Refocus not required - Not active service'); |
52 | } | 63 | } |
@@ -92,9 +103,8 @@ class ServiceWebview extends Component { | |||
92 | } | 103 | } |
93 | allowpopups | 104 | allowpopups |
94 | nodeintegration | 105 | nodeintegration |
95 | webpreferences={`spellcheck=${ | 106 | webpreferences={`spellcheck=${isSpellcheckerEnabled ? 1 : 0 |
96 | isSpellcheckerEnabled ? 1 : 0 | 107 | }, contextIsolation=1, enableRemoteModule=1`} |
97 | }, contextIsolation=1, enableRemoteModule=1`} | ||
98 | /> | 108 | /> |
99 | ); | 109 | ); |
100 | } | 110 | } |
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index e52d661f3..926ee36f0 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -690,6 +690,9 @@ export default class ServicesStore extends Store { | |||
690 | // TODO: add checks to not focus service when router path is /settings or /auth | 690 | // TODO: add checks to not focus service when router path is /settings or /auth |
691 | const service = this.active; | 691 | const service = this.active; |
692 | if (service) { | 692 | if (service) { |
693 | document.title = `Ferdi - ${service.name} ${ | ||
694 | service.dialogTitle ? ` - ${service.dialogTitle}` : '' | ||
695 | } ${service._webview ? `- ${service._webview.getTitle()}` : ''}`; | ||
693 | this._focusService({ serviceId: service.id }); | 696 | this._focusService({ serviceId: service.id }); |
694 | if (this.stores.settings.app.splitMode && !focusEvent) { | 697 | if (this.stores.settings.app.splitMode && !focusEvent) { |
695 | setTimeout(() => { | 698 | setTimeout(() => { |
@@ -1082,7 +1085,7 @@ export default class ServicesStore extends Store { | |||
1082 | this.actions.service.focusService({ serviceId: service.id }); | 1085 | this.actions.service.focusService({ serviceId: service.id }); |
1083 | document.title = `Ferdi - ${service.name} ${ | 1086 | document.title = `Ferdi - ${service.name} ${ |
1084 | service.dialogTitle ? ` - ${service.dialogTitle}` : '' | 1087 | service.dialogTitle ? ` - ${service.dialogTitle}` : '' |
1085 | }`; | 1088 | } ${service._webview ? `- ${service._webview.getTitle()}` : ''}`; |
1086 | } else { | 1089 | } else { |
1087 | debug('No service is active'); | 1090 | debug('No service is active'); |
1088 | } | 1091 | } |