Skip to content

Commit

Permalink
feat: add locale for invalid url text
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed May 12, 2024
1 parent 22e8bc2 commit aee35ff
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/src/content/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ NgxEditorModule.forRoot({
altText: 'Alt Text',
title: 'Title',
remove: 'Remove',
enterValidUrl: 'Please enter a valid URL',
},
});
```
Expand Down
1 change: 1 addition & 0 deletions docs/src/content/docs/examples/full-featured-editor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import { schema } from 'ngx-editor/schema';
altText: 'Alt Text',
title: 'Title',
remove: 'Remove',
enterValidUrl: 'Please enter a valid URL',
},
}),
],
Expand Down
1 change: 1 addition & 0 deletions projects/ngx-editor/src/lib/Locals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const defaults: Record<string, string | Observable<string>> = {
altText: 'Alt Text',
title: 'Title',
remove: 'Remove',
enterValidUrl: 'Please enter a valid URL',
};

export type LocalsKeys = keyof typeof defaults;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}}</label>
<input type="href" [id]="getId('image-popup-url')" formControlName="src" autocomplete="off" />
<div *ngIf="src.touched && src.invalid" class="NgxEditor__HelpText NgxEditor__HelpText--Error">
{{ src.errors?.['pattern'] && 'Please enter valid url.' }}
{{ src.errors?.['pattern'] && getLabel('enterValidUrl') | async }}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<label class="NgxEditor__Popup--Label" [htmlFor]="getId('link-popup-url')">{{ getLabel('url') | async }}</label>
<input type="href" [id]="getId('link-popup-url')" formControlName="href" autocomplete="off" />
<div *ngIf="href.touched && href.invalid" class="NgxEditor__HelpText NgxEditor__HelpText--Error">
{{ href.errors?.['pattern'] && 'Please enter valid url.' }}
{{ href.errors?.['pattern'] && getLabel('enterValidUrl') | async }}
</div>
</div>
</div>
Expand Down

0 comments on commit aee35ff

Please sign in to comment.