From 999b6a926985011800096c06610c092ca0e8212d Mon Sep 17 00:00:00 2001 From: Zubair Shakoor Date: Wed, 21 May 2025 23:11:33 +0500 Subject: [PATCH 1/3] fix: Added * for required fields in labels --- src/discussions/posts/post-editor/PostEditor.jsx | 1 + src/discussions/posts/post-editor/messages.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/discussions/posts/post-editor/PostEditor.jsx b/src/discussions/posts/post-editor/PostEditor.jsx index a2f57959c..6e01a794c 100644 --- a/src/discussions/posts/post-editor/PostEditor.jsx +++ b/src/discussions/posts/post-editor/PostEditor.jsx @@ -409,6 +409,7 @@ const PostEditor = ({ value={values.comment} onEditorChange={formikCompatibleHandler(handleChange, 'comment')} onBlur={formikCompatibleHandler(handleBlur, 'comment')} + placeholder={'Post content*'} /> diff --git a/src/discussions/posts/post-editor/messages.js b/src/discussions/posts/post-editor/messages.js index e91781317..7e8821a52 100644 --- a/src/discussions/posts/post-editor/messages.js +++ b/src/discussions/posts/post-editor/messages.js @@ -55,7 +55,7 @@ const messages = defineMessages({ }, postTitle: { id: 'discussions.post.editor.title', - defaultMessage: 'Post title', + defaultMessage: 'Post title*', }, titleDescription: { id: 'discussions.post.editor.titleDescription', From a4fe4c10d0866386e5088de8a60b79a57e5f51fd Mon Sep 17 00:00:00 2001 From: Zubair Shakoor Date: Wed, 21 May 2025 23:43:31 +0500 Subject: [PATCH 2/3] fix: placeholder props added --- src/components/TinyMCEEditor.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/TinyMCEEditor.jsx b/src/components/TinyMCEEditor.jsx index 510adf17e..cde183286 100644 --- a/src/components/TinyMCEEditor.jsx +++ b/src/components/TinyMCEEditor.jsx @@ -152,6 +152,7 @@ const TinyMCEEditor = (props) => { relative_urls: false, default_link_target: '_blank', target_list: false, + placeholder: props.placeholder, images_upload_handler: uploadHandler, setup, }} From 7ec40b91237e91313c998dac13d3ffc2a8437293 Mon Sep 17 00:00:00 2001 From: Zubair Shakoor Date: Tue, 3 Jun 2025 14:26:49 +0500 Subject: [PATCH 3/3] fix: linter fixes and requested changes added --- src/components/TinyMCEEditor.jsx | 9 +++++++++ src/discussions/posts/post-editor/PostEditor.jsx | 2 +- src/discussions/posts/post-editor/messages.js | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/TinyMCEEditor.jsx b/src/components/TinyMCEEditor.jsx index cde183286..ff266ef4a 100644 --- a/src/components/TinyMCEEditor.jsx +++ b/src/components/TinyMCEEditor.jsx @@ -1,4 +1,5 @@ import React, { useCallback, useEffect, useState } from 'react'; +import PropTypes from 'prop-types'; import { ActionRow, AlertModal, Button } from '@openedx/paragon'; import { Editor } from '@tinymce/tinymce-react'; @@ -179,4 +180,12 @@ const TinyMCEEditor = (props) => { ); }; +TinyMCEEditor.propTypes = { + placeholder: PropTypes.string, +}; + +TinyMCEEditor.defaultProps = { + placeholder: '', +}; + export default React.memo(TinyMCEEditor); diff --git a/src/discussions/posts/post-editor/PostEditor.jsx b/src/discussions/posts/post-editor/PostEditor.jsx index 6e01a794c..2a4c62120 100644 --- a/src/discussions/posts/post-editor/PostEditor.jsx +++ b/src/discussions/posts/post-editor/PostEditor.jsx @@ -409,7 +409,7 @@ const PostEditor = ({ value={values.comment} onEditorChange={formikCompatibleHandler(handleChange, 'comment')} onBlur={formikCompatibleHandler(handleBlur, 'comment')} - placeholder={'Post content*'} + placeholder={intl.formatMessage(messages.postContent)} /> diff --git a/src/discussions/posts/post-editor/messages.js b/src/discussions/posts/post-editor/messages.js index 7e8821a52..c58d4dd2e 100644 --- a/src/discussions/posts/post-editor/messages.js +++ b/src/discussions/posts/post-editor/messages.js @@ -57,6 +57,10 @@ const messages = defineMessages({ id: 'discussions.post.editor.title', defaultMessage: 'Post title*', }, + postContent: { + id: 'discussions.post.editor.postContent', + defaultMessage: 'Post content*', + }, titleDescription: { id: 'discussions.post.editor.titleDescription', defaultMessage: 'Add a clear and descriptive title to encourage participation.',