Skip to content

Commit

Permalink
[SuperEditor][web] Defer to browser toolbar and magnifier (Resolves #…
Browse files Browse the repository at this point in the history
  • Loading branch information
angelosilvestre authored and matthew-carroll committed Oct 12, 2023
1 parent ca9e930 commit 9dbb439
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import 'package:super_editor/src/infrastructure/platforms/android/magnifier.dart
import 'package:super_editor/src/infrastructure/platforms/android/selection_handles.dart';
import 'package:super_editor/src/infrastructure/platforms/mobile_documents.dart';
import 'package:super_editor/src/infrastructure/selection_leader_document_layer.dart';
import 'package:super_editor/src/infrastructure/text_input.dart';
import 'package:super_editor/src/infrastructure/toolbar_position_delegate.dart';
import 'package:super_editor/src/infrastructure/touch_controls.dart';
import 'package:super_editor/src/super_textfield/metrics.dart';
Expand Down Expand Up @@ -1494,16 +1495,22 @@ class _AndroidDocumentTouchEditingControlsState extends State<AndroidDocumentTou
children: [
// Build the caret
_buildCaret(),
// Build the drag handles (if desired)
..._buildHandles(),
// Build the drag handles (if desired).
// We don't show handles on web because the browser already displays the native handles.
if (!isWeb) //
..._buildHandles(),
// Build the focal point for the magnifier
if (_isDraggingHandle || widget.longPressMagnifierGlobalOffset.value != null)
_buildMagnifierFocalPoint(),
// Build the magnifier (this needs to be done before building
// the handles so that the magnifier doesn't show the handles
if (widget.editingController.shouldDisplayMagnifier) _buildMagnifier(),
// Build the editing toolbar
if (widget.editingController.shouldDisplayToolbar && widget.editingController.isToolbarPositioned)
// the handles so that the magnifier doesn't show the handles.
// We don't show magnifier on web because the browser already displays the native magnifier.
if (!isWeb && widget.editingController.shouldDisplayMagnifier) _buildMagnifier(),
// Build the editing toolbar.
// We don't show toolbar on web because the browser already displays the native toolbar.
if (!isWeb &&
widget.editingController.shouldDisplayToolbar &&
widget.editingController.isToolbarPositioned)
_buildToolbar(context),
// Build a UI that's useful for debugging, if desired.
if (widget.showDebugPaint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:super_editor/src/infrastructure/_logging.dart';
import 'package:super_editor/src/infrastructure/flutter/flutter_pipeline.dart';
import 'package:super_editor/src/infrastructure/platforms/ios/selection_handles.dart';
import 'package:super_editor/src/infrastructure/platforms/mobile_documents.dart';
import 'package:super_editor/src/infrastructure/text_input.dart';
import 'package:super_editor/src/infrastructure/toolbar_position_delegate.dart';
import 'package:super_editor/src/infrastructure/touch_controls.dart';
import 'package:super_text_layout/super_text_layout.dart';
Expand Down Expand Up @@ -274,13 +275,18 @@ class _IosDocumentTouchEditingControlsState extends State<IosDocumentTouchEditin
_buildHandles(),
// Build the floating cursor
_buildFloatingCursor(),
// Build the editing toolbar
if (widget.editingController.shouldDisplayToolbar && widget.editingController.isToolbarPositioned)
// Build the editing toolbar.
// We don't show toolbar on web because the browser already displays the native toolbar.
if (!isWeb &&
widget.editingController.shouldDisplayToolbar &&
widget.editingController.isToolbarPositioned)
_buildToolbar(),
// Build the focal point for the magnifier
if (widget.magnifierFocalPointOffset != null) _buildMagnifierFocalPoint(),
// Build the magnifier
if (widget.editingController.shouldDisplayMagnifier) _buildMagnifier(),
// Build the focal point for the magnifier.
// Don't build the focal point on web because, on web, we defer to the native magnifier.
if (!isWeb && widget.magnifierFocalPointOffset != null) _buildMagnifierFocalPoint(),
// Build the magnifier.
// We don't show magnifier on web because the browser already displays the native magnifier.
if (!isWeb && widget.editingController.shouldDisplayMagnifier) _buildMagnifier(),
if (widget.showDebugPaint)
IgnorePointer(
child: Container(
Expand Down

0 comments on commit 9dbb439

Please sign in to comment.