Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
fix(markdown): Ensure fieldEmpty get correct value on chrome and fire…
Browse files Browse the repository at this point in the history
…fox (#153)
  • Loading branch information
jarifibrahim authored and joshuawilson committed Aug 28, 2018
1 parent b378247 commit 4d262cb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/markdown/markdown.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,9 @@ export class MarkdownComponent implements OnChanges, OnInit, AfterViewChecked {
}

editorKeyUp(event: Event) {
this.fieldEmpty =
event.srcElement.textContent.trim() === '';
// Do not use this.event.srcElement. The "event" object is not consistent
// across browsers. Chrome has event.srcElement while firefox has event.originalTarget.
this.fieldEmpty = this.editorInput.nativeElement.innerText.trim() === '';
}

closeClick() {
Expand Down

0 comments on commit 4d262cb

Please sign in to comment.