Rich text editor for Flutter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

39 lines
807 B

import 'package:flutter_quill/flutter_quill.dart';
import '../../presentation/embeds/editor/webview.dart';
extension QuillControllerExt on QuillController {
int get index => selection.baseOffset;
int get length => selection.extentOffset - index;
void insertWebViewBlock({
required String initialUrl,
}) {
final block = BlockEmbed.custom(
QuillEditorWebViewBlockEmbed(
initialUrl,
),
);
this
..skipRequestKeyboard = true
..replaceText(
index,
length,
block,
null,
);
}
void insertImageBlock({
required String imageUrl,
}) {
this
..skipRequestKeyboard = skipRequestKeyboard
..replaceText(
index,
length,
BlockEmbed.image(imageUrl),
null,
);
}
}