From ba149c2b65727c6cbea60e15de01323a79788012 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Sun, 24 Jan 2021 11:00:03 -0800 Subject: [PATCH] simplify isSafari isFirefox --- components/Editor.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/Editor.js b/components/Editor.js index 8266083..346dc69 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -78,14 +78,14 @@ class Editor extends React.Component { this.setState(newState) - this.isSafari = - window.navigator && - window.navigator.userAgent.indexOf('Safari') !== -1 && - window.navigator.userAgent.indexOf('Chrome') === -1 - this.isFirefox = - window.navigator && - window.navigator.userAgent.indexOf('Firefox') !== -1 && - window.navigator.userAgent.indexOf('Chrome') === -1 + if (window.navigator) { + this.isSafari = + window.navigator.userAgent.indexOf('Safari') !== -1 && + window.navigator.userAgent.indexOf('Chrome') === -1 + this.isFirefox = + window.navigator.userAgent.indexOf('Firefox') !== -1 && + window.navigator.userAgent.indexOf('Chrome') === -1 + } } carbonNode = React.createRef()