diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-25 23:46:30 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-26 00:31:21 +0800 |
commit | 2a2acc8e31aef538a8e68e6b53cacafb38841c26 (patch) | |
tree | 3e6101a4b7090b57342df9e31db4cb184b8e8116 /src/dumbymap.mjs | |
parent | 587ba9e22cdbc48f675e77ec6572520a0cd12a58 (diff) |
refactor: patch 1dd8064, remove classes for GeoLink/DocLink
Seems link content script don't accecpt custom element access its own
properties. This commit revert part of 1dd8064, generate GeoLink/DocLonk
by appending features onto existing anchor element
Diffstat (limited to 'src/dumbymap.mjs')
-rw-r--r-- | src/dumbymap.mjs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs index 3200a05..f1e971b 100644 --- a/src/dumbymap.mjs +++ b/src/dumbymap.mjs | |||
@@ -6,7 +6,7 @@ import MarkdownItInjectLinenumbers from 'markdown-it-inject-linenumbers' | |||
6 | import * as mapclay from 'mapclay' | 6 | import * as mapclay from 'mapclay' |
7 | import { onRemove, animateRectTransition, throttle, debounce, shiftByWindow } from './utils' | 7 | import { onRemove, animateRectTransition, throttle, debounce, shiftByWindow } from './utils' |
8 | import { Layout, SideBySide, Overlay, Sticky } from './Layout' | 8 | import { Layout, SideBySide, Overlay, Sticky } from './Layout' |
9 | import { GeoLink, DocLink } from './Link.mjs' | 9 | import { GeoLink, DocLink, getMarkersFromMaps } from './Link.mjs' |
10 | import * as utils from './dumbyUtils' | 10 | import * as utils from './dumbyUtils' |
11 | import * as menuItem from './MenuItem' | 11 | import * as menuItem from './MenuItem' |
12 | import PlainModal from 'plain-modal' | 12 | import PlainModal from 'plain-modal' |
@@ -246,9 +246,9 @@ export const generateMaps = (container, { | |||
246 | 246 | ||
247 | // Add GeoLinks/DocLinks by pattern | 247 | // Add GeoLinks/DocLinks by pattern |
248 | target.querySelectorAll(geoLinkSelector) | 248 | target.querySelectorAll(geoLinkSelector) |
249 | .forEach(GeoLink.replaceWith) | 249 | .forEach(GeoLink) |
250 | target.querySelectorAll(docLinkSelector) | 250 | target.querySelectorAll(docLinkSelector) |
251 | .forEach(DocLink.replaceWith) | 251 | .forEach(DocLink) |
252 | 252 | ||
253 | // Add GeoLinks from text nodes | 253 | // Add GeoLinks from text nodes |
254 | // const addedNodes = Array.from(mutation.addedNodes) | 254 | // const addedNodes = Array.from(mutation.addedNodes) |
@@ -319,7 +319,7 @@ export const generateMaps = (container, { | |||
319 | values.at(-1) | 319 | values.at(-1) |
320 | .map(utils.setGeoSchemeByCRS(crsString)) | 320 | .map(utils.setGeoSchemeByCRS(crsString)) |
321 | .filter(link => link) | 321 | .filter(link => link) |
322 | .forEach(GeoLink.replaceWith) | 322 | .forEach(GeoLink) |
323 | }) | 323 | }) |
324 | } | 324 | } |
325 | 325 | ||
@@ -557,7 +557,7 @@ export const generateMaps = (container, { | |||
557 | menu.appendChild(new menuItem.Item({ | 557 | menu.appendChild(new menuItem.Item({ |
558 | text: 'Delete', | 558 | text: 'Delete', |
559 | onclick: () => { | 559 | onclick: () => { |
560 | geoLink.getMarkersFromMaps() | 560 | getMarkersFromMaps(geoLink) |
561 | .forEach(m => m.remove()) | 561 | .forEach(m => m.remove()) |
562 | geoLink.replaceWith( | 562 | geoLink.replaceWith( |
563 | document.createTextNode(geoLink.textContent), | 563 | document.createTextNode(geoLink.textContent), |