From c3a7ad5d0feff2e9ffe9339fad8de31e1b739b92 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Wed, 20 Oct 2021 22:19:18 -0700 Subject: [PATCH] inline isFirefox --- components/Editor.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/components/Editor.js b/components/Editor.js index 71e0426..97d7753 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -77,12 +77,6 @@ class Editor extends React.Component { } this.setState(newState) - - if (window.navigator) { - this.isFirefox = - window.navigator.userAgent.indexOf('Firefox') !== -1 && - window.navigator.userAgent.indexOf('Chrome') === -1 - } } carbonNode = React.createRef() @@ -191,7 +185,11 @@ class Editor extends React.Component { if (format !== 'open') { link.download = `${prefix}.${format}` } - if (this.isFirefox) { + if ( + // isFirefox + window.navigator.userAgent.indexOf('Firefox') !== -1 && + window.navigator.userAgent.indexOf('Chrome') === -1 + ) { link.target = '_blank' } link.href = url