AppFlowy-IO / AppFlowy-IO/appflowy-editor

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

Đang mở
#715 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
p1
Ngôn ngữ chính
Dart
Star
684
Fork
329
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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_

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.