mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
Minor Fixes (border, history line background), Toggle DevUI (#379)
* restore sidebar right border, fix line-container background color for history * add a dev-only 'Toggle Dev UI' switch in the View Menu (for testing UI and screenshots, etc.)
This commit is contained in:
parent
70db1e1b48
commit
e30748109c
@ -32,7 +32,7 @@ class App extends React.Component<{}, {}> {
|
|||||||
|
|
||||||
constructor(props: {}) {
|
constructor(props: {}) {
|
||||||
super(props);
|
super(props);
|
||||||
if (GlobalModel.isDev) document.body.className = "is-dev";
|
if (GlobalModel.isDev) document.body.classList.add("is-dev");
|
||||||
}
|
}
|
||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
|
@ -257,7 +257,6 @@
|
|||||||
.line-container {
|
.line-container {
|
||||||
padding: 0px 10px 10px 10px;
|
padding: 0px 10px 10px 10px;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
background-color: var(--term-black);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.line-context {
|
.line-context {
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
font-size: var(--sidebar-font-size);
|
font-size: var(--sidebar-font-size);
|
||||||
font-family: var(--base-font-family);
|
font-family: var(--base-font-family);
|
||||||
font-weight: var(--sidebar-font-weight);
|
font-weight: var(--sidebar-font-weight);
|
||||||
|
border-right: 1px solid var(--app-border-color);
|
||||||
|
|
||||||
.title-bar-drag {
|
.title-bar-drag {
|
||||||
-webkit-app-region: drag;
|
-webkit-app-region: drag;
|
||||||
|
@ -34,6 +34,7 @@ let wasActive = true;
|
|||||||
let wasInFg = true;
|
let wasInFg = true;
|
||||||
let currentGlobalShortcut: string | null = null;
|
let currentGlobalShortcut: string | null = null;
|
||||||
let initialClientData: ClientDataType = null;
|
let initialClientData: ClientDataType = null;
|
||||||
|
let MainWindow: Electron.BrowserWindow | null = null;
|
||||||
|
|
||||||
checkPromptMigrate();
|
checkPromptMigrate();
|
||||||
ensureDir(waveHome);
|
ensureDir(waveHome);
|
||||||
@ -199,6 +200,55 @@ function readAuthKey(): string {
|
|||||||
}
|
}
|
||||||
const reloadAcceleratorKey = unamePlatform == "darwin" ? "Option+R" : "Super+R";
|
const reloadAcceleratorKey = unamePlatform == "darwin" ? "Option+R" : "Super+R";
|
||||||
const cmdOrAlt = process.platform === "darwin" ? "Cmd" : "Alt";
|
const cmdOrAlt = process.platform === "darwin" ? "Cmd" : "Alt";
|
||||||
|
let viewSubMenu: Electron.MenuItemConstructorOptions[] = [];
|
||||||
|
viewSubMenu.push({ role: "reload", accelerator: reloadAcceleratorKey });
|
||||||
|
viewSubMenu.push({ role: "toggleDevTools" });
|
||||||
|
if (isDev) {
|
||||||
|
viewSubMenu.push({
|
||||||
|
label: "Toggle Dev UI",
|
||||||
|
click: () => {
|
||||||
|
MainWindow?.webContents.send("toggle-devui");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
viewSubMenu.push({ type: "separator" });
|
||||||
|
viewSubMenu.push({
|
||||||
|
label: "Actual Size",
|
||||||
|
accelerator: cmdOrAlt + "+0",
|
||||||
|
click: () => {
|
||||||
|
if (MainWindow == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MainWindow.webContents.setZoomFactor(1);
|
||||||
|
MainWindow.webContents.send("zoom-changed");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
viewSubMenu.push({
|
||||||
|
label: "Zoom In",
|
||||||
|
accelerator: cmdOrAlt + "+Plus",
|
||||||
|
click: () => {
|
||||||
|
if (MainWindow == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const zoomFactor = MainWindow.webContents.getZoomFactor();
|
||||||
|
MainWindow.webContents.setZoomFactor(zoomFactor * 1.1);
|
||||||
|
MainWindow.webContents.send("zoom-changed");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
viewSubMenu.push({
|
||||||
|
label: "Zoom Out",
|
||||||
|
accelerator: cmdOrAlt + "+-",
|
||||||
|
click: () => {
|
||||||
|
if (MainWindow == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const zoomFactor = MainWindow.webContents.getZoomFactor();
|
||||||
|
MainWindow.webContents.setZoomFactor(zoomFactor / 1.1);
|
||||||
|
MainWindow.webContents.send("zoom-changed");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
viewSubMenu.push({ type: "separator" });
|
||||||
|
viewSubMenu.push({ role: "togglefullscreen" });
|
||||||
const menuTemplate: Electron.MenuItemConstructorOptions[] = [
|
const menuTemplate: Electron.MenuItemConstructorOptions[] = [
|
||||||
{
|
{
|
||||||
role: "appMenu",
|
role: "appMenu",
|
||||||
@ -223,48 +273,7 @@ const menuTemplate: Electron.MenuItemConstructorOptions[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
role: "viewMenu",
|
role: "viewMenu",
|
||||||
submenu: [
|
submenu: viewSubMenu,
|
||||||
{ role: "reload", accelerator: reloadAcceleratorKey },
|
|
||||||
{ role: "toggleDevTools" },
|
|
||||||
{ type: "separator" },
|
|
||||||
{
|
|
||||||
label: "Actual Size",
|
|
||||||
accelerator: cmdOrAlt + "+0",
|
|
||||||
click: () => {
|
|
||||||
if (MainWindow == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MainWindow.webContents.setZoomFactor(1);
|
|
||||||
MainWindow.webContents.send("zoom-changed");
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Zoom In",
|
|
||||||
accelerator: cmdOrAlt + "+Plus",
|
|
||||||
click: () => {
|
|
||||||
if (MainWindow == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const zoomFactor = MainWindow.webContents.getZoomFactor();
|
|
||||||
MainWindow.webContents.setZoomFactor(zoomFactor * 1.1);
|
|
||||||
MainWindow.webContents.send("zoom-changed");
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Zoom Out",
|
|
||||||
accelerator: cmdOrAlt + "+-",
|
|
||||||
click: () => {
|
|
||||||
if (MainWindow == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const zoomFactor = MainWindow.webContents.getZoomFactor();
|
|
||||||
MainWindow.webContents.setZoomFactor(zoomFactor / 1.1);
|
|
||||||
MainWindow.webContents.send("zoom-changed");
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ type: "separator" },
|
|
||||||
{ role: "togglefullscreen" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
role: "windowMenu",
|
role: "windowMenu",
|
||||||
@ -277,8 +286,6 @@ const menuTemplate: Electron.MenuItemConstructorOptions[] = [
|
|||||||
const menu = electron.Menu.buildFromTemplate(menuTemplate);
|
const menu = electron.Menu.buildFromTemplate(menuTemplate);
|
||||||
electron.Menu.setApplicationMenu(menu);
|
electron.Menu.setApplicationMenu(menu);
|
||||||
|
|
||||||
let MainWindow: Electron.BrowserWindow | null = null;
|
|
||||||
|
|
||||||
function getMods(input: any): object {
|
function getMods(input: any): object {
|
||||||
return { meta: input.meta, shift: input.shift, ctrl: input.control, alt: input.alt };
|
return { meta: input.meta, shift: input.shift, ctrl: input.control, alt: input.alt };
|
||||||
}
|
}
|
||||||
|
@ -37,4 +37,5 @@ contextBridge.exposeInMainWorld("api", {
|
|||||||
contextScreen: (screenOpts, position) => ipcRenderer.send("context-screen", screenOpts, position),
|
contextScreen: (screenOpts, position) => ipcRenderer.send("context-screen", screenOpts, position),
|
||||||
contextEditMenu: (position, opts) => ipcRenderer.send("context-editmenu", position, opts),
|
contextEditMenu: (position, opts) => ipcRenderer.send("context-editmenu", position, opts),
|
||||||
onWaveSrvStatusChange: (callback) => ipcRenderer.on("wavesrv-status-change", callback),
|
onWaveSrvStatusChange: (callback) => ipcRenderer.on("wavesrv-status-change", callback),
|
||||||
|
onToggleDevUI: (callback) => ipcRenderer.on("toggle-devui", callback),
|
||||||
});
|
});
|
||||||
|
@ -135,6 +135,7 @@ class Model {
|
|||||||
this.clientId = getApi().getId();
|
this.clientId = getApi().getId();
|
||||||
this.isDev = getApi().getIsDev();
|
this.isDev = getApi().getIsDev();
|
||||||
this.authKey = getApi().getAuthKey();
|
this.authKey = getApi().getAuthKey();
|
||||||
|
getApi().onToggleDevUI(this.toggleDevUI.bind(this));
|
||||||
this.ws = new WSControl(this.getBaseWsHostPort(), this.clientId, this.authKey, (message: any) => {
|
this.ws = new WSControl(this.getBaseWsHostPort(), this.clientId, this.authKey, (message: any) => {
|
||||||
const interactive = message?.interactive ?? false;
|
const interactive = message?.interactive ?? false;
|
||||||
this.runUpdate(message, interactive);
|
this.runUpdate(message, interactive);
|
||||||
@ -205,6 +206,10 @@ class Model {
|
|||||||
return (window as any).GlobalModel;
|
return (window as any).GlobalModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleDevUI(): void {
|
||||||
|
document.body.classList.toggle("is-dev");
|
||||||
|
}
|
||||||
|
|
||||||
bumpRenderVersion() {
|
bumpRenderVersion() {
|
||||||
mobx.action(() => {
|
mobx.action(() => {
|
||||||
this.renderVersion.set(this.renderVersion.get() + 1);
|
this.renderVersion.set(this.renderVersion.get() + 1);
|
||||||
|
1
src/types/custom.d.ts
vendored
1
src/types/custom.d.ts
vendored
@ -910,6 +910,7 @@ declare global {
|
|||||||
contextEditMenu: (position: { x: number; y: number }, opts: ContextMenuOpts) => void;
|
contextEditMenu: (position: { x: number; y: number }, opts: ContextMenuOpts) => void;
|
||||||
onWaveSrvStatusChange: (callback: (status: boolean, pid: number) => void) => void;
|
onWaveSrvStatusChange: (callback: (status: boolean, pid: number) => void) => void;
|
||||||
getLastLogs: (numOfLines: number, callback: (logs: any) => void) => void;
|
getLastLogs: (numOfLines: number, callback: (logs: any) => void) => void;
|
||||||
|
onToggleDevUI: (callback: () => void) => void;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user