tneotia/html-editor-enhanced

How to Display final output

egnimos opened this issue · 6 comments

I want to display the final output on the flutter web, but there is no option to display the final output... Can you help me on this
please

Check the example app, it works on Flutter Web. TLDR:

initialize editor:

HtmlEditorController controller = HtmlEditorController();

HtmlEditor(
   controller: controller
)

get text:

String? txt = await controller.getText();
setState(() {
   textToDisplay = txt;
});

widget:

Text(textToDisplay)

Let me know if you have any issues with this.

I had another thought about this - if you want to display the output in WYSIWYG format with Flutter widgets, I recommend you use flutter_html like this:

initialize editor:

HtmlEditorController controller = HtmlEditorController();

HtmlEditor(
   controller: controller
)

get text:

String? txt = await controller.getText();
setState(() {
   htmlString = txt;
});

widget:

Html(data: htmlString ?? "No data!")

I don't want to add this as an option in the package because it is quite a heavy dependency, but the option is there if you want to use it.

String? txt = await controller.getText();
setState(() {
htmlString = txt;
});

submit button it's not able to set the state in the latest version on web, can you check

Do you get any errors in the console?

there are no errors on the console, the state is not set, when I am trying to print the txt, the console is just stuck there, no response in the console.

Yep I found the issue and it is fixed on master. the stream.drain() line in the getText() code was causing the issue, it did the same thing for mobile height detection. Thanks for the report!