Add script trigger content size changed on android
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit c39e932b634d164d75c0cf1cac35c27be04d8e1b)
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
|
||||
class HtmlUtils {
|
||||
|
||||
static const scrollEventJSChannelName = 'ScrollEventListener';
|
||||
static const contentSizeChangedEventJSChannelName = 'ContentSizeChangedEventListener';
|
||||
|
||||
static const runScriptsHandleScrollEvent = '''
|
||||
let contentElement = document.getElementsByClassName('tmail-content')[0];
|
||||
@@ -61,6 +62,16 @@ class HtmlUtils {
|
||||
}
|
||||
''';
|
||||
|
||||
static const scriptsHandleContentSizeChanged = '''
|
||||
<script>
|
||||
const bodyResizeObserver = new ResizeObserver(entries => {
|
||||
window.flutter_inappwebview.callHandler('$contentSizeChangedEventJSChannelName', '');
|
||||
})
|
||||
|
||||
bodyResizeObserver.observe(document.body)
|
||||
</script>
|
||||
''';
|
||||
|
||||
static String customCssStyleHtmlEditor({TextDirection direction = TextDirection.ltr}) {
|
||||
if (PlatformInfo.isWeb) {
|
||||
return '''
|
||||
|
||||
Reference in New Issue
Block a user