Fix cannot focus recipients, subject and open popup menu when code view is enabled and focused
This commit is contained in:
@@ -1551,6 +1551,17 @@ class ComposerController extends BaseController
|
||||
replyToRecipientState.value = PrefixRecipientState.disabled;
|
||||
}
|
||||
|
||||
void clearFocusRecipients() {
|
||||
toAddressFocusNode?.unfocus();
|
||||
ccAddressFocusNode?.unfocus();
|
||||
bccAddressFocusNode?.unfocus();
|
||||
replyToAddressFocusNode?.unfocus();
|
||||
}
|
||||
|
||||
void clearFocusSubject() {
|
||||
subjectEmailInputFocusNode?.unfocus();
|
||||
}
|
||||
|
||||
void _closeSuggestionBox() {
|
||||
if (toEmailAddressController.text.isEmpty) {
|
||||
keyToEmailTagEditor.currentState?.closeSuggestionBox();
|
||||
@@ -1899,8 +1910,12 @@ class ComposerController extends BaseController
|
||||
}
|
||||
|
||||
void handleOnFocusHtmlEditorWeb() {
|
||||
clearFocusRecipients();
|
||||
clearFocusSubject();
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
richTextWebController?.editorController.setFocus();
|
||||
if (richTextWebController?.codeViewEnabled != true) {
|
||||
richTextWebController?.editorController.setFocus();
|
||||
}
|
||||
richTextWebController?.closeAllMenuPopup();
|
||||
if (menuMoreOptionController?.menuIsShowing == true) {
|
||||
menuMoreOptionController?.hideMenu();
|
||||
@@ -2428,4 +2443,11 @@ class ComposerController extends BaseController
|
||||
void onCompleteSetupComposer() {
|
||||
initEmailDraftHash();
|
||||
}
|
||||
|
||||
void onPopupMenuChanged(bool isShowing) {
|
||||
if (isShowing) {
|
||||
clearFocusRecipients();
|
||||
clearFocusSubject();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -619,6 +619,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
||||
isEmailChanged: controller.isEmailChanged.isTrue,
|
||||
toggleCodeViewAction: controller.richTextWebController!.toggleCodeView,
|
||||
menuMoreOptionController: controller.menuMoreOptionController!,
|
||||
onPopupMenuChanged: controller.onPopupMenuChanged,
|
||||
printDraftAction: () => controller.printDraft(context),
|
||||
toggleRequestReadReceiptAction: () => controller.toggleRequestReadReceipt(context),
|
||||
toggleMarkAsImportantAction: () => controller.toggleMarkAsImportant(context),
|
||||
@@ -940,6 +941,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
||||
isEmailChanged: controller.isEmailChanged.isTrue,
|
||||
toggleCodeViewAction: controller.richTextWebController!.toggleCodeView,
|
||||
menuMoreOptionController: controller.menuMoreOptionController!,
|
||||
onPopupMenuChanged: controller.onPopupMenuChanged,
|
||||
printDraftAction: () => controller.printDraft(context),
|
||||
toggleRequestReadReceiptAction: () => controller.toggleRequestReadReceipt(context),
|
||||
toggleMarkAsImportantAction: () => controller.toggleMarkAsImportant(context),
|
||||
|
||||
@@ -30,6 +30,7 @@ class BottomBarComposerWidget extends StatelessWidget {
|
||||
final VoidCallback printDraftAction;
|
||||
final VoidCallback toggleMarkAsImportantAction;
|
||||
final VoidCallback saveAsTemplateAction;
|
||||
final OnMenuChanged? onPopupMenuChanged;
|
||||
|
||||
const BottomBarComposerWidget({
|
||||
super.key,
|
||||
@@ -51,6 +52,7 @@ class BottomBarComposerWidget extends StatelessWidget {
|
||||
required this.printDraftAction,
|
||||
required this.toggleMarkAsImportantAction,
|
||||
required this.saveAsTemplateAction,
|
||||
this.onPopupMenuChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -182,6 +184,7 @@ class BottomBarComposerWidget extends StatelessWidget {
|
||||
],
|
||||
arrangeAsList: true,
|
||||
position: null,
|
||||
onMenuChanged: onPopupMenuChanged,
|
||||
),
|
||||
const Spacer(),
|
||||
TMailButtonWidget.fromIcon(
|
||||
|
||||
Reference in New Issue
Block a user