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",
|
mode: getToggle("search") ? "search" : "global",
|
||||||
...key
|
...key
|
||||||
})),
|
})),
|
||||||
|
filter(({ mode }) => {
|
||||||
|
if (mode === "global") {
|
||||||
|
const active = getActiveElement()
|
||||||
|
if (typeof active !== "undefined")
|
||||||
|
return !isSusceptibleToKeyboard(active)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}),
|
||||||
share()
|
share()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -150,14 +158,7 @@ export function setupKeyboard(): Observable<Keyboard> {
|
|||||||
/* Setup global keyboard handlers */
|
/* Setup global keyboard handlers */
|
||||||
keyboard$
|
keyboard$
|
||||||
.pipe(
|
.pipe(
|
||||||
filter(({ mode }) => {
|
filter(({ mode }) => mode === "global"),
|
||||||
if (mode === "global") {
|
|
||||||
const active = getActiveElement()
|
|
||||||
if (typeof active !== "undefined")
|
|
||||||
return !isSusceptibleToKeyboard(active)
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}),
|
|
||||||
withLatestFrom(useComponent("search-query"))
|
withLatestFrom(useComponent("search-query"))
|
||||||
)
|
)
|
||||||
.subscribe(([key, query]) => {
|
.subscribe(([key, query]) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user