Try our conversational search powered by Generative AI!

Adding the GoogleMapsEditor not working

Vote:
 

I'm having issues adding the GoogleMapsEditor https://nuget.episerver.com/package?id=EPiServer.GoogleMapsEditor

I have a local block

public class CoordinatesBlock : SiteBlockData, IGoogleMapsCoordinates
    {
        public virtual double Longitude { get; set; }
        public virtual double Latitude { get; set; }
    }

If I understand it correctly the editor should automatically be added to propertyes having a type inheriting from this class so this would work?

[Display(GroupName = SystemTabNames.Content, Order = 900)]
        public virtual CoordinatesBlock Coordinates { get; set; }

However it doesn't. In the editor mode the block is added with just two basic input fields like a regular block.

Adding either of these attributes result in the same behaviour:

 [UIHint(GoogleMapsEditorDescriptor.UIHint)]
        [Display(GroupName = SystemTabNames.Content, Order = 900)]
        public virtual CoordinatesBlock Coordinates { get; set; }

//Or my custom editordescriptor available in the 1.0.12 update to set our own api-key
 [UIHint(CustomGoogleMapsEditorDescriptor.UIHint)]
        [Display(GroupName = SystemTabNames.Content, Order = 900)]
        public virtual CoordinatesBlock Coordinates { get; set; }

But, adding this attribute result in an error in edit mode stating that /EPiServer/Shell/11.17.0/ClientResources/googlemapseditor/Editor.js is not found

[ClientEditor(ClientEditingClass = "googlemapseditor/Editor")]
        [Display(GroupName = SystemTabNames.Content, Order = 900)]
        public virtual CoordinatesBlock Coordinates { get; set; }

What is the correct way to get this to work? TargetFramework 4.6.2, Epi version 11.11.3

#202954
Apr 04, 2019 13:54
Vote:
 

Hmm, it should work with Episerver 11 and we use it and it works.
When it says that it can not find the file I would look and see that the files below modules/_protected for it has been included and then try to reinstall it:
update-package Episerver.GoogleMapsEditor -reinstall

But I see now that we do not use it that way. We use it like this:

[ClientEditor(ClientEditingClass = "googlemapseditor/Editor")]
[Display(GroupName = SystemTabNames.Content, Order = 1040)]
public virtual CoordinatesBlock Location { get; set; }

So the last example you show should be correct.

Maybe @ted could help

#202985
Edited, Apr 05, 2019 7:43
Vote:
 

Looking in the modules/_protected folder it seems correct:

And we have other addons like DBLocalizationProvider, Geta.Epi.FontThumbnail installed and working. 

Tried reinstalling it with same issue

Comparing with AlloyDemoKit (web.config settings etc.) I see no difference

#203037
Edited, Apr 08, 2019 10:35
Vote:
 

Make sure you dump references of the old way for referring to this Nuget and download the latest and make sure you register the API-key for your Google API as Ted describes below:

https://tedgustaf.com/blog/2018/episerver-google-maps-editor-update/

Hopefulle this will resolve your issues

#203041
Apr 08, 2019 11:58
Vote:
 

What do you mean by dumping references of the old way? I just installed this addon to the project and haven't had any old version of it in the project before. I have also created a custom descriptor for it with our own apikey (not listed below ;) )

 [EditorDescriptorRegistration(TargetType = typeof(IGoogleMapsCoordinates), UIHint = UIHint, EditorDescriptorBehavior = EditorDescriptorBehavior.OverrideDefault)]
    [EditorDescriptorRegistration(TargetType = typeof(string), UIHint = UIHint, EditorDescriptorBehavior = EditorDescriptorBehavior.OverrideDefault)]
    public class SiteGoogleMapsEditorDescriptor : GoogleMapsEditorDescriptorBase
    {
        public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            base.ModifyMetadata(metadata, attributes);

            // API key for the Google Maps JavaScript API
            metadata.EditorConfiguration["apiKey"] = "nnnnnnnnnnnnn";

            // Default zoom level from 1 (least) to 20 (most)
            metadata.EditorConfiguration["defaultZoom"] = 5;

            // Default coordinates when no property value is set
            metadata.EditorConfiguration["defaultCoordinates"] = new { latitude = 57.781958, longitude = 14.231367 };
        }
    }

 Regarding that editor update blog post I see Waldis has made a rather cryptic comment about it, wonder if it has anything to do with that code example being wrong or something that might cause this issue.

#203042
Edited, Apr 08, 2019 12:18
Vote:
 
#203048
Apr 08, 2019 13:49
Vote:
 

I just had the same issue, and had to manually add the editor to protectedModules in web.config:

<configuration>

...
<episerver.shell>

...
<protectedModules rootPath="...">

<add name="EPiServer.XForms" />
<add name="EPiServer.VisitorGroupsCriteriaPack" />
<add name="EPiServer.Cms.TinyMce" />
<add name="Geta.SEO.Sitemaps" />
<add name="Shell" />
<add name="CMS" />
<add name="Find">
...
<add name="TedGustaf.Episerver.GoogleMapsEditor" />

#224621
Jun 23, 2020 12:42
Vote:
 

Hi Tobias,

You could see the error in detail by adding the following tag  <clientResources debug="true" /> to your web.config inside the episerver.framework element.

After that, you can easily find the root cause of the problem.

I've got the same issue when trying to integrate this custom property to our customer website.

But I believe that your case is not as easy as mine.

So please share your browser console log after add "clientResources" as I mentioned to your web.config file.

I'm happy to investigate the issue.

Thanks, COVID! I've so much free time :D

#245930
Dec 21, 2020 17:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.