diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 3c141c9aa..0f3593a64 100755 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -471,7 +471,7 @@ class IndexController extends InvokeController action: "eeuiAppSendMessage", data: [ { - action: 'setPageData', + action: 'setPageData', // 设置页面数据 data: { showProgress: true, titleFixed: true, @@ -479,7 +479,7 @@ class IndexController extends InvokeController } }, { - action: 'createTarget', + action: 'createTarget', // 创建目标(访问新地址) url: "{$redirectUrl}", } ] diff --git a/electron/electron.js b/electron/electron.js index 1e3657377..ac32dcec0 100644 --- a/electron/electron.js +++ b/electron/electron.js @@ -442,11 +442,16 @@ function createChildWindow(args) { // 加载地址 const hash = `${args.hash || args.path}`; if (/^https?:/i.test(hash)) { - browser.loadURL(hash).then(_ => { }).catch(_ => { }) + browser.loadURL(hash) + .then(_ => { }) + .catch(_ => { }) } else if (isPreload) { - browser.webContents.executeJavaScript(`if(typeof window.__initializeApp === 'function'){window.__initializeApp('${hash}')}else{throw new Error('no function')}`, true).catch(() => { - utils.loadUrlOrFile(browser, devloadUrl, hash) - }); + browser + .webContents + .executeJavaScript(`if(typeof window.__initializeApp === 'function'){window.__initializeApp('${hash}')}else{throw new Error('no function')}`, true) + .catch(() => { + utils.loadUrlOrFile(browser, devloadUrl, hash) + }); } else { utils.loadUrlOrFile(browser, devloadUrl, hash) } @@ -567,10 +572,6 @@ function createWebTabWindow(args) { args = {url: args} } - if (!allowedUrls.test(args.url)) { - return; - } - // 创建父级窗口 if (!webTabWindow) { const titleBarOverlay = { @@ -602,6 +603,12 @@ function createWebTabWindow(args) { }, }, userConf.get('webTabWindow', {}))) + const originalClose = webTabWindow.close; + webTabWindow.close = function() { + webTabClosedByShortcut = true; + return originalClose.apply(this, arguments); + }; + webTabWindow.on('resize', () => { resizeWebTab(0) }) diff --git a/electron/render/tabs/assets/css/style.css b/electron/render/tabs/assets/css/style.css index 5f5dc480a..f064cc3a6 100644 --- a/electron/render/tabs/assets/css/style.css +++ b/electron/render/tabs/assets/css/style.css @@ -23,11 +23,17 @@ html, body { color: #333; } +.app { + display: flex; + align-items: center; +} + .nav { font-family: var(--tab-font-family); font-feature-settings: 'clig', 'kern'; + flex: 1; + width: 0; display: flex; - width: 100%; cursor: default; background-color: var(--tab-background); -webkit-app-region: drag; @@ -36,7 +42,7 @@ html, body { .nav ul { display: flex; height: 35px; - margin: 5px 46px 0 0; + margin-top: 5px; user-select: none; overflow-x: auto; overflow-y: hidden; @@ -96,14 +102,13 @@ html, body { /* 浏览器打开 */ .browser { - position: absolute; - top: 0; - right: 0; + flex-shrink: 0; display: flex; align-items: center; - height: 38px; + height: 40px; padding: 0 14px; cursor: pointer; + background-color: var(--tab-background); -webkit-app-region: none; } .browser span { diff --git a/electron/render/tabs/index.html b/electron/render/tabs/index.html index 31aba4716..8c85d8e02 100644 --- a/electron/render/tabs/index.html +++ b/electron/render/tabs/index.html @@ -20,7 +20,7 @@ -
+
@@ -119,15 +119,23 @@ } }, computed: { + activeItem() { + if (this.tabs.length === 0) { + return null + } + return this.tabs.find(item => item.id === this.activeId) + }, pageTitle() { - const activeItem = this.tabs.find(item => item.id === this.activeId) - return activeItem ? activeItem.title : 'Untitled' + return this.activeItem ? this.activeItem.title : 'Untitled' + }, + canBrowser() { + return !(this.activeItem && /^file:/.test(this.activeItem.url)) } }, watch: { pageTitle(title) { document.title = title; - } + }, }, methods: { onSwitch(item) {