-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
editor: count chars and words in textarea #370
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reformat the html part template
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Outdated
Show resolved
Hide resolved
<ng-container | ||
*ngIf=" | ||
field.templateOptions.limitChars || field.templateOptions.displayChars | ||
" | ||
> | ||
<span class="small text-muted d-inline-block" | ||
>{{ 'Number of chars' | translate }}: {{ countChars | ||
}}<ng-container *ngIf="field.templateOptions.limitChars"> | ||
/ {{ field.templateOptions.limitChars }}</ng-container | ||
></span | ||
> | ||
</ng-container> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you don't use ng-template
with a parameter display
only with values word
or char
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure to understand, could you be more precise, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I changed the way to handle this.
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Outdated
Show resolved
Hide resolved
@zannkukai, @Garfield-fr I use |
@sebastiendeleze We don't use a 80 characters line limit in angular projects. Isn't it ? <span class="small text-muted d-inline-block"
>{{ 'Number of chars' | translate }}: {{ countChars
}}<ng-container *ngIf="field.templateOptions.limitChars">
/ {{ field.templateOptions.limitChars }}</ng-container
></span
> It seems (always for me) better to write <span class="small text-muted d-inline-block">
{{ 'Number of chars' | translate }}: {{ countChars }}
<ng-container *ngIf="field.templateOptions.limitChars">
/ {{ field.templateOptions.limitChars }}
</ng-container>
</span> At least have the |
@Component({ | ||
selector: 'ng-core-editor-formly-field-textarea', | ||
template: ` | ||
<textarea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be in a separate file.
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/editor/type/textarea/textarea.component.ts
Outdated
Show resolved
Hide resolved
* Adds counters in textarea for chars and words, depending on the configuration. * Avoids to exceed the counts when typing. * Checks for new resource context to avoid `pid` to be set in model. Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
pid
to be set in model.Co-Authored-by: Sébastien Délèze sebastien.deleze@rero.ch