mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-04-05 20:17:53 +08:00
perf: 优化项目阅读界面, 新增打开搜索面板快捷键(Ctrl + f), esc恢复到目录快捷键功能
This commit is contained in:
parent
d217c7ee48
commit
18875b9da4
@ -228,7 +228,23 @@ function initHighlighting() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleEvent(event) {
|
||||||
|
switch (event.keyCode) {
|
||||||
|
case 70: // ctrl + f 打开搜索面板 并获取焦点
|
||||||
|
$(".navg-item[data-mode='search']").click();
|
||||||
|
document.getElementById('searchForm').querySelector('input').focus();
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
case 27: // esc 关闭搜索面板
|
||||||
|
$(".navg-item[data-mode='view']").click();
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
window.addEventListener('keydown', handleEvent)
|
||||||
|
|
||||||
checkMarkdownTocElement();
|
checkMarkdownTocElement();
|
||||||
$(".view-backtop").on("click", function () {
|
$(".view-backtop").on("click", function () {
|
||||||
$('.manual-right').animate({ scrollTop: '0px' }, 200);
|
$('.manual-right').animate({ scrollTop: '0px' }, 200);
|
||||||
@ -420,7 +436,6 @@ function loadCopySnippets() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkMarkdownTocElement() {
|
function checkMarkdownTocElement() {
|
||||||
console.log(111)
|
|
||||||
let toc = $(".markdown-toc-list");
|
let toc = $(".markdown-toc-list");
|
||||||
let articleComment = $("#articleComment");
|
let articleComment = $("#articleComment");
|
||||||
if (toc.length) {
|
if (toc.length) {
|
||||||
|
Loading…
Reference in New Issue
Block a user