Skip to content

Commit

Permalink
feat(admin-ui): Add rich text control form input
Browse files Browse the repository at this point in the history
Relates to #415, relates to #722
  • Loading branch information
michaelbromley committed Nov 25, 2021
1 parent f52459f commit 0b09598
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,6 @@

.ProseMirror p {
margin-bottom: 0.5rem;
color: var(--color-grey-800);
color: var(--color-grey-800) !important;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { NumberFormInputComponent } from './number-form-input/number-form-input.
import { PasswordFormInputComponent } from './password-form-input/password-form-input.component';
import { ProductSelectorFormInputComponent } from './product-selector-form-input/product-selector-form-input.component';
import { RelationFormInputComponent } from './relation-form-input/relation-form-input.component';
import { RichTextFormInputComponent } from './rich-text-form-input/rich-text-form-input.component';
import { SelectFormInputComponent } from './select-form-input/select-form-input.component';
import { TextFormInputComponent } from './text-form-input/text-form-input.component';
import { TextareaFormInputComponent } from './textarea-form-input/textarea-form-input.component';
Expand All @@ -34,6 +35,7 @@ export const defaultFormInputs = [
PasswordFormInputComponent,
RelationFormInputComponent,
TextareaFormInputComponent,
RichTextFormInputComponent,
];

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vdr-rich-text-editor
[readonly]="readonly"
[formControl]="formControl"
></vdr-rich-text-editor>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:host {
textarea {
resize: both;
height: 6rem;
width: 100%;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { FormControl } from '@angular/forms';
import { DefaultFormComponentConfig, DefaultFormComponentId } from '@vendure/common/lib/shared-types';

import { FormInputComponent, InputComponentConfig } from '../../../common/component-registry-types';

@Component({
selector: 'vdr-rich-text-form-input',
templateUrl: './rich-text-form-input.component.html',
styleUrls: ['./rich-text-form-input.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class RichTextFormInputComponent implements FormInputComponent {
static readonly id: DefaultFormComponentId = 'rich-text-form-input';
readonly: boolean;
formControl: FormControl;
config: DefaultFormComponentConfig<'rich-text-form-input'>;
}
2 changes: 2 additions & 0 deletions packages/admin-ui/src/lib/core/src/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import {
} from './dynamic-form-inputs/relation-form-input/relation-card/relation-card.component';
import { RelationFormInputComponent } from './dynamic-form-inputs/relation-form-input/relation-form-input.component';
import { RelationSelectorDialogComponent } from './dynamic-form-inputs/relation-form-input/relation-selector-dialog/relation-selector-dialog.component';
import { RichTextFormInputComponent } from './dynamic-form-inputs/rich-text-form-input/rich-text-form-input.component';
import { SelectFormInputComponent } from './dynamic-form-inputs/select-form-input/select-form-input.component';
import { TextFormInputComponent } from './dynamic-form-inputs/text-form-input/text-form-input.component';
import { TextareaFormInputComponent } from './dynamic-form-inputs/textarea-form-input/textarea-form-input.component';
Expand Down Expand Up @@ -242,6 +243,7 @@ const DYNAMIC_FORM_INPUTS = [
RelationCardDetailDirective,
RelationSelectorDialogComponent,
TextareaFormInputComponent,
RichTextFormInputComponent,
];

@NgModule({
Expand Down
2 changes: 2 additions & 0 deletions packages/common/src/shared-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export type DefaultFormComponentId =
| 'customer-group-form-input'
| 'text-form-input'
| 'textarea-form-input'
| 'rich-text-form-input'
| 'password-form-input'
| 'relation-form-input';

Expand All @@ -164,6 +165,7 @@ type DefaultFormConfigHash = {
'textarea-form-input': {
spellcheck?: boolean;
};
'rich-text-form-input': {};
'password-form-input': {};
'relation-form-input': {};
};
Expand Down

0 comments on commit 0b09598

Please sign in to comment.