diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-10-21 11:36:52 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-10-21 11:36:52 +0200 |
| commit | 87744841c81377b1f195ff171fb23c9ae3d40303 (patch) | |
| tree | b1a4eb814b80ce1433de6d5efa3cddb29b67ce42 | |
| parent | 14f0ed64e306cfc232c3209985afb53fa2cadbb2 (diff) | |
| download | rust-87744841c81377b1f195ff171fb23c9ae3d40303.tar.gz rust-87744841c81377b1f195ff171fb23c9ae3d40303.zip | |
Add option to disable keyboard shortcuts in docs
| -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; } |
