Skip to content

Commit acda485

Browse files
committed
🐛 修复mac下无法在节点编辑状态下进行command+c和command+v的问题
1 parent 8dc2412 commit acda485

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

app/src/main.tsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { routes } from "@generouted/react-router";
2-
import { Menu, MenuItem } from "@tauri-apps/api/menu";
2+
// import { Menu, MenuItem } from "@tauri-apps/api/menu";
33
import { getMatches } from "@tauri-apps/plugin-cli";
44
import "driver.js/dist/driver.css";
55
import i18next from "i18next";
@@ -37,7 +37,7 @@ import "./index.css";
3737
import "./polyfills/roundRect";
3838
import { exists } from "./utils/fs";
3939
import { exit, writeStderr } from "./utils/otherApi";
40-
import { getCurrentWindow, isDesktop, isFrame, isMac, isWeb, isWindows } from "./utils/platform";
40+
import { getCurrentWindow, isDesktop, isFrame, isWeb, isWindows } from "./utils/platform";
4141

4242
/**
4343
* @private
@@ -55,9 +55,6 @@ const el = document.getElementById("root")!;
5555
(async () => {
5656
const matches = !isWeb && isDesktop ? await getMatches() : null;
5757
const isCliMode = isDesktop && matches?.args.output?.occurrences === 1;
58-
if (isMac) {
59-
macosLoadMenu();
60-
}
6158
await Promise.all([
6259
Settings.init(),
6360
RecentFileManager.init(),
@@ -171,28 +168,31 @@ async function loadStartFile() {
171168
}
172169

173170
/** macos加载顶部菜单栏 */
174-
async function macosLoadMenu() {
175-
// 奇怪了,什么都显示不出来(
176-
// 创建菜单项
177-
const testItem1 = await MenuItem.new({
178-
text: "测试",
179-
action: (_id) => {
180-
console.log(_id);
181-
},
182-
});
183-
const testItem2 = await MenuItem.new({
184-
text: "测试2",
185-
action: (_id) => {
186-
console.log(_id);
187-
},
188-
});
189-
// 创建主菜单
190-
const menu = await Menu.new({ items: [testItem1, testItem2] });
171+
// tnnd, 屏蔽一些mac的顶部菜单栏本来是打算防止有人误以为软件是英文的
172+
// 结果导致节点进入编辑状态后无法command c/v了。
191173

192-
// 设置应用菜单
193-
await menu.setAsAppMenu();
194-
console.log("macos加载菜单栏成功");
195-
}
174+
// async function macosLoadMenu() {
175+
// // 奇怪了,什么都显示不出来(
176+
// // 创建菜单项
177+
// const testItem1 = await MenuItem.new({
178+
// text: "测试",
179+
// action: (_id) => {
180+
// console.log(_id);
181+
// },
182+
// });
183+
// const testItem2 = await MenuItem.new({
184+
// text: "测试2",
185+
// action: (_id) => {
186+
// console.log(_id);
187+
// },
188+
// });
189+
// // 创建主菜单
190+
// const menu = await Menu.new({ items: [testItem1, testItem2] });
191+
192+
// // 设置应用菜单
193+
// await menu.setAsAppMenu();
194+
// console.log("macos加载菜单栏成功");
195+
// }
196196

197197
/** 渲染应用 */
198198
async function renderApp(cli: boolean = false) {

0 commit comments

Comments
 (0)