From c9d5f8616f18d208cfec86611d853685045f3b94 Mon Sep 17 00:00:00 2001 From: Xen Date: Sat, 16 May 2020 10:04:15 +0800 Subject: [PATCH] - add ctrl/cmd+shift+d shortcut - try to fix window 1px border disappear issue --- src/index.css | 35 +++++++++++++++++++---------------- src/index.js | 11 +++++++++++ src/main.js | 5 +++++ 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/src/index.css b/src/index.css index d3b9d47..5562f2b 100755 --- a/src/index.css +++ b/src/index.css @@ -1,24 +1,25 @@ +:root { + --menu-height: 200px; + --bar-height: 53px; + --trans-btn-height: 20px; + --modem-btn-height: 10px; + --body-border-widht: 1px; + --bar-color-head: #fafafa; + --bar-color-middle: #fafafa; + --bar-color-tail: #fafafa; +} + html { height: 100%; font-size: 12px; } body { - border: 1px solid #26a69a; + border: var(--body-border-widht) solid #26a69a; height: 100%; background-color: #fafafa; } -:root { - --menu-height: 200px; - --bar-height: 53px; - --trans-btn-height: 20px; - --modem-btn-height: 10px; - --bar-color-head: #fafafa; - --bar-color-middle: #fafafa; - --bar-color-tail: #fafafa; -} - ::-webkit-scrollbar { display: none; } @@ -170,6 +171,7 @@ input { #menu-area { height: var(--menu-height); width: calc(100%); + /* width: 100%; */ background-color: #fafafa; } @@ -183,12 +185,13 @@ input { } #bar-area { - width: calc(100% - 2px); + /* width: calc(100% - 1px); */ + width: 100%; height: var(--bar-height); - position: fixed; - bottom: 1px; - margin-bottom: 0px; - line-height: 54px; + /* position: fixed; */ + position: sticky; + bottom: var(--body-border-widht); + line-height: var(--bar-height); background: -webkit-linear-gradient( 60deg, var(--bar-color-head), diff --git a/src/index.js b/src/index.js index 3aa8a2c..71c057e 100755 --- a/src/index.js +++ b/src/index.js @@ -89,6 +89,17 @@ ipcRenderer.on("main-cmd", (event, arg) => { case "Switch": document.getElementById("port-switch").click(); break; + case "ClearSwitch": + { + let switcher = document.getElementById("port-switch"); + switcher.click(); + if (true == switcher.checked) { + let text = editor.getModel().getValue(); + clipboard.writeText(text); + editor.getModel().setValue(""); + } + } + break; case "Open": openFile(); break; diff --git a/src/main.js b/src/main.js index d6b04fe..9665cc8 100755 --- a/src/main.js +++ b/src/main.js @@ -69,6 +69,11 @@ const createWindow = () => { mainWindow.webContents.send("main-cmd", "Switch"); }); + Shortcut.register(mainWindow, "CmdOrCtrl+Shift+D", () => { + console.log("You pressed cmd/ctrl shift d"); + mainWindow.webContents.send("main-cmd", "ClearSwitch"); + }); + Shortcut.register(mainWindow, "CmdOrCtrl+O", () => { console.log("You pressed cmd/ctrl o"); mainWindow.webContents.send("main-cmd", "Open");