aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--eslint.config.js6
-rw-r--r--src/editor.mjs6
2 files changed, 9 insertions, 3 deletions
diff --git a/eslint.config.js b/eslint.config.js
index ac88ddf..228a920 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -21,7 +21,11 @@ export default [
21 node: nodePlugin, 21 node: nodePlugin,
22 }, 22 },
23 rules: { 23 rules: {
24 'no-unused-vars': ['warn', { 'varsIgnorePattern': '^_' }], 24 'no-unused-vars': ['warn', {
25 'varsIgnorePattern': '^_',
26 "argsIgnorePattern": "^_",
27 "caughtErrorsIgnorePattern": "^ignore|_",
28 }],
25 'import/no-unresolved': 'error', 29 'import/no-unresolved': 'error',
26 'no-console': ["error", { allow: ["info", "warn", "error"] }], 30 'no-console': ["error", { allow: ["info", "warn", "error"] }],
27 'eqeqeq': ['error', 'always'], 31 'eqeqeq': ['error', 'always'],
diff --git a/src/editor.mjs b/src/editor.mjs
index beee35b..5470b64 100644
--- a/src/editor.mjs
+++ b/src/editor.mjs
@@ -1,3 +1,5 @@
1/*global EasyMDE*/
2/*eslint no-undef: "error"*/
1import { markdown2HTML, generateMaps } from './dumbymap' 3import { markdown2HTML, generateMaps } from './dumbymap'
2import { defaultAliasesForRenderer, parseConfigsFromYaml } from 'mapclay' 4import { defaultAliasesForRenderer, parseConfigsFromYaml } from 'mapclay'
3import { createDocLinks } from './dumbymap.mjs' 5import { createDocLinks } from './dumbymap.mjs'
@@ -270,7 +272,7 @@ const getSuggestions = (anchor) => {
270 .then(rendererModule => { 272 .then(rendererModule => {
271 rendererOptions[renderer] = rendererModule.default.validOptions 273 rendererOptions[renderer] = rendererModule.default.validOptions
272 }) 274 })
273 .catch(() => { 275 .catch(_ => {
274 markInputIsInvalid(lineWithRenderer) 276 markInputIsInvalid(lineWithRenderer)
275 console.warn(`Fail to get valid options from renderer with URL ${rendererUrl}`) 277 console.warn(`Fail to get valid options from renderer with URL ${rendererUrl}`)
276 }) 278 })
@@ -406,6 +408,7 @@ cm.on('keydown', (_, e) => {
406 const focusSuggestion = e.shiftKey ? previousSuggestion : nextSuggestion 408 const focusSuggestion = e.shiftKey ? previousSuggestion : nextSuggestion
407 409
408 // Current editor selection state 410 // Current editor selection state
411 const anchor = cm.getCursor()
409 switch (e.key) { 412 switch (e.key) {
410 case 'Tab': 413 case 'Tab':
411 Array.from(suggestionsEle.children).forEach(s => s.classList.remove('focus')) 414 Array.from(suggestionsEle.children).forEach(s => s.classList.remove('focus'))
@@ -416,7 +419,6 @@ cm.on('keydown', (_, e) => {
416 currentSuggestion.onclick() 419 currentSuggestion.onclick()
417 break; 420 break;
418 case 'Escape': 421 case 'Escape':
419 const anchor = cm.getCursor()
420 suggestionsEle.style.display = 'none'; 422 suggestionsEle.style.display = 'none';
421 // Focus editor again 423 // Focus editor again
422 setTimeout(() => cm.focus() && cm.setCursor(anchor), 100) 424 setTimeout(() => cm.focus() && cm.setCursor(anchor), 100)