Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: do not throw during ssr

Abdullah Atta55e6a4b65a13
diff --git a/packages/editor/src/utils/platform.ts b/packages/editor/src/utils/platform.ts
index f7f8ae241..fc2a76134 100644
--- a/packages/editor/src/utils/platform.ts
+++ b/packages/editor/src/utils/platform.ts
@@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
export const isiOS =
- [
+ "navigator" in globalThis &&
+ ([
"iPad Simulator",
"iPhone Simulator",
"iPod Simulator",
@@ -26,8 +27,9 @@ export const isiOS =
"iPhone",
"iPod"
].includes(navigator.platform) ||
- // iPad on iOS 13 detection
- (navigator.userAgent.includes("Mac") && "ontouchend" in document);
+ // iPad on iOS 13 detection
+ (navigator.userAgent.includes("Mac") && "ontouchend" in document));
export const isAndroid =
+ "navigator" in globalThis &&
navigator.userAgent.toLowerCase().indexOf("android") > -1;