aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/dumbymap.mjs5
-rw-r--r--src/editor.mjs4
2 files changed, 9 insertions, 0 deletions
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs
index 393cc08..595de5c 100644
--- a/src/dumbymap.mjs
+++ b/src/dumbymap.mjs
@@ -191,6 +191,10 @@ function focusNextBlock(reverse = false) {
191 nextBlock.scrollIntoView({behavior: 'smooth', block: "nearest"}) 191 nextBlock.scrollIntoView({behavior: 'smooth', block: "nearest"})
192} 192}
193 193
194function removeBlockFocus() {
195 this.blocks.forEach(b=>b.classList.remove('focus'))
196}
197
194export const generateMaps = (container, callback) => { 198export const generateMaps = (container, callback) => {
195 container.classList.add('Dumby') 199 container.classList.add('Dumby')
196 const htmlHolder = container.querySelector('.SemanticHtml') ?? container 200 const htmlHolder = container.querySelector('.SemanticHtml') ?? container
@@ -211,6 +215,7 @@ export const generateMaps = (container, callback) => {
211 focusNextMap: throttle(focusNextMap.bind(dumbymap), focusDelay.bind(dumbymap)), 215 focusNextMap: throttle(focusNextMap.bind(dumbymap), focusDelay.bind(dumbymap)),
212 switchToNextLayout: throttle(switchToNextLayout.bind(dumbymap), 300), 216 switchToNextLayout: throttle(switchToNextLayout.bind(dumbymap), 300),
213 focusNextBlock: focusNextBlock.bind(dumbymap), 217 focusNextBlock: focusNextBlock.bind(dumbymap),
218 removeBlockFocus: removeBlockFocus.bind(dumbymap),
214 } 219 }
215 220
216 // LeaderLine {{{ 221 // LeaderLine {{{
diff --git a/src/editor.mjs b/src/editor.mjs
index f4fadb4..35b1949 100644
--- a/src/editor.mjs
+++ b/src/editor.mjs
@@ -570,6 +570,10 @@ document.onkeydown = (e) => {
570 e.preventDefault() 570 e.preventDefault()
571 dumbymap.utils.focusNextBlock(true) 571 dumbymap.utils.focusNextBlock(true)
572 } 572 }
573 if (e.key === 'Escape') {
574 e.preventDefault()
575 dumbymap.utils.removeBlockFocus()
576 }
573 } 577 }
574} 578}
575 579