From 7145e0be27d0a97bde9d3805a7b356c4c9f4f0f9 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Fri, 23 Jun 2023 23:38:39 -0400 Subject: [PATCH] fix: Fix some more private message form stuff --- .../components/common/markdown-textarea.tsx | 12 +++++++++++ .../private_message/private-message-form.tsx | 17 ++++----------- .../private_message/private-message.tsx | 21 +++++++++++++++---- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index 73946ea8..97a26a74 100644 --- a/src/shared/components/common/markdown-textarea.tsx +++ b/src/shared/components/common/markdown-textarea.tsx @@ -23,15 +23,27 @@ import NavigationPrompt from "./navigation-prompt"; import ProgressBar from "./progress-bar"; interface MarkdownTextAreaProps { + /** + * Initial content inside the textarea + */ initialContent?: string; + /** + * Numerical ID of the language to select in dropdown + */ initialLanguageId?: number; placeholder?: string; buttonTitle?: string; maxLength?: number; + /** + * Whether this form is for a reply to a Private Message + */ replyType?: boolean; focus?: boolean; disabled?: boolean; finished?: boolean; + /** + * Whether to show the language selector + */ showLanguage?: boolean; hideNavigationWarnings?: boolean; onContentChange?(val: string): void; diff --git a/src/shared/components/private_message/private-message-form.tsx b/src/shared/components/private_message/private-message-form.tsx index 12fd9bd2..147269a5 100644 --- a/src/shared/components/private_message/private-message-form.tsx +++ b/src/shared/components/private_message/private-message-form.tsx @@ -1,6 +1,6 @@ import { myAuthRequired } from "@utils/app"; import { capitalizeFirstLetter } from "@utils/helpers"; -import { Component, InfernoNode, linkEvent } from "inferno"; +import { Component, InfernoNode } from "inferno"; import { T } from "inferno-i18next-dess"; import { CreatePrivateMessage, @@ -19,6 +19,7 @@ import { PersonListing } from "../person/person-listing"; interface PrivateMessageFormProps { recipient: Person; privateMessageView?: PrivateMessageView; // If a pm is given, that means this is an edit + replyType?: boolean; onCancel?(): any; onCreate?(form: CreatePrivateMessage): void; onEdit?(form: EditPrivateMessage): void; @@ -113,6 +114,8 @@ export class PrivateMessageForm extends Component< allLanguages={[]} siteLanguages={[]} hideNavigationWarnings + onReplyCancel={() => handleCancel()} + replyType={this.props.replyType} buttonTitle={ this.props.privateMessageView ? capitalizeFirstLetter(I18NextService.i18n.t("save")) @@ -121,18 +124,6 @@ export class PrivateMessageForm extends Component< /> - -
- {this.props.privateMessageView && ( - - )} -
); } diff --git a/src/shared/components/private_message/private-message.tsx b/src/shared/components/private_message/private-message.tsx index af8d64e5..110a908f 100644 --- a/src/shared/components/private_message/private-message.tsx +++ b/src/shared/components/private_message/private-message.tsx @@ -145,6 +145,7 @@ export class PrivateMessage extends Component< <>