Skip to content

Commit

Permalink
Expose navigationDelegate.
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-kwon committed Sep 15, 2023
1 parent d841726 commit f28447f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/src/quill_editor_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class QuillHtmlEditor extends StatefulWidget {
final bool? autoFocus;

/// Callback to decide whether to allow navigation to the incoming url
final NavigationDecision Function(NavigationRequest navigation)?
final FutureOr<bool> Function(NavigationRequest navigation)?
navigationDelegate;

@override
Expand Down Expand Up @@ -418,7 +418,18 @@ class QuillHtmlEditorState extends State<QuillHtmlEditor> {
mobileSpecificParams: const MobileSpecificParams(
androidEnableHybridComposition: true,
),
navigationDelegate: widget.navigationDelegate,
navigationDelegate: widget.navigationDelegate == null
? null
: (navigation) async {
final consumed =
await widget.navigationDelegate?.call(navigation) ??
false;
if (consumed) {
return NavigationDecision.prevent;
} else {
return NavigationDecision.navigate;
}
},
),
Visibility(
visible: !_editorLoaded,
Expand Down

0 comments on commit f28447f

Please sign in to comment.