A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: remove auto item reveal when opening items
Abdullah Atta25956ccadb8c
diff --git a/apps/web/src/components/list-container/index.tsx b/apps/web/src/components/list-container/index.tsxindex 8ea97d84b..6978e11f8 100644--- a/apps/web/src/components/list-container/index.tsx+++ b/apps/web/src/components/list-container/index.tsx@@ -17,13 +17,7 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import {- forwardRef,- useEffect,- useLayoutEffect,- useRef,- useState-} from "react";+import { forwardRef, useEffect, useRef, useState } from "react";import { Flex, Button } from "@theme-ui/components";import { Plus } from "../icons";import {@@ -50,7 +44,6 @@ import {} from "react-virtuoso";import { getRandom, useResolvedItem } from "@notesnook/common";import { Context } from "./types";-import { AppEventManager, AppEvents } from "../../common/app-events";export const CustomScrollbarsVirtualList = forwardRef<HTMLDivElement,@@ -96,7 +89,7 @@ function ListContainer(props: ListContainerProps) {const listRef = useRef<VirtuosoHandle>(null);const listContainerRef = useRef(null);- const activeItem = useRef<{ focus: boolean; id: string }>();+ // const activeItem = useRef<{ focus: boolean; id: string }>();useEffect(() => {return () => {@@ -104,42 +97,6 @@ function ListContainer(props: ListContainerProps) {};}, []);- useLayoutEffect(() => {- if (activeItem.current) {- items- .ids()- .then(- (ids) =>- listRef.current &&- activeItem.current &&- revealItemInList(- listRef.current,- activeItem.current.id,- ids,- activeItem.current.focus- )- );- }-- const event = AppEventManager.subscribe(- AppEvents.revealItemInList,- (id, focus) => {- if (activeItem.current?.id === id) return;- activeItem.current = { id, focus };- items- .ids()- .then(- (ids) =>- listRef.current &&- revealItemInList(listRef.current, id, ids, focus)- );- }- );- return () => {- event.unsubscribe();- };- }, [items]);-const { onMouseUp, onKeyDown } = useKeyboardListNavigation({length: items.length,reset: () => toggleSelection(false),@@ -442,20 +399,3 @@ export function waitForElement(}});}--function revealItemInList(- list: VirtuosoHandle,- itemId: string,- ids: string[],- focus: boolean-) {- const index = ids.indexOf(itemId);- if (index === -1) return;- waitForElement(- list,- index,- `id_${itemId}`,- (element) => focus && element.focus(),- { align: "center" }- );-}