TF-3601 Fix content gone blank in composer on IOS
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
|
||||
import 'package:core/presentation/constants/constants_ui.dart';
|
||||
import 'package:core/utils/html/html_utils.dart';
|
||||
import 'package:core/utils/platform_info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rich_text_composer/rich_text_composer.dart';
|
||||
|
||||
typedef OnCreatedEditorAction = Function(BuildContext context, HtmlEditorApi editorApi, String content);
|
||||
typedef OnLoadCompletedEditorAction = Function(HtmlEditorApi editorApi, WebUri? url);
|
||||
typedef OnEditorContentHeightChanged = Function(double height);
|
||||
|
||||
class MobileEditorWidget extends StatelessWidget {
|
||||
|
||||
@@ -12,6 +15,7 @@ class MobileEditorWidget extends StatelessWidget {
|
||||
final TextDirection direction;
|
||||
final OnCreatedEditorAction onCreatedEditorAction;
|
||||
final OnLoadCompletedEditorAction onLoadCompletedEditorAction;
|
||||
final OnEditorContentHeightChanged? onEditorContentHeightChanged;
|
||||
|
||||
const MobileEditorWidget({
|
||||
super.key,
|
||||
@@ -19,6 +23,7 @@ class MobileEditorWidget extends StatelessWidget {
|
||||
required this.direction,
|
||||
required this.onCreatedEditorAction,
|
||||
required this.onLoadCompletedEditorAction,
|
||||
this.onEditorContentHeightChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -26,6 +31,7 @@ class MobileEditorWidget extends StatelessWidget {
|
||||
return HtmlEditor(
|
||||
key: const Key('mobile_editor'),
|
||||
minHeight: 550,
|
||||
maxHeight: PlatformInfo.isIOS ? ConstantsUI.composerHtmlContentMaxHeight : null,
|
||||
addDefaultSelectionMenuItems: false,
|
||||
initialContent: content,
|
||||
customStyleCss: HtmlUtils.customCssStyleHtmlEditor(
|
||||
@@ -34,6 +40,7 @@ class MobileEditorWidget extends StatelessWidget {
|
||||
),
|
||||
onCreated: (editorApi) => onCreatedEditorAction.call(context, editorApi, content),
|
||||
onCompleted: onLoadCompletedEditorAction,
|
||||
onContentHeightChanged: PlatformInfo.isIOS ? onEditorContentHeightChanged : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user