TF-2533 Fix composer memory leak when reply and forward
This commit is contained in:
@@ -147,6 +147,9 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
|
||||
window.parent.addEventListener('message', handleMessage, false);
|
||||
window.addEventListener('click', handleOnClickLink, true);
|
||||
window.addEventListener('load', handleOnLoad);
|
||||
window.addEventListener('beforeunload', (event) => {
|
||||
window.parent.removeEventListener('message', handleMessage, false);
|
||||
});
|
||||
|
||||
function handleMessage(e) {
|
||||
if (e && e.data && e.data.includes("toIframe:")) {
|
||||
|
||||
@@ -218,7 +218,11 @@ class ComposerController extends BaseController {
|
||||
void onClose() {
|
||||
_initTextEditor = null;
|
||||
_textEditorWeb = null;
|
||||
viewState.value = Right(UIClosedState());
|
||||
dispatchState(Right(UIClosedState()));
|
||||
composerArguments.value = null;
|
||||
emailContentsViewState.value = Right(UIClosedState());
|
||||
identitySelected.value = null;
|
||||
listFromIdentities.clear();
|
||||
if (PlatformInfo.isMobile) {
|
||||
FkUserAgent.release();
|
||||
}
|
||||
|
||||
@@ -310,6 +310,7 @@ class RichTextWebController extends BaseRichTextController {
|
||||
void onClose() {
|
||||
menuParagraphController.dispose();
|
||||
menuOrderListController.dispose();
|
||||
editorController.clear();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -65,15 +65,9 @@ class _WebEditorState extends State<WebEditorWidget> {
|
||||
double? dropZoneHeight;
|
||||
final ValueNotifier<double> _htmlEditorHeight = ValueNotifier(_defaultHtmlEditorHeight);
|
||||
bool _dropListenerRegistered = false;
|
||||
Function(Event)? _dropListener;
|
||||
|
||||
void _dropListener(Event event) {
|
||||
if (event is MessageEvent) {
|
||||
if (jsonDecode(event.data)['name'] == HtmlUtils.registerDropListener.name) {
|
||||
_editorController.evaluateJavascriptWeb(
|
||||
HtmlUtils.lineHeight100Percent.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -89,6 +83,13 @@ class _WebEditorState extends State<WebEditorWidget> {
|
||||
}
|
||||
log('_WebEditorState::initState:dropZoneWidth: $dropZoneWidth | dropZoneHeight: $dropZoneHeight');
|
||||
|
||||
_dropListener = (event) {
|
||||
if (event is MessageEvent) {
|
||||
if (jsonDecode(event.data)['name'] == HtmlUtils.registerDropListener.name) {
|
||||
_editorController.evaluateJavascriptWeb(HtmlUtils.lineHeight100Percent.name);
|
||||
}
|
||||
}
|
||||
};
|
||||
window.addEventListener("message", _dropListener);
|
||||
}
|
||||
|
||||
@@ -113,6 +114,7 @@ class _WebEditorState extends State<WebEditorWidget> {
|
||||
_editorController.evaluateJavascriptWeb(
|
||||
HtmlUtils.unregisterDropListener.name);
|
||||
window.removeEventListener("message", _dropListener);
|
||||
_dropListener = null;
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1025,8 +1025,8 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: email_supported
|
||||
resolved-ref: "96c199b233c5afde583295890ffbd880ea4c7d8c"
|
||||
ref: memory_fixed_in_cnb
|
||||
resolved-ref: "0292fa1b9c8bb018b910c1b8248be231b88a97b6"
|
||||
url: "https://github.com/linagora/html-editor-enhanced.git"
|
||||
source: git
|
||||
version: "2.5.1"
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ dependencies:
|
||||
html_editor_enhanced:
|
||||
git:
|
||||
url: https://github.com/linagora/html-editor-enhanced.git
|
||||
ref: email_supported
|
||||
ref: memory_fixed_in_cnb
|
||||
|
||||
jmap_dart_client:
|
||||
git:
|
||||
|
||||
Reference in New Issue
Block a user