File tree Expand file tree Collapse file tree
src/app/shared/form/builder
ds-dynamic-form-ui/models/markdown Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { DynamicFormControlLayout , serializable } from '@ng-dynamic-forms/core' ;
2+ import { DsDynamicInputModel , DsDynamicInputModelConfig } from '../ds-dynamic-input.model' ;
3+ import { DYNAMIC_FORM_CONTROL_TYPE_MARKDOWN } from './dynamic-markdown.model' ;
4+
5+
6+ export class DsDynamicMarkdownModel extends DsDynamicInputModel {
7+ @serializable ( ) type = DYNAMIC_FORM_CONTROL_TYPE_MARKDOWN ;
8+
9+ constructor ( config : DsDynamicInputModelConfig , layout ?: DynamicFormControlLayout ) {
10+ super ( config , layout ) ;
11+
12+ }
13+
14+ }
Original file line number Diff line number Diff line change 1+ import { FieldParser } from './field-parser' ;
2+ import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model' ;
3+ import { environment } from '../../../../../environments/environment' ;
4+ import { DsDynamicMarkdownModel } from '../ds-dynamic-form-ui/models/markdown/ds-dynamic-markdown.model' ;
5+ import { DsDynamicInputModelConfig } from '../ds-dynamic-form-ui/models/ds-dynamic-input.model' ;
6+
7+ export class MarkdownFieldParser extends FieldParser {
8+
9+ public modelFactory ( fieldValue ?: FormFieldMetadataValueObject | any , label ?: boolean ) : any {
10+ const markDownModelConfig : DsDynamicInputModelConfig = this . initModel ( null , label ) ;
11+
12+ markDownModelConfig . spellCheck = environment . form . spellCheck ;
13+ this . setValues ( markDownModelConfig , fieldValue ) ;
14+ return new DsDynamicMarkdownModel ( markDownModelConfig ) ;
15+ }
16+ }
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import { TextareaFieldParser } from './textarea-field-parser';
2222import { NumberFieldParser } from './number-field-parser' ;
2323import { CalendarFieldParser } from './calendar-field-parser' ;
2424import { DisabledFieldParser } from './disabled-field-parser' ;
25+ import { MarkdownFieldParser } from './markdown-field-parser' ;
2526
2627const fieldParserDeps = [
2728 SUBMISSION_ID ,
@@ -143,6 +144,13 @@ export class ParserFactory {
143144 deps : [ ...fieldParserDeps ]
144145 } ;
145146 }
147+ case ParserType . Markdown : {
148+ return {
149+ provide : FieldParser ,
150+ useClass : MarkdownFieldParser ,
151+ deps : [ ...fieldParserDeps ]
152+ } ;
153+ }
146154 case undefined : {
147155 return {
148156 provide : FieldParser ,
Original file line number Diff line number Diff line change @@ -15,5 +15,6 @@ export enum ParserType {
1515 Tag = 'tag' ,
1616 Textarea = 'textarea' ,
1717 Number = 'number' ,
18- Calendar = 'calendar'
18+ Calendar = 'calendar' ,
19+ Markdown = 'markdown' ,
1920}
You can’t perform that action at this time.
0 commit comments