Skip to content

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

mobile: make tab active on focus

Ammar Ahmedab33aa7ebd92
diff --git a/packages/editor-mobile/src/components/editor.tsx b/packages/editor-mobile/src/components/editor.tsx
index 3330c9aee..3096176e1 100644
--- a/packages/editor-mobile/src/components/editor.tsx
+++ b/packages/editor-mobile/src/components/editor.tsx
@@ -74,7 +74,7 @@ const Tiptap = ({
const tabRef = useRef<TabItem>(tab);
const biometryAvailable = useTabStore((state) => state.biometryAvailable);
const biometryEnrolled = useTabStore((state) => state.biometryEnrolled);
-
+ const editorRoot = useRef<HTMLDivElement>(null);
const isFocusedRef = useRef<boolean>(false);
tabRef.current = tab;
@@ -228,6 +228,8 @@ const Tiptap = ({
if (!getContentDiv().parentElement) {
contentPlaceholderRef.current?.appendChild(getContentDiv());
}
+ const editorRootElement = editorRoot.current;
+ editorRootElement?.classList.add("active");
if (!didCallOnLoad) {
didCallOnLoad = true;
@@ -282,7 +284,10 @@ const Tiptap = ({
if (state.currentTab === prevState.currentTab) return;
updateScrollPosition(state);
});
+ logger("info", tabRef.current.id, "active");
return () => {
+ editorRootElement?.classList.remove("active");
+ logger("info", tabRef.current.id, "inactive");
unsub();
};
}, [getContentDiv]);
@@ -358,7 +363,7 @@ const Tiptap = ({
flexDirection: "column",
maxWidth: "100vw"
}}
- id="editorroot"
+ ref={editorRoot}
onDoubleClick={onClickEmptyArea}
>
<Header