mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Only emit global keyboard events when not in editable element
This commit is contained in:
parent
c4820f9313
commit
c738110391
@ -92,6 +92,14 @@ export function setupKeyboard(): Observable<Keyboard> {
|
||||
mode: getToggle("search") ? "search" : "global",
|
||||
...key
|
||||
})),
|
||||
filter(({ mode }) => {
|
||||
if (mode === "global") {
|
||||
const active = getActiveElement()
|
||||
if (typeof active !== "undefined")
|
||||
return !isSusceptibleToKeyboard(active)
|
||||
}
|
||||
return true
|
||||
}),
|
||||
share()
|
||||
)
|
||||
|
||||
@ -150,14 +158,7 @@ export function setupKeyboard(): Observable<Keyboard> {
|
||||
/* Setup global keyboard handlers */
|
||||
keyboard$
|
||||
.pipe(
|
||||
filter(({ mode }) => {
|
||||
if (mode === "global") {
|
||||
const active = getActiveElement()
|
||||
if (typeof active !== "undefined")
|
||||
return !isSusceptibleToKeyboard(active)
|
||||
}
|
||||
return false
|
||||
}),
|
||||
filter(({ mode }) => mode === "global"),
|
||||
withLatestFrom(useComponent("search-query"))
|
||||
)
|
||||
.subscribe(([key, query]) => {
|
||||
|
Loading…
Reference in New Issue
Block a user