Skip to content

Commit

Permalink
fix: use window instead of global. fixes #86
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Aug 9, 2022
1 parent 1023413 commit 1910895
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/index.tsx
@@ -1,5 +1,3 @@
/* global global */

import * as React from 'react';

type Props = React.HTMLAttributes<HTMLDivElement> & {
Expand Down Expand Up @@ -65,9 +63,14 @@ const KEYCODE_ESCAPE = 27;
const HISTORY_LIMIT = 100;
const HISTORY_TIME_GAP = 3000;

const isWindows = 'navigator' in global && /Win/i.test(navigator.platform);
const isWindows =
typeof window !== 'undefined' &&
'navigator' in window &&
/Win/i.test(navigator.platform);
const isMacLike =
'navigator' in global && /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
typeof window !== 'undefined' &&
'navigator' in window &&
/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);

const className = 'npm__react-simple-code-editor__textarea';

Expand Down

0 comments on commit 1910895

Please sign in to comment.