From b055693358fcbe6873d000aa2ab88c7a2b390908 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Tue, 25 Feb 2025 13:20:27 -0500 Subject: [PATCH] chore: revert deleting selection area in input bar --- lib/pages/chat/input_bar.dart | 140 +++++++++++++++++----------------- 1 file changed, 72 insertions(+), 68 deletions(-) diff --git a/lib/pages/chat/input_bar.dart b/lib/pages/chat/input_bar.dart index 74626c37f8..bbadbb0e74 100644 --- a/lib/pages/chat/input_bar.dart +++ b/lib/pages/chat/input_bar.dart @@ -491,79 +491,83 @@ class InputBar extends StatelessWidget { // #Pangea // builder: (context, controller, focusNode) => TextField( builder: (context, _, focusNode) { - return TextField( - enableSuggestions: false, - readOnly: - controller != null && controller!.choreographer.isRunningIT, - autocorrect: enableAutocorrect, - // controller: controller, - controller: (controller - ?.choreographer.chatController.obscureText) ?? - false - ? controller?.choreographer.chatController.hideTextController - : controller, - // Pangea# - focusNode: focusNode, - contextMenuBuilder: (c, e) => markdownContextBuilder( - c, - e, - // #Pangea - // controller, - _, + // fix for issue with typing not working sometimes on Firefox and Safari + return SelectionArea( + child: TextField( + enableSuggestions: false, + readOnly: + controller != null && controller!.choreographer.isRunningIT, + autocorrect: enableAutocorrect, + // controller: controller, + controller: + (controller?.choreographer.chatController.obscureText) ?? + false + ? controller + ?.choreographer.chatController.hideTextController + : controller, // Pangea# - ), - contentInsertionConfiguration: ContentInsertionConfiguration( - onContentInserted: (KeyboardInsertedContent content) { - final data = content.data; - if (data == null) return; + focusNode: focusNode, + contextMenuBuilder: (c, e) => markdownContextBuilder( + c, + e, + // #Pangea + // controller, + _, + // Pangea# + ), + contentInsertionConfiguration: ContentInsertionConfiguration( + onContentInserted: (KeyboardInsertedContent content) { + final data = content.data; + if (data == null) return; - final file = MatrixFile( - mimeType: content.mimeType, - bytes: data, - name: content.uri.split('/').last, - ); - room.sendFileEvent( - file, - shrinkImageMaxDimension: 1600, + final file = MatrixFile( + mimeType: content.mimeType, + bytes: data, + name: content.uri.split('/').last, + ); + room.sendFileEvent( + file, + shrinkImageMaxDimension: 1600, + ); + }, + ), + minLines: minLines, + maxLines: maxLines, + keyboardType: keyboardType!, + textInputAction: textInputAction, + autofocus: autofocus!, + inputFormatters: [ + //#Pangea + //LengthLimitingTextInputFormatter((maxPDUSize / 3).floor()), + //setting max character count to 1000 + //after max, nothing else can be typed + LengthLimitingTextInputFormatter(1000), + //Pangea# + ], + onSubmitted: (text) { + // fix for library for now + // it sets the types for the callback incorrectly + onSubmitted!(text); + }, + // #Pangea + style: controller?.exceededMaxLength ?? false + ? const TextStyle(color: Colors.red) + : null, + onTap: () { + controller?.onInputTap( + context, + fNode: focusNode, ); }, + // Pangea# + decoration: decoration!, + onChanged: (text) { + // fix for the library for now + // it sets the types for the callback incorrectly + onChanged!(text); + }, + textCapitalization: TextCapitalization.sentences, ), - minLines: minLines, - maxLines: maxLines, - keyboardType: keyboardType!, - textInputAction: textInputAction, - autofocus: autofocus!, - inputFormatters: [ - //#Pangea - //LengthLimitingTextInputFormatter((maxPDUSize / 3).floor()), - //setting max character count to 1000 - //after max, nothing else can be typed - LengthLimitingTextInputFormatter(1000), - //Pangea# - ], - onSubmitted: (text) { - // fix for library for now - // it sets the types for the callback incorrectly - onSubmitted!(text); - }, - // #Pangea - style: controller?.exceededMaxLength ?? false - ? const TextStyle(color: Colors.red) - : null, - onTap: () { - controller?.onInputTap( - context, - fNode: focusNode, - ); - }, - // Pangea# - decoration: decoration!, - onChanged: (text) { - // fix for the library for now - // it sets the types for the callback incorrectly - onChanged!(text); - }, - textCapitalization: TextCapitalization.sentences, ); }, suggestionsCallback: getSuggestions,