@@ -9,6 +9,7 @@ import { toast } from "sonner";
|
||||
import styled from "styled-components";
|
||||
import breakpoint from "styled-components-breakpoint";
|
||||
import { s, ellipsis } from "@shared/styles";
|
||||
import { UserPreference } from "@shared/types";
|
||||
import { getEventFiles } from "@shared/utils/files";
|
||||
import Document from "~/models/Document";
|
||||
import ContextMenu from "~/components/ContextMenu";
|
||||
@@ -324,7 +325,13 @@ function DocumentMenu({
|
||||
label={t("Full width")}
|
||||
checked={document.fullWidth}
|
||||
onChange={(ev) => {
|
||||
document.fullWidth = ev.currentTarget.checked;
|
||||
const fullWidth = ev.currentTarget.checked;
|
||||
user.setPreference(
|
||||
UserPreference.FullWidthDocuments,
|
||||
fullWidth
|
||||
);
|
||||
void user.save();
|
||||
document.fullWidth = fullWidth;
|
||||
void document.save();
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useHistory, useLocation, useRouteMatch } from "react-router-dom";
|
||||
import { toast } from "sonner";
|
||||
import { UserPreference } from "@shared/types";
|
||||
import CenteredContent from "~/components/CenteredContent";
|
||||
import Flex from "~/components/Flex";
|
||||
import PlaceholderDocument from "~/components/PlaceholderDocument";
|
||||
@@ -42,7 +43,9 @@ function DocumentNew({ template }: Props) {
|
||||
const document = await documents.create({
|
||||
collectionId: collection?.id,
|
||||
parentDocumentId,
|
||||
fullWidth: parentDocument?.fullWidth,
|
||||
fullWidth:
|
||||
parentDocument?.fullWidth ||
|
||||
user.getPreference(UserPreference.FullWidthDocuments),
|
||||
templateId: query.get("templateId") ?? undefined,
|
||||
template,
|
||||
title: "",
|
||||
|
||||
@@ -116,6 +116,8 @@ export enum UserPreference {
|
||||
CodeBlockLineNumers = "codeBlockLineNumbers",
|
||||
/** Whether documents have a separate edit mode instead of always editing. */
|
||||
SeamlessEdit = "seamlessEdit",
|
||||
/** Whether documents should start in full-width mode. */
|
||||
FullWidthDocuments = "fullWidthDocuments",
|
||||
}
|
||||
|
||||
export type UserPreferences = { [key in UserPreference]?: boolean };
|
||||
|
||||
Reference in New Issue
Block a user