cancel
Showing results for 
Search instead for 
Did you mean: 

Smart Edit Error when open pages

Hi All,

Recently I have configured a new store and smartedit is opening fine, but when I select any page, the loading endless animations is being presented, and the following messages are being displayed in browser console:

Missing SmartEdit attributes on body element of the storefront - SmartEdit will resume once the attributes are added

Do anyone has experienced this error? How do I can fix it?

Thank you, in advance,

Best Regards,

Rodrigo

phoude
Participant
0 Kudos

I have the same issue but no solution. Did you resolve it?

Accepted Solutions (0)

Answers (3)

Answers (3)

abderzakeboufeta
Explorer

I can only assume your storefront doesn't respect the SmartEdit contract.

Did you install the smarteditaddon that allows your storefront to respect that contract? Maybe you can have a look at the page Migrating Accelerator Storefront Versions to be Edited by SmartEdit

Cheers,

Abderzake

slawomir_feliks
Discoverer
0 Kudos

I am no expert in Spartacus, but i managed to fix this issue in my project.

In my project, Smartedit was loading fine when the starting page for Smartedit was homepage. The problem started when we introduced forced login (requiresAuthentication flag on BaseSite), so the starting page changed to login page. That resulted in 'Missing SmartEdit attributes on body element of the storefront - SmartEdit will resume once the attributes are added'.

Smartedit requires each component, content slot and whole html body element to have specific smartedit classes assigned. It is done in two places:

  • assigning classes to body starts in SmartEditService.processCmsPage, and finishes in calling SmartEditService.addSmartEditContract with body element
  • assigning classes to components and content slots is done in two decorators: SmartEditComponentDecorator and SmartEditSlotDecorator, both of them calls SmartEditService.addSmartEditContract for each component/content slot

Somehow, for homepage those decorators and processCmsPage method were invoked, but not for other pages.

Mine solution was to modify my project smart-edit-feature.module.ts file as follows:

  • i changed the definition of class SmartEditFeatureModule to
import {SmartEditService} from "@spartacus/smartedit/core";
...

export class SmartEditFeatureModule {
constructor(private smartEditService: SmartEditService) {
this.smartEditService.processCmsPage();
}
}
  • i attached smartedit decorators in SmartEditFeatureModule providers like this:
  providers: [
...smartEditDecorators,
provideConfig(<CmsConfig>{
...
}),
... ]

Here i had a problem with import - using 'import {smartEditDecorators} from "@spartacus/smartedit/core/decorators";' failed. I had to copy those decorators from source code into my project and use this import 'import {smartEditDecorators} from "./decorators";'.

serdar_dere_cs
Explorer
0 Kudos

What exactly is the solution for this problem?

It still appears on 2211 with Composable Storefront 6.0