Browse Source

chore: rename flowy_editor to appflowy_editor

Lucas.Xu 2 years ago
parent
commit
2adde7c173
30 changed files with 56 additions and 57 deletions
  1. 3 3
      frontend/app_flowy/packages/flowy_editor/README.md
  2. 1 1
      frontend/app_flowy/packages/flowy_editor/documentation/contributing.md
  3. 6 6
      frontend/app_flowy/packages/flowy_editor/documentation/customizing.md
  4. 1 1
      frontend/app_flowy/packages/flowy_editor/documentation/testing.md
  5. 13 13
      frontend/app_flowy/packages/flowy_editor/example/lib/main.dart
  6. 1 1
      frontend/app_flowy/packages/flowy_editor/example/lib/plugin/image_node_widget.dart
  7. 1 1
      frontend/app_flowy/packages/flowy_editor/example/lib/plugin/network_image_node_widget.dart
  8. 1 1
      frontend/app_flowy/packages/flowy_editor/example/lib/plugin/underscore_to_italic_key_event_handler.dart
  9. 1 1
      frontend/app_flowy/packages/flowy_editor/example/lib/plugin/youtube_link_node_widget.dart
  10. 2 2
      frontend/app_flowy/packages/flowy_editor/lib/appflowy_editor.dart
  11. 1 2
      frontend/app_flowy/packages/flowy_editor/lib/src/operation/operation.dart
  12. 5 5
      frontend/app_flowy/packages/flowy_editor/lib/src/service/editor_service.dart
  13. 1 1
      frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/arrow_keys_handler.dart
  14. 2 2
      frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/copy_paste_handler.dart
  15. 1 1
      frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/delete_text_handler.dart
  16. 1 1
      frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/page_up_down_handler.dart
  17. 1 1
      frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/select_all_handler.dart
  18. 1 1
      frontend/app_flowy/packages/flowy_editor/lib/src/service/keyboard_service.dart
  19. 1 1
      frontend/app_flowy/packages/flowy_editor/lib/src/service/service.dart
  20. 1 1
      frontend/app_flowy/packages/flowy_editor/lib/src/service/toolbar_service.dart
  21. 2 2
      frontend/app_flowy/packages/flowy_editor/test/infra/test_editor.dart
  22. 1 1
      frontend/app_flowy/packages/flowy_editor/test/render/rich_text/checkbox_text_test.dart
  23. 1 1
      frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/delete_text_handler_test.dart
  24. 1 1
      frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler_test.dart
  25. 1 1
      frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/page_up_down_handler_test.dart
  26. 1 1
      frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/redo_undo_handler_test.dart
  27. 1 1
      frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/select_all_handler_test.dart
  28. 1 1
      frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/slash_handler_test.dart
  29. 1 1
      frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/update_text_style_by_command_x_handler_test.dart
  30. 1 1
      frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/white_space_handler_test.dart

+ 3 - 3
frontend/app_flowy/packages/flowy_editor/README.md

@@ -11,7 +11,7 @@ and the Flutter guide for
 [developing packages and plugins](https://flutter.dev/developing-packages). 
 -->
 
-<h1 align="center"><b>FlowyEditor</b></h1>
+<h1 align="center"><b>AppFlowyEditor</b></h1>
 
 <p align="center">An completely customize, test-covered rich text editing component for Flutter</p>
 
@@ -45,7 +45,7 @@ flutter pub get
 Creates editor with empty document
 ```dart
 final editorState = EditorState.empty();
-final editor = FlowyEditor(
+final editor = AppFlowyEditor(
     editorState: editorState,
     keyEventHandlers: const [],
     customBuilders: const {},
@@ -56,7 +56,7 @@ Creates editor from JSON file
 ```dart
 final json = ...;
 final editorState = EditorState(StateTree.fromJson(data));
-final editor = FlowyEditor(
+final editor = AppFlowyEditor(
     editorState: editorState,
     keyEventHandlers: const [],
     customBuilders: const {},

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/documentation/contributing.md

@@ -14,4 +14,4 @@ We welcome and appreciate your pull request submissions, and we have many good-f
 
 As [README](../README.md) said, we want to make sure that the code you submit will not affect the existing code logic and functionality, so please attach the corresponding test for each PR submission, and it is recommended to add a brief description of the test case and scope to the test. For more details, please see [TESTING.md](./testing.md)
 
-Finally, to repeat, since the FlowyEditor is a community-driven open source editor, we take every PR seriously and feel very much for everyone's contribution.
+Finally, to repeat, since the AppFlowyEditor is a community-driven open source editor, we take every PR seriously and feel very much for everyone's contribution.

+ 6 - 6
frontend/app_flowy/packages/flowy_editor/documentation/customizing.md

@@ -13,7 +13,7 @@ Widget build(BuildContext context) {
   return Scaffold(
     body: Container(
       alignment: Alignment.topCenter,
-      child: FlowyEditor(
+      child: AppFlowyEditor(
         editorState: EditorState.empty(),
         keyEventHandlers: const [],
       ),
@@ -29,7 +29,7 @@ Nothing will happen after typing `_xxx_`.
 Next, we will create a function to handler underscore input.
 
 ```dart
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 
@@ -102,7 +102,7 @@ Widget build(BuildContext context) {
   return Scaffold(
     body: Container(
       alignment: Alignment.topCenter,
-      child: FlowyEditor(
+      child: AppFlowyEditor(
         editorState: EditorState.empty(),
         keyEventHandlers: [
             underscoreToItalicHandler,
@@ -130,7 +130,7 @@ Widget build(BuildContext context) {
   return Scaffold(
     body: Container(
       alignment: Alignment.topCenter,
-      child: FlowyEditor(
+      child: AppFlowyEditor(
         editorState: EditorState.empty(),
         keyEventHandlers: const [],
       ),
@@ -156,7 +156,7 @@ Then, we create a class that inherits [NodeWidgetBuilder](). As shown in the aut
 
 
 ```dart
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/material.dart';
 
 class NetworkImageNodeWidgetBuilder extends NodeWidgetBuilder {
@@ -266,7 +266,7 @@ final editorState = EditorState(
       ],
     ),
 );
-return FlowyEditor(
+return AppFlowyEditor(
   editorState: editorState,
   customBuilders: {
     'network_image': NetworkImageNodeWidgetBuilder(),

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/documentation/testing.md

@@ -94,7 +94,7 @@ print(attributes);
 
 完整的例子
 ```dart
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
 import '../../infra/test_editor.dart';

+ 13 - 13
frontend/app_flowy/packages/flowy_editor/example/lib/main.dart

@@ -7,7 +7,7 @@ import 'package:example/expandable_floating_action_button.dart';
 import 'package:example/plugin/image_node_widget.dart';
 import 'package:example/plugin/youtube_link_node_widget.dart';
 
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 
 void main() {
   runApp(const MyApp());
@@ -32,7 +32,7 @@ class MyApp extends StatelessWidget {
         // is not restarted.
         primarySwatch: Colors.blue,
       ),
-      home: const MyHomePage(title: 'FlowyEditor Example'),
+      home: const MyHomePage(title: 'AppFlowyEditor Example'),
     );
   }
 }
@@ -72,11 +72,11 @@ class _MyHomePageState extends State<MyHomePage> {
 
   Widget _buildBody() {
     if (page == 0) {
-      return _buildFlowyEditorWithExample();
+      return _buildAppFlowyEditorWithExample();
     } else if (page == 1) {
-      return _buildFlowyEditorWithEmptyDocument();
+      return _buildAppFlowyEditorWithEmptyDocument();
     } else if (page == 2) {
-      return _buildFlowyEditorWithBigDocument();
+      return _buildAppFlowyEditorWithBigDocument();
     }
     return Container();
   }
@@ -116,9 +116,9 @@ class _MyHomePageState extends State<MyHomePage> {
     );
   }
 
-  Widget _buildFlowyEditorWithEmptyDocument() {
+  Widget _buildAppFlowyEditorWithEmptyDocument() {
     final editorState = EditorState.empty();
-    final editor = FlowyEditor(
+    final editor = AppFlowyEditor(
       editorState: editorState,
       keyEventHandlers: const [],
       customBuilders: const {},
@@ -126,13 +126,13 @@ class _MyHomePageState extends State<MyHomePage> {
     return editor;
   }
 
-  Widget _buildFlowyEditorWithExample() {
+  Widget _buildAppFlowyEditorWithExample() {
     return FutureBuilder<String>(
       future: rootBundle.loadString('assets/example.json'),
       builder: (context, snapshot) {
         if (snapshot.hasData) {
           final data = Map<String, Object>.from(json.decode(snapshot.data!));
-          return _buildFlowyEditor(EditorState(
+          return _buildAppFlowyEditor(EditorState(
             document: StateTree.fromJson(data),
           ));
         } else {
@@ -144,13 +144,13 @@ class _MyHomePageState extends State<MyHomePage> {
     );
   }
 
-  Widget _buildFlowyEditorWithBigDocument() {
+  Widget _buildAppFlowyEditorWithBigDocument() {
     return FutureBuilder<String>(
       future: rootBundle.loadString('assets/big_document.json'),
       builder: (context, snapshot) {
         if (snapshot.hasData) {
           final data = Map<String, Object>.from(json.decode(snapshot.data!));
-          return _buildFlowyEditor(EditorState(
+          return _buildAppFlowyEditor(EditorState(
             document: StateTree.fromJson(data),
           ));
         } else {
@@ -162,10 +162,10 @@ class _MyHomePageState extends State<MyHomePage> {
     );
   }
 
-  Widget _buildFlowyEditor(EditorState editorState) {
+  Widget _buildAppFlowyEditor(EditorState editorState) {
     return Container(
       padding: const EdgeInsets.only(left: 20, right: 20),
-      child: FlowyEditor(
+      child: AppFlowyEditor(
         key: editorKey,
         editorState: editorState,
         keyEventHandlers: const [],

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/example/lib/plugin/image_node_widget.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/material.dart';
 
 /// 1. define your custom type in example.json

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/example/lib/plugin/network_image_node_widget.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/material.dart';
 
 class NetworkImageNodeWidgetBuilder extends NodeWidgetBuilder {

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/example/lib/plugin/underscore_to_italic_key_event_handler.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/example/lib/plugin/youtube_link_node_widget.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/material.dart';
 import 'package:pod_player/pod_player.dart';
 

+ 2 - 2
frontend/app_flowy/packages/flowy_editor/lib/flowy_editor.dart → frontend/app_flowy/packages/flowy_editor/lib/appflowy_editor.dart

@@ -1,5 +1,5 @@
-/// FlowyEditor library
-library flowy_editor;
+/// AppFlowyEditor library
+library appflowy_editor;
 
 export 'src/document/node.dart';
 export 'src/document/path.dart';

+ 1 - 2
frontend/app_flowy/packages/flowy_editor/lib/src/operation/operation.dart

@@ -1,5 +1,4 @@
-import 'package:flowy_editor/src/document/attributes.dart';
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 
 abstract class Operation {
   factory Operation.fromJson(Map<String, dynamic> map) {

+ 5 - 5
frontend/app_flowy/packages/flowy_editor/lib/src/service/editor_service.dart

@@ -26,8 +26,8 @@ NodeWidgetBuilders defaultBuilders = {
   'text/quote': QuotedTextNodeWidgetBuilder(),
 };
 
-class FlowyEditor extends StatefulWidget {
-  const FlowyEditor({
+class AppFlowyEditor extends StatefulWidget {
+  const AppFlowyEditor({
     Key? key,
     required this.editorState,
     this.customBuilders = const {},
@@ -43,10 +43,10 @@ class FlowyEditor extends StatefulWidget {
   final List<FlowyKeyEventHandler> keyEventHandlers;
 
   @override
-  State<FlowyEditor> createState() => _FlowyEditorState();
+  State<AppFlowyEditor> createState() => _AppFlowyEditorState();
 }
 
-class _FlowyEditorState extends State<FlowyEditor> {
+class _AppFlowyEditorState extends State<AppFlowyEditor> {
   EditorState get editorState => widget.editorState;
 
   @override
@@ -57,7 +57,7 @@ class _FlowyEditorState extends State<FlowyEditor> {
   }
 
   @override
-  void didUpdateWidget(covariant FlowyEditor oldWidget) {
+  void didUpdateWidget(covariant AppFlowyEditor oldWidget) {
     super.didUpdateWidget(oldWidget);
 
     if (editorState.service != oldWidget.editorState.service) {

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/arrow_keys_handler.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 

+ 2 - 2
frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/copy_paste_handler.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flowy_editor/src/infra/html_converter.dart';
 import 'package:flowy_editor/src/document/node_iterator.dart';
 import 'package:flutter/material.dart';
@@ -106,7 +106,7 @@ _pasteMultipleLinesInText(
       if (tailNodes.last.type == "text") {
         final tailTextNode = tailNodes.last as TextNode;
         tailTextNode.delta = tailTextNode.delta + remain;
-      } else if (remain.length > 0) {
+      } else if (remain.isNotEmpty) {
         tailNodes.add(TextNode(type: "text", delta: remain));
       }
     } else {

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/delete_text_handler.dart

@@ -1,7 +1,7 @@
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 
 KeyEventResult _handleBackspace(EditorState editorState, RawKeyEvent event) {
   var selection = editorState.service.selectionService.currentSelection.value;

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/page_up_down_handler.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/select_all_handler.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/lib/src/service/keyboard_service.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/services.dart';
 
 import 'package:flutter/material.dart';

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/lib/src/service/service.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flowy_editor/src/service/toolbar_service.dart';
 import 'package:flutter/material.dart';
 

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/lib/src/service/toolbar_service.dart

@@ -1,6 +1,6 @@
 import 'package:flutter/material.dart';
 
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flowy_editor/src/render/selection/toolbar_widget.dart';
 import 'package:flowy_editor/src/extensions/object_extensions.dart';
 

+ 2 - 2
frontend/app_flowy/packages/flowy_editor/test/infra/test_editor.dart

@@ -1,6 +1,6 @@
 import 'dart:collection';
 
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
@@ -26,7 +26,7 @@ class EditorWidgetTester {
     await tester.pumpWidget(
       MaterialApp(
         home: Scaffold(
-          body: FlowyEditor(
+          body: AppFlowyEditor(
             editorState: _editorState,
           ),
         ),

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/test/render/rich_text/checkbox_text_test.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flowy_editor/src/render/rich_text/default_selectable.dart';
 import 'package:flowy_editor/src/render/rich_text/rich_text_style.dart';
 import 'package:flowy_editor/src/extensions/text_node_extensions.dart';

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/delete_text_handler_test.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flowy_editor/src/render/rich_text/rich_text_style.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler_test.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flowy_editor/src/render/rich_text/rich_text_style.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/page_up_down_handler_test.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
 import '../../infra/test_editor.dart';

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/redo_undo_handler_test.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
 import '../../infra/test_editor.dart';

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/select_all_handler_test.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
 import '../../infra/test_editor.dart';

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/slash_handler_test.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flowy_editor/src/service/internal_key_event_handlers/slash_handler.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/update_text_style_by_command_x_handler_test.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flowy_editor/src/render/rich_text/rich_text_style.dart';
 import 'package:flowy_editor/src/extensions/text_node_extensions.dart';
 import 'package:flutter/services.dart';

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/test/service/internal_key_event_handlers/white_space_handler_test.dart

@@ -1,4 +1,4 @@
-import 'package:flowy_editor/flowy_editor.dart';
+import 'package:flowy_editor/appflowy_editor.dart';
 import 'package:flowy_editor/src/render/rich_text/rich_text_style.dart';
 import 'package:flowy_editor/src/service/internal_key_event_handlers/whitespace_handler.dart';
 import 'package:flutter/services.dart';