
    // actions$ = new Subject();
   
    // this.state$ = this.actions$.pipe(
    //     scan(this.reducer, this.state)
    // );

// reducer = (state, action) => {  
//     switch(action.type) {
//         case 'FIELD_SELECTED':
//         return {
//             ...state,
//             selectedFields: action.payload
//         };
//         case 'OPEN_CONTROLS':
//         return {
//             ...state,
//             panelStatus: state.panelStatus === 'closed' ? 'editing' : state.panelStatus
//         };
//         case 'ClOSE_CONTROLS':
//         return {
//             ...state,
//             panelStatus: !state.panelStatus === 'closed' ? 'closed' : state.panelStatus
//         };
            case 'STAGE_CHANGES'
            case 'DISCARD_CHANGES'
            case 'PUBLISH_CHANGES'
            case 'UNLOCK/LOCK'
//         case 'FIELD_CHANGED':
//         return {
//             ...state,
//             changedFields: action.payload
//         };
        
//         default:
//         return state;
//     }
// }



// emitAction = (func) => (...args) => {   //a function that returns a function that emits action by calling the passed in function with a list of args
//     this.actions$.next(func(...args));
// }

selectField = this.emitAction((payload) => ({
//     type: 'FIELD_SELECTED',
//     payload
// }));

    // this.state$.subscribe(state => {
    //     if(this.state.panelStatus === 'closed' && state.panelStatus !== 'closed'){
    //         from(wallaceInline.editableFields).pipe(
    //             filter(field => field.uiType === 'text'),
    //             map(field => this.addElemRef(field))
    //         )
    //         .subscribe(field => {
    //             this.activateTextField(field);
    //         });
    //     }

    //     this.setState(state);
    // });