fix(editor): 防止快捷键重复注册

This commit is contained in:
roymondchen 2025-06-25 14:17:43 +08:00
parent b6a260471d
commit 18e8df4a55

View File

@ -145,6 +145,18 @@ class Keybinding extends BaseService {
for (const [type = '', eventType = 'keydown'] of when) {
const cacheItem: KeyBindingCacheItem = { type, command, keybinding, eventType, bound: false };
if (
this.bindingList.find(
(item) =>
item.command === command &&
item.eventType === eventType &&
item.type === type &&
item.keybinding === keybinding,
)
) {
continue;
}
this.bindingList.push(cacheItem);
}
}