We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
建议加入搜索快捷键绑定,如github,按 "/" 或者vuepress 按 “ctrl+k” 就能弹出搜索框
https://v2.vuepress.vuejs.org/zh/reference/plugin/search.html#hotkeys
The text was updated successfully, but these errors were encountered:
该issue可扩展为自定义全局快捷键(如vim键位支持
Sorry, something went wrong.
需求+1, 目前自实现(代码通过AI生成)
class KeybindCustom { static initKeyBind() { const SEARCH_TOGGLE_ID = "search-toggle-desktop"; const SEARCH_INPUT_ID = "search-input-desktop"; let isSearchActive = false; const handleKeyDown = (event) => { const searchToggle = document.getElementById(SEARCH_TOGGLE_ID); const searchInput = document.getElementById(SEARCH_INPUT_ID); if (event.key === "/") { if (document.activeElement !== searchInput && document.activeElement.tagName !== 'TEXTAREA' && document.activeElement.tagName !== 'INPUT' && document.activeElement.tagName !== 'PRE' ) { event.preventDefault(); if (searchToggle) { searchToggle.click(); isSearchActive = true; searchInput.focus(); } } } else if (event.key === "Escape" && isSearchActive) { const mask = document.getElementById("mask"); if (mask) { mask.click(); isSearchActive = false; searchInput.blur(); } } }; document.addEventListener("keydown", handleKeyDown); const searchInput = document.getElementById(SEARCH_INPUT_ID); if (searchInput) { const handleFocus = () => isSearchActive = true; const handleBlur = () => isSearchActive = false; searchInput.addEventListener("focus", handleFocus); searchInput.addEventListener("blur", handleBlur); } } } (() => { if (!window.ExtUtils.isMobile()) { KeybindCustom.initKeyBind(); } })();
这个需求迟迟没有动,是因为我想整体重构搜索框,像vuepress等那样。
lyj0309
No branches or pull requests
Describe the feature you want 描述你的功能需求
建议加入搜索快捷键绑定,如github,按 "/" 或者vuepress 按 “ctrl+k” 就能弹出搜索框
Useful reference 有价值的参考
https://v2.vuepress.vuejs.org/zh/reference/plugin/search.html#hotkeys
The text was updated successfully, but these errors were encountered: