diff --git a/README.md b/README.md index d1e85af..5499b45 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,9 @@ You can access your browser API key in templates using `craft.simpleMap.apiKey`. ## Changelog +### 1.2.4 +- The address input automatically updates the map after paste + ### 1.2.3 - Browser API key can now be accessed in templates diff --git a/SimpleMapPlugin.php b/SimpleMapPlugin.php index f46459f..e00ea89 100644 --- a/SimpleMapPlugin.php +++ b/SimpleMapPlugin.php @@ -24,7 +24,7 @@ public function getDescription() public function getVersion() { - return '1.2.3'; + return '1.2.4'; } public function getSchemaVersion() diff --git a/releases.json b/releases.json index b57322a..c38e0fe 100644 --- a/releases.json +++ b/releases.json @@ -84,5 +84,13 @@ "notes": [ "- Browser API key can now be accessed in templates" ] + }, + { + "version": "1.2.4", + "downloadUrl": "https://github.com/ethercreative/SimpleMap/archive/v1.2.4.zip", + "date": "2016-08-09T10:00:00-08:00", + "notes": [ + "[Improved] The address input automatically updates the map after paste" + ] } ] \ No newline at end of file diff --git a/resources/SimpleMap_Map.js b/resources/SimpleMap_Map.js index 58fa9be..45e0f0b 100644 --- a/resources/SimpleMap_Map.js +++ b/resources/SimpleMap_Map.js @@ -116,6 +116,13 @@ SimpleMap.prototype.setupMap = function () { autocomplete.map = this.map; autocomplete.bindTo('bounds', this.map); + // Update map on paste + this.address.addEventListener('paste', function () { + setTimeout(function () { + google.maps.event.trigger(autocomplete, 'place_changed'); + }, 1); + }); + this.address.addEventListener('input', function () { if (this.value === '') self.clear(); }); @@ -159,7 +166,7 @@ SimpleMap.prototype.setupMap = function () { // If we have a place var place = this.getPlace(); - if (place.geometry) { + if (place && place.geometry) { lat = place.geometry.location.lat(); lng = place.geometry.location.lng();