pasteContent method
Pastes content from the system clipboard into the editor.
Implementation
Future<void> pasteContent() async {
final blockIndex = _editorWidgetState?.focusedBlockIndex;
if (blockIndex == null) return;
final reader = await SystemClipboard.instance?.read();
if (reader == null) return;
if (reader.canProvide(Formats.htmlText)) {
final html = await reader.readValue(Formats.htmlText);
if (html != null && html.isNotEmpty) {
insertHtml(html);
return;
}
}
if (reader.canProvide(Formats.plainText)) {
final text = await reader.readValue(Formats.plainText);
if (text != null && text.isNotEmpty) {
insertText(text);
}
}
}