Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update taskbar title on widget of windowOS #171

Merged
merged 2 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/main/utils/window/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export function hideSearch() {
* windowOS need to `search.window.blur()` to hide menubar.
* macOS need to `search.hideWindow()`.
*/
search.window.blur(); // Need to reopen in windowOS
if (search.window) {
search.window.blur(); // Need to reopen in windowOS
}
search.hideWindow(); // Need to reopen in macOS
}

Expand Down
10 changes: 10 additions & 0 deletions app/renderer/pages/widget/components/WebWidget/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Helmet } from 'react-helmet';
import * as NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import url from 'url';
Expand Down Expand Up @@ -36,6 +37,7 @@ const initialPage = 'https://google.com';

class WebWidget extends React.Component {
state = {
title: '',
currentUrl: '',
isLoading: false,
isSettingOpen: false,
Expand Down Expand Up @@ -99,6 +101,10 @@ class WebWidget extends React.Component {
NProgress.done();
this.setState({ isLoading: false });
});

webView.addEventListener('page-title-updated', ({ title }) => {
this.setState({ title });
});
};

configureNavigateEvent = () => {
Expand Down Expand Up @@ -197,6 +203,7 @@ class WebWidget extends React.Component {
const text = i18n().widget;
const {
currentUrl,
title,
isLoading,
isMakeMenuOpen,
newWindowURL,
Expand All @@ -211,6 +218,9 @@ class WebWidget extends React.Component {

return (
<div className="WebWidget">
<Helmet>
<title>{title}</title>
</Helmet>
<WidgetHeaderContainer
currentUrl={currentUrl}
webView={this.webViewRef.current}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"prop-types": "^15.6.2",
"react": "^16.6.3",
"react-dom": "^16.4.1",
"react-helmet": "^5.2.0",
"react-modal": "^3.4.5",
"react-redux": "^5.0.7",
"react-router": "^4.3.1",
Expand Down
27 changes: 25 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3476,7 +3476,7 @@ execa@^0.9.0:
signal-exit "^3.0.0"
strip-eof "^1.0.0"

exenv@^1.2.0:
exenv@^1.2.0, exenv@^1.2.1:
version "1.2.2"
resolved "https://registry.yarnpkg.com/exenv/-/exenv-1.2.2.tgz#2ae78e85d9894158670b03d47bec1f03bd91bb9d"

Expand Down Expand Up @@ -7380,7 +7380,7 @@ prop-types@^15.5.10, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2:
loose-envify "^1.3.1"
object-assign "^4.1.1"

prop-types@^15.5.8:
prop-types@^15.5.4, prop-types@^15.5.8:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
Expand Down Expand Up @@ -7565,6 +7565,16 @@ react-dom@^16.4.1:
object-assign "^4.1.1"
prop-types "^15.6.0"

react-helmet@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-5.2.0.tgz#a81811df21313a6d55c5f058c4aeba5d6f3d97a7"
integrity sha1-qBgR3yExOm1VxfBYxK66XW89l6c=
dependencies:
deep-equal "^1.0.1"
object-assign "^4.1.1"
prop-types "^15.5.4"
react-side-effect "^1.1.0"

react-is@^16.4.2:
version "16.4.2"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.4.2.tgz#84891b56c2b6d9efdee577cc83501dfc5ecead88"
Expand Down Expand Up @@ -7621,6 +7631,14 @@ react-router@^4.3.1:
prop-types "^15.6.1"
warning "^4.0.1"

react-side-effect@^1.1.0:
version "1.1.5"
resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-1.1.5.tgz#f26059e50ed9c626d91d661b9f3c8bb38cd0ff2d"
integrity sha512-Z2ZJE4p/jIfvUpiUMRydEVpQRf2f8GMHczT6qLcARmX7QRb28JDBTpnM2g/i5y/p7ZDEXYGHWg0RbhikE+hJRw==
dependencies:
exenv "^1.2.1"
shallowequal "^1.0.1"

react-svg-inline@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/react-svg-inline/-/react-svg-inline-2.1.1.tgz#532664006bf5b4f9ca2879d185e546df9a7476ef"
Expand Down Expand Up @@ -8447,6 +8465,11 @@ shallow-clone@^1.0.0:
kind-of "^5.0.0"
mixin-object "^2.0.1"

shallowequal@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8"
integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==

shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
Expand Down