Skip to Content
0
Former Member
Aug 21, 2018 at 11:00 AM

Override service in SmartEdit

790 Views

Hi there! As there are a lot of bugs in SmartEdit, we're trying to fix them via overriding services. For instance, we created service, that overrides "nestedComponentManagementServiceModule":

 angular.module('nestedComponentManagementServiceModule', ['genericEditorModalServiceModule', 'yLoDashModule'])
         .service('nestedComponentManagementService', function(genericEditorModalService, lodash) {
                 // ------------------------------------------------------------------------
                 // Public API
                 // ------------------------------------------------------------------------
                 this.openNestedComponentEditor = function(componentInfo, editorStackId, saveCallback) {
                     var componentData = prepareComponentData(componentInfo, editorStackId);
                     saveCallback = (saveCallback) ? saveCallback : this.defaultSaveCallback;
     
                     return genericEditorModalService.open(componentData, null, saveCallback);
                 };
     
                 // ------------------------------------------------------------------------
                 // Helper Methods
                 // ------------------------------------------------------------------------
                 var prepareComponentData = function(componentInfo, editorStackId) {
                     var type = componentInfo.content.itemtype.toLowerCase();
                     return {
                         componentUuid: componentInfo.componentUuid,
                         componentType: componentInfo.content.itemtype,
                         title: 'type.' + type + '.name',
                         content: lodash.defaultsDeep({}, {
                             typeCode: componentInfo.content.itemtype,
                             itemtype: componentInfo.content.itemtype,
                             visible: true
                         }, componentInfo.content),
                         editorStackId: editorStackId
                     };
                 };
     
                 this.defaultSaveCallback = function() {
     
                 }.bind(this);
         });

But it is still executed default one service. Has anybody had such experience. I'd appreciate you help!