mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-19 21:11:32 +01:00
Cmd-m magnify block
This commit is contained in:
parent
a4551f9e4c
commit
933c5d66e9
@ -670,6 +670,14 @@ function makeAppMenu() {
|
|||||||
role: "togglefullscreen",
|
role: "togglefullscreen",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const windowMenu: Electron.MenuItemConstructorOptions[] = [
|
||||||
|
{ role: "minimize", accelerator: "" },
|
||||||
|
{ role: "zoom" },
|
||||||
|
{ type: "separator" },
|
||||||
|
{ role: "front" },
|
||||||
|
{ type: "separator" },
|
||||||
|
{ role: "window" },
|
||||||
|
];
|
||||||
const menuTemplate: Electron.MenuItemConstructorOptions[] = [
|
const menuTemplate: Electron.MenuItemConstructorOptions[] = [
|
||||||
{
|
{
|
||||||
role: "appMenu",
|
role: "appMenu",
|
||||||
@ -688,6 +696,7 @@ function makeAppMenu() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
role: "windowMenu",
|
role: "windowMenu",
|
||||||
|
submenu: windowMenu,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const menu = electron.Menu.buildFromTemplate(menuTemplate);
|
const menu = electron.Menu.buildFromTemplate(menuTemplate);
|
||||||
|
@ -20,6 +20,7 @@ import clsx from "clsx";
|
|||||||
import * as jotai from "jotai";
|
import * as jotai from "jotai";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
|
||||||
|
import { adaptFromReactOrNativeKeyEvent, checkKeyPressed } from "@/util/keyutil";
|
||||||
import "./block.less";
|
import "./block.less";
|
||||||
|
|
||||||
export interface LayoutComponentModel {
|
export interface LayoutComponentModel {
|
||||||
@ -385,6 +386,15 @@ const BlockFrame_Default_Component = ({
|
|||||||
layoutModel?.onMagnifyToggle();
|
layoutModel?.onMagnifyToggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {
|
||||||
|
const waveEvent = adaptFromReactOrNativeKeyEvent(e);
|
||||||
|
if (checkKeyPressed(waveEvent, "Cmd:m")) {
|
||||||
|
e.preventDefault();
|
||||||
|
layoutModel?.onMagnifyToggle();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const innerStyle: React.CSSProperties = {};
|
const innerStyle: React.CSSProperties = {};
|
||||||
if (!preview && customBg?.bg != null) {
|
if (!preview && customBg?.bg != null) {
|
||||||
innerStyle.background = customBg.bg;
|
innerStyle.background = customBg.bg;
|
||||||
@ -410,6 +420,7 @@ const BlockFrame_Default_Component = ({
|
|||||||
onFocusCapture={blockModel?.onFocusCapture}
|
onFocusCapture={blockModel?.onFocusCapture}
|
||||||
ref={blockModel?.blockRef}
|
ref={blockModel?.blockRef}
|
||||||
style={style}
|
style={style}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
>
|
>
|
||||||
<div className="block-mask"></div>
|
<div className="block-mask"></div>
|
||||||
<div className="block-frame-default-inner" style={innerStyle}>
|
<div className="block-frame-default-inner" style={innerStyle}>
|
||||||
|
Loading…
Reference in New Issue
Block a user