diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-07 16:12:11 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-08 10:28:47 +0800 |
| commit | d1dcafa87ed1621e3fc2b264818a2966b40231ae (patch) | |
| tree | fceeaf754ff83d4da10ce6d926f411bb32fb869b /src | |
| parent | d407f526ab63eb631d14c5fe74c36db5a0cf202e (diff) | |
style: code reformat
Diffstat (limited to 'src')
| -rw-r--r-- | src/css/dumbymap.css | 2 | ||||
| -rw-r--r-- | src/editor.mjs | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/css/dumbymap.css b/src/css/dumbymap.css index 7a4d3e7..d9a7791 100644 --- a/src/css/dumbymap.css +++ b/src/css/dumbymap.css | |||
| @@ -54,8 +54,8 @@ a[href^='http']:not(:has(img))::after, | |||
| 54 | display: inline-block; | 54 | display: inline-block; |
| 55 | width: 8px; | 55 | width: 8px; |
| 56 | height: 8px; | 56 | height: 8px; |
| 57 | margin-left: 2px; | ||
| 58 | margin-right: 4px; | 57 | margin-right: 4px; |
| 58 | margin-left: 2px; | ||
| 59 | 59 | ||
| 60 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E"); | 60 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E"); |
| 61 | background-position: center; | 61 | background-position: center; |
diff --git a/src/editor.mjs b/src/editor.mjs index 71e66be..02df642 100644 --- a/src/editor.mjs +++ b/src/editor.mjs | |||
| @@ -4,7 +4,6 @@ import { markdown2HTML, generateMaps } from './dumbymap' | |||
| 4 | import { defaultAliases, parseConfigsFromYaml } from 'mapclay' | 4 | import { defaultAliases, parseConfigsFromYaml } from 'mapclay' |
| 5 | import * as menuItem from './MenuItem' | 5 | import * as menuItem from './MenuItem' |
| 6 | import { shiftByWindow } from './utils.mjs' | 6 | import { shiftByWindow } from './utils.mjs' |
| 7 | import { Item } from './MenuItem.mjs' | ||
| 8 | 7 | ||
| 9 | // Set up Containers {{{ | 8 | // Set up Containers {{{ |
| 10 | 9 | ||
| @@ -407,7 +406,7 @@ const completeForCodeBlock = change => { | |||
| 407 | */ | 406 | */ |
| 408 | const menuForEditor = (event, menu) => { | 407 | const menuForEditor = (event, menu) => { |
| 409 | if (context.dataset.mode !== 'editing') { | 408 | if (context.dataset.mode !== 'editing') { |
| 410 | const switchToEditingMode = new Item({ | 409 | const switchToEditingMode = new menuItem.Item({ |
| 411 | innerHTML: '<strong>EDIT</strong>', | 410 | innerHTML: '<strong>EDIT</strong>', |
| 412 | onclick: () => context.dataset.mode = 'editing' | 411 | onclick: () => context.dataset.mode = 'editing' |
| 413 | }) | 412 | }) |
| @@ -416,7 +415,7 @@ const menuForEditor = (event, menu) => { | |||
| 416 | 415 | ||
| 417 | const map = dumbyContainer.querySelector('#' + menu.dataset.map) | 416 | const map = dumbyContainer.querySelector('#' + menu.dataset.map) |
| 418 | if (map) { | 417 | if (map) { |
| 419 | const item = new Item({ | 418 | const item = new menuItem.Item({ |
| 420 | text: 'Add Anchor for GeoLinks', | 419 | text: 'Add Anchor for GeoLinks', |
| 421 | onclick: () => { | 420 | onclick: () => { |
| 422 | const rect = map.getBoundingClientRect() | 421 | const rect = map.getBoundingClientRect() |
| @@ -432,7 +431,7 @@ const menuForEditor = (event, menu) => { | |||
| 432 | anchorName = window.prompt(prompt, `${x}, ${y}`) | 431 | anchorName = window.prompt(prompt, `${x}, ${y}`) |
| 433 | link = `geo:${y},${x}?xy=${x},${y}&id=${map.id} "${anchorName}"` | 432 | link = `geo:${y},${x}?xy=${x},${y}&id=${map.id} "${anchorName}"` |
| 434 | } | 433 | } |
| 435 | while (refLinks.find(({ref}) => ref === anchorName)) | 434 | while (refLinks.find(({ ref }) => ref === anchorName)) |
| 436 | 435 | ||
| 437 | const lastLineIsRefLink = cm.getLine(cm.lastLine()).match(refLinkPattern) | 436 | const lastLineIsRefLink = cm.getLine(cm.lastLine()).match(refLinkPattern) |
| 438 | cm.replaceRange( | 437 | cm.replaceRange( |