on 2022 Sep 15 2:28 PM
I upgraded a SAP Hybris/Commerce from v1808 to v2205. In my custom SmartEdit-Extension I had a service that changed the editor template for the number type so that it could hold a value of 0. (I used this tutorial for it: Tutorial
Here is the code of the Service I created
angular.module('newGenericEditorConfigurationServiceModule', ['editorFieldMappingServiceModule', 'newsmarteditContainerTemplates'])
.service('newGenericEditorConfigurationService', function(editorFieldMappingService) {
this.overrideDefaultEditorFieldMappings = function() {
editorFieldMappingService.addFieldMapping('Number', null, null, {
template: 'newNumberTemplate.html'
});
};
});
Now in v2205 Smartedit got upgraded from Angularjs to Angular and so the service is not working anymore.
Anyone has an idea how to do it? I already tried the code from here: Trail
import { SeEntryModule, EditorFieldMappingService, moduleUtils } from 'smarteditcommons';
. . . . . . ..
@NgModule({
imports: [BrowserModule, UpgradeModule],
declarations: [],
entryComponents: [],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: DummyInterceptor,
multi: true
},
moduleUtils.bootstrap(
(editorFieldMappingService: EditorFieldMappingService) => {
// Adds the mapping. With this the new widget will be used for all fields of type "Range"
editorFieldMappingService.addFieldMapping('Range', null, null, {
template: 'rangeFieldTemplate.html'
});
},
[EditorFieldMappingService]
)
]
})
export class SmartedittrailContainerModule {}
But it is not working I get still the same old template. Here they are using the same old AngularJs Syntax, but don't show how to wire it up to the new Angluar Module.
angular.module('trainingModule', ['editorFieldMappingServiceModule', 'smartedittrail/cmssmarteditContainerTemplates'])
.run(function(editorFieldMappingService) {
editorFieldMappingService.addFieldMapping('Integer', null, null, {
template: 'web/featureExtensions/smartedittrail/cmssmarteditContainer/integer-editorTemplate.html'
});
});
Anyone has an idea how to do it in the new version?
Request clarification before answering.
User | Count |
---|---|
12 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.