html-editor-enhanced icon indicating copy to clipboard operation
html-editor-enhanced copied to clipboard

[BUG] HTML editor is still loading, please wait before evaluating this JS:

Open ajay-zartek opened this issue 3 years ago • 3 comments

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",
          ),
        ),

ajay-zartek avatar Feb 22 '22 18:02 ajay-zartek

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) {

iluvgy avatar Mar 29 '22 12:03 iluvgy

Yes, this is how it should be done. Please do not initialize the controller inside build method.

tneotia avatar Apr 06 '22 23:04 tneotia

I still get this error, even if I initialize the controller outside the build method.

stefan-weinand avatar Sep 14 '22 15:09 stefan-weinand

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.

tneotia avatar Oct 19 '22 13:10 tneotia

  • 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', ...

kuyaC avatar Feb 06 '23 13:02 kuyaC

Getting same error image

sunnyasr avatar Feb 14 '23 08:02 sunnyasr