Open Closed

Blazor CmsKit MarkdownToolbarButton broken #4884


User avatar
0
jfistelmann created
  • ABP Framework version: v7.1.1
  • UI type: Blazor package.json:
{
  "version": "1.0.0",
  "name": "my-app",
  "private": true,
  "dependencies": {
    "@volo/abp.aspnetcore.mvc.ui.theme.leptonx": "~2.1.0",
    "@volo/aspnetcore.components.server.leptonxtheme": "~2.1.0",
    "@volo/cms-kit-pro.admin": "~7.1.1",
    "@volo/account": "~7.1.1",
    "@volo/language-management": "~7.1.1"
  }
}
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
Unable to set property 'text' on object of type 'Blazorise.Markdown.MarkdownToolbarButton'. The error was: Unable to cast object of type 'System.Boolean' to type 'System.String'.

Message: Unable to set property 'text' on object of type 'Blazorise.Markdown.MarkdownToolbarButton'. The error was: Unable to cast object of type 'System.Boolean' to type 'System.String'.
Type: InvalidOperationException

Stack Trace
System.InvalidOperationException: Unable to set property 'text' on object of type 'Blazorise.Markdown.MarkdownToolbarButton'. The error was: Unable to cast object of type 'System.Boolean' to type 'System.String'.
 ---> System.InvalidCastException: Unable to cast object of type 'System.Boolean' to type 'System.String'.
   at Microsoft.AspNetCore.Components.Reflection.PropertySetter.CallPropertySetter[TTarget,TValue](Action`2 setter, Object target, Object value)
   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.<SetProperties>g__SetProperty|3_0(Object target, PropertySetter writer, String parameterName, Object value)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.<SetProperties>g__SetProperty|3_0(Object target, PropertySetter writer, String parameterName, Object value)
   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.SetProperties(ParameterView& parameters, Object target)
   at Blazorise.BaseComponent.SetParametersAsync(ParameterView parameters)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(ParameterView directAndCascadingParameters)
  • Steps to reproduce the issue:"

navigate to Cms/BlogPosts/Create

or

Cms/Pages/Create


1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    We will fix it in the patch version and your ticket refunded

    You can try this:

    MyDynamicWidgetMarkdown

    @using Volo.Abp.DependencyInjection
    @using Volo.CmsKit.Pro.Admin.Blazor.Pages.CmsKit
    @inherits Volo.CmsKit.Pro.Admin.Blazor.Pages.CmsKit.DynamicWidgetMarkdown
    @attribute [ExposeServices(typeof(DynamicWidgetMarkdown))]
    @attribute [Dependency(ReplaceServices = true)]
    
    <Markdown
        @Value="@Value"
        ValueChanged="@OnValueChanged"
        ImageUploadChanged="@OnImageUploadChangedAsync"
        ImageUploadEnded="@OnImageUploadEndedAsync"
        AutoDownloadFontAwesome="false"
        CustomButtonClicked="@OnCustomButtonClicked"
        @ref="@MarkdownRef">
        <Toolbar>
            @{
                foreach (var markdownToolbarButton in MarkdownToolbarButtons)
                {
                    <MarkdownToolbarButton Action="@markdownToolbarButton"/>
                }
                <MarkdownToolbarButton Separator Name="W" Icon="@("none")" Title="Add Widget" Text="W" ></MarkdownToolbarButton>
            }
        </Toolbar>
    </Markdown>
    
    
    <Modal @ref="@AddWidgetModalRef" Closing="@ClosingAddWidgetModal" RenderMode="ModalRenderMode.LazyReload">
        <ModalContent Size="ModalSize.Large" Centered="true">
            <Form>
                <ModalHeader>
                    <ModalTitle>@L["AddWidget"]</ModalTitle>
                    <CloseButton Clicked="CloseAddWidgetModalAsync"/>
                </ModalHeader>
                <ModalBody>
                    @if (Widgets.Any())
                    {
                        <Field>
                            <FieldLabel>@L["Widget"]</FieldLabel>
                            <FieldBody>
                                <Select @bind-SelectedValue="@ViewModel.Widget">
                                    <SelectItem></SelectItem>
                                    @foreach (var item in Widgets)
                                    {
                                        <SelectItem Value="@item.Key">@item.Value</SelectItem>
                                    }
                                </Select>
                            </FieldBody>
                        </Field>
    
                        foreach (var item in ViewModel.Details)
                        {
                            if (item.EditorComponentName is not null)
                            {
                                if (ViewModel.Widget == item.Name)
                                {
                                    <div id="editor-@item.Name">
                                        <form data-check-form-on-close="false">
                                            <DynamicComponent Type="Options.Value.FindParameterComponentType(item.EditorComponentName)"></DynamicComponent>
                                        </form>
                                    </div>
                                }
                            }
                        }
                    }
                    else
                    {
                        <p>@L["PleaseConfigureWidgets"].Value</p>
                    }
                </ModalBody>
                <ModalFooter>
                    @if (Widgets.Any())
                    {
                        <Button Color="Color.Primary" Clicked="AddWidgetAsync">@L["Add"]</Button>
                    }
                </ModalFooter>
            </Form>
        </ModalContent>
    </Modal>
    
Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35