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
editor: insert new p at end of document on click
Abdullah Atta06dd760325fc
diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsxindex 24b4fdf0d..7f3733194 100644--- a/apps/web/src/components/editor/tiptap.tsx+++ b/apps/web/src/components/editor/tiptap.tsx@@ -235,8 +235,14 @@ function TipTap(props: TipTapProps) {if (!editorContainer) return;const currentEditor = editor;function onClick(e: MouseEvent) {- if (currentEditor?.isFocused || e.target !== editorContainer) return;- currentEditor?.commands.focus("end");+ if (e.target !== editorContainer) return;+ const lastNode = currentEditor?.state.doc.lastChild;+ const isLastNodeParagraph = lastNode?.type.name === "paragraph";+ const isEmpty = lastNode?.nodeSize === 2;+ if (isLastNodeParagraph && isEmpty) currentEditor?.commands.focus("end");+ else {+ currentEditor?.chain().focus("end").insertContent("<p></p>").run();+ }}editorContainer.addEventListener("click", onClick);return () => {