Blazored / TextEditor

Rich text editor for Blazor applications - Uses Quill JS
MIT License
276 stars 58 forks source link

Multiple text editors in one component #15

Closed DSBhogal closed 4 years ago

DSBhogal commented 4 years ago

Issue

I have three editors in one component all with unique references, once i have submitted the form i get the HTML for each editor. It gets the HTML of the first editor fine but encounters the following error when getting the HTML for the second editor:

BlazoredTextEditorError

Microsoft.JSInterop.JSException: 'Cannot read property 'root' of undefined TypeError: Cannot read property 'root' of undefined at Object.getQuillHTML (https://localhost:44307/_content/Blazored.TextEditor/Blazored-BlazorQuill.js:29:41) at https://localhost:44307/_framework/blazor.server.js:8:31421 at new Promise () at e.beginInvokeJSFromDotNet (https://localhost:44307/_framework/blazor.server.js:8:31390) at https://localhost:44307/_framework/blazor.server.js:1:19202 at Array.forEach () at e.invokeClientMethod (https://localhost:44307/_framework/blazor.server.js:1:19173) at e.processIncomingData (https://localhost:44307/_framework/blazor.server.js:1:17165) at e.connection.onreceive (https://localhost:44307/_framework/blazor.server.js:1:10276) at WebSocket.i.onmessage (https://localhost:44307/_framework/blazor.server.js:1:38091)'

Could you provide me with some details as to why I am or may be encountering the issue?

ADefWebserver commented 4 years ago

This page demonstrates multiple editors on the same page: https://github.com/Blazored/TextEditor/blob/master/samples/BlazorServerSide/Pages/Index.razor

You don't load HTML into the editor by using GetHTML() you get HTML from the editor that way.

This is the second issue in two days where someone tried to do that so I will blame myself for bad naming 😣

To load HTML into the editor you use:

@((MarkupString)@QuillReadOnlyContent)

DSBhogal commented 4 years ago

Unsure if my explanation wasn't clear enough, I'm trying to get the content from the second text editor but its crashing not load html content into the editor. If you look at my screenshot in my 'HandleValidSubmit' method it gets the contents of the first editor fine but not the second

ADefWebserver commented 4 years ago

Does the sample code in the repository work for you?

DSBhogal commented 4 years ago

I've temporarily moved onto another project so I'm not working with the text editor at the moment, so I'll close the issue and next time I'm on the project again I'll try out the sample code. Appreciate the response and help