RED-7684: Convert line endings in rule editors to LF

This commit is contained in:
Adina Țeudan 2023-10-05 20:51:58 +03:00
parent ed881ceee4
commit 29b97002dd

View File

@ -105,7 +105,7 @@ export class RulesScreenComponent implements OnInit, ComponentCanDeactivate {
this._removeErrorMarkers();
await firstValueFrom(
this._rulesService.uploadRules({
rules: this._codeEditor.getModel().getValue(),
rules: this._getValue(),
dossierTemplateId: this.#dossierTemplateId,
ruleFileType: this.type,
}),
@ -131,6 +131,11 @@ export class RulesScreenComponent implements OnInit, ComponentCanDeactivate {
this._loadingService.stop();
}
private _getValue(): string {
this._codeEditor.getModel().setEOL(monaco.editor.EndOfLineSequence.LF);
return this._codeEditor.getModel().getValue();
}
private async _configureSyntaxHighlighting() {
const languages = (window as any).monaco.languages.getLanguages();
const javaLang = languages.find(l => l.id === 'java');