mirror of
https://github.com/docmost/docmost.git
synced 2025-11-18 18:41:11 +10:00
* lock/unlock pages * remove using isLocked column - add default page edit state preference * * Move state management to editors (avoids flickers on edit mode switch) * Rename variables * Add strings to translation file * Memoize components in page component * Fix title editor sending update request on editable state change * fixed errors merging main * Fix embed view in read-only mode * remove unused line * sync * fix responsiveness on mobile --------- Co-authored-by: Philipinho <16838612+Philipinho@users.noreply.github.com>
53 lines
1.2 KiB
TypeScript
53 lines
1.2 KiB
TypeScript
import classes from "@/features/editor/styles/editor.module.css";
|
|
import React from "react";
|
|
import { TitleEditor } from "@/features/editor/title-editor";
|
|
import PageEditor from "@/features/editor/page-editor";
|
|
import { Container } from "@mantine/core";
|
|
import { useAtom } from "jotai";
|
|
import { userAtom } from "@/features/user/atoms/current-user-atom.ts";
|
|
|
|
const MemoizedTitleEditor = React.memo(TitleEditor);
|
|
const MemoizedPageEditor = React.memo(PageEditor);
|
|
|
|
export interface FullEditorProps {
|
|
pageId: string;
|
|
slugId: string;
|
|
title: string;
|
|
content: string;
|
|
spaceSlug: string;
|
|
editable: boolean;
|
|
}
|
|
|
|
export function FullEditor({
|
|
pageId,
|
|
title,
|
|
slugId,
|
|
content,
|
|
spaceSlug,
|
|
editable,
|
|
}: FullEditorProps) {
|
|
const [user] = useAtom(userAtom);
|
|
const fullPageWidth = user.settings?.preferences?.fullPageWidth;
|
|
|
|
return (
|
|
<Container
|
|
fluid={fullPageWidth}
|
|
size={!fullPageWidth && 900}
|
|
className={classes.editor}
|
|
>
|
|
<MemoizedTitleEditor
|
|
pageId={pageId}
|
|
slugId={slugId}
|
|
title={title}
|
|
spaceSlug={spaceSlug}
|
|
editable={editable}
|
|
/>
|
|
<MemoizedPageEditor
|
|
pageId={pageId}
|
|
editable={editable}
|
|
content={content}
|
|
/>
|
|
</Container>
|
|
);
|
|
}
|