Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
feat: optimize selection gesture in editor (#6445)
Lucas19361e2c681d
diff --git a/frontend/appflowy_flutter/integration_test/desktop/document/document_selection_test.dart b/frontend/appflowy_flutter/integration_test/desktop/document/document_selection_test.dartnew file mode 100644index 0000000000..bd0fd18c50--- /dev/null+++ b/frontend/appflowy_flutter/integration_test/desktop/document/document_selection_test.dart@@ -0,0 +1,51 @@+import 'package:appflowy_editor/appflowy_editor.dart';+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:integration_test/integration_test.dart';++import '../../shared/util.dart';++void main() {+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();++ group('document selection:', () {+ testWidgets('select text from start to end by pan gesture ',+ (tester) async {+ await tester.initializeAppFlowy();+ await tester.tapAnonymousSignInButton();++ // create a new document+ await tester.createNewPageWithNameUnderParent();++ final editor = tester.editor;+ final editorState = editor.getCurrentEditorState();+ // insert a paragraph+ final transaction = editorState.transaction;+ transaction.insertNode(+ [0],+ paragraphNode(+ text:+ '''Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.''',+ ),+ );+ await editorState.apply(transaction);+ await tester.pumpAndSettle(Durations.short1);++ final textBlocks = find.byType(AppFlowyRichText);+ final topLeft = tester.getTopLeft(textBlocks.at(0));++ final gesture = await tester.startGesture(+ topLeft,+ pointer: 7,+ );+ await tester.pumpAndSettle();++ for (var i = 0; i < 10; i++) {+ await gesture.moveBy(const Offset(10, 0));+ await tester.pump(Durations.short1);+ }++ expect(editorState.selection!.start.offset, 0);+ });+ });+}diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lockindex 7c31ed53fe..193cacfe66 100644--- a/frontend/appflowy_flutter/pubspec.lock+++ b/frontend/appflowy_flutter/pubspec.lock@@ -53,8 +53,8 @@ packages:dependency: "direct main"description:path: "."- ref: "3bbdccd"- resolved-ref: "3bbdccd9b1b583027c2ac9121de04b8c76bfef73"+ ref: "98356fa"+ resolved-ref: "98356fac4cbac7abefcc8641eb8481a9e527611f"url: "https://github.com/AppFlowy-IO/appflowy-editor.git"source: gitversion: "3.3.0"diff --git a/frontend/appflowy_flutter/pubspec.yaml b/frontend/appflowy_flutter/pubspec.yamlindex 35e0940a5e..4aaca478c8 100644--- a/frontend/appflowy_flutter/pubspec.yaml+++ b/frontend/appflowy_flutter/pubspec.yaml@@ -170,7 +170,7 @@ dependency_overrides:appflowy_editor:git:url: https://github.com/AppFlowy-IO/appflowy-editor.git- ref: "3bbdccd"+ ref: "98356fa"appflowy_editor_plugins:git: