Skip to content

Commit

Permalink
Merge pull request #194 from yuque/feat/change-login
Browse files Browse the repository at this point in the history
fix: 修复修饰键导致划词无法开启问题
  • Loading branch information
moshangqi authored Nov 1, 2023
2 parents 41363a2 + d038f77 commit 5122ea6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pages/inject/WordMark/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,16 @@ function WordMarkApp() {
}, [selectText, initPosition, type]);

useEffect(() => {
setVisible(wordMarkContext.enable);
// 不存在修饰键时不监听键盘事件
if (!wordMarkContext.evokeWordMarkShortKey) {
return;
}
const onkeydown = (e: KeyboardEvent) => {
if (e.key === wordMarkContext.evokeWordMarkShortKey && showWordMarkRef.current) {
if (
e.key === wordMarkContext.evokeWordMarkShortKey &&
showWordMarkRef.current
) {
setVisible(v => !v);
}
};
Expand Down

0 comments on commit 5122ea6

Please sign in to comment.