diff --git a/app/scenes/Document/components/CommentForm.tsx b/app/scenes/Document/components/CommentForm.tsx
index 5accb27e5..0cb297f00 100644
--- a/app/scenes/Document/components/CommentForm.tsx
+++ b/app/scenes/Document/components/CommentForm.tsx
@@ -24,6 +24,7 @@ import useOnClickOutside from "~/hooks/useOnClickOutside";
import useStores from "~/hooks/useStores";
import CommentEditor from "./CommentEditor";
import { Bubble } from "./CommentThreadItem";
+import { HighlightedText } from "./HighlightText";
type Props = {
/** Callback when the draft should be saved. */
@@ -42,6 +43,8 @@ type Props = {
standalone?: boolean;
/** Whether to animate the comment form in and out */
animatePresence?: boolean;
+ /** Text to highlight at the top of the comment */
+ highlightedText?: string;
/** The text direction of the editor */
dir?: "rtl" | "ltr";
/** Callback when the user is typing in the editor */
@@ -64,6 +67,7 @@ function CommentForm({
standalone,
placeholder,
animatePresence,
+ highlightedText,
dir,
...rest
}: Props) {
@@ -274,6 +278,9 @@ function CommentForm({
$firstOfThread={standalone}
column
>
+ {highlightedText && (
+ {highlightedText}
+ )}
)}
diff --git a/app/scenes/Document/components/CommentThreadItem.tsx b/app/scenes/Document/components/CommentThreadItem.tsx
index ada71ffbc..aeda32d28 100644
--- a/app/scenes/Document/components/CommentThreadItem.tsx
+++ b/app/scenes/Document/components/CommentThreadItem.tsx
@@ -19,8 +19,9 @@ import Text from "~/components/Text";
import Time from "~/components/Time";
import useBoolean from "~/hooks/useBoolean";
import CommentMenu from "~/menus/CommentMenu";
-import { hover, truncateMultiline } from "~/styles";
+import { hover } from "~/styles";
import CommentEditor from "./CommentEditor";
+import { HighlightedText } from "./HighlightText";
/**
* Hook to calculate if we should display a timestamp on a comment
@@ -127,12 +128,12 @@ function CommentThreadItem({
const handleCancel = () => {
setData(toJS(comment.data));
setReadOnly();
- setForceRender((s) => ++s);
+ setForceRender((i) => ++i);
};
React.useEffect(() => {
setData(toJS(comment.data));
- setForceRender((s) => ++s);
+ setForceRender((i) => ++i);
}, [comment.data]);
return (
@@ -240,28 +241,6 @@ const Body = styled.form`
border-radius: 2px;
`;
-const HighlightedText = styled(Text)`
- position: relative;
- color: ${s("textSecondary")};
- font-size: 14px;
- padding: 0 8px;
- margin: 4px 0;
- display: inline-block;
-
- ${truncateMultiline(3)}
-
- &:after {
- content: "";
- width: 2px;
- position: absolute;
- left: 0;
- top: 2px;
- bottom: 2px;
- background: ${s("commentMarkBackground")};
- border-radius: 2px;
- }
-`;
-
const Menu = styled(CommentMenu)<{ dir?: "rtl" | "ltr" }>`
position: absolute;
left: ${(props) => (props.dir !== "rtl" ? "auto" : "4px")};
diff --git a/app/scenes/Document/components/Comments.tsx b/app/scenes/Document/components/Comments.tsx
index 482efa5c6..fe485232c 100644
--- a/app/scenes/Document/components/Comments.tsx
+++ b/app/scenes/Document/components/Comments.tsx
@@ -42,7 +42,6 @@ function Comments() {
.threadsInDocument(document.id)
.filter((thread) => !thread.isNew || thread.createdById === user.id);
const hasComments = threads.length > 0;
- const hasMultipleComments = comments.inDocument(document.id).length > 1;
return (