From 3274d7fe8c711e7466890b6a3948e9708877ca4a Mon Sep 17 00:00:00 2001 From: DatDang Date: Thu, 12 Sep 2024 13:22:39 +0700 Subject: [PATCH] Add onInitialTextLoadComplete callback --- lib/src/widgets/html_editor_widget_web.dart | 2 ++ lib/utils/callbacks.dart | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/src/widgets/html_editor_widget_web.dart b/lib/src/widgets/html_editor_widget_web.dart index 9190c1c6..af5279b5 100644 --- a/lib/src/widgets/html_editor_widget_web.dart +++ b/lib/src/widgets/html_editor_widget_web.dart @@ -911,6 +911,8 @@ class _HtmlEditorWidgetWebState extends State { } if (widget.htmlEditorOptions.initialText != null) { widget.controller.setText(widget.htmlEditorOptions.initialText!); + widget.callbacks?.onInitialTextLoadComplete?.call( + widget.htmlEditorOptions.initialText!); } var data = {'type': 'toIframe: getHeight'}; data['view'] = createdViewId; diff --git a/lib/utils/callbacks.dart b/lib/utils/callbacks.dart index 06206341..186642cf 100644 --- a/lib/utils/callbacks.dart +++ b/lib/utils/callbacks.dart @@ -28,6 +28,7 @@ class Callbacks { this.onTextFontSizeChanged, this.onDragEnter, this.onDragLeave, + this.onInitialTextLoadComplete, }); /// Called before certain commands are fired and the editor is in rich text view. @@ -194,4 +195,6 @@ class Callbacks { void Function(List? types)? onDragEnter; void Function(List? types)? onDragLeave; + + void Function(String initialText)? onInitialTextLoadComplete; }