From 29b97002dd132035ee2cb9d955d56b491b391e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Thu, 5 Oct 2023 20:51:58 +0300 Subject: [PATCH] RED-7684: Convert line endings in rule editors to LF --- .../screens/rules/rules-screen/rules-screen.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.ts index dae37142e..980d9caf3 100644 --- a/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/rules/rules-screen/rules-screen.component.ts @@ -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');