angular-froala-wysiwyg
angular-froala-wysiwyg copied to clipboard
touched set on mousedown
Have noticed a problem when using the Froala WYSIWYG Editor within a mat-form-field
. When I use a <input matInput formControlName="formModel" />
in a mat-form-field
with a required
validator I see the error is set to { "required": true }
and touched
and invalid
are false
and true
respectively. When clicking into the field nothing changes but when i leave the field the touched
value gets updated to true
.
When I use the Froala with <textarea matInput [froalaEditor] formControlName="formModel"></textarea>
I see the same as above except when I click into the editor the touched
value is updated to true
and the form validation immediately shows to the user.
This should IMO be consistent with how the standard input
etc. work and the touched
value should be updated on blur
Looking at the code, this (line 181 in editor.directive.ts)
this._editor.events.on('mousedown', function () {
setTimeout(function () {
self.onTouched();
}, 0);
});
This should be the blur
event which would set touched when leaving the control, I could make this change and submit a PR if this makes sense
I totally agree. The blur event would make more sense!
Is this still an issue?