insertHtml method

void insertHtml(
  1. String html
)

Inserts HTML at the current cursor position. Parses the HTML and inserts the resulting text content.

Implementation

void insertHtml(String html) {
  if (processInputHtml) {
    html = _processInput(html);
  }

  final parsed = _parser.parse(html);
  final blockIndex = _editorWidgetState?.focusedBlockIndex ?? 0;
  final offset = _editorWidgetState?.cursorOffset ?? 0;

  if (parsed.blocks.isNotEmpty) {
    _documentController.insertParsedDocument(blockIndex, offset, parsed);
    _editorWidgetState?.rebuild();
  }
}