diff --git a/backend/src/Squidex/Areas/Api/Controllers/News/Service/FeaturesService.cs b/backend/src/Squidex/Areas/Api/Controllers/News/Service/FeaturesService.cs
index 7cde60e68..6f503426c 100644
--- a/backend/src/Squidex/Areas/Api/Controllers/News/Service/FeaturesService.cs
+++ b/backend/src/Squidex/Areas/Api/Controllers/News/Service/FeaturesService.cs
@@ -9,6 +9,8 @@ using Microsoft.Extensions.Options;
using Squidex.Areas.Api.Controllers.News.Models;
using Squidex.ClientLibrary;
+#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
+
namespace Squidex.Areas.Api.Controllers.News.Service
{
public sealed class FeaturesService
diff --git a/frontend/src/app/features/rules/pages/simulator/simulated-rule-event.component.html b/frontend/src/app/features/rules/pages/simulator/simulated-rule-event.component.html
index 3d9ad65ca..15f9b354e 100644
--- a/frontend/src/app/features/rules/pages/simulator/simulated-rule-event.component.html
+++ b/frontend/src/app/features/rules/pages/simulator/simulated-rule-event.component.html
@@ -53,7 +53,7 @@
-
+
diff --git a/frontend/src/app/framework/angular/forms/editors/code-editor.component.ts b/frontend/src/app/framework/angular/forms/editors/code-editor.component.ts
index 812400b62..1101bebac 100644
--- a/frontend/src/app/framework/angular/forms/editors/code-editor.component.ts
+++ b/frontend/src/app/framework/angular/forms/editors/code-editor.component.ts
@@ -46,7 +46,7 @@ export class CodeEditorComponent extends StatefulControlComponent<{}, string> im
public valueFile = '';
@Input()
- public valueMode: 'String' | 'Json' = 'String';
+ public valueMode: 'String' | 'Json' | 'JsonString' = 'String';
@Input()
public maxLines: number | undefined;
@@ -92,22 +92,22 @@ export class CodeEditorComponent extends StatefulControlComponent<{}, string> im
}
public writeValue(obj: string) {
- if (this.valueMode === 'Json') {
- if (obj === null) {
+ try {
+ if (Types.isNull(obj) || Types.isUndefined(obj)) {
this.value = '';
+ } else if (Types.isString(obj) && this.valueMode === 'JsonString') {
+ this.value = JSON.stringify(JSON.parse(obj), undefined, 4);
+ } else if (Types.isString(obj)) {
+ this.value = obj;
+ } else if (this.valueMode === 'Json') {
+ this.value = JSON.stringify(obj, undefined, 4);
} else {
- try {
- this.value = JSON.stringify(obj, undefined, 4);
- } catch (e) {
- this.value = '';
- }
+ this.value = '';
}
- } else if (Types.isString(obj)) {
- this.value = obj;
- } else {
+ } catch {
this.value = '';
}
-
+
if (this.aceEditor) {
this.setValue(this.value);
}