insertEmbedAtCurrent method
Insert an embed at the current index.
Implementation
EmbedState? insertEmbedAtCurrent(
ParagraphEmbed embed, {
bool deleteLineIfEmpty = true,
}) {
// We replace the current line if it's empty.
var index = focusedParagraphIndex;
if (index == null) {
return null;
}
final p = paragraphs[index];
if (p is LineState && p.controller.text.isEmpty) {
removeParagraphAt(index);
} else {
index += 1;
}
return insertEmbed(index + 1, embed, deleteLineIfEmpty: deleteLineIfEmpty);
}