mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-11 18:02:28 +03:00
Change shortcut key for search to join command palette fad, but preserve old shortcut too
This commit is contained in:
@@ -14,12 +14,17 @@
|
|||||||
var siteDocsVersion = inputElement.getAttribute('data-bd-docs-version')
|
var siteDocsVersion = inputElement.getAttribute('data-bd-docs-version')
|
||||||
|
|
||||||
document.addEventListener('keydown', function (event) {
|
document.addEventListener('keydown', function (event) {
|
||||||
if (event.ctrlKey && event.key === '/') {
|
if ((((event.ctrlKey || event.metaKey) && event.key === 'k')) || (event.ctrlKey && event.key === '/')) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
inputElement.focus()
|
inputElement.focus()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (navigator.platform.includes('Windows')) {
|
||||||
|
var searchShortcut = document.querySelector('.bd-search')
|
||||||
|
searchShortcut.setAttribute('data-shortcut', '⌃K')
|
||||||
|
}
|
||||||
|
|
||||||
window.docsearch({
|
window.docsearch({
|
||||||
apiKey: '5990ad008512000bba2cf951ccf0332f',
|
apiKey: '5990ad008512000bba2cf951ccf0332f',
|
||||||
indexName: 'bootstrap',
|
indexName: 'bootstrap',
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
padding-left: .3125rem;
|
padding-left: .3125rem;
|
||||||
@include font-size(.75rem);
|
@include font-size(.75rem);
|
||||||
color: rgba($white, .65);
|
color: rgba($white, .65);
|
||||||
content: "Ctrl + /";
|
// content: "⌘K";
|
||||||
|
content: attr(data-shortcut);
|
||||||
background-color: rgba($white, .1);
|
background-color: rgba($white, .1);
|
||||||
@include border-radius(.125rem);
|
@include border-radius(.125rem);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
<hr class="d-lg-none text-white-50">
|
<hr class="d-lg-none text-white-50">
|
||||||
|
|
||||||
{{ if eq .Layout "docs" }}
|
{{ if eq .Layout "docs" }}
|
||||||
<form class="bd-search">
|
<form class="bd-search" data-shortcut="⌘K">
|
||||||
<input type="search" class="form-control" id="search-input" placeholder="Search docs..." aria-label="Search docs for..." autocomplete="off" data-bd-docs-version="{{ .Site.Params.docs_version }}">
|
<input type="search" class="form-control" id="search-input" placeholder="Search docs..." aria-label="Search docs for..." autocomplete="off" data-bd-docs-version="{{ .Site.Params.docs_version }}">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user