Skip to content

Commit ffb4b85

Browse files
committed
Refactor rich text editor configuration and improve change detection logic
1 parent 3500bf6 commit ffb4b85

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

packages/angular-sdk-components/src/lib/_components/designSystemExtension/rich-text-editor/rich-text-editor.component.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,16 @@ export class RichTextEditorComponent implements OnChanges {
5757
min_height: 130,
5858
plugins: ['lists', 'advlist', 'autolink', 'image', 'link', 'autoresize'],
5959
autoresize_bottom_margin: 0,
60-
6160
toolbar: this.disabled ? false : 'blocks | bold italic strikethrough | bullist numlist outdent indent | link image',
6261
toolbar_location: 'bottom',
63-
6462
content_style: `
65-
body {
66-
font-family: Helvetica, Arial, sans-serif;
67-
font-size: 14px;
68-
color: ${textColor} !important;
69-
background: transparent !important;
63+
body {
64+
font-family: Helvetica, Arial, sans-serif;
65+
font-size: 14px;
66+
color: ${textColor} !important;
67+
background: transparent !important;
7068
}
7169
`,
72-
7370
branding: false,
7471
paste_data_images: true,
7572
file_picker_types: 'image',

packages/angular-sdk-components/src/lib/_components/field/rich-text/rich-text.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Component, forwardRef } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { ReactiveFormsModule } from '@angular/forms';
4+
45
import { FieldBase } from '../field.base';
56
import { ComponentMapperComponent } from '../../../_bridge/component-mapper/component-mapper.component';
67
import { handleEvent } from '../../../_helpers/event-util';
@@ -18,6 +19,7 @@ interface RichTextProps extends PConnFieldProps {
1819
})
1920
export class RichTextComponent extends FieldBase {
2021
configProps$: RichTextProps;
22+
2123
info: any;
2224
error: boolean;
2325
status: any;
@@ -60,7 +62,10 @@ export class RichTextComponent extends FieldBase {
6062

6163
fieldOnBlur(editorValue: any) {
6264
const oldVal = this.value$ ?? '';
63-
if (editorValue.toString() !== oldVal.toString()) {
65+
66+
const isValueChanged = editorValue.toString() !== oldVal.toString();
67+
68+
if (isValueChanged) {
6469
handleEvent(this.actionsApi, 'changeNblur', this.propName, editorValue);
6570
}
6671
}

0 commit comments

Comments
 (0)