Multiple RichTextEditorHtml in module on same page #4610
-
I am trying to use the RichTextEditorHtml in the module settings on the same module and when ... on first load it throws an error. Can you please let me know how I can put multiple RichTextEditorHtml in the module setting of a module. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 6 replies
-
@vnetonline are you going to share details about the actual error? |
Beta Was this translation helpful? Give feedback.
-
@zyhfish do you know if there are any limitations to using multiple RichTextEditors on the same page? I am guessing that each TextEditorProvider would have to handle this internally ie. if a TextEditorProvider was using JavaScript to access specific input elements in the page then they would need unique IDs to be able to distinguish them. Although he did not mention it, I am assuming @vnetonline is using the default QuillJSEditor in his installation. |
Beta Was this translation helpful? Give feedback.
-
Yes I am using the default out of the box QuillJSEditor Still done have access to my dev laptop as soon as I have access then I will update this discussion with the error I get on initial load. But from memory it complains that it is undefined |
Beta Was this translation helpful? Give feedback.
-
Hi @sbwalker , yes, this need to be controlled in the text editor provider implementation. For QuillJS, it should be a race condition, when it's loaded the first time, the backend will be called before the quilljs client libraries loaded completely, so that it will throw out a null reference exception. |
Beta Was this translation helpful? Give feedback.
-
here is the error finally have access to my dev laptop
|
Beta Was this translation helpful? Give feedback.
-
@vnetonline I believe @zyhfish is correct - the problem is not that you are trying to use 2 RichTextEditors in the same component - the problem is that a race condition is occurring in your component, which is resulting in the razor component trying to invoke JS Interop methods before the JavaScript library has been loaded. How is your component calling the GetContent() method? |
Beta Was this translation helpful? Give feedback.
-
This error has also been happening to me for quite a while |
Beta Was this translation helpful? Give feedback.
-
Submitted PR #4636 to handle this scenario. The root cause of this issue is that when there have multiple instances, they will register scripts with same bundle value, so for the second control, when load the scripts, the bundle name has already marked as loaded, so it will return directly, but no wait for really loaded in client. |
Beta Was this translation helpful? Give feedback.
-
I can also confirm that this change has fixed my issue as well thanks @zyhfish |
Beta Was this translation helpful? Give feedback.
Submitted PR #4636 to handle this scenario.
The root cause of this issue is that when there have multiple instances, they will register scripts with same bundle value, so for the second control, when load the scripts, the bundle name has already marked as loaded, so it will return directly, but no wait for really loaded in client.