mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-19 03:55:50 +08:00
fix(editor): 防止快捷键重复注册
This commit is contained in:
parent
b6a260471d
commit
18e8df4a55
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user