From c57800b4cf5fc2aa047c9f01bae5b5994f89fbe9 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 24 Sep 2024 20:08:36 +0800 Subject: chore: reformat code --- src/editor.mjs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/editor.mjs') diff --git a/src/editor.mjs b/src/editor.mjs index 92513a3..539a770 100644 --- a/src/editor.mjs +++ b/src/editor.mjs @@ -151,10 +151,11 @@ const debounceForMap = (() => { let timer = null; return function(...args) { - clearTimeout(timer); - timer = setTimeout(() => { dumbymap = generateMaps.apply(this, args) - }, 1000); + // clearTimeout(timer); + // timer = setTimeout(() => { + // dumbymap = generateMaps.apply(this, args) + // }, 10); } })() @@ -542,9 +543,9 @@ document.onkeydown = (e) => { e.preventDefault() dumbymap.utils.focusNextMap(e.shiftKey) } - if (e.key === 'x') { + if (e.key === 'x' || e.key === 'X') { e.preventDefault() - dumbymap.utils.switchToNextLayout() + dumbymap.utils.switchToNextLayout(e.shiftKey) } if (e.key === 'n') { e.preventDefault() @@ -563,6 +564,7 @@ document.onkeydown = (e) => { // }}} // }}} +// Layout Switch {{{ const layoutObserver = new MutationObserver(() => { const layout = HtmlContainer.getAttribute('data-layout') if (layout !== 'normal') { @@ -575,5 +577,6 @@ layoutObserver.observe(HtmlContainer, { attributeFilter: ["data-layout"], attributeOldValue: true }); +// }}} // vim: sw=2 ts=2 foldmethod=marker foldmarker={{{,}}} -- cgit v1.2.3-70-g09d2