From d64fd9a47a11b46dbc81ea9b2263cd3dde1bed7f Mon Sep 17 00:00:00 2001 From: kiwamizamurai <24860100+kiwamizamurai@users.noreply.github.com> Date: Fri, 16 Feb 2024 01:08:27 +0900 Subject: [PATCH] feat: move cursor after inserting video/image (#1739) --- flutter_quill_extensions/lib/extensions/controller_ext.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/flutter_quill_extensions/lib/extensions/controller_ext.dart b/flutter_quill_extensions/lib/extensions/controller_ext.dart index 9ae00839..8346538a 100644 --- a/flutter_quill_extensions/lib/extensions/controller_ext.dart +++ b/flutter_quill_extensions/lib/extensions/controller_ext.dart @@ -24,7 +24,8 @@ extension QuillControllerExt on QuillController { length, BlockEmbed.image(imageSource), null, - ); + ) + ..moveCursorToPosition(index + 1); } /// Insert video embed block, it requires the [videoUrl] @@ -39,6 +40,7 @@ extension QuillControllerExt on QuillController { }) { this ..skipRequestKeyboard = true - ..replaceText(index, length, BlockEmbed.video(videoUrl), null); + ..replaceText(index, length, BlockEmbed.video(videoUrl), null) + ..moveCursorToPosition(index + 1); } }