forked from MapComplete/MapComplete
refactoring: move logic of lastclick into special layer, fix labels, fix anchoring
This commit is contained in:
parent
25a98af057
commit
52a0810ea9
47 changed files with 682 additions and 197 deletions
|
|
@ -5,6 +5,7 @@ import metapaths from "../../../assets/layoutconfigmeta.json"
|
|||
import tagrenderingmetapaths from "../../../assets/questionabletagrenderingconfigmeta.json"
|
||||
import Translations from "../../../UI/i18n/Translations"
|
||||
|
||||
import { parse as parse_html } from "node-html-parser"
|
||||
export class ExtractImages extends Conversion<
|
||||
LayoutConfigJson,
|
||||
{ path: string; context: string }[]
|
||||
|
|
@ -190,6 +191,17 @@ export class ExtractImages extends Conversion<
|
|||
const cleanedImages: { path: string; context: string }[] = []
|
||||
|
||||
for (const foundImage of allFoundImages) {
|
||||
if (foundImage.path.startsWith("<") && foundImage.path.endsWith(">")) {
|
||||
// These is probably html - we ignore
|
||||
const doc = parse_html(foundImage.path)
|
||||
const images = Array.from(doc.getElementsByTagName("img"))
|
||||
const paths = images.map((i) => i.getAttribute("src"))
|
||||
cleanedImages.push(
|
||||
...paths.map((path) => ({ path, context: foundImage.context + " (in html)" }))
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
||||
// Split "circle:white;./assets/layers/.../something.svg" into ["circle", "./assets/layers/.../something.svg"]
|
||||
const allPaths = Utils.NoNull(
|
||||
Utils.NoEmpty(foundImage.path?.split(";")?.map((part) => part.split(":")[0]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue