Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
fix(web): correct task checkbox toggling in multi-section memos
Stevend30ff2898fbe
diff --git a/web/src/components/MemoContent/MemoContentContext.tsx b/web/src/components/MemoContent/MemoContentContext.tsxindex e2e36f943..3be3eeb97 100644--- a/web/src/components/MemoContent/MemoContentContext.tsx+++ b/web/src/components/MemoContent/MemoContentContext.tsx@@ -19,6 +19,9 @@ export interface MemoContentContextType {/** Parent page path (for navigation) */parentPage?: string;++ /** Reference to the container element for the memo content */+ containerRef?: React.RefObject<HTMLDivElement>;}export const MemoContentContext = createContext<MemoContentContextType>({diff --git a/web/src/components/MemoContent/TaskListItem.tsx b/web/src/components/MemoContent/TaskListItem.tsxindex e9365a2a5..eeebf1444 100644--- a/web/src/components/MemoContent/TaskListItem.tsx+++ b/web/src/components/MemoContent/TaskListItem.tsx@@ -44,8 +44,14 @@ export const TaskListItem: React.FC<TaskListItemProps> = ({ checked, ...props })if (taskIndexStr !== null) {taskIndex = parseInt(taskIndexStr);} else {- // Fallback: Calculate index by counting previous task list items- const allTaskItems = listItem.closest("ul, ol")?.querySelectorAll("li.task-list-item") || [];+ // Fallback: Calculate index by counting ALL task list items in the memo+ // Use the container ref from context for proper scoping+ const container = context.containerRef?.current;+ if (!container) {+ return;+ }++ const allTaskItems = container.querySelectorAll("li.task-list-item");for (let i = 0; i < allTaskItems.length; i++) {if (allTaskItems[i] === listItem) {taskIndex = i;diff --git a/web/src/components/MemoContent/index.tsx b/web/src/components/MemoContent/index.tsxindex e1b510ce2..a1483fe9e 100644--- a/web/src/components/MemoContent/index.tsx+++ b/web/src/components/MemoContent/index.tsx@@ -49,6 +49,7 @@ const MemoContent = observer((props: Props) => {readonly: !allowEdit,disableFilter: props.disableFilter,parentPage: props.parentPage,+ containerRef: memoContentContainerRef,};// Initial compact mode.