From 0439be15f2127212797c4c1671580de4e82ab442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Poizat?= Date: Thu, 15 Jan 2026 14:21:39 +0100 Subject: [PATCH] Fix setText failing because using incorrect WebView API setText is not working because in this commit https://github.com/Enough-Software/enough_html_editor/commit/fb99d59cf7575e25c52b43a87a2a26f722907e02 the API used to load HTML has been changed from `loadHtmlString` to `evaluateJavascript` instead of `loadData`. It raises errors like this one because we send HTML string to JS handler : `Uncaught SyntaxError: Unexpected token '<'` --- lib/src/editor_api.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/editor_api.dart b/lib/src/editor_api.dart index d08b4c1..2a9d160 100644 --- a/lib/src/editor_api.dart +++ b/lib/src/editor_api.dart @@ -368,7 +368,7 @@ class HtmlEditorApi { /// Sets the given text, replacing the previous text completely Future setText(String text) { final html = _htmlEditorState.generateHtmlDocument(text); - return _webViewController.evaluateJavascript(source: html); + return _webViewController.loadData(data: html); } /// Selects the HTML DOM node at the current position fully.