Skip to content

feat(Vditor): support bind value#745

Merged
ArgoZhang merged 2 commits intomasterfrom
feat-vditor
Nov 28, 2025
Merged

feat(Vditor): support bind value#745
ArgoZhang merged 2 commits intomasterfrom
feat-vditor

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Nov 28, 2025

Link issues

fixes #744

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

Ensure Vditor component updates its internal value on input events regardless of callbacks and refresh copyright metadata.

New Features:

  • Allow the Vditor component's bound value to stay in sync with user input even when no input callback is registered.

Enhancements:

  • Update Vditor component copyright header to the current BootstrapBlazor ownership information.

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

sourcery-ai Bot commented Nov 28, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the Vditor component’s input handling so that its internal value state is always updated on JS-invoked input events, even when no input callback is registered, and updates the file copyright header.

Sequence diagram for Vditor JS-invoked input handling

sequenceDiagram
    actor User
    participant BrowserVditorJS
    participant BlazorRuntime
    participant VditorComponent
    participant AppConsumer

    User->>BrowserVditorJS: Type text in editor
    BrowserVditorJS->>BlazorRuntime: invoke TriggerInputAsync(value)
    BlazorRuntime->>VditorComponent: TriggerInputAsync(value)
    activate VditorComponent
    VditorComponent->>VditorComponent: _lastValue = value
    VditorComponent->>VditorComponent: CurrentValue = value
    alt OnInputAsync is configured
        VditorComponent->>AppConsumer: OnInputAsync(value)
        AppConsumer-->>VditorComponent: Task completed
    else OnInputAsync is null
        VditorComponent->>VditorComponent: Skip invoking callback
    end
    deactivate VditorComponent
    VditorComponent-->>BlazorRuntime: Task completed
    BlazorRuntime-->>BrowserVditorJS: return
    BrowserVditorJS-->>User: Updated editor reflects bound value
Loading

Class diagram for updated Vditor input handling

classDiagram
    class Vditor
    Vditor : string _lastValue
    Vditor : string CurrentValue
    Vditor : Task TriggerInputAsync(string value)
    Vditor : Func~string, Task~ OnInputAsync

    class AppConsumer
    AppConsumer : void ConfigureVditor()
    AppConsumer : Task OnVditorInputAsync(string value)

    Vditor --> AppConsumer : optional_OnInputAsync_callback
Loading

File-Level Changes

Change Details Files
Ensure Vditor internal value is updated on every JS input event, independent of OnInputAsync callback presence.
  • Move assignments to _lastValue and CurrentValue to execute before the null-check for OnInputAsync in TriggerInputAsync
  • Keep existing async callback invocation logic for OnInputAsync(value) unchanged apart from its position
  • Maintain JSInvokable TriggerInputAsync signature and overall behavior while fixing bind-value support
src/components/BootstrapBlazor.Vditor/Vditor.razor.cs
Update project file copyright header attribution.
  • Adjust copyright header in Vditor.razor.cs to include BootstrapBlazor & Argo Zhang with updated email
src/components/BootstrapBlazor.Vditor/Vditor.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#744 Add support for binding the Vditor component's value so that changes in the editor correctly update the bound value (two-way binding support).

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

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 merged commit 1938e41 into master Nov 28, 2025
6 checks passed
@ArgoZhang ArgoZhang deleted the feat-vditor branch November 28, 2025 03:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables proper two-way binding support for the Vditor markdown editor component by ensuring the component's value is updated during input events regardless of whether an OnInputAsync callback is registered. The change fixes issue #744.

  • Moves CurrentValue and _lastValue assignments outside the OnInputAsync null check to support two-way binding
  • Updates copyright header to current standard format (BootstrapBlazor & Argo Zhang (argo@live.ca))
  • Increments package version to 10.0.1

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/components/BootstrapBlazor.Vditor/Vditor.razor.cs Fixes TriggerInputAsync to update component value unconditionally, enabling two-way binding; updates copyright header to current format
src/components/BootstrapBlazor.Vditor/BootstrapBlazor.Vditor.csproj Bumps package version to 10.0.1

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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(Vditor): support bind value

2 participants