diff options
Diffstat (limited to 'src/editor.mjs')
-rw-r--r-- | src/editor.mjs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/editor.mjs b/src/editor.mjs index f6c7dab..a8e3e0d 100644 --- a/src/editor.mjs +++ b/src/editor.mjs | |||
@@ -9,9 +9,9 @@ import * as tutorial from './tutorial' | |||
9 | 9 | ||
10 | /** | 10 | /** |
11 | * @typedef {Object} RefLink | 11 | * @typedef {Object} RefLink |
12 | * @property {string} ref -- name of link | 12 | * @property {string} ref - name of link |
13 | * @property {string} link -- content of link | 13 | * @property {string} link - content of link |
14 | * @property {string|null} title -- title of link | 14 | * @property {string|null} title - title of link |
15 | */ | 15 | */ |
16 | 16 | ||
17 | // Set up Containers {{{ | 17 | // Set up Containers {{{ |
@@ -291,6 +291,7 @@ const updateScrollLine = (ele) => () => { | |||
291 | } | 291 | } |
292 | } | 292 | } |
293 | 293 | ||
294 | /** sync scroll from HTML to CodeMirror */ | ||
294 | new window.MutationObserver(() => { | 295 | new window.MutationObserver(() => { |
295 | clearTimeout(dumbyContainer.timer) | 296 | clearTimeout(dumbyContainer.timer) |
296 | dumbyContainer.timer = setTimeout( | 297 | dumbyContainer.timer = setTimeout( |
@@ -377,7 +378,7 @@ addClassToCodeLines() | |||
377 | /** | 378 | /** |
378 | * completeForCodeBlock. | 379 | * completeForCodeBlock. |
379 | * | 380 | * |
380 | * @param {Object} change -- codemirror change object | 381 | * @param {Object} change - codemirror change object |
381 | */ | 382 | */ |
382 | const completeForCodeBlock = change => { | 383 | const completeForCodeBlock = change => { |
383 | const line = change.to.line | 384 | const line = change.to.line |
@@ -436,8 +437,8 @@ const completeForCodeBlock = change => { | |||
436 | /** | 437 | /** |
437 | * menuForEditor. | 438 | * menuForEditor. |
438 | * | 439 | * |
439 | * @param {Event} event -- Event for context menu | 440 | * @param {Event} event - Event for context menu |
440 | * @param {HTMLElement} menu -- menu of dumbymap | 441 | * @param {HTMLElement} menu - menu of dumbymap |
441 | */ | 442 | */ |
442 | const menuForEditor = (event, menu) => { | 443 | const menuForEditor = (event, menu) => { |
443 | event.preventDefault() | 444 | event.preventDefault() |
@@ -583,7 +584,7 @@ const insideCodeblockForMap = anchor => { | |||
583 | /** | 584 | /** |
584 | * getLineWithRenderer. Get Renderer by cursor position in code block {{{ | 585 | * getLineWithRenderer. Get Renderer by cursor position in code block {{{ |
585 | * | 586 | * |
586 | * @param {Object} anchor -- Codemirror Anchor Object | 587 | * @param {Object} anchor - Codemirror Anchor Object |
587 | */ | 588 | */ |
588 | const getLineWithRenderer = anchor => { | 589 | const getLineWithRenderer = anchor => { |
589 | const currentLine = anchor.line | 590 | const currentLine = anchor.line |
@@ -686,7 +687,7 @@ const getSuggestionsFromAliases = option => | |||
686 | /** | 687 | /** |
687 | * handleTypingInCodeBlock. Handler for map codeblock {{{ | 688 | * handleTypingInCodeBlock. Handler for map codeblock {{{ |
688 | * | 689 | * |
689 | * @param {Object} anchor -- Codemirror Anchor Object | 690 | * @param {Object} anchor - Codemirror Anchor Object |
690 | */ | 691 | */ |
691 | const handleTypingInCodeBlock = anchor => { | 692 | const handleTypingInCodeBlock = anchor => { |
692 | const text = cm.getLine(anchor.line) | 693 | const text = cm.getLine(anchor.line) |
@@ -703,7 +704,7 @@ const handleTypingInCodeBlock = anchor => { | |||
703 | /** | 704 | /** |
704 | * getSuggestions. Get suggestions by current input {{{ | 705 | * getSuggestions. Get suggestions by current input {{{ |
705 | * | 706 | * |
706 | * @param {Object} anchor -- Codemirror Anchor Object | 707 | * @param {Object} anchor - Codemirror Anchor Object |
707 | */ | 708 | */ |
708 | const getSuggestions = anchor => { | 709 | const getSuggestions = anchor => { |
709 | const text = cm.getLine(anchor.line) | 710 | const text = cm.getLine(anchor.line) |
@@ -823,7 +824,7 @@ const getSuggestions = anchor => { | |||
823 | /** | 824 | /** |
824 | * addSuggestions. Show element about suggestions {{{ | 825 | * addSuggestions. Show element about suggestions {{{ |
825 | * | 826 | * |
826 | * @param {Object} anchor -- Codemirror Anchor Object | 827 | * @param {Object} anchor - Codemirror Anchor Object |
827 | * @param {Suggestion[]} suggestions | 828 | * @param {Suggestion[]} suggestions |
828 | */ | 829 | */ |
829 | const addSuggestions = (anchor, suggestions) => { | 830 | const addSuggestions = (anchor, suggestions) => { |
@@ -1102,6 +1103,8 @@ dumbyContainer.onmousedown = (e) => { | |||
1102 | lineEnd.style.left = event.clientX + 'px' | 1103 | lineEnd.style.left = event.clientX + 'px' |
1103 | lineEnd.style.top = event.clientY + 'px' | 1104 | lineEnd.style.top = event.clientY + 'px' |
1104 | line.position() | 1105 | line.position() |
1106 | |||
1107 | // TODO Scroll dumbymap.htmlHolder when cursor is at upper/lower side | ||
1105 | } | 1108 | } |
1106 | 1109 | ||
1107 | context.classList.add('dragging-geolink') | 1110 | context.classList.add('dragging-geolink') |