cancel
Showing results for 
Search instead for 
Did you mean: 

Error while trying to edit nested component via SmartEdit

Former Member
0 Kudos

Hi there, The problem is that I get an error in the browser console, while trying to open nested component:

"TypeError: Cannot read property 'toLowerCase' of undefined"

It happens because in function editComponent (which is in cmsItemDropdown.js) itemToEdit.typeCode is undefiened. But why and when it should be set up I can't figure out. If anybody have faced with such problem and could help - I'd really appreciate your help! Thanks in advance!

Former Member
0 Kudos

Have you found the root cause of it?

Former Member
0 Kudos

Yes! Here I described the root cause and how to fix it. https://dmitrykrivenko.blogspot.com/2018/08/override-smartedit-service.html

Former Member
0 Kudos

Thanks . It was helpful.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I've found the root cause and fixed it. The problem in the file: web/features/cmssmarteditContainer/components/cmsComponents/cmsItemDropdown/services/nestedComponentManagementService.js. In componentInfo object field .componentType represents deprecated typeCode, which presents only in cms components, that extend AbstractCMSComponent , but not CMSItemComponent. To fix it I've overiden original service nestedComponentManagementService:

 angular.module('overridenNestedComponentManagementServiceModule', [...])  
    .service('nestedComponentManagementService', function(...) {  
     ... 
      var prepareComponentData = function(...) {  
        var componentType = componentInfo.componentType || componentInfo.content.itemtype;  
        ...
        return {  
          ...  
          componentType: componentType,  
          ...  
          ...                      {  
            typeCode: componentType,  
            itemtype: componentType,  
            ...
          }, ...),    
        };  
      };  
     ...
    });  

More details in my blog:

Answers (0)