setHtml method

void setHtml(
  1. String html
)

Set html content for editor

Implementation

void setHtml(String html) async {
  if (html != '<p></p>' && html != '<p><br></p>') {
    await webViewController.evaluateJavascript(source: 'hidePlaceholder();');
  }
  if (html == '<p></p>') {
    html = '<p><br></p>';
  }
  await webViewController.evaluateJavascript(
      source: 'editor.innerHTML = `$html`;');
  double contentHeight = double.parse((await webViewController
          .evaluateJavascript(source: 'editor.scrollHeight;'))
      .toString());
  setHeight?.call(contentHeight);
}