AppFlowy-IO / AppFlowy-IO/appflowy-editor

[Bug] assert failure of autoscroll on mobile on empty editor

Abierto
#715 4 comentarios 0 reacciones 0 asignados Ver en GitHub
p1
Lenguaje dominante
Dart
Estrellas
684
Forks
329
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Bug Description

We use the editor (thanks by the way for all your great work here!) to create whats-app-style updates in our app. Thus we have the editor centered on the screen start out empty. When we start typing, the `EdgeDraggingAutoScroller` throws an assertion error internally - but everything else seems to work fine.

```dart
E/global.acter.app( 3872): _dragTargetRelatedToScrollOrigin.size.height': Drag target size is larger than scrollable size, which may cause bouncing
E/global.acter.app( 3872): acter::platform::native: [2024-02-16][11:59:59][acter::platform::native][ERROR] #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/global.acter.app( 3872): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/global.acter.app( 3872): #2 EdgeDraggingAutoScroller._scroll (package:appflowy_editor/src/flutter/scrollable_helpers.dart:236:7)
E/global.acter.app( 3872): #3 EdgeDraggingAutoScroller.startAutoScrollIfNecessary (package:appflowy_editor/src/flutter/scrollable_helpers.dart:215:5)
E/global.acter.app( 3872): #4 AutoScroller.startAutoScroll (package:appflowy_editor/src/editor/editor_component/service/scroll/auto_scroller.dart:48:5)
E/global.acter.app( 3872): #5 _MobileScrollServiceState.startAutoScroll (package:appflowy_editor/src/editor/editor_component/service/scroll/mobile_scroll_service.dart:103:19)
E/global.acter.app( 3872): #6 _ScrollServiceWidgetState.startAutoScroll (package:appflowy_editor/src/editor/editor_component/service/scroll_service_widget.dart:172:13)
E/global.acter.app( 3872): #7 _ScrollServiceWidgetState._onSelectionChanged.. (package:appflowy_editor/src/editor/editor_component/service/scroll_service_widget.dart:109:11)
E/global.acter.app( 3872): #8 new Future.delayed. (dart:async/future.dart:427:39)
E/global.acter.app( 3872): #9 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15)
E/global.acter.app( 3872): #10 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/global.acter.app( 3872): #11 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/global.acter.app( 3872): #12 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
```

### How to Reproduce

We only see this on mobile, the Android Emulator in particular when we have `shrinkWrap: true` and the Editor wrapped in:

```dart
MobileToolbarV2(
toolbarItems: [
textDecorationMobileToolbarItemV2,
buildTextAndBackgroundColorMobileToolbarItem(
textColorOptions: [],
),
headingMobileToolbarItem,
listMobileToolbarItem,
linkMobileToolbarItem,
quoteMobileToolbarItem,
],
editorState: editorState,
child: MobileFloatingToolbar(
editorScrollController: editorScrollController,
editorState: editorState,
toolbarBuilder: (context, anchor, closeToolbar) {
return AdaptiveTextSelectionToolbar.editable(
clipboardStatus: ClipboardStatus.pasteable,
onCopy: () {
copyCommand.execute(editorState);
closeToolbar();
},
onCut: () => cutCommand.execute(editorState),
onPaste: () => pasteCommand.execute(editorState),
onSelectAll: () => selectAllCommand.execute(editorState),
onLiveTextInput: null,
onLookUp: null,
onSearchWeb: null,
onShare: null,
anchors: TextSelectionToolbarAnchors(
primaryAnchor: anchor,
),
);
},
child: AppFlowyEditor(
// widget pass through
editable: widget.editable,
shrinkWrap: widget.shrinkWrap,
autoFocus: widget.autoFocus,
header: widget.header,
// local states
editorState: editorState,
editorScrollController: editorScrollController,
editorStyle: mobileEditorStyle(),
footer: generateFooter(),
),
),
);
```

full code at: https://github.com/acterglobal/a3/blob/18bc72cb5f9d97b2e76771f3a8cd6aa6ec86d69b/app/lib/common/widgets/html_editor.dart

### Expected Behavior

Not seeing any exception

### Operating System

Android Emulator

### AppFlowy Editor Version(s)

2.3.2

### Screenshots

_No response_

### Additional Context

_No response_

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.