mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
v1.5.73 - better: remove sodipodi and inkscape attributes on load
This commit is contained in:
parent
fb4cf38bad
commit
b256030602
2 changed files with 21 additions and 5 deletions
|
|
@ -42,9 +42,7 @@
|
|||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape">
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<g id="filters">
|
||||
<filter id="blurFilter" x="-1" y="-1" width="100" height="100">
|
||||
|
|
|
|||
|
|
@ -238,8 +238,26 @@ function editEmblem(type, id, el) {
|
|||
const svg = `<svg id="${id}" xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><image x="0" y="0" width="200" height="200" href="${result}"/></svg>`;
|
||||
defs.insertAdjacentHTML("beforeend", svg);
|
||||
} else {
|
||||
defs.insertAdjacentHTML("beforeend", result);
|
||||
const newEmblem = defs.lastChild; // new coa
|
||||
|
||||
const el = document.createElement("html");
|
||||
el.innerHTML = result;
|
||||
|
||||
// remove sodipodi and inkscape attributes
|
||||
el.querySelectorAll("*").forEach(el => {
|
||||
const attributes = el.getAttributeNames();
|
||||
attributes.forEach(attr => {
|
||||
if (attr.includes("inkscape") || attr.includes("sodipodi")) el.removeAttribute(attr);
|
||||
});
|
||||
});
|
||||
|
||||
const g = el.querySelector("g");
|
||||
|
||||
if (!g) {
|
||||
tip("The file should be prepated for load to FMG. Please use Armoria or other relevant tools", false, "error");
|
||||
return;
|
||||
}
|
||||
|
||||
const newEmblem = defs.appendChild(g);
|
||||
newEmblem.id = id;
|
||||
newEmblem.setAttribute("width", 200);
|
||||
newEmblem.setAttribute("height", 200);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue