Blazored / TextEditor

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

In production "root" property is undefined... #27

Closed BerteskaLukas closed 4 years ago

BerteskaLukas commented 4 years ago

Hi, everything works fine on local host, but in production get this erorr. Any ideas ?

[2020-10-14T07:14:07.918Z] Error: Microsoft.JSInterop.JSException: Cannot read property 'root' of undefined TypeError: Cannot read property 'root' of undefined at Object.getQuillHTML (https://prodivierptest.azurewebsites.net/_content/Blazored.TextEditor/Blazored-BlazorQuill.js:29:41) at https://prodivierptest.azurewebsites.net/_framework/blazor.server.js:8:31619 at new Promise () at e.beginInvokeJSFromDotNet (https://prodivierptest.azurewebsites.net/_framework/blazor.server.js:8:31587) at https://prodivierptest.azurewebsites.net/_framework/blazor.server.js:1:20052 at Array.forEach () at e.invokeClientMethod (https://prodivierptest.azurewebsites.net/_framework/blazor.server.js:1:20022) at e.processIncomingData (https://prodivierptest.azurewebsites.net/_framework/blazor.server.js:1:18006) at e.connection.onreceive (https://prodivierptest.azurewebsites.net/_framework/blazor.server.js:1:11091) at e. (https://prodivierptest.azurewebsites.net/_framework/blazor.server.js:1:31146) at Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](String identifier, Object[] args) at Blazored.TextEditor.BlazoredTextEditor.GetHTML() at Prodivi.WebUI.Components.Common.Email.GenerateEmailBody(Boolean send) in C:\Users\leign\source\repos\Prodivi ERP\Prodivi.WebUI\Components\Common\Email.razor:line 161 at Prodivi.WebUI.Components.Common.Email.OnInitializedAsync() in C:\Users\leign\source\repos\Prodivi ERP\Prodivi.WebUI\Components\Common\Email.razor:line 133 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

ADefWebserver commented 4 years ago

What version of .Net Core are you using (for example are you using .Net Core 5?). Also, see if this helps: https://github.com/Blazored/TextEditor/issues/26

ADefWebserver commented 4 years ago

Also see: https://github.com/Blazored/TextEditor/issues/10

BerteskaLukas commented 4 years ago

I use .net core 3.1

i get error then i use

emailBody = await textEditor.GetHTML();

i use it to get text body, then i add string template to it and load textEditor.LoadHTMLContent(emailBody) . It works like template. I have premade templates.

On localhost i get that emailbody is

, on production get the error "root" property is undefined.

ADefWebserver commented 4 years ago

If you try to call:

emailBody = await textEditor.GetHTML();

as your .razor control loads you may get an error. If you call that code in response to a button click, after the .razor control loads, you should never have a problem.

However, you should never need to call .GetHTML()when a .razor control loads. If there is already HTML content, for example in a database, simply get that HTML content from the database not the Blazored textEditor.

BerteskaLukas commented 4 years ago

if(textEditor != null ) { emailBody = await textEditor.GetHTML(); } i was trying this. Now i just use emailBody = string.empty; and every thing works on local and is production. So it works but why it wroked on local but not on production i dont get it. Big thanks for all support and help!!!!