diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-23 12:45:40 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-23 16:50:30 +0800 |
commit | 24c4fe6d2fa8c1824129535502d4f619fcf0f912 (patch) | |
tree | cfec74036861ca3e63e6c50ca9e36abdb463895e /src/dumbyUtils.mjs | |
parent | 1e1ad1a1f8dc738d1f716646ceed30174ee76331 (diff) |
refactor: set observers for charactorData/childList separately
* this patches e774e55, make code easier to understanded
* use data attribute to initialize content in container
* add limitation on method replaceNode(), to prevent GeoLinks generated
in pre/code/a element
Diffstat (limited to 'src/dumbyUtils.mjs')
-rw-r--r-- | src/dumbyUtils.mjs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dumbyUtils.mjs b/src/dumbyUtils.mjs index 409fe93..23461ce 100644 --- a/src/dumbyUtils.mjs +++ b/src/dumbyUtils.mjs | |||
@@ -439,11 +439,11 @@ export const dragForAnchor = (container, range, endOfLeaderLine) => { | |||
439 | } | 439 | } |
440 | } | 440 | } |
441 | 441 | ||
442 | export const addGeoSchemeByText = async (element) => { | 442 | export const addGeoSchemeByText = async (node) => { |
443 | const coordPatterns = /(-?\d+\.?\d*)([,\x2F\uFF0C])(-?\d+\.?\d*)/ | 443 | const coordPatterns = /(-?\d+\.?\d*)([,\x2F\uFF0C])(-?\d+\.?\d*)/ |
444 | const re = new RegExp(coordPatterns, 'g') | 444 | const re = new RegExp(coordPatterns, 'g') |
445 | 445 | ||
446 | return replaceTextNodes(element, re, match => { | 446 | return replaceTextNodes(node, re, match => { |
447 | const [x, y] = [match.at(1), match.at(3)] | 447 | const [x, y] = [match.at(1), match.at(3)] |
448 | // Don't process string which can be used as date | 448 | // Don't process string which can be used as date |
449 | if (Date.parse(match.at(0) + ' 1990')) return null | 449 | if (Date.parse(match.at(0) + ' 1990')) return null |