Skip to content

Set dynamically height of editor acording to content for read only mode. #69

@magiino

Description

@magiino

I have integrated TinyMCE editor 6 to .NET 7 blazor web assembly app according to official doc.
https://www.tiny.cloud/docs/tinymce/6/blazor-ref/
https://www.tiny.cloud/docs/tinymce/6/blazor-cloud/

Nuget packages:

<PackageReference Include="TinyMCE" Version="6.4.2" />
<PackageReference Include="TinyMCE.Blazor" Version="1.0.4" />

I'm using TinyMCE Editor component also for 'read only' mode and I have issue with setting dynamically height of editor acording to content.

I'm using currently autoresize plugin, but it has some bug and it not always resize editor correctly. Sometimes I can see just first 3 lines of text. This bug happens totally randomly.

This is how it looks like if it will not resize correctly.
image

This is how it looks like if it will resize correctly.
image

<MudCard>
      <MudCardContent>
            <Editor
                Value="@_html"
                Conf="@_editorReadOnlyConfig"
                Disable=true
                ScriptSrc="/lib/tinymce/tinymce.min.js"
            />
     </MudCardContent>
</MudCard>
    private readonly Dictionary<string, object> _editorReadOnlyConfig = new()
    {
        { "plugins", new string[] { "autoresize" } }, // https://www.tiny.cloud/docs/plugins/opensource/autoresize/
        { "toolbar", false },
        { "menubar", false },
        { "statusbar", false },
    };

Any ideas how to deal with this?
Can i do the same thing just with css?
I'm using Editor component in readonly mode to view html because the blazor app will break all css if i would render the html as MarkupString.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions