Reset the CR Mode by motion-motion navigation

Set the CR mode to default if navigating from one motion
to the other motion instead of keeping the previously selected
CD mode
This commit is contained in:
Sean 2020-12-02 12:42:03 +01:00
parent 652b727386
commit a410083349

View File

@ -360,10 +360,15 @@ export class MotionDetailComponent extends BaseViewComponentDirective implements
public lnMode: LineNumberingMode; public lnMode: LineNumberingMode;
/** /**
* Indicates the Change reco Mode. * Indicates the current change reco mode.
*/ */
public crMode: ChangeRecoMode; public crMode: ChangeRecoMode;
/**
* Indicates the default change reco mode.
*/
private defaultCrMode: ChangeRecoMode;
/** /**
* Indicates the maximum line length as defined in the configuration. * Indicates the maximum line length as defined in the configuration.
*/ */
@ -544,7 +549,8 @@ export class MotionDetailComponent extends BaseViewComponentDirective implements
.subscribe(mode => (this.lnMode = mode)); .subscribe(mode => (this.lnMode = mode));
this.configService.get<ChangeRecoMode>('motions_recommendation_text_mode').subscribe(mode => { this.configService.get<ChangeRecoMode>('motions_recommendation_text_mode').subscribe(mode => {
if (mode) { if (mode) {
this.crMode = this.determineCrMode(mode); this.defaultCrMode = mode;
this.resetCrMode();
} }
}); });
this.configService this.configService
@ -634,6 +640,10 @@ export class MotionDetailComponent extends BaseViewComponentDirective implements
}); });
} }
private resetCrMode(): void {
this.crMode = this.determineCrMode(this.defaultCrMode);
}
/** /**
* Retrieves * Retrieves
*/ */
@ -739,6 +749,7 @@ export class MotionDetailComponent extends BaseViewComponentDirective implements
if (!this.editMotion) { if (!this.editMotion) {
this.patchForm(this.motion); this.patchForm(this.motion);
} }
this.resetCrMode();
this.cd.markForCheck(); this.cd.markForCheck();
} }
}), }),