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

Removed disallowedElementsMarkdown #555

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

fonstack
Copy link
Member

@fonstack fonstack commented Sep 26, 2023

Summary by CodeRabbit

  • Refactor: Updated the FormMDEditor component in the web package. The markdown preview options have been modified to only render specified elements, enhancing security and control over content display. This change improves the user experience by ensuring that only approved markdown elements are visible in the preview.

@fonstack fonstack requested a review from shayzluf September 26, 2023 18:41
@github-actions
Copy link

github-actions bot commented Sep 26, 2023

Image description CodeRabbit

Walkthrough

The change primarily focuses on enhancing the markdown preview functionality in the FormMDEditor component. It replaces the disallowedElementsMarkdown constant with the allowedElementsMarkdown constant, thereby refining the control over elements that can be rendered in the markdown editor's preview.

Changes

File Summary
packages/web/src/components/FormControls/FormMDEditor/FormMDEditor.tsx The diff replaces the disallowedElementsMarkdown constant with the allowedElementsMarkdown constant in the FormMDEditorComponent module. This change affects the preview options of the MDEditor component, allowing only the specified elements to be rendered in the preview.

🐇💻

In the land of code, where logic intertwines,
A rabbit hops, making changes line by line.
With each hop, a better version unfurls,
In the world of brackets, loops, and curls.
Today we celebrate a change so fine,
Enhancing previews, one markdown at a time! 🎉


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 83a1a2e and d57e1a0 commits.
Files selected (1)
  • packages/web/src/components/FormControls/FormMDEditor/FormMDEditor.tsx (2)
Review comments generated (2)
  • Review: 2
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

@@ -1,5 +1,5 @@
import MDEditor, { PreviewType } from "@uiw/react-md-editor";
import { disallowedElementsMarkdown } from "constants/constants";
import { allowedElementsMarkdown } from "constants/constants";

Choose a reason for hiding this comment

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

Image description CodeRabbit

The import statement has been changed from disallowedElementsMarkdown to allowedElementsMarkdown. Ensure that the allowedElementsMarkdown constant is correctly defined and contains all the necessary elements that should be allowed in the markdown editor. If it doesn't, you might face issues with rendering certain elements in the preview.

- import { disallowedElementsMarkdown } from "constants/constants";
+ import { allowedElementsMarkdown } from "constants/constants";

@@ -37,7 +37,7 @@ export const FormMDEditorComponent = (
>
<MDEditor
value={value}
previewOptions={{ disallowedElements: disallowedElementsMarkdown }}
previewOptions={{ allowedElements: allowedElementsMarkdown }}

Choose a reason for hiding this comment

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

Image description CodeRabbit

The previewOptions prop of the MDEditor component now uses allowedElementsMarkdown instead of disallowedElementsMarkdown. This change implies a shift from a blacklist approach to a whitelist approach for controlling what elements are rendered in the markdown preview. Make sure that this change aligns with your application's requirements and that all necessary elements are included in allowedElementsMarkdown.

- previewOptions={{ disallowedElements: disallowedElementsMarkdown }}
+ previewOptions={{ allowedElements: allowedElementsMarkdown }}

@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: d57e1a0
Status: ✅  Deploy successful!
Preview URL: https://42c03204.dapp-a9y.pages.dev
Branch Preview URL: https://fix-removed-disallowedelemen.dapp-a9y.pages.dev

View logs

@shayzluf shayzluf merged commit 7d1a0c5 into develop Sep 27, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants