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