memspace / zefyr

Soft and gentle rich text editing for Flutter applications.
https://zefyr-editor.gitbook.io
2.22k stars 551 forks source link

1.0-dev ZefyrEditor's focusNode.requestFocus() should put focus at the end of the text #474

Open hyouuu opened 3 years ago

hyouuu commented 3 years ago

Steps to Reproduce

  1. Set up the editor like the example app:
    
    ZefyrEditor(controller: textCo,  focusNode: textFocusNode)

composeDoc().then((doc) { setState(() { textCo = ZefyrController(doc); }); });

Future composeDoc() async { final delta = Delta()..insert("example text"); return NotusDocument()..compose(delta, ChangeSource.local); }

2. Call `textFocusNode.requestFocus()`

Expecting cursor at the end of the text, but the cursor is at the beginning of the text.

Note that there are similar issues on a normal TextField: https://github.com/flutter/flutter/issues/11416

<!-- Paste the output of running `flutter doctor -v` here. -->

[✓] Flutter (Channel stable, 1.22.5, on macOS 11.1 20C69 darwin-x64, locale en-US) • Flutter version 1.22.5 at /Users/shawn.gong/flutter • Framework revision 7891006299 (6 weeks ago), 2020-12-10 11:54:40 -0800 • Engine revision ae90085a84 • Dart version 2.10.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at /Users/shawn.gong/Library/Android/sdk • Platform android-30, build-tools 30.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.3, Build version 12C33 • CocoaPods version 1.10.1

[!] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] Connected device (2 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator) • hyouuu test 11 pro (mobile) • 00008030-000E39242140802E • ios • iOS 14.3

danleitch commented 1 year ago

Have the same issue, I'm also aware of the other thread.

amantoux commented 1 year ago

@hyouuu @danleitch this repo is not actively maintained anymore. We've forked it --> https://github.com/fleather-editor/fleather and we actively maintain the new repo.

Feel free to contribute or submit any issues