Skip to content

Commit 9771d75

Browse files
committed
Enable / disable spellcheck for textarea inputs via config
1 parent ffc5ecb commit 9771d75

9 files changed

Lines changed: 22 additions & 0 deletions

File tree

config/config.example.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ auth:
5555

5656
# Form settings
5757
form:
58+
# Sets the spellcheck textarea attribute value
59+
spellCheck: true
5860
# NOTE: Map server-side validators to comparative Angular form validators
5961
validatorMap:
6062
required: required

src/app/access-control/group-registry/group-form/group-form.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { followLink } from '../../../shared/utils/follow-link-config.model';
4646
import { NoContent } from '../../../core/shared/NoContent.model';
4747
import { Operation } from 'fast-json-patch';
4848
import { ValidateGroupExists } from './validators/group-exists.validator';
49+
import { environment } from '../../../../environments/environment';
4950

5051
@Component({
5152
selector: 'ds-group-form',
@@ -194,6 +195,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
194195
label: groupDescription,
195196
name: 'groupDescription',
196197
required: false,
198+
spellCheck: environment.form.spellCheck,
197199
});
198200
this.formModel = [
199201
this.groupName,

src/app/admin/admin-registries/bitstream-formats/format-form/format-form.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { Router } from '@angular/router';
1515
import { hasValue, isEmpty } from '../../../../shared/empty.util';
1616
import { TranslateService } from '@ngx-translate/core';
1717
import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths';
18+
import { environment } from '../../../../../environments/environment';
1819

1920
/**
2021
* The component responsible for rendering the form to create/edit a bitstream format
@@ -90,6 +91,7 @@ export class FormatFormComponent implements OnInit {
9091
name: 'description',
9192
label: 'admin.registries.bitstream-formats.edit.description.label',
9293
hint: 'admin.registries.bitstream-formats.edit.description.hint',
94+
spellCheck: environment.form.spellCheck,
9395

9496
}),
9597
new DynamicSelectModel({

src/app/collection-page/collection-form/collection-form.models.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { DynamicFormControlModel, DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core';
22
import { DynamicSelectModelConfig } from '@ng-dynamic-forms/core/lib/model/select/dynamic-select.model';
3+
import { environment } from '../../../environments/environment';
34

45
export const collectionFormEntityTypeSelectionConfig: DynamicSelectModelConfig<string> = {
56
id: 'entityType',
@@ -26,21 +27,26 @@ export const collectionFormModels: DynamicFormControlModel[] = [
2627
new DynamicTextAreaModel({
2728
id: 'description',
2829
name: 'dc.description',
30+
spellCheck: environment.form.spellCheck,
2931
}),
3032
new DynamicTextAreaModel({
3133
id: 'abstract',
3234
name: 'dc.description.abstract',
35+
spellCheck: environment.form.spellCheck,
3336
}),
3437
new DynamicTextAreaModel({
3538
id: 'rights',
3639
name: 'dc.rights',
40+
spellCheck: environment.form.spellCheck,
3741
}),
3842
new DynamicTextAreaModel({
3943
id: 'tableofcontents',
4044
name: 'dc.description.tableofcontents',
45+
spellCheck: environment.form.spellCheck,
4146
}),
4247
new DynamicTextAreaModel({
4348
id: 'license',
4449
name: 'dc.rights.license',
50+
spellCheck: environment.form.spellCheck,
4551
})
4652
];

src/app/community-page/community-form/community-form.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { CommunityDataService } from '../../core/data/community-data.service';
1313
import { AuthService } from '../../core/auth/auth.service';
1414
import { RequestService } from '../../core/data/request.service';
1515
import { ObjectCacheService } from '../../core/cache/object-cache.service';
16+
import { environment } from '../../../environments/environment';
1617

1718
/**
1819
* Form used for creating and editing communities
@@ -52,18 +53,22 @@ export class CommunityFormComponent extends ComColFormComponent<Community> {
5253
new DynamicTextAreaModel({
5354
id: 'description',
5455
name: 'dc.description',
56+
spellCheck: environment.form.spellCheck,
5557
}),
5658
new DynamicTextAreaModel({
5759
id: 'abstract',
5860
name: 'dc.description.abstract',
61+
spellCheck: environment.form.spellCheck,
5962
}),
6063
new DynamicTextAreaModel({
6164
id: 'rights',
6265
name: 'dc.rights',
66+
spellCheck: environment.form.spellCheck,
6367
}),
6468
new DynamicTextAreaModel({
6569
id: 'tableofcontents',
6670
name: 'dc.description.tableofcontents',
71+
spellCheck: environment.form.spellCheck,
6772
}),
6873
];
6974

src/app/shared/form/builder/parsers/textarea-field-parser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
DsDynamicTextAreaModel,
66
DsDynamicTextAreaModelConfig
77
} from '../ds-dynamic-form-ui/models/ds-dynamic-textarea.model';
8+
import { environment } from '../../../../../environments/environment';
89

910
export class TextareaFieldParser extends FieldParser {
1011

@@ -20,6 +21,7 @@ export class TextareaFieldParser extends FieldParser {
2021
};
2122

2223
textAreaModelConfig.rows = 10;
24+
textAreaModelConfig.spellCheck = environment.form.spellCheck;
2325
this.setValues(textAreaModelConfig, fieldValue);
2426
const textAreaModel = new DsDynamicTextAreaModel(textAreaModelConfig, layout);
2527

src/config/default-app-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export class DefaultAppConfig implements AppConfig {
9393

9494
// Form settings
9595
form: FormConfig = {
96+
spellCheck: true,
9697
// NOTE: Map server-side validators to comparative Angular form validators
9798
validatorMap: {
9899
required: 'required',

src/config/form-config.interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export interface ValidatorMap {
55
}
66

77
export interface FormConfig extends Config {
8+
spellCheck: boolean;
89
validatorMap: ValidatorMap;
910
}

src/environments/environment.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export const environment: BuildConfig = {
7878

7979
// Form settings
8080
form: {
81+
spellCheck: true,
8182
// NOTE: Map server-side validators to comparative Angular form validators
8283
validatorMap: {
8384
required: 'required',

0 commit comments

Comments
 (0)