Reputation: 138
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: Customizing smartedit in hybris
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 the 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: SPA Help Portal 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 SAP Trail Creating a Custom Component 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?
Upvotes: 2
Views: 516
Reputation: 1
copy NumberComponent.html from OTB and paste it inside customize folder
hybris\config\customize\modules\smartedit\smartedit\apps\smartedit-commons\src\components\genericEditor\widgets\NumberComponent
do required changes in the html file
ant customize ant all
Upvotes: 0