From 6fd030a31351f80f4e07cbc645647f2e2a6d60d4 Mon Sep 17 00:00:00 2001 From: marshennikovaolga Date: Sun, 11 Aug 2024 14:58:37 +0300 Subject: [PATCH] create page --- .../custom/sidebar/partial/page-section.tsx | 2 +- web/components/routes/page/detail/wrapper.tsx | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/web/components/custom/sidebar/partial/page-section.tsx b/web/components/custom/sidebar/partial/page-section.tsx index 5d7a1a05..d51c99bd 100644 --- a/web/components/custom/sidebar/partial/page-section.tsx +++ b/web/components/custom/sidebar/partial/page-section.tsx @@ -81,7 +81,7 @@ const CreatePageForm: React.FC = () => { route.push(`/pages/${newPersonalPage.id}`) - toast.success("Page created successfully") + // toast.success("Page created successfully") } catch (error) { console.error(error) toast.error("Failed to create page") diff --git a/web/components/routes/page/detail/wrapper.tsx b/web/components/routes/page/detail/wrapper.tsx index 5abab1a5..5c16a327 100644 --- a/web/components/routes/page/detail/wrapper.tsx +++ b/web/components/routes/page/detail/wrapper.tsx @@ -2,7 +2,7 @@ import React, { useCallback, useRef, useEffect } from "react" import { LAEditor, LAEditorRef } from "@/components/la-editor" -import { DetailPageHeader } from "./header" +// import { DetailPageHeader } from "./header" //dont need. check figma import { ID } from "jazz-tools" import { PersonalPage } from "@/lib/schema/personal-page" import { Content, EditorContent, useEditor } from "@tiptap/react" @@ -25,7 +25,7 @@ export function DetailPageWrapper({ pageId }: { pageId: string }) {
- } /> + {/* } /> */}
@@ -59,8 +59,11 @@ const DetailPageForm = ({ page }: { page: PersonalPage }) => { const personalPages = me.root?.personalPages?.toJSON() || [] const slug = generateUniqueSlug(personalPages, page.slug) - page.title = newTitle + const capitalizedTitle = newTitle.charAt(0).toUpperCase() + newTitle.slice(1) + page.title = capitalizedTitle page.slug = slug + + editor.commands.setContent(capitalizedTitle) } const handleTitleKeyDown = useCallback((view: EditorView, event: KeyboardEvent) => { @@ -140,7 +143,8 @@ const DetailPageForm = ({ page }: { page: PersonalPage }) => { handleKeyDown: handleTitleKeyDown }, onCreate: ({ editor }) => { - editor.commands.setContent(`

${page.title}

`) + const capitalizedTitle = page.title.charAt(0).toUpperCase() + page.title.slice(1) + editor.commands.setContent(`

${capitalizedTitle}

`) }, onBlur: ({ editor }) => handleTitleBlur(editor) })