mirror of
https://github.com/docmost/docmost.git
synced 2025-11-18 15:21:11 +10:00
refactor layout
* ui polishing * frontend and backend fixes
This commit is contained in:
@ -10,12 +10,23 @@ export interface FullEditorProps {
|
||||
pageId: string;
|
||||
slugId: string;
|
||||
title: string;
|
||||
spaceSlug: string;
|
||||
}
|
||||
|
||||
export function FullEditor({ pageId, title, slugId }: FullEditorProps) {
|
||||
export function FullEditor({
|
||||
pageId,
|
||||
title,
|
||||
slugId,
|
||||
spaceSlug,
|
||||
}: FullEditorProps) {
|
||||
return (
|
||||
<div className={classes.editor}>
|
||||
<MemoizedTitleEditor pageId={pageId} slugId={slugId} title={title} />
|
||||
<MemoizedTitleEditor
|
||||
pageId={pageId}
|
||||
slugId={slugId}
|
||||
title={title}
|
||||
spaceSlug={spaceSlug}
|
||||
/>
|
||||
<MemoizedPageEditor pageId={pageId} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -13,7 +13,7 @@ import { authTokensAtom } from "@/features/auth/atoms/auth-tokens-atom";
|
||||
import useCollaborationUrl from "@/features/editor/hooks/use-collaboration-url";
|
||||
import { currentUserAtom } from "@/features/user/atoms/current-user-atom";
|
||||
import { pageEditorAtom } from "@/features/editor/atoms/editor-atoms";
|
||||
import { asideStateAtom } from "@/components/navbar/atoms/sidebar-atom";
|
||||
import { asideStateAtom } from "@/components/layouts/global/hooks/atoms/sidebar-atom";
|
||||
import {
|
||||
activeCommentIdAtom,
|
||||
showCommentPopupAtom,
|
||||
|
||||
@ -20,16 +20,22 @@ import { treeDataAtom } from "@/features/page/tree/atoms/tree-data-atom";
|
||||
import { updateTreeNodeName } from "@/features/page/tree/utils";
|
||||
import { useQueryEmit } from "@/features/websocket/use-query-emit.ts";
|
||||
import { History } from "@tiptap/extension-history";
|
||||
import { buildPageSlug } from "@/features/page/page.utils.ts";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { buildPageUrl } from "@/features/page/page.utils.ts";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
|
||||
export interface TitleEditorProps {
|
||||
pageId: string;
|
||||
slugId: string;
|
||||
title: string;
|
||||
spaceSlug: string;
|
||||
}
|
||||
|
||||
export function TitleEditor({ pageId, slugId, title }: TitleEditorProps) {
|
||||
export function TitleEditor({
|
||||
pageId,
|
||||
slugId,
|
||||
title,
|
||||
spaceSlug,
|
||||
}: TitleEditorProps) {
|
||||
const [debouncedTitleState, setDebouncedTitleState] = useState(null);
|
||||
const [debouncedTitle] = useDebouncedValue(debouncedTitleState, 1000);
|
||||
const updatePageMutation = useUpdatePageMutation();
|
||||
@ -37,6 +43,7 @@ export function TitleEditor({ pageId, slugId, title }: TitleEditorProps) {
|
||||
const [, setTitleEditor] = useAtom(titleEditorAtom);
|
||||
const [treeData, setTreeData] = useAtom(treeDataAtom);
|
||||
const emit = useQueryEmit();
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const titleEditor = useEditor({
|
||||
@ -69,7 +76,7 @@ export function TitleEditor({ pageId, slugId, title }: TitleEditorProps) {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const pageSlug = buildPageSlug(slugId, title);
|
||||
const pageSlug = buildPageUrl(spaceSlug, slugId, title);
|
||||
navigate(pageSlug, { replace: true });
|
||||
}, [title]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user