aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editor.mjs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/editor.mjs b/src/editor.mjs
index ba54aa9..281182e 100644
--- a/src/editor.mjs
+++ b/src/editor.mjs
@@ -213,6 +213,16 @@ const getSuggestionsFromAliases = (option) => Object.entries(aliasesForMapOption
213 }) 213 })
214 ?? [] 214 ?? []
215// }}} 215// }}}
216const handleTypingInCodeBlock = (currentLine, selection) => {
217 const text = currentLine.textContent
218 if (text.match(/^\s\+$/) && text.length % 2 != 0) {
219 // TODO Completion for even number of spaces
220 } else if (text.match(/^-/)){
221 // TODO Completion for YAML doc separator
222 } else {
223 addSuggestions(currentLine, selection)
224 }
225}
216// FUNCTION: Add HTML element for List of suggestions {{{ 226// FUNCTION: Add HTML element for List of suggestions {{{
217const addSuggestions = (currentLine, selection) => { 227const addSuggestions = (currentLine, selection) => {
218 const text = currentLine.textContent 228 const text = currentLine.textContent
@@ -362,7 +372,9 @@ tinyEditor.addEventListener('selection', selection => {
362 } 372 }
363 373
364 // Show suggestions for map code block 374 // Show suggestions for map code block
365 if (insideCodeblockForMap(element)) addSuggestions(element, selection) 375 if (insideCodeblockForMap(element)) {
376 handleTypingInCodeBlock(element, selection)
377 }
366}); 378});
367// }}} 379// }}}
368// EVENT: keydown for suggestions {{{ 380// EVENT: keydown for suggestions {{{