fix: Command bar should bust cache when docs and collections are renamed

fix: Command bar should get larger on large screens
fix: Editable titles in sidebar should enforce max length
This commit is contained in:
Tom Moor
2021-10-24 17:26:35 -07:00
parent 7f3df8158a
commit 2e56bdc388
6 changed files with 20 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import * as React from "react";
import { useDrag, useDrop } from "react-dnd";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import { MAX_TITLE_LENGTH } from "shared/constants";
import Collection from "models/Collection";
import Document from "models/Document";
import Fade from "components/Fade";
@@ -242,6 +243,7 @@ function DocumentLink(
title={node.title || t("Untitled")}
onSubmit={handleTitleChange}
canUpdate={canUpdate}
maxLength={MAX_TITLE_LENGTH}
/>
</>
}

View File

@@ -7,9 +7,10 @@ type Props = {|
onSubmit: (title: string) => Promise<void>,
title: string,
canUpdate: boolean,
maxLength?: number,
|};
function EditableTitle({ title, onSubmit, canUpdate }: Props) {
function EditableTitle({ title, onSubmit, canUpdate, ...rest }: Props) {
const [isEditing, setIsEditing] = React.useState(false);
const [originalValue, setOriginalValue] = React.useState(title);
const [value, setValue] = React.useState(title);
@@ -79,6 +80,7 @@ function EditableTitle({ title, onSubmit, canUpdate }: Props) {
onChange={handleChange}
onBlur={handleSave}
autoFocus
{...rest}
/>
</form>
) : (

View File

@@ -4,6 +4,7 @@ import * as React from "react";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import { MAX_TITLE_LENGTH } from "shared/constants";
import Fade from "components/Fade";
import useStores from "../../../hooks/useStores";
import Disclosure from "./Disclosure";
@@ -85,6 +86,7 @@ function StarredLink({ depth, title, to, documentId, collectionId }: Props) {
title={title || t("Untitled")}
onSubmit={handleTitleChange}
canUpdate={canUpdate}
maxLength={MAX_TITLE_LENGTH}
/>
</>
}