getHtml method

Future<String> getHtml()

Implementation

Future<String> getHtml() async {
  final completerName =
      '__smart_rte_get_html_${DateTime.now().millisecondsSinceEpoch}';
  await _web.runJavaScript("""
    (function(){
      window.$completerName = '';
      if (window.SmartRTE && window.SmartRTE.__controller) {
        const html = window.SmartRTE.__controller.getHtml();
        window.$completerName = html || '';
      }
    })();
  """
      .replaceAll('\n', ' '));
  final res =
      await _web.runJavaScriptReturningResult('window.$completerName');
  if (res is String) return res;
  return (res.toString()).replaceAll('"', '');
}