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: fix note toc not loading on app restart
Abdullah Atta08c6a9933662
diff --git a/apps/web/src/components/editor/table-of-contents.tsx b/apps/web/src/components/editor/table-of-contents.tsxindex 11892b7e3..7ad164c5e 100644--- a/apps/web/src/components/editor/table-of-contents.tsx+++ b/apps/web/src/components/editor/table-of-contents.tsx@@ -149,7 +149,7 @@ function TableOfContents(props: TableOfContentsProps) {key={t.id}sx={{textAlign: "left",- paddingLeft: `${t.level * 5}px`,+ paddingLeft: `${t.level * 5 + (t.level - 1) * 5}px`,py: 1,pr: 1,borderLeft: "5px solid transparent",diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsxindex ec5378c38..7b03c2d7e 100644--- a/apps/web/src/components/editor/tiptap.tsx+++ b/apps/web/src/components/editor/tiptap.tsx@@ -245,10 +245,13 @@ function TipTap(props: TipTapProps) {onDestroy: () => {useEditorManager.getState().setEditor(id);},- onTransaction: ({ editor }) => {+ onTransaction: ({ editor, transaction }) => {useEditorManager.getState().updateEditor(id, {canRedo: editor.can().redo(),- canUndo: editor.can().undo()+ canUndo: editor.can().undo(),+ tableOfContents: transaction.getMeta("isUpdatingContent")+ ? getTableOfContents(editor.view.dom)+ : useEditorManager.getState().getEditor(id)?.tableOfContents});},copyToClipboard(text, html) {@@ -487,6 +490,7 @@ function toIEditor(editor: Editor): IEditor {?.chain().command(({ tr }) => {tr.setMeta("preventSave", true);+ tr.setMeta("isUpdatingContent", true);return true;}).setContent(content, false, { preserveWhitespace: true })