aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/editor.mjs
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-09-24 20:08:36 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-09-25 10:49:45 +0800
commitc57800b4cf5fc2aa047c9f01bae5b5994f89fbe9 (patch)
treeb36bd40d82544f79919584e56eed344c84f7c901 /src/editor.mjs
parent54f0c9381fce41c4ca46baebfd6281a8f9f9ff93 (diff)
chore: reformat code
Diffstat (limited to 'src/editor.mjs')
-rw-r--r--src/editor.mjs13
1 files changed, 8 insertions, 5 deletions
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 = (() => {
151 let timer = null; 151 let timer = null;
152 152
153 return function(...args) { 153 return function(...args) {
154 clearTimeout(timer);
155 timer = setTimeout(() => {
156 dumbymap = generateMaps.apply(this, args) 154 dumbymap = generateMaps.apply(this, args)
157 }, 1000); 155 // clearTimeout(timer);
156 // timer = setTimeout(() => {
157 // dumbymap = generateMaps.apply(this, args)
158 // }, 10);
158 } 159 }
159})() 160})()
160 161
@@ -542,9 +543,9 @@ document.onkeydown = (e) => {
542 e.preventDefault() 543 e.preventDefault()
543 dumbymap.utils.focusNextMap(e.shiftKey) 544 dumbymap.utils.focusNextMap(e.shiftKey)
544 } 545 }
545 if (e.key === 'x') { 546 if (e.key === 'x' || e.key === 'X') {
546 e.preventDefault() 547 e.preventDefault()
547 dumbymap.utils.switchToNextLayout() 548 dumbymap.utils.switchToNextLayout(e.shiftKey)
548 } 549 }
549 if (e.key === 'n') { 550 if (e.key === 'n') {
550 e.preventDefault() 551 e.preventDefault()
@@ -563,6 +564,7 @@ document.onkeydown = (e) => {
563 564
564// }}} 565// }}}
565// }}} 566// }}}
567// Layout Switch {{{
566const layoutObserver = new MutationObserver(() => { 568const layoutObserver = new MutationObserver(() => {
567 const layout = HtmlContainer.getAttribute('data-layout') 569 const layout = HtmlContainer.getAttribute('data-layout')
568 if (layout !== 'normal') { 570 if (layout !== 'normal') {
@@ -575,5 +577,6 @@ layoutObserver.observe(HtmlContainer, {
575 attributeFilter: ["data-layout"], 577 attributeFilter: ["data-layout"],
576 attributeOldValue: true 578 attributeOldValue: true
577}); 579});
580// }}}
578 581
579// vim: sw=2 ts=2 foldmethod=marker foldmarker={{{,}}} 582// vim: sw=2 ts=2 foldmethod=marker foldmarker={{{,}}}