AppFlowy-IO / AppFlowy-IO/appflowy-editor

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

オープン
#715 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
p1
主要言語
Dart
スター
684
フォーク
329
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。