Skip to content

Commit b091366

Browse files
authored
fix: remove global var for Vue 2 (#120)
1 parent 3e951af commit b091366

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/vue-prism-editor/src/Editor.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ const KEYCODE_ESCAPE = 27;
1616
const HISTORY_LIMIT = 100;
1717
const HISTORY_TIME_GAP = 3000;
1818

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

2222
export interface EditorProps {
2323
lineNumbers: boolean;

0 commit comments

Comments
 (0)