Add new line after adding photo on mobile #1293
Unanswered
basicemotions
asked this question in
Mobile
Replies: 1 comment
-
This problem could be solved by defining the logic internally to the onImageInsertCallback in QuillToolbarImageConfigurations which is defined in QuillToolbarImageButtonOptions. So you can do something like this,: QuillToolbar.simple(
configurations: QuillSimpleToolbarConfigurations(
// ... put all your configurations to show buttons
embedButtons: FlutterQuillEmbeds.toolbarButtons(
imageButtonOptions: QuillToolbarImageButtonOptions(
imageButtonConfigurations: QuillToolbarImageConfigurations(
onImageInsertCallback: (imageUrl, quillController) async {
// final position
final int position = quillController.selection.baseOffset;
// Insert the image
quillController.document
.insert(position, BlockEmbed.image(imageUrl));
// Insert a new line after the image
quillController.document.insert(position + 1, '\n');
// Move the cursor after the image in the new line
quillController.updateSelection(
TextSelection.collapsed(offset: position + 2),
ChangeSource.local,
);
},
),
),
videoButtonOptions: null,
cameraButtonOptions: null,
),
),
); In general you can add any kind of logic with this callback and there are also other callback, as for example for imagePickerService (if you use another imagePickerService). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In mobile version (especially iOS) adding photos from quill_extensions feels very uncomfortable because of cursor position after photo add. Cursor is to the right from photo (that takes a full screen width after adding btw). And user can't tap screen on cursor to open keyboard and continue typing. User have to tap on previous line and move cursor by holing a space button. It'd be very comfortable to create an option foк developer to add new line after adding photo.
Beta Was this translation helpful? Give feedback.
All reactions