insertImage method
Inserts an image block at or after blockIndex.
If blockIndex is null, inserts at the currently focused block or appends to the document.
Implementation
int insertImage({
required String src,
String? alt,
double? width,
double? height,
String? caption,
SmartTextAlign alignment = SmartTextAlign.center,
int? blockIndex,
}) {
final targetIndex = blockIndex ?? _editorWidgetState?.focusedBlockIndex;
final index = _documentController.insertImage(
src: src,
alt: alt,
width: width,
height: height,
caption: caption,
alignment: alignment,
blockIndex: targetIndex,
);
_editorWidgetState?.rebuild();
return index;
}