From: Jay Sitter Date: Sat, 24 Jun 2023 03:38:39 +0000 (-0400) Subject: fix: Fix some more private message form stuff X-Git-Url: http://these/git/readmes/%7Bthis.props.banner%7D?a=commitdiff_plain;h=7145e0be27d0a97bde9d3805a7b356c4c9f4f0f9;p=lemmy-ui.git fix: Fix some more private message form stuff --- diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index 73946ea..97a26a7 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 12fd9bd..147269a 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 af8d64e..110a908 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< <>