Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SuperEditor][Android] Fix toolbar being hidden when releasing a long press (Resolves #2481) #2552

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use SuperKeyboard instead of checking for IME connection
  • Loading branch information
angelosilvestre committed Feb 18, 2025
commit 4031adf10868becdc054abe4b8702e3ea476bfc8
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import 'package:super_editor/src/infrastructure/platforms/mobile_documents.dart'
import 'package:super_editor/src/infrastructure/signal_notifier.dart';
import 'package:super_editor/src/infrastructure/sliver_hybrid_stack.dart';
import 'package:super_editor/src/infrastructure/touch_controls.dart';
import 'package:super_keyboard/super_keyboard.dart';

import '../infrastructure/document_gestures.dart';
import '../infrastructure/document_gestures_interaction_overrides.dart';
Expand Down Expand Up @@ -430,7 +431,6 @@ class AndroidDocumentTouchInteractor extends StatefulWidget {
required this.selection,
this.openKeyboardWhenTappingExistingSelection = true,
required this.openSoftwareKeyboard,
required this.isImeConnected,
required this.scrollController,
required this.fillViewport,
this.contentTapHandlers,
Expand All @@ -453,10 +453,6 @@ class AndroidDocumentTouchInteractor extends StatefulWidget {
/// A callback that should open the software keyboard when invoked.
final VoidCallback openSoftwareKeyboard;

/// A [ValueListenable] that should notify this widget when the IME connects
/// and disconnects.
final ValueListenable<bool> isImeConnected;

/// Optional list of handlers that respond to taps on content, e.g., opening
/// a link when the user taps on text with a link attribution.
///
Expand Down Expand Up @@ -993,7 +989,7 @@ class _AndroidDocumentTouchInteractorState extends State<AndroidDocumentTouchInt
..hideMagnifier()
..blinkCaret();

if (didTapOnExistingSelection && widget.isImeConnected.value) {
if (didTapOnExistingSelection && SuperKeyboard.instance.state.value == KeyboardState.open) {
// Toggle the toolbar display when the user taps on the collapsed caret,
// or on top of an existing selection.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import 'package:super_editor/src/infrastructure/platforms/platform.dart';
import 'package:super_editor/src/infrastructure/signal_notifier.dart';
import 'package:super_editor/src/infrastructure/sliver_hybrid_stack.dart';
import 'package:super_editor/src/infrastructure/touch_controls.dart';
import 'package:super_keyboard/super_keyboard.dart';

import '../infrastructure/document_gestures.dart';
import '../infrastructure/document_gestures_interaction_overrides.dart';
Expand Down Expand Up @@ -266,7 +267,6 @@ class IosDocumentTouchInteractor extends StatefulWidget {
required this.selection,
this.openKeyboardWhenTappingExistingSelection = true,
required this.openSoftwareKeyboard,
required this.isImeConnected,
required this.scrollController,
required this.dragHandleAutoScroller,
required this.fillViewport,
Expand All @@ -289,10 +289,6 @@ class IosDocumentTouchInteractor extends StatefulWidget {
/// A callback that should open the software keyboard when invoked.
final VoidCallback openSoftwareKeyboard;

/// A [ValueListenable] that should notify this widget when the IME connects
/// and disconnects.
final ValueListenable<bool> isImeConnected;

/// Optional list of handlers that respond to taps on content, e.g., opening
/// a link when the user taps on text with a link attribution.
///
Expand Down Expand Up @@ -661,7 +657,7 @@ class _IosDocumentTouchInteractorState extends State<IosDocumentTouchInteractor>
selection.extent.nodeId == docPosition.nodeId &&
selection.extent.nodePosition.isEquivalentTo(docPosition.nodePosition);

if (didTapOnExistingSelection && widget.isImeConnected.value) {
if (didTapOnExistingSelection && SuperKeyboard.instance.state.value == KeyboardState.open) {
// Toggle the toolbar display when the user taps on the collapsed caret,
// or on top of an existing selection.
//
Expand Down
Loading