diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4fa538..e5461bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: # https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/7.0/solution-level-output-no-longer-valid - name: Upload artifacts - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: nuget path: ${{ env.OUTPUT_PATH }} \ No newline at end of file diff --git a/Our.Umbraco.GMaps.Core/Composing/ServerVariablesParsingHandler.v9.cs b/Our.Umbraco.GMaps.Core/Composing/ServerVariablesParsingHandler.cs similarity index 100% rename from Our.Umbraco.GMaps.Core/Composing/ServerVariablesParsingHandler.v9.cs rename to Our.Umbraco.GMaps.Core/Composing/ServerVariablesParsingHandler.cs diff --git a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMap.cs b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMap.cs index b24fed7..d315da9 100644 --- a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMap.cs +++ b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMap.cs @@ -9,12 +9,12 @@ internal class LegacyMap [DataMember(Name = "address")] [JsonProperty("address")] [JsonPropertyName("address")] - internal LegacyAddress Address { get; set; } + public LegacyAddress Address { get; set; } [DataMember(Name = "mapconfig")] [JsonProperty("mapconfig")] [JsonPropertyName("mapconfig")] - internal LegacyMapConfig MapConfig { get; set; } + public LegacyMapConfig MapConfig { get; set; } } } \ No newline at end of file diff --git a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs index 4fb2c53..d59ba2b 100644 --- a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs +++ b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs @@ -9,8 +9,47 @@ internal class LegacyMapConfig : MapConfig [JsonPropertyName("mapcenter")] public string MapCenter { get; set; } + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public new string Zoom { get; set; } + [JsonProperty("zoom")] [JsonPropertyName("zoom")] - public new string Zoom { get; set; } + public object _zoom + { + get + { + if (int.TryParse(Zoom, out var intValue)) return intValue; + return this.Zoom; + } + set { this.Zoom = value.ToString(); } + } + + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public new MapType MapType { get; set; } + + [JsonProperty("maptype")] + [JsonPropertyName("maptype")] + public new object _mapType + { + get + { + return this.MapType; + //return base.MapType?.ToString().ToLower(); + } + set { + this.MapType = value switch + { + "roadmap" => Models.MapType.Roadmap, + "satellite" => Models.MapType.Satellite, + "hybrid" => Models.MapType.Hybrid, + "terrain" => Models.MapType.Terrain, + "styled_map" => Models.MapType.StyledMap, + "styled map" => Models.MapType.StyledMap, + _ => Models.MapType.Roadmap, + }; + } + } } } diff --git a/Our.Umbraco.GMaps.Core/Models/MapType.cs b/Our.Umbraco.GMaps.Core/Models/MapType.cs index aa857ae..52ce667 100644 --- a/Our.Umbraco.GMaps.Core/Models/MapType.cs +++ b/Our.Umbraco.GMaps.Core/Models/MapType.cs @@ -16,6 +16,6 @@ public enum MapType [EnumMember(Value = "terrain")] Terrain, [EnumMember(Value = "styled_map")] - StyledMap + StyledMap } } \ No newline at end of file diff --git a/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj b/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj index 5418126..3aced0c 100644 --- a/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj +++ b/Our.Umbraco.GMaps.Core/Our.Umbraco.GMaps.Core.csproj @@ -1,9 +1,9 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 True - 3.0.2 + 3.0.3 Arnold Visser Arnold Visser Basic Google Maps with autocomplete property editor for Umbraco 8+. This package contains the Core DLL only. diff --git a/Our.Umbraco.GMaps.Core/PropertyValueConverter/SingleMapPropertyValueConverter.cs b/Our.Umbraco.GMaps.Core/PropertyValueConverter/SingleMapPropertyValueConverter.cs index 557d739..617701d 100644 --- a/Our.Umbraco.GMaps.Core/PropertyValueConverter/SingleMapPropertyValueConverter.cs +++ b/Our.Umbraco.GMaps.Core/PropertyValueConverter/SingleMapPropertyValueConverter.cs @@ -54,6 +54,10 @@ public override object ConvertIntermediateToObject(IPublishedElement owner, IPub { model.MapConfig.Zoom = string.IsNullOrEmpty(intermediate.MapConfig.Zoom) ? 17 : Convert.ToInt32(intermediate.MapConfig.Zoom); } + if (model.MapConfig.MapType == null) + { + model.MapConfig.MapType = intermediate.MapConfig.MapType; + } } else { diff --git a/Our.Umbraco.GMaps.UmbracoV13/Our.Umbraco.GMaps.UmbracoV13.csproj b/Our.Umbraco.GMaps.UmbracoV13/Our.Umbraco.GMaps.UmbracoV13.csproj index 0f6dede..b0feb70 100644 --- a/Our.Umbraco.GMaps.UmbracoV13/Our.Umbraco.GMaps.UmbracoV13.csproj +++ b/Our.Umbraco.GMaps.UmbracoV13/Our.Umbraco.GMaps.UmbracoV13.csproj @@ -6,7 +6,7 @@ - + diff --git a/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj b/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj index 8397596..4db4aa0 100644 --- a/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj +++ b/Our.Umbraco.GMaps/Our.Umbraco.GMaps.csproj @@ -1,13 +1,13 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 App_Plugins/Our.Umbraco.GMaps true . false true - 3.0.2 + 3.0.3 Arnold Visser Arnold Visser Basic Google Maps with autocomplete property editor for Umbraco 8+ diff --git a/Our.Umbraco.GMaps/wwwroot/js/maps.controller.js b/Our.Umbraco.GMaps/wwwroot/js/maps.controller.js index 1b51f9d..00c3032 100644 --- a/Our.Umbraco.GMaps/wwwroot/js/maps.controller.js +++ b/Our.Umbraco.GMaps/wwwroot/js/maps.controller.js @@ -260,6 +260,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element var mapOptions = { zoom: vm.zoomLevel, + mapId: 'DEMO_MAP_ID', center: latLngMapCenter, streetViewControl: false, // Fix for #15 gestureHandling: 'cooperative', @@ -281,7 +282,7 @@ angular.module('umbraco').controller('GMapsMapsController', ['$scope', '$element vm.map.setMapTypeId(mapTypeId) - vm.marker = new google.maps.Marker({ + vm.marker = new google.maps.marker.AdvancedMarkerElement({ position: latLng, title: 'Marker', map: vm.map, diff --git a/Our.Umbraco.GMaps/wwwroot/js/maps.factory.js b/Our.Umbraco.GMaps/wwwroot/js/maps.factory.js index 9d5ab7a..5627ef0 100644 --- a/Our.Umbraco.GMaps/wwwroot/js/maps.factory.js +++ b/Our.Umbraco.GMaps/wwwroot/js/maps.factory.js @@ -10,7 +10,7 @@ return { initialize: function (apiKey) { - var url = 'https://maps.googleapis.com/maps/api/js?key=' + apiKey + '&libraries=places&callback=googleMapsInitialized'; + var url = 'https://maps.googleapis.com/maps/api/js?key=' + apiKey + '&libraries=places&libraries=marker&callback=googleMapsInitialized&v=weekly'; if (!scriptExists(url)) { var script = document.createElement('script'); script.async = true;