mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Allow data URI scheme for custom images (#1196)
* Allow data URL external images * fix * removed inconsistency
This commit is contained in:
parent
f859439fc8
commit
8131f25456
12 changed files with 32 additions and 32 deletions
|
|
@ -44,7 +44,7 @@ function editRegiment(selector) {
|
|||
function updateRegimentData(regiment) {
|
||||
byId("regimentType").className = regiment.n ? "icon-anchor" : "icon-users";
|
||||
byId("regimentName").value = regiment.name;
|
||||
byId("regimentEmblem").innerHTML = regiment.icon.startsWith("http")
|
||||
byId("regimentEmblem").innerHTML = regiment.icon.startsWith("http") || regiment.icon.startsWith("data:image")
|
||||
? `<img src="${regiment.icon}" style="width: 1em; height: 1em;">`
|
||||
: regiment.icon;
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ function editRegiment(selector) {
|
|||
|
||||
selectIcon(regiment.icon, value => {
|
||||
regiment.icon = value;
|
||||
const isExternal = value.startsWith("http");
|
||||
const isExternal = value.startsWith("http") || value.startsWith("data:image");
|
||||
byId("regimentEmblem").innerHTML = isExternal ? `<img src="${value}" style="width: 1em; height: 1em;">` : value;
|
||||
elSelected.querySelector(".regimentIcon").innerHTML = isExternal ? "" : value;
|
||||
elSelected.querySelector(".regimentImage").setAttribute("href", isExternal ? value : "");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue