From 41fc67f41de50e0384cfecda3dd7961c4064c539 Mon Sep 17 00:00:00 2001 From: michaelfebrianto Date: Mon, 21 Feb 2022 23:14:57 +1100 Subject: [PATCH] feature/add-new-line: replace text with new line --- lib/src/widgets/toolbar/image_video_utils.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/widgets/toolbar/image_video_utils.dart b/lib/src/widgets/toolbar/image_video_utils.dart index cd05de95..db2851a6 100644 --- a/lib/src/widgets/toolbar/image_video_utils.dart +++ b/lib/src/widgets/toolbar/image_video_utils.dart @@ -141,6 +141,10 @@ class ImageVideoUtils { if (imageUrl != null) { controller.replaceText(index, length, BlockEmbed.image(imageUrl), null); + // ignore: cascade_invocations + controller.moveCursorToEnd(); + final newLineIndex = controller.selection.baseOffset; + controller.replaceText(newLineIndex, 0, '\n', null); } }