Various commenting improvements (#4941)

* fix: New threads attached to previous as replies

* fix: Cannot use floating toolbar properly in comments

* perf: Avoid re-writing history on click in editor

* fix: Comment on text selection

* fix: 'Copy link' on comments uses wrong hostname

* Show comment buttons on input focus rather than non-empty input
Increase maximum sidebar size

* Allow opening comments from document menu

* fix: Clicking comment menu should not focus thread

* fix: Selection color

* fix: Draft comments not restored

* Add border above document level comment input

* fix: Floating toolbar not constrainted by offset parent

* fix flash of no comment on saving

* fix: Clicking on editor does not remove draft mark
This commit is contained in:
Tom Moor
2023-02-27 19:50:35 -05:00
committed by GitHub
parent 6b00ced48f
commit fff0812659
7 changed files with 91 additions and 72 deletions

View File

@@ -9,13 +9,17 @@ import Scrollable from "~/components/Scrollable";
import Tooltip from "~/components/Tooltip";
type Props = React.HTMLAttributes<HTMLDivElement> & {
/* The title of the sidebar */
title: React.ReactNode;
/* The content of the sidebar */
children: React.ReactNode;
/* Called when the sidebar is closed */
onClose: React.MouseEventHandler;
border?: boolean;
/* Whether the sidebar should be scrollable */
scrollable?: boolean;
};
function SidebarLayout({ title, onClose, children }: Props) {
function SidebarLayout({ title, onClose, children, scrollable = true }: Props) {
const { t } = useTranslation();
return (
@@ -31,9 +35,13 @@ function SidebarLayout({ title, onClose, children }: Props) {
/>
</Tooltip>
</Header>
<Scrollable hiddenScrollbars topShadow>
{children}
</Scrollable>
{scrollable ? (
<Scrollable hiddenScrollbars topShadow>
{children}
</Scrollable>
) : (
children
)}
</>
);
}