@@ -8,11 +8,26 @@ import { DomSanitizer } from '@angular/platform-browser';
88 templateUrl : './markdown-editor.component.html' ,
99 styleUrls : [ './markdown-editor.component.scss' ]
1010} )
11- export class MarkdownEditorComponent {
11+ export class MarkdownEditorComponent {
1212 /**
1313 * Markdown Editor String value
1414 */
15- @Input ( ) editValue = '' ;
15+ @Input ( ) set editValue ( value : string ) {
16+ if ( value && ! this . _editValue ) {
17+ this . _editValue = value ;
18+ }
19+ }
20+
21+ get editValue ( ) : string {
22+ return this . _editValue ;
23+ }
24+
25+ private _editValue = '' ;
26+ /**
27+ * Indicates whether the markdown editor is required.
28+ */
29+ @Input ( ) required : boolean ;
30+
1631 /**
1732 * Markdown Editor String value Emitter
1833 */
@@ -24,7 +39,7 @@ export class MarkdownEditorComponent {
2439 modules : QuillModules = {
2540 'emoji-toolbar' : true ,
2641 toolbar : {
27- container : [
42+ container : [
2843 [ 'bold' , 'italic' , 'underline' , 'strike' ] ,
2944 [ { 'header' : 1 } , { 'header' : 2 } ] ,
3045 [ { 'list' : 'ordered' } , { 'list' : 'bullet' } ] ,
@@ -50,6 +65,7 @@ export class MarkdownEditorComponent {
5065 */
5166 updateContent ( content : ContentChange ) {
5267 const sanitizedContent = this . sanitizer . sanitize ( SecurityContext . HTML , content . html ) ;
53- this . editValueChange . emit ( sanitizedContent ) ;
68+ const normalizedContent = sanitizedContent ?. replace ( / & # 1 6 0 ; / g, ' ' ) ;
69+ this . editValueChange . emit ( normalizedContent ) ;
5470}
5571}
0 commit comments