Temp work around of safari map load bug

This commit is contained in:
Mitchell McCaffrey 2020-04-30 14:24:26 +10:00
parent d066b262fa
commit 87952491f0

View File

@ -119,6 +119,8 @@ function SelectMapModal({
let fileGridY = defaultMapSize;
let name = "Unknown Map";
if (file.name) {
// TODO: match all not supported on safari, find alternative
if (file.name.matchAll) {
// Match against a regex to find the grid size in the file name
// e.g. Cave 22x23 will return [["22x22", "22", "x", "23"]]
const gridMatches = [...file.name.matchAll(/(\d+) ?(x|X) ?(\d+)/g)];
@ -131,6 +133,8 @@ function SelectMapModal({
fileGridY = matchY;
}
}
}
// Remove file extension
name = file.name.replace(/\.[^/.]+$/, "");
// Removed grid size expression