My goal is to create a rich text editor that returns html results. I am using the package flutter_quill. It can only return plain text using _controller.document.toPlainText() and json using _controller.document.toDelta().toJson(). I also tried html_editor_enhanced before. It has some problems. When I click the text color button and the dialog is shown, I can't press one of the colors in the horizontal color list. The mouse is always a text mouse and I can enter text despite the dialog being displayed in front of the text field. Although the dialog is blocked, I can still write behind the text field. Also, I am using web (Chrome) to run the app. Are there any other rich text editors that can return html results or any way to return html results in flutter_quill? Appreciate if someone can advise. Thank you in advance!
One possible solution is to manually convert the Quill Delta format to HTML using a library like quill_delta_to_html. Here's an example of how to use it:
- Add the package quill_delta_to_html to your dependencies in pubspec.yaml:
dependencies:
quill_delta_to_html: ^1.2.0
- Import the package and create an instance of DeltaToHtmlConverter:
import 'package:quill_delta_to_html/quill_delta_to_html.dart';
var converter = DeltaToHtmlConverter();
- Convert the Quill Delta to HTML using the converter:
var html = converter.convert(_controller.document.toDelta());
This will generate an HTML string that you can use however you need. Keep in mind that not all Quill features may be properly converted to HTML, so you may need to add your own custom conversion rules or modify the output as needed.