html-editor-enhanced
html-editor-enhanced copied to clipboard
[BUG] HTML editor is still loading, please wait before evaluating this JS:
Shows error Exception: HTML editor is still loading, please wait before evaluating this JS..
When inserting HTML using controller.insertHtml(<html text>);
and never updating the widget.
Error:
Exception: HTML editor is still loading, please wait before evaluating this JS: $('#summernote-2').summernote('pasteHTML', '<h1>test</h1>');!
Widget:
HtmlEditor(
controller: controller,
htmlEditorOptions: const HtmlEditorOptions(
hint: "Type here",
),
),
Got the same error, managed to solve it by moving the controller declaration outside the build method.
From
@override
Widget build(BuildContext context) {
HtmlEditorController controller = HtmlEditorController();
to
HtmlEditorController controller;
@override void initState() {
super.initState();
controller = HtmlEditorController();
}
@override
Widget build(BuildContext context) {
Yes, this is how it should be done. Please do not initialize the controller inside build method.
I still get this error, even if I initialize the controller outside the build method.
This error also occurs if the webview is not initialized properly. Please make sure internet permission is added to androidmanifest, and test webview functionality yourself by instantiating an InAppWebView
widget.
- I initialize my controller in initState(),
- I have Internet permission in my AndroidManifest.xml
- and I tested
return InAppWebView()
in my build() functions, without any Exceptions/Errors in the console.
But I still get: Exception: HTML editor is still loading, please wait before evaluating this JS: $('#summernote-2').summernote('code', ...
Getting same error