Skip to content

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

Fix insets in landscape mode on iOS and Android (#10334)

Ammar Ahmed06461a85ca12
diff --git a/apps/mobile/app/components/side-menu/index.tsx b/apps/mobile/app/components/side-menu/index.tsx
index de6e0b92b..9b07e6f81 100644
--- a/apps/mobile/app/components/side-menu/index.tsx
+++ b/apps/mobile/app/components/side-menu/index.tsx
@@ -193,8 +193,7 @@ export const SideMenu = React.memo(
flex: 1,
backgroundColor: colors.primary.background,
paddingTop: insets.top,
- paddingBottom: insets.bottom,
- paddingLeft: insets.left
+ paddingBottom: insets.bottom
}}
>
<SimpleTabView
diff --git a/apps/mobile/app/navigation/fluid-panels-view.tsx b/apps/mobile/app/navigation/fluid-panels-view.tsx
index e2650aef9..641e94a99 100644
--- a/apps/mobile/app/navigation/fluid-panels-view.tsx
+++ b/apps/mobile/app/navigation/fluid-panels-view.tsx
@@ -29,7 +29,7 @@ import React, {
useRef,
useState
} from "react";
-import { LayoutChangeEvent, View } from "react-native";
+import { LayoutChangeEvent, Platform, View } from "react-native";
import Orientation, {
OrientationType,
useDeviceOrientationChange
@@ -41,7 +41,7 @@ import Animated, {
} from "react-native-reanimated";
import { notesnook } from "../../e2e/test.ids";
import { db } from "../common/database";
-import { FluidPanels, FluidTabPage } from "../components/fluid-panels";
+import { FluidPanels } from "../components/fluid-panels";
import { useSideBarDraggingStore } from "../components/side-menu/dragging-store";
import useGlobalSafeAreaInsets from "../hooks/use-global-safe-area-insets";
import { hideAllTooltips } from "../hooks/use-tooltip";
@@ -90,6 +90,14 @@ export const FluidPanelsView = React.memo(
);
const appLoading = useSettingStore((state) => state.isAppLoading);
const [isLoading, setIsLoading] = useState(false);
+ const availableWidth =
+ dimensions.width -
+ (orientation === "LANDSCAPE-LEFT" || Platform.OS === "android"
+ ? insets.left
+ : 0) -
+ (orientation === "LANDSCAPE-RIGHT" || Platform.OS === "android"
+ ? insets.right
+ : 0);
useDeviceOrientationChange((o) => {
if (
@@ -101,6 +109,7 @@ export const FluidPanelsView = React.memo(
setOrientation(o);
}
});
+ console.log(orientation);
React.useEffect(() => {
const shortcut = useSettingStore.getState().pendingShortcut;
@@ -239,54 +248,55 @@ export const FluidPanelsView = React.memo(
[setDimensions]
);
- const PANE_OFFSET = useMemo(
- () => ({
+ const PANE_OFFSET = useMemo(() => {
+ const smallTabletSidebar = valueLimiter(availableWidth * 0.3, 300, 450);
+ const smallTabletList = valueLimiter(availableWidth * 0.3, 300, 450);
+
+ return {
mobile: {
- sidebar: dimensions.width * MOBILE_SIDEBAR_SIZE,
- list: dimensions.width + dimensions.width * MOBILE_SIDEBAR_SIZE,
- editor: dimensions.width * 2 + dimensions.width * MOBILE_SIDEBAR_SIZE
+ sidebar: availableWidth * MOBILE_SIDEBAR_SIZE,
+ list: availableWidth + availableWidth * MOBILE_SIDEBAR_SIZE,
+ editor: availableWidth * 2 + availableWidth * MOBILE_SIDEBAR_SIZE
},
smallTablet: {
- sidebar: fullscreen
- ? 0
- : valueLimiter(dimensions.width * 0.3, 300, 350),
- list: fullscreen
- ? 0
- : dimensions.width + valueLimiter(dimensions.width * 0.3, 300, 350),
+ sidebar: fullscreen ? 0 : smallTabletSidebar,
+ list: fullscreen ? 0 : smallTabletSidebar + smallTabletList,
editor: fullscreen
? 0
- : dimensions.width + valueLimiter(dimensions.width * 0.3, 300, 350)
+ : smallTabletSidebar +
+ smallTabletList +
+ availableWidth -
+ smallTabletList
},
tablet: {
sidebar: 0,
list: 0,
editor: 0
}
- }),
- [dimensions.width, fullscreen]
- );
+ };
+ }, [availableWidth, fullscreen]);
- const PANE_WIDTHS: PaneWidths = useMemo(
- () => ({
+ const PANE_WIDTHS: PaneWidths = useMemo(() => {
+ const smallTabletSidebar = valueLimiter(availableWidth * 0.3, 300, 450);
+ const smallTabletList = valueLimiter(availableWidth * 0.3, 300, 450);
+ return {
mobile: {
- sidebar: dimensions.width * MOBILE_SIDEBAR_SIZE,
- list: dimensions.width,
- editor: dimensions.width
+ sidebar: availableWidth * MOBILE_SIDEBAR_SIZE,
+ list: availableWidth,
+ editor: availableWidth
},
smallTablet: {
- sidebar: valueLimiter(dimensions.width * 0.3, 300, 350),
- list: valueLimiter(dimensions.width * 0.4, 300, 450),
- editor:
- dimensions.width - valueLimiter(dimensions.width * 0.4, 300, 450)
+ sidebar: smallTabletSidebar,
+ list: smallTabletList,
+ editor: availableWidth - smallTabletList
},
tablet: {
- sidebar: dimensions.width * 0.22,
- list: dimensions.width * 0.3,
- editor: dimensions.width * 0.48
+ sidebar: availableWidth * 0.22,
+ list: availableWidth * 0.3,
+ editor: availableWidth * 0.48
}
- }),
- [dimensions.width]
- );
+ };
+ }, [availableWidth]);
const onScroll = React.useCallback(
(scrollOffset: number) => {
@@ -332,7 +342,15 @@ export const FluidPanelsView = React.memo(
style={{
height: "100%",
width: "100%",
- backgroundColor: colors.primary.background
+ backgroundColor: colors.primary.background,
+ paddingLeft:
+ orientation === "LANDSCAPE-LEFT" || Platform.OS === "android"
+ ? insets.left
+ : 0,
+ paddingRight:
+ orientation === "LANDSCAPE-RIGHT" || Platform.OS === "android"
+ ? insets.right
+ : 0
}}
>
{deviceMode && PANE_WIDTHS[deviceMode as keyof typeof PANE_WIDTHS] ? (
@@ -356,6 +374,7 @@ export const FluidPanelsView = React.memo(
key="1"
style={{
height: "100%",
+ display: fullscreen ? "none" : "flex",
width: fullscreen
? 0
: PANE_WIDTHS[deviceMode as keyof typeof PANE_WIDTHS]?.sidebar
@@ -370,6 +389,7 @@ export const FluidPanelsView = React.memo(
key="2"
style={{
height: "100%",
+ display: fullscreen ? "none" : "flex",
width: fullscreen
? 0
: PANE_WIDTHS[deviceMode as keyof typeof PANE_WIDTHS]?.list
@@ -416,7 +436,12 @@ export const FluidPanelsView = React.memo(
</View>
<ScopedThemeProvider value="editor">
- {isLoading ? null : <EditorWrapper widths={PANE_WIDTHS} />}
+ {isLoading ? null : (
+ <EditorWrapper
+ availableWidth={availableWidth}
+ widths={PANE_WIDTHS}
+ />
+ )}
</ScopedThemeProvider>
</FluidPanels>
) : null}
diff --git a/apps/mobile/app/screens/editor/tiptap/commands.ts b/apps/mobile/app/screens/editor/tiptap/commands.ts
index 21c3e8821..ea9daed6b 100644
--- a/apps/mobile/app/screens/editor/tiptap/commands.ts
+++ b/apps/mobile/app/screens/editor/tiptap/commands.ts
@@ -46,7 +46,7 @@ async function call(
}
const fn = (fn: string, name?: string) => {
- const id = randId("fn_");
+ const id = randId(`fn_${name}-`);
return {
job: `(async () => {
if (typeof __PLATFORM__ === "undefined") __PLATFORM__ = "${Platform.OS}";
@@ -55,6 +55,7 @@ const fn = (fn: string, name?: string) => {
${fn}
post("${id}",response);
} catch(e) {
+ post("${id}",false);
const DEV_MODE = ${__DEV__};
if (DEV_MODE && typeof logger !== "undefined") logger('error', "webview: ", e.message, e.stack, "${name}");
}
@@ -73,7 +74,9 @@ class Commands {
}
async doAsync<T>(job: string, name?: string) {
- if (!this.ref.current) return false;
+ if (!this.ref.current) {
+ return false;
+ }
return call(this.ref, fn(job, name)) as Promise<T>;
}
diff --git a/apps/mobile/app/screens/editor/tiptap/utils.ts b/apps/mobile/app/screens/editor/tiptap/utils.ts
index 09635e980..51d52c7b9 100644
--- a/apps/mobile/app/screens/editor/tiptap/utils.ts
+++ b/apps/mobile/app/screens/editor/tiptap/utils.ts
@@ -97,16 +97,19 @@ type WebviewResponseData = {
export const getResponse = async (
type: string,
- waitFor = 300
+ waitFor = 500
): Promise<WebviewResponseData | false> => {
return new Promise((resolve) => {
+ let timeout: NodeJS.Timeout | undefined = undefined;
const callback = (data: WebviewResponseData) => {
+ clearTimeout(timeout);
eUnSubscribeEvent(type, callback);
resolve(data);
};
eSubscribeEvent(type, callback);
- setTimeout(() => {
+ timeout = setTimeout(() => {
eUnSubscribeEvent(type, callback);
+ console.log(type, "failed call");
resolve(false);
}, waitFor);
});
@@ -117,12 +120,14 @@ export const waitForEvent = async (
waitFor = 300
): Promise<any> => {
return new Promise((resolve) => {
+ let timeout: NodeJS.Timeout | undefined = undefined;
const callback = (data: any) => {
+ clearTimeout(timeout);
eUnSubscribeEvent(type, callback);
resolve(data);
};
eSubscribeEvent(type, callback);
- setTimeout(() => {
+ timeout = setTimeout(() => {
eUnSubscribeEvent(type, callback);
resolve(false);
}, waitFor);
diff --git a/apps/mobile/app/screens/editor/wrapper.tsx b/apps/mobile/app/screens/editor/wrapper.tsx
index 1b7ea56c1..3fbcfb798 100644
--- a/apps/mobile/app/screens/editor/wrapper.tsx
+++ b/apps/mobile/app/screens/editor/wrapper.tsx
@@ -52,7 +52,13 @@ export type PaneWidths = {
};
};
-export const EditorWrapper = ({ widths }: { widths: PaneWidths }) => {
+export const EditorWrapper = ({
+ widths,
+ availableWidth
+}: {
+ widths: PaneWidths;
+ availableWidth: number;
+}) => {
const { colors } = useThemeColors();
const { colors: toolBarColors } = useThemeColors("editorToolbar");
const deviceMode = useSettingStore((state) => state.deviceMode);
@@ -95,7 +101,7 @@ export const EditorWrapper = ({ widths }: { widths: PaneWidths }) => {
style={[
{
width: isFullscreen
- ? dimensions.width
+ ? availableWidth
: widths[
!introCompleted ? "mobile" : (deviceMode as keyof PaneWidths)
]?.editor,
@@ -105,13 +111,13 @@ export const EditorWrapper = ({ widths }: { widths: PaneWidths }) => {
paddingLeft: isFullscreen
? deviceMode === "smallTablet"
? 0
- : dimensions.width * 0.15
+ : availableWidth * 0.15
: null,
paddingRight: isFullscreen
? deviceMode === "smallTablet"
? 0
- : dimensions.width * 0.15
- : insets.right,
+ : availableWidth * 0.15
+ : null,
borderLeftWidth: DDS.isTab ? 1 : 0,
borderLeftColor: DDS.isTab
? colors.secondary.background
diff --git a/packages/editor-mobile/src/components/editor.tsx b/packages/editor-mobile/src/components/editor.tsx
index 9f7469ca9..22b959249 100644
--- a/packages/editor-mobile/src/components/editor.tsx
+++ b/packages/editor-mobile/src/components/editor.tsx
@@ -37,8 +37,8 @@ import {
useState
} from "react";
import { useEditorController } from "../hooks/useEditorController";
-import { useSafeArea } from "../hooks/useSafeArea";
-import { useSettings } from "../hooks/useSettings";
+import { useSafeAreaStore } from "../hooks/useSafeArea";
+import { useSettingsStore } from "../hooks/useSettings";
import { TabItem, useTabContext, useTabStore } from "../hooks/useTabStore";
import { postAsyncWithTimeout, Settings } from "../utils";
import { EditorEvents } from "../utils/editor-events";
@@ -79,7 +79,7 @@ const Tiptap = ({
undo,
redo
});
- const insets = useSafeArea();
+ const insets = useSafeAreaStore((state) => state.insets);
tabRef.current = tab;
valueRef.current = {
undo,
@@ -986,7 +986,7 @@ const Tiptap = ({
};
const TiptapProvider = (): JSX.Element => {
- const settings = useSettings();
+ const settings = useSettingsStore((state) => state.settings);
const { colors } = useThemeColors("editor");
const contentRef = useRef<HTMLElement>();
diff --git a/packages/editor-mobile/src/components/header.tsx b/packages/editor-mobile/src/components/header.tsx
index d3aaf52e0..c14f960e9 100644
--- a/packages/editor-mobile/src/components/header.tsx
+++ b/packages/editor-mobile/src/components/header.tsx
@@ -33,7 +33,7 @@ import PlusIcon from "mdi-react/PlusIcon";
import PencilLockIcon from "mdi-react/PencilLockIcon";
import TableOfContentsIcon from "mdi-react/TableOfContentsIcon";
import React, { useRef, useState } from "react";
-import { useSafeArea } from "../hooks/useSafeArea";
+import { useSafeAreaStore } from "../hooks/useSafeArea";
import { useTabContext, useTabStore } from "../hooks/useTabStore";
import { Settings } from "../utils";
import { EditorEvents } from "../utils/editor-events";
@@ -140,7 +140,7 @@ function Header({
const tab = useTabContext();
const editor = editors[tab.id];
const tableOfContents = editorControllers[tab.id]?.getTableOfContents?.();
- const insets = useSafeArea();
+ const insets = useSafeAreaStore((state) => state.insets);
const openedTabsCount = useTabStore((state) => state.tabs.length);
const [isOpen, setOpen] = useState(false);
const btnRef = useRef(null);
diff --git a/packages/editor-mobile/src/components/readonly-editor.tsx b/packages/editor-mobile/src/components/readonly-editor.tsx
index 38ffa17a4..66328493c 100644
--- a/packages/editor-mobile/src/components/readonly-editor.tsx
+++ b/packages/editor-mobile/src/components/readonly-editor.tsx
@@ -26,12 +26,12 @@ import {
useRef,
useState
} from "react";
-import { useSettings } from "../hooks/useSettings";
+import { useSettingsStore } from "../hooks/useSettings";
import { Settings, isReactNative, randId } from "../utils";
import { EditorEvents } from "../utils/editor-events";
export const ReadonlyEditorProvider = (): JSX.Element => {
- const settings = useSettings();
+ const settings = useSettingsStore((state) => state.settings);
const { colors } = useThemeColors("editor");
const contentRef = useRef<HTMLElement>();
const getContentDiv = useCallback(() => {
diff --git a/packages/editor-mobile/src/hooks/useSafeArea.ts b/packages/editor-mobile/src/hooks/useSafeArea.ts
index e53bc6786..d27ab9e12 100644
--- a/packages/editor-mobile/src/hooks/useSafeArea.ts
+++ b/packages/editor-mobile/src/hooks/useSafeArea.ts
@@ -17,35 +17,30 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import { useState } from "react";
-import { SafeAreaType } from "../utils";
+import { create } from "zustand";
+import { createJSONStorage, persist } from "zustand/middleware";
+import type { SafeAreaType } from "../utils";
-const insetsStorage = localStorage.getItem("safeAreaInsets");
-const initialState =
- insetsStorage && !globalThis.noHeader
- ? JSON.parse(insetsStorage)
- : {
+type SafeAreaStore = {
+ insets: SafeAreaType;
+ setInsets: (insets: SafeAreaType) => void;
+};
+
+export const useSafeAreaStore = create<SafeAreaStore>()(
+ persist(
+ (set) => ({
+ insets: {
top: 0,
bottom: 0,
left: 0,
right: 0
- };
-
-global.safeAreaController = {
- update: (safeArea) => {
- if (safeAreaController.set) safeAreaController.set(safeArea);
- safeAreaController.previous = safeArea;
- localStorage.setItem("safeAreaInsets", JSON.stringify(safeArea));
- },
- reset: () => {
- if (safeAreaController.set) safeAreaController.set(initialState);
- },
- previous: initialState
-};
-
-export const useSafeArea = (): SafeAreaType => {
- const [safeArea, setSafeArea] = useState(global.safeAreaController.previous);
- global.safeAreaController.set = setSafeArea;
-
- return safeArea;
-};
+ },
+ setInsets: (insets) => set({ insets })
+ }),
+ {
+ name: "safeAreaInsets",
+ storage: createJSONStorage(() => localStorage),
+ partialize: (state) => ({ insets: state.insets })
+ }
+ )
+);
diff --git a/packages/editor-mobile/src/hooks/useSettings.ts b/packages/editor-mobile/src/hooks/useSettings.ts
index fe69edc56..2a5a3fbe5 100644
--- a/packages/editor-mobile/src/hooks/useSettings.ts
+++ b/packages/editor-mobile/src/hooks/useSettings.ts
@@ -18,11 +18,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { getDefaultPresets } from "@notesnook/editor";
-import { useEffect, useState } from "react";
-import { Settings } from "../utils";
+import { create } from "zustand";
+import { createJSONStorage, persist } from "zustand/middleware";
+import type { Settings } from "../utils";
-const settingsJson = localStorage.getItem("editorSettings");
-const initialState: Partial<Settings> = {
+type SettingsStore = {
+ settings: Settings;
+ setSettings: (settings?: Partial<Settings>) => void;
+};
+
+const initialSettings = {
fullscreen: false,
deviceMode: "mobile",
premium: false,
@@ -37,51 +42,30 @@ const initialState: Partial<Settings> = {
dateFormat: "DD-MM-YYYY",
loggedIn: false,
defaultLineHeight: 1.2
-};
-
-global.settingsController = {
- update: (settings) => {
- const nextSettings = {
- ...settings,
- noToolbar: globalThis.noToolbar || settings.noToolbar,
- noHeader: globalThis.noHeader || settings.noHeader,
- readonly: globalThis.readonly || settings.readonly
- };
- if (
- JSON.stringify(nextSettings) ===
- JSON.stringify(global.settingsController.previous)
- ) {
- return;
- }
- if (global.settingsController.set)
- global.settingsController.set(nextSettings);
- if (settings) {
- localStorage.setItem("editorSettings", JSON.stringify(nextSettings));
- } else {
- localStorage.removeItem("editorSettings");
- }
- settingsController.previous = { ...nextSettings };
- },
- previous: settingsJson ? JSON.parse(settingsJson) : { ...initialState }
-};
-global.settingsController.previous.noHeader = globalThis.noHeader;
-global.settingsController.previous.noToolbar = globalThis.noToolbar;
-global.settingsController.previous.readonly = globalThis.readonly;
-
-export const useSettings = (): Settings => {
- const [settings, setSettings] = useState({
- ...global.settingsController.previous
- });
- global.settingsController.set = setSettings;
+} as Settings;
- useEffect(() => {
- setSettings((current) =>
- JSON.stringify(current) ===
- JSON.stringify(global.settingsController.previous)
- ? current
- : { ...global.settingsController.previous }
- );
- }, []);
+export const useSettingsStore = create<SettingsStore>()(
+ persist(
+ (set, get) => ({
+ settings: initialSettings,
+ setSettings: (settings) => {
+ const nextSettings = {
+ ...get().settings,
+ ...settings,
+ noToolbar: globalThis.noToolbar || settings?.noToolbar,
+ noHeader: globalThis.noHeader || settings?.noHeader,
+ readonly: globalThis.readonly || settings?.readonly
+ } as Settings;
- return settings;
-};
+ if (JSON.stringify(nextSettings) !== JSON.stringify(get().settings)) {
+ set({ settings: nextSettings });
+ }
+ }
+ }),
+ {
+ name: "editorSettings",
+ storage: createJSONStorage(() => localStorage),
+ partialize: (state) => ({ settings: state.settings })
+ }
+ )
+);
diff --git a/packages/editor-mobile/src/index.tsx b/packages/editor-mobile/src/index.tsx
index 17507101a..6778dd810 100644
--- a/packages/editor-mobile/src/index.tsx
+++ b/packages/editor-mobile/src/index.tsx
@@ -16,9 +16,9 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+import "./polyfill";
import "./utils/index";
import "./utils/commands";
-global.Buffer = require("buffer").Buffer;
import { i18n, initLocale, setI18nGlobal } from "@notesnook/intl";
import "@notesnook/editor/styles/fonts.mobile.css";
import "@notesnook/editor/styles/katex-fonts.mobile.css";
diff --git a/packages/editor-mobile/src/polyfill.ts b/packages/editor-mobile/src/polyfill.ts
index 316cfff28..24a32af07 100644
--- a/packages/editor-mobile/src/polyfill.ts
+++ b/packages/editor-mobile/src/polyfill.ts
@@ -17,8 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import { Buffer } from "buffer/";
+import { Buffer } from "buffer";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-expect-error
globalThis.Buffer = Buffer;
diff --git a/packages/editor-mobile/src/theme-factory/index.tsx b/packages/editor-mobile/src/theme-factory/index.tsx
index f3495423a..099dd50be 100644
--- a/packages/editor-mobile/src/theme-factory/index.tsx
+++ b/packages/editor-mobile/src/theme-factory/index.tsx
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { PropsWithChildren, useMemo } from "react";
import { Theme, ThemeFactory, useThemeColors } from "@notesnook/theme";
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
+import { useSettingsStore } from "../hooks/useSettings";
const modifyToolbarTheme = (toolbarTheme: Theme) => {
toolbarTheme.space = [0, 10, 12, 18];
@@ -30,8 +31,8 @@ const modifyToolbarTheme = (toolbarTheme: Theme) => {
paddingX: "20px",
borderBottomWidth: 0
};
- const fontScale = settingsController.previous?.fontScale
- ? settingsController.previous?.fontScale
+ const fontScale = useSettingsStore.getState().settings.fontScale
+ ? useSettingsStore.getState().settings.fontScale
: 1;
toolbarTheme.iconSizes = {
big: 20 * fontScale,
diff --git a/packages/editor-mobile/src/utils/commands.ts b/packages/editor-mobile/src/utils/commands.ts
index c30cf4626..349156bcd 100644
--- a/packages/editor-mobile/src/utils/commands.ts
+++ b/packages/editor-mobile/src/utils/commands.ts
@@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { Attachment, ImageAttributes, LinkAttributes } from "@notesnook/editor";
import { Settings } from ".";
+import { useSafeAreaStore } from "../hooks/useSafeArea";
+import { useSettingsStore } from "../hooks/useSettings";
globalThis.commands = {
clearContent: (tabId: string) => {
@@ -90,21 +92,15 @@ globalThis.commands = {
},
setInsets: (insets: any) => {
- if (typeof safeAreaController !== "undefined") {
- safeAreaController.update(insets);
- }
+ useSafeAreaStore.getState().setInsets(insets);
},
updateSettings: (settings?: Partial<Settings>) => {
- if (typeof globalThis.settingsController !== "undefined") {
- globalThis.settingsController.update(settings as Settings);
- }
+ useSettingsStore.getState().setSettings(settings);
},
setSettings: (settings?: Partial<Settings>) => {
- if (typeof globalThis.settingsController !== "undefined") {
- globalThis.settingsController.update(settings as Settings);
- }
+ useSettingsStore.getState().setSettings(settings);
},
setTags: async (tabId: string, tags: any) => {
diff --git a/packages/editor-mobile/src/utils/index.ts b/packages/editor-mobile/src/utils/index.ts
index 4ea757de0..b025578cf 100644
--- a/packages/editor-mobile/src/utils/index.ts
+++ b/packages/editor-mobile/src/utils/index.ts
@@ -104,32 +104,12 @@ declare global {
*/
var editorControllers: Record<string, EditorController | undefined>;
- var settingsController: {
- update: (settings: Settings) => void;
- previous: Settings;
- set?: Dispatch<SetStateAction<Settings>>;
- };
-
var premiumController: {
update: (premium: boolean) => void;
previous: boolean;
set?: Dispatch<SetStateAction<boolean>>;
};
- var safeAreaController: {
- update: (insets: SafeAreaType) => void;
- reset: () => void;
- previous: SafeAreaType;
- set?: Dispatch<
- SetStateAction<{
- top: number;
- bottom: number;
- left: number;
- right: number;
- }>
- >;
- };
-
var editorTitles: Record<string, RefObject<HTMLTextAreaElement> | undefined>;
/**
* Global ref to manage tags in editor.