diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-08 10:27:47 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-08 10:28:47 +0800 |
| commit | 2caa6eba91f9c810bda3087d521771b0b9e013f2 (patch) | |
| tree | ddad329501aab61c0f692423cf1f4b53a23c033b /src | |
| parent | b761821e1ad50b42c92e1bbb7926bed3f3195fac (diff) | |
fix: only show "More" with renderer suggestions in menu
Diffstat (limited to 'src')
| -rw-r--r-- | src/editor.mjs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/editor.mjs b/src/editor.mjs index 29e7052..d75d1ec 100644 --- a/src/editor.mjs +++ b/src/editor.mjs | |||
| @@ -193,7 +193,6 @@ const editor = new EasyMDE({ | |||
| 193 | 193 | ||
| 194 | const cm = editor.codemirror | 194 | const cm = editor.codemirror |
| 195 | 195 | ||
| 196 | |||
| 197 | const getRefLinks = () => editor.value() | 196 | const getRefLinks = () => editor.value() |
| 198 | .split('\n') | 197 | .split('\n') |
| 199 | .map(line => { | 198 | .map(line => { |
| @@ -779,13 +778,13 @@ const getSuggestions = anchor => { | |||
| 779 | return rendererSuggestions.length === 0 | 778 | return rendererSuggestions.length === 0 |
| 780 | ? [] | 779 | ? [] |
| 781 | : [ | 780 | : [ |
| 782 | ...rendererSuggestions, | 781 | ...rendererSuggestions, |
| 783 | new menuItem.Item({ | 782 | new menuItem.Item({ |
| 784 | innerHTML: '<a href="https://github.com/outdoorsafetylab/mapclay#renderer" class="external" style="display: block;">More...</a>', | 783 | innerHTML: '<a href="https://github.com/outdoorsafetylab/mapclay#renderer" class="external" style="display: block;">More...</a>', |
| 785 | className: ['suggestion'], | 784 | className: ['suggestion'], |
| 786 | onclick: () => window.open('https://github.com/outdoorsafetylab/mapclay#renderer', '_blank') | 785 | onclick: () => window.open('https://github.com/outdoorsafetylab/mapclay#renderer', '_blank') |
| 787 | }) | 786 | }) |
| 788 | ] | 787 | ] |
| 789 | } | 788 | } |
| 790 | return [] | 789 | return [] |
| 791 | } | 790 | } |
| @@ -940,7 +939,7 @@ const addMapRandomlyByPreset = () => { | |||
| 940 | const yamlText = [ | 939 | const yamlText = [ |
| 941 | 'apply: dist/default.yml', | 940 | 'apply: dist/default.yml', |
| 942 | 'width: 85%', | 941 | 'width: 85%', |
| 943 | 'height: 200px', | 942 | 'height: 200px' |
| 944 | ] | 943 | ] |
| 945 | const order = [ | 944 | const order = [ |
| 946 | 'id', | 945 | 'id', |
| @@ -954,8 +953,8 @@ const addMapRandomlyByPreset = () => { | |||
| 954 | ] | 953 | ] |
| 955 | const aliasesEntries = Object.entries(aliasesForMapOptions) | 954 | const aliasesEntries = Object.entries(aliasesForMapOptions) |
| 956 | .filter(([key, _]) => | 955 | .filter(([key, _]) => |
| 957 | order.includes(key) | 956 | order.includes(key) && |
| 958 | && !yamlText.find(text => text.startsWith(key)) | 957 | !yamlText.find(text => text.startsWith(key)) |
| 959 | ) | 958 | ) |
| 960 | if (aliasesEntries.length === 0) return | 959 | if (aliasesEntries.length === 0) return |
| 961 | 960 | ||