Skip to content

feat(CherryMarkdown): support validate in form#663

Merged
ArgoZhang merged 6 commits intomasterfrom
refactor-cherry-md
Nov 8, 2025
Merged

feat(CherryMarkdown): support validate in form#663
ArgoZhang merged 6 commits intomasterfrom
refactor-cherry-md

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Nov 8, 2025

Link issues

fixes #662

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Enable validation feedback in forms for the CherryMarkdown component by adding validation CSS classes, updating script initialization, and including corresponding styles.

New Features:

  • Support form validation styling for CherryMarkdown by applying .is-valid and .is-invalid classes.

Enhancements:

  • Introduce ClassString property with CssBuilder to combine custom and validation classes on the editor container.
  • Load the non-minified cherry-markdown.css instead of the minified version and set the default editor height to 200px.
  • Add a new cherry-markdown.css file with validation state styles and basic markdown border styling.
  • Reformat the JavaScript init call arguments for improved readability.

Copilot AI review requested due to automatic review settings November 8, 2025 10:14
@bb-auto bb-auto Bot added the enhancement New feature or request label Nov 8, 2025
@bb-auto bb-auto Bot added this to the v9.2.0 milestone Nov 8, 2025
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Nov 8, 2025

Reviewer's Guide

This PR adds form validation support to the CherryMarkdown component by introducing a CSS-based valid/invalid visual state and wiring it into the component’s rendering and initialization logic.

Class diagram for CherryMarkdown validation support

classDiagram
    class CherryMarkdown {
        +string? Language
        +string? ClassString
        +Task InvokeInitAsync()
    }
    CherryMarkdown : ClassString
    CherryMarkdown : InvokeInitAsync()
Loading

Flow diagram for CherryMarkdown CSS class assignment based on validation

flowchart TD
    A[CherryMarkdown component renders]
    B{Validation state}
    C[Assign 'is-valid' CSS class]
    D[Assign 'is-invalid' CSS class]
    E[No validation class]
    F[Render editor with assigned class]
    A --> B
    B -- Valid --> C
    B -- Invalid --> D
    B -- None --> E
    C --> F
    D --> F
    E --> F
Loading

File-Level Changes

Change Details Files
Add validation-aware CSS class building
  • Created private ClassString property combining base class, custom CssClass, and ValidCss
  • Updated markup to bind the computed ClassString to the wrapper div
CherryMarkdown.razor.cs
CherryMarkdown.razor
Provide validation styling in a new stylesheet
  • Added cherry-markdown.css importing the base stylesheet
  • Defined .bb-cherry-markdown.is-valid and .is-invalid borders
  • Scoped inner .cherry container styling
wwwroot/css/cherry-markdown.css
Adjust JS initialization to use new CSS and default dimensions
  • Changed addLink to load cherry-markdown.css instead of min.css
  • Modified default editor height from '100%' to "200px"
CherryMarkdown.razor.js
Refactor initialization call formatting
  • Reformatted InvokeInitAsync argument object for readability
CherryMarkdown.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#662 Add support for validation (valid/invalid state) in CherryMarkdown form component.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ArgoZhang ArgoZhang merged commit 5fb08a4 into master Nov 8, 2025
6 of 7 checks passed
@ArgoZhang ArgoZhang deleted the refactor-cherry-md branch November 8, 2025 10:15
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang ArgoZhang review requested due to automatic review settings March 23, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(CherryMarkdown): support validate in form

1 participant