From 13df01d55acc79cdbfd4b979a6bb904ed01d0bdd Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Wed, 20 Nov 2024 12:35:56 +0500 Subject: [PATCH] mobile: fix readonly editor not loading --- apps/mobile/app/screens/editor/readonly-editor.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/mobile/app/screens/editor/readonly-editor.tsx b/apps/mobile/app/screens/editor/readonly-editor.tsx index 43902dd7e1..ec9234ffb6 100644 --- a/apps/mobile/app/screens/editor/readonly-editor.tsx +++ b/apps/mobile/app/screens/editor/readonly-editor.tsx @@ -34,6 +34,7 @@ import { EditorEvents } from "./tiptap/utils"; import { useThemeColors } from "@notesnook/theme"; import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets"; import { db } from "../../common/database"; +import { i18n } from "@lingui/core"; const onShouldStartLoadWithRequest = (request: ShouldStartLoadRequest) => { if (request.url.includes("https")) { @@ -143,10 +144,17 @@ export function ReadonlyEditor(props: { ref={editorRef} key={"readonly-editor:" + props.editorId} nestedScrollEnabled - injectedJavaScriptBeforeContentLoaded={`globalThis.readonlyEditor=true;`} - injectedJavaScript="globalThis.readonlyEditor=true;" + injectedJavaScript={` + globalThis.__DEV__ = ${__DEV__} + globalThis.readonlyEditor=true; + globalThis.LINGUI_LOCALE = "${i18n.locale}"; + globalThis.LINGUI_LOCALE_DATA = ${JSON.stringify({ + [i18n.locale]: i18n.messages + })}; + globalThis.loadApp();`} useSharedProcessPool={false} javaScriptEnabled={true} + webviewDebuggingEnabled={__DEV__} focusable={true} setSupportMultipleWindows={false} overScrollMode="never"