Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rich text editor component ( markdown + mentions + fileuploads) #8070

Closed

Conversation

UdaySagar-Git
Copy link
Contributor

@UdaySagar-Git UdaySagar-Git commented Jun 20, 2024

Proposed Changes

This pr is a follow up of #8016

  • Rich text editor with support of bold , italic , heading styles , quote , add link , undo , redo options
  • Adds a package turndown to convert html to markdown
  • Adds support for mentioning users
  • Adds support to upload files to specifc note

created a temporary /test route which will be removed after review

@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers

@UdaySagar-Git UdaySagar-Git requested a review from a team as a code owner June 20, 2024 10:42
Copy link

vercel bot commented Jun 20, 2024

@UdaySagar-Git is attempting to deploy a commit to the Open Healthcare Network Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

netlify bot commented Jun 20, 2024

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit 2943843
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/668bbaa623d8ed00087d2e20
😎 Deploy Preview https://deploy-preview-8070--care-egov-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@UdaySagar-Git
Copy link
Contributor Author

UdaySagar-Git commented Jun 20, 2024

@gigincg @khavinshankar built a text editor from scratch. If this is okay, I will improve the styling and integrate it with doctor's notes.
There are some bugs, I will fix them along the way

https://deploy-preview-8070--care-net.netlify.app/test

Copy link
Member

@khavinshankar khavinshankar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@UdaySagar-Git Nicely done, the code is well broken down into functions and well written. Here are some pointers to be noted:

package.json Outdated Show resolved Hide resolved
src/Components/Common/MarkdownEditor.tsx Outdated Show resolved Hide resolved
src/Components/Common/MarkdownEditor.tsx Outdated Show resolved Hide resolved
Comment on lines 36 to 38
document.addEventListener("selectionchange", handleSelectionChange);
return () => {
document.removeEventListener("selectionchange", handleSelectionChange);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, event listeners are added on the document, consider adding them to editor

src/Components/Common/MarkdownEditor.tsx Outdated Show resolved Hide resolved
Comment on lines 247 to 251
const turndownService = new TurndownService();
const htmlContent = editorRef.current?.innerHTML || "";
const markdownText = turndownService.turndown(htmlContent);
setMarkdown(markdownText);
setHtmlCode(htmlContent);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, we are styling in HTML, converting it into markdown and then again we are converting it back into HTML. Why not directly edit markdown? Look into the feasibility of doing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. if there is no requirement of live preview (for example showing stars * *) for bold while editing similar to github comments , then i will go for directly editing the markdown and preview as html

src/Components/Common/MarkdownEditor.tsx Outdated Show resolved Hide resolved
Copy link

👋 Hi, @UdaySagar-Git,
Conflicts have been detected against the base branch. Please rebase your branch against the base branch.


This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there.

@github-actions github-actions bot added the merge conflict pull requests with merge conflict label Jun 26, 2024
@github-actions github-actions bot added merge conflict pull requests with merge conflict and removed merge conflict pull requests with merge conflict labels Jun 28, 2024
Copy link

github-actions bot commented Jul 4, 2024

👋 Hi, @UdaySagar-Git,
Conflicts have been detected against the base branch. Please rebase your branch against the base branch.


This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there.

@UdaySagar-Git UdaySagar-Git marked this pull request as draft July 5, 2024 03:23
@github-actions github-actions bot removed the merge conflict pull requests with merge conflict label Jul 5, 2024
@UdaySagar-Git UdaySagar-Git changed the title Rich text editor component Rich text editor component ( markdown + mentions + fileuploads) Jul 5, 2024
@UdaySagar-Git UdaySagar-Git marked this pull request as ready for review July 9, 2024 08:44
@UdaySagar-Git UdaySagar-Git marked this pull request as draft July 11, 2024 11:07
Copy link

Hi, This pr has been automatically marked as stale because it has not had any recent activity. It will be automatically closed if no further activity occurs for 7 more days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jul 19, 2024
@UdaySagar-Git
Copy link
Contributor Author

Closing as superseded by #8016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants