1. chrigu
  2. ADVANCED GUTENBERG
  3. Thursday, May 14 2020
  4.  Subscribe via email
Hi,

I use the Map Block a lot on one of my pages (https://bilder.tracks4africa.de/). I have now realized there is a problem with the block. I get the sometimes the information "The block contains unexpected or invalid content." This is only happened, when I move the marker by hand on the map, save the post and open the post again in the edit mode.

If I check the block in the editor, it looks like this.


<!-- wp:advgb/map {"mapID":"advgbmap-899b748e-e7fe-4130-b077-c40de2c91cd6","useLatLng":true,"address":"palmwag konzession","currentAddress":"Palmwag, Namibia","markerTitle":"Palmwag Konzession","markerDesc":"Damaraland - Namibia","changed":true} -->
<div class="wp-block-advgb-map advgb-map-block" style="margin:10px auto"><div class="advgb-map-content" id="advgbmap-899b748e-e7fe-4130-b077-c40de2c91cd6" style="height:350px" data-default="https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png" data-lat="-19.781478791710498" data-lng="13.76632294123537" data-zoom="14" data-title="Palmwag Konzession" data-desc="Damaraland - Namibia" data-shown="true" data-style=""></div></div>
<!-- /wp:advgb/map -->


To have a correct block, I need to add lat and lng in the parameter as well. Then it looks like:


<!-- wp:advgb/map {"mapID":"advgbmap-899b748e-e7fe-4130-b077-c40de2c91cd6","useLatLng":true,"address":"palmwag konzession","currentAddress":"Palmwag, Namibia","lat":"-19.781478791710498","lng":"13.76632294123537","markerTitle":"Palmwag Konzession","markerDesc":"Damaraland - Namibia","changed":true} -->
<div class="wp-block-advgb-map advgb-map-block" style="margin:10px auto"><div class="advgb-map-content" id="advgbmap-899b748e-e7fe-4130-b077-c40de2c91cd6" style="height:350px" data-default="https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png" data-lat="-19.781478791710498" data-lng="13.76632294123537" data-zoom="14" data-title="Palmwag Konzession" data-desc="Damaraland - Namibia" data-shown="true" data-style=""></div></div>
<!-- /wp:advgb/map -->


I hope you can fix this.

Thanks
Christoph
Responses (2)
Accepted AnswerPending Moderation
I could solve the problem. Just change the following lines in block.js at line 16842.

from:

marker.addListener('dragend', function () {
var newLocation = marker.getPosition();
var newLat = newLocation.lat();
var newLng = newLocation.lng();

that.props.setAttributes({ lat: newLat, lng: newLng });
});



to:

marker.addListener('dragend', function () {
var newLocation = marker.getPosition();
var newLat = newLocation.lat().toString();
var newLng = newLocation.lng().toString();

that.props.setAttributes({ lat: newLat, lng: newLng });
});



Kind regards
Christoph
Accepted AnswerPending Moderation
Hi,

Thanks for contacting us here about this extension.

Yes, thanks for your feedback, our developer will check this issue.

Thanks a lot!
Cheers,
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!