[WEB-735] chore: added a custom placeholder prop to all the editors (#4194)

* chore: added a custom placeholder prop to all the editors

* chore: inbox issue create modal placeholder
This commit is contained in:
Aaryan Khandelwal 2024-04-15 20:00:02 +05:30 committed by GitHub
parent 77b323f562
commit abce0ed946
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 102 additions and 80 deletions

View file

@ -38,8 +38,10 @@ export const InboxIssueDescription: FC<TInboxIssueDescription> = observer((props
workspaceId={workspaceId}
projectId={projectId}
dragDropEnabled={false}
onChange={(_description: object, description_html: string) => {
handleData("description_html", description_html);
onChange={(_description: object, description_html: string) => handleData("description_html", description_html)}
placeholder={(isFocused) => {
if (isFocused) return "Press '/' for commands...";
else return "Click to add description";
}}
/>
</div>

View file

@ -19,6 +19,7 @@ export type IssueDescriptionInputProps = {
initialValue: string | undefined;
disabled?: boolean;
issueOperations: TIssueOperations;
placeholder?: string | ((isFocused: boolean) => string);
setIsSubmitting: (initialValue: "submitting" | "submitted" | "saved") => void;
swrIssueDescription: string | null | undefined;
};
@ -33,6 +34,7 @@ export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = observer((p
initialValue,
issueOperations,
setIsSubmitting,
placeholder,
} = props;
const { handleSubmit, reset, control } = useForm<TIssue>({
@ -103,6 +105,14 @@ export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = observer((p
onChange(description_html);
debouncedFormSave();
}}
placeholder={
placeholder
? placeholder
: (isFocused) => {
if (isFocused) return "Press '/' for commands...";
else return "Click to add description";
}
}
/>
) : (
<RichTextReadOnlyEditor

View file

@ -477,6 +477,10 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
}}
ref={editorRef}
tabIndex={getTabIndex("description_html")}
placeholder={(isFocused) => {
if (isFocused) return "Press '/' for commands...";
else return "Click to add description";
}}
/>
)}
/>