fix: 客户端提交截图空格报错的问题

This commit is contained in:
kuaifan 2022-12-07 21:43:52 +08:00
parent f4a7b8e2bb
commit 4b90086e5a
2 changed files with 4 additions and 3 deletions

View File

@ -169,14 +169,15 @@ $A.execMainCacheJudge = (key) => {
// 绑定截图快捷键
$A.bindScreenshotKey = (data) => {
let key = "";
if (data.screenshot_key && (data.screenshot_mate || data.screenshot_shift)) {
let screenshot_key = (data.screenshot_key || "").trim().toLowerCase()
if (screenshot_key && (data.screenshot_mate || data.screenshot_shift)) {
if (data.screenshot_mate) {
key = /macintosh|mac os x/i.test(navigator.userAgent) ? 'command' : 'ctrl'
}
if (data.screenshot_shift) {
key = `${key ? `${key}+` : ''}shift`
}
key = `${key}+${data.screenshot_key.toLowerCase()}`
key = `${key}+${screenshot_key.toLowerCase()}`
}
$A.Electron.sendMessage('bindScreenshotKey', {key});
};

View File

@ -74,7 +74,7 @@ export default {
onKeydown({key, keyCode}) {
if (keyCode !== 8) {
key = key && key.length === 1 ? key.toUpperCase() : ""
key = key && key.length === 1 ? key.trim().toUpperCase() : ""
if (key) {
this.formData.screenshot_key = key
}