diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-10-23 17:14:37 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-23 17:14:37 +0900 |
| commit | 88e3ae2eb4f3391fcecd3e53405b08df83e2fe28 (patch) | |
| tree | b1f10e9908f83e68e8c4103c69e24c4d01ca9476 | |
| parent | ff2442ff36a5ddb8a2b6ae737b2acb5c9718c04e (diff) | |
| parent | 87744841c81377b1f195ff171fb23c9ae3d40303 (diff) | |
| download | rust-88e3ae2eb4f3391fcecd3e53405b08df83e2fe28.tar.gz rust-88e3ae2eb4f3391fcecd3e53405b08df83e2fe28.zip | |
Rollup merge of #65656 - GuillaumeGomez:option-disable-shortcut, r=Dylan-DPC
Add option to disable keyboard shortcuts in docs Fixes #65211. r? @Manishearth
| -rw-r--r-- | src/librustdoc/html/render.rs | 1 | ||||
| -rw-r--r-- | src/librustdoc/html/static/main.js | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 72a72e89281..414c3137376 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1241,6 +1241,7 @@ fn settings(root_path: &str, suffix: &str) -> String { ("go-to-only-result", "Directly go to item in search if there is only one result", false), ("line-numbers", "Show line numbers on code examples", false), + ("disable-shortcuts", "Disable keyboard shortcuts", false), ]; format!( "<h1 class='fqn'>\ diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 17a940cc4c9..f0104c9156d 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -79,6 +79,7 @@ function getSearchElement() { "derive", "traitalias"]; + var disableShortcuts = getCurrentValue("rustdoc-disable-shortcuts") !== "true"; var search_input = getSearchInput(); // On the search screen, so you remain on the last tab you opened. @@ -294,7 +295,7 @@ function getSearchElement() { function handleShortcut(ev) { // Don't interfere with browser shortcuts - if (ev.ctrlKey || ev.altKey || ev.metaKey) { + if (ev.ctrlKey || ev.altKey || ev.metaKey || disableShortcuts === true) { return; } |
