Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>9.0.8</Version>
<Version>9.0.9</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
{
<BootstrapLabel required="@Required" for="@Id" ShowLabelTooltip="ShowLabelTooltip" Value="@DisplayText" />
}
<div @attributes="@AdditionalAttributes" id="@Id" class="editor" data-bb-submit="@ShowSubmitString">
<div @attributes="@AdditionalAttributes" id="@Id" class="@ClassString" data-bb-submit="@ShowSubmitString">
<div class="@EditClassString" placeholder="@PlaceHolder"></div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ namespace BootstrapBlazor.Components;
/// </summary>
public partial class Editor
{
private string? ClassString => CssBuilder.Default("editor")
.AddClass(CssClass).AddClass(ValidCss)
.Build();

/// <summary>
/// 获得 Editor 样式
/// </summary>
Expand Down Expand Up @@ -182,20 +186,10 @@ protected override async Task InvokeInitAsync()
/// </summary>
/// <param name="value"></param>
[JSInvokable]
public async Task Update(string value)
public void Update(string value)
{
Value = value;
_lastValue = Value;

if (ValueChanged.HasDelegate)
{
await ValueChanged.InvokeAsync(Value);
}

if (OnValueChanged != null)
{
await OnValueChanged.Invoke(value);
}
CurrentValue = value;
_lastValue = value;
}
Comment on lines +189 to 193
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

The refactoring to use CurrentValue instead of manually invoking ValueChanged is correct for a component inheriting from ValidateBase<T>. However, the previous implementation also supported an OnValueChanged callback (visible in the removed code), which is referenced in the test file at test/UnitTestEditor/EditorTest.cs:28. If OnValueChanged was a public parameter that has been removed, this is a breaking API change. Either:

  1. The test needs to be updated to remove OnValueChanged usage, or
  2. The OnValueChanged parameter needs to be retained for backwards compatibility.

Additionally, consider keeping the method signature as async Task and returning Task.CompletedTask for better semantic clarity with the JavaScript invokeMethodAsync call, though void methods are technically supported.

Copilot uses AI. Check for mistakes.

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../../js/summernote-bs5.min.js'
import '../../js/summernote-bs5.min.js'
import { addLink, addScript } from '../../../BootstrapBlazor/modules/utility.js'
import Data from '../../../BootstrapBlazor/modules/data.js'
import EventHandler from '../../../BootstrapBlazor/modules/event-handler.js'
Expand Down Expand Up @@ -175,7 +175,11 @@ export function getCode(id) {
}

export function reset(id) {
const editor = Data.get(id)
const editor = Data.get(id);
if (!editor.$editor) {
return;
}

const context = editor.$editor.data('summernote')

const showSubmit = editor.el.getAttribute("data-bb-submit") === "true"
Expand Down
12 changes: 11 additions & 1 deletion src/components/BootstrapBlazor.SummerNote/wwwroot/css/editor.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.editor .editor-body {
.editor .editor-body {
cursor: pointer;
min-height: 50px;
height: auto;
Expand Down Expand Up @@ -58,6 +58,16 @@
display: block;
}

.editor.is-invalid .note-frame,
.editor.is-invalid > .form-control {
border: 1px solid var(--bs-danger) !important;
}

.editor.is-valid .note-frame,
.editor.is-valid > .form-control {
border: 1px solid var(--bs-success) !important;
}

.modal-body .note-form-group:not(:last-child) {
margin-bottom: 0.5rem;
}
Expand Down
Loading