Skip to content

Commit

Permalink
fix(directive): fix for non-string values
Browse files Browse the repository at this point in the history
  • Loading branch information
waterplea committed Jul 27, 2021
1 parent f11836c commit 38ac555
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
13 changes: 9 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,12 @@ export class ContenteditableValueAccessor
}

/*
* null and other falsy control values are treated as empty string to
* prevent IE11 outputting 'null', also single <br> is replaced with empty
* string when passed to the control
* null is treated as empty string to prevent IE11 outputting 'null',
* also single <br> is replaced with empty string when passed to the control
*/
private static processValue(value: string | null): string {
const processed = value || '';
private static processValue(value: unknown): string {
const processed = String(value == null ? '' : value);

return processed.toString().trim() === '<br>' ? '' : processed;
return processed.trim() === '<br>' ? '' : processed;
}
}

0 comments on commit 38ac555

Please sign in to comment.