Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can´t reference Editor in OnAfterRender or OnParametersSet #34

Closed
Sahara150 opened this issue Jan 20, 2021 · 2 comments
Closed

Can´t reference Editor in OnAfterRender or OnParametersSet #34

Sahara150 opened this issue Jan 20, 2021 · 2 comments

Comments

@Sahara150
Copy link

Sahara150 commented Jan 20, 2021

Hey, I pretty much copied your "Basic Example" of the TextEditor into my component.
However, when I try to fetch the Text from the Editor in "OnAfterRenderAsync" it always throws following error:

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Unable to get property 'getText' of undefined or null reference TypeError: Unable to get property 'getText' of undefined or null reference at window.QuillFunctions.getQuillText

which seems pretty weird to me. I checked, if you initialized your Editor somewhere, but could not find anything. I am using Blazor WASM.
Here´s my code:
`
<Blazored.TextEditor.BlazoredTextEditor @ref="DescriptionEditor" >

//The content you had


@Model.Description

</Blazored.TextEditor.BlazoredTextEditor>

@code {

[Parameter]
public ExtendedModel Model { get; set; }
BlazoredTextEditor DescriptionEditor;

protected override async Task OnAfterRenderAsync(bool firstRender)
{
    Console.WriteLine(await DescriptionEditor.GetText());
}

`

(Something weird happened to the formatting. Sorry for that...)

@Sahara150 Sahara150 changed the title Unhandled exception rendering component: Unable to get property 'getText' of undefined or null reference Can´t reference Editor in OnAfterRender or OnParametersSet Jan 20, 2021
@Sahara150
Copy link
Author

So I checked the same stuff with your example and it also threw the error.
It makes sense to me, that you cannot reference it in the OnInitialized-method, since the editor is not rendered there, yet.
However above methods are called after rendering. Shouldn´t it work there?

@ADefWebserver
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants