From b0ae57ed4e6daeffa64a035ce84769bec5ba40bf Mon Sep 17 00:00:00 2001 From: HyunMo Ahn Date: Mon, 15 Apr 2019 13:10:39 +0900 Subject: [PATCH 1/2] update title when move page of widget --- .../widget/components/WebWidget/index.jsx | 10 +++++++ package.json | 1 + yarn.lock | 27 +++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/app/renderer/pages/widget/components/WebWidget/index.jsx b/app/renderer/pages/widget/components/WebWidget/index.jsx index 88f0f472..7d6c46a9 100644 --- a/app/renderer/pages/widget/components/WebWidget/index.jsx +++ b/app/renderer/pages/widget/components/WebWidget/index.jsx @@ -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'; @@ -36,6 +37,7 @@ const initialPage = 'https://google.com'; class WebWidget extends React.Component { state = { + title: '', currentUrl: '', isLoading: false, isSettingOpen: false, @@ -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 = () => { @@ -197,6 +203,7 @@ class WebWidget extends React.Component { const text = i18n().widget; const { currentUrl, + title, isLoading, isMakeMenuOpen, newWindowURL, @@ -211,6 +218,9 @@ class WebWidget extends React.Component { return (
+ + {title} + Date: Mon, 15 Apr 2019 13:21:39 +0900 Subject: [PATCH 2/2] fix error about refer of undefined --- app/main/utils/window/search.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/main/utils/window/search.js b/app/main/utils/window/search.js index b65c1b15..6a94da30 100644 --- a/app/main/utils/window/search.js +++ b/app/main/utils/window/search.js @@ -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 }