mirror of
https://github.com/fanchenio/DawnLauncher.git
synced 2025-07-13 12:52:10 +08:00
所有文本框支持右键剪切、复制、粘贴。
This commit is contained in:
parent
78cf39bec7
commit
a2ccd8670b
@ -77,10 +77,12 @@ let simplifiedChinese = {
|
||||
controlPanel: "控制面板",
|
||||
convertAbsolutePath: "转为绝对路径",
|
||||
convertRelativePath: "转为相对路径",
|
||||
copy: "复制",
|
||||
copyFullPath: "复制完整路径",
|
||||
copyTo: "复制到",
|
||||
createShortcut: "创建快捷方式",
|
||||
ctrlNumberKey: "Ctrl + 数字键",
|
||||
cut: "剪切",
|
||||
default: "默认",
|
||||
defaultIcon: "默认图标",
|
||||
delayDisplay: "延迟显示",
|
||||
@ -206,6 +208,7 @@ let simplifiedChinese = {
|
||||
parameters: "参数",
|
||||
password: "密码",
|
||||
pasteIcon: "粘贴图标",
|
||||
paste: "粘贴",
|
||||
path: "路径",
|
||||
powerOptions: "电源选项",
|
||||
powerShell: "PowerShell",
|
||||
@ -384,10 +387,12 @@ let traditionalChinese = {
|
||||
controlPanel: "控製面板",
|
||||
convertAbsolutePath: "轉為絕對路徑",
|
||||
convertRelativePath: "轉為相對路徑",
|
||||
copy: "復製",
|
||||
copyFullPath: "復製完整路徑",
|
||||
copyTo: "復製到",
|
||||
createShortcut: "創建快捷方式",
|
||||
ctrlNumberKey: "Ctrl + 數字鍵",
|
||||
cut: "剪切",
|
||||
default: "默認",
|
||||
defaultIcon: "默認圖標",
|
||||
delayDisplay: "延遲顯示",
|
||||
@ -513,6 +518,7 @@ let traditionalChinese = {
|
||||
parameters: "參數",
|
||||
password: "密碼",
|
||||
pasteIcon: "粘貼圖標",
|
||||
paste: "粘貼",
|
||||
path: "路徑",
|
||||
powerOptions: "電源選項",
|
||||
powerShell: "PowerShell",
|
||||
@ -699,10 +705,12 @@ let english = {
|
||||
controlPanel: "Control Panel",
|
||||
convertAbsolutePath: "Convert to Absolute Path",
|
||||
convertRelativePath: "Convert to Relative Path",
|
||||
copy: "Copy",
|
||||
copyFullPath: "Copy Full Path",
|
||||
copyTo: "Copy to",
|
||||
createShortcut: "Create Shortcut",
|
||||
ctrlNumberKey: "Ctrl + Number Key",
|
||||
cut: "Cut",
|
||||
default: "Default",
|
||||
defaultIcon: "Default Icon",
|
||||
delayDisplay: "Delay Display",
|
||||
@ -830,6 +838,7 @@ let english = {
|
||||
parameters: "Parameters",
|
||||
password: "Password",
|
||||
pasteIcon: "Paste Icon",
|
||||
paste: "Paste",
|
||||
path: "Path",
|
||||
powerOptions: "Power Options",
|
||||
powerShell: "PowerShell",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { app, ipcMain, OpenDialogSyncOptions, shell } from "electron";
|
||||
import { app, ipcMain, Menu, OpenDialogSyncOptions, shell } from "electron";
|
||||
import { getFileIcon } from "../../commons/utils";
|
||||
import mime from "mime";
|
||||
import { ShortcutInfo } from "../../../types/common";
|
||||
@ -164,4 +164,24 @@ export default function () {
|
||||
app.getPath("home")
|
||||
);
|
||||
});
|
||||
// 文本框菜单
|
||||
ipcMain.on("textRightMenu", (event, args) => {
|
||||
// 菜单
|
||||
let menu = Menu.buildFromTemplate([
|
||||
{
|
||||
role: "cut",
|
||||
label: global.language.cut,
|
||||
},
|
||||
{
|
||||
role: "copy",
|
||||
label: global.language.copy,
|
||||
},
|
||||
{
|
||||
role: "paste",
|
||||
label: global.language.paste,
|
||||
},
|
||||
]);
|
||||
// 显示
|
||||
menu.popup();
|
||||
});
|
||||
}
|
||||
|
@ -114,6 +114,10 @@ contextBridge.exposeInMainWorld("api", {
|
||||
) => {
|
||||
ipcRenderer.send("run", { operation, target, params, startLocation });
|
||||
},
|
||||
// 文本框菜单
|
||||
textRightMenu: () => {
|
||||
ipcRenderer.send("textRightMenu");
|
||||
},
|
||||
});
|
||||
|
||||
contextBridge.exposeInMainWorld("main", {
|
||||
|
22
src/App.vue
22
src/App.vue
@ -305,6 +305,24 @@ function keydown(e: any) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 监听鼠标右键
|
||||
function contextmenu(e: MouseEvent) {
|
||||
let target = e.target as HTMLInputElement;
|
||||
if (target) {
|
||||
if (
|
||||
(target.nodeName != null &&
|
||||
target.nodeName.toLowerCase() == "input" &&
|
||||
target.type != null &&
|
||||
target.type.toLowerCase() == "text") ||
|
||||
(target.nodeName != null && target.nodeName.toLowerCase() == "textarea")
|
||||
) {
|
||||
window.api.textRightMenu();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 监听
|
||||
let onUpdateSettingUnListen: Function | null = null;
|
||||
// mounted
|
||||
@ -313,6 +331,8 @@ onMounted(() => {
|
||||
createStyle();
|
||||
// 监听键盘
|
||||
window.addEventListener("keydown", keydown, true);
|
||||
// 监听右键
|
||||
window.addEventListener("contextmenu", contextmenu, true);
|
||||
// 监听更新项目
|
||||
onUpdateSettingUnListen = window.setting.onUpdate((data) => {
|
||||
store.setting = data;
|
||||
@ -322,6 +342,8 @@ onMounted(() => {
|
||||
onUnmounted(() => {
|
||||
// 监听键盘
|
||||
window.removeEventListener("keydown", keydown, true);
|
||||
// 监听右键
|
||||
window.removeEventListener("contextmenu", contextmenu, true);
|
||||
// 删除监听
|
||||
if (onUpdateSettingUnListen) {
|
||||
onUpdateSettingUnListen();
|
||||
|
1
src/index.d.ts
vendored
1
src/index.d.ts
vendored
@ -37,6 +37,7 @@ declare global {
|
||||
params: string | null,
|
||||
startLocation: string | null
|
||||
) => void;
|
||||
textRightMenu: () => void;
|
||||
};
|
||||
main: {
|
||||
showWindow: (blurHide: boolean, autoHide: boolean) => void;
|
||||
|
Loading…
Reference in New Issue
Block a user