Skip to content

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.

Merge branch 'AppFlowy-IO:main' into documentation/flowy_editor

Lucas.Xu5c314ae664ab
diff --cc frontend/app_flowy/packages/flowy_editor/README.md
index 84d4a2562a,8b55e735b5..1e23b05409
--- a/frontend/app_flowy/packages/flowy_editor/README.md
+++ b/frontend/app_flowy/packages/flowy_editor/README.md
@@@ -11,20 -11,12 +11,32 @@@ and the Flutter guide fo
[developing packages and plugins](https://flutter.dev/developing-packages).
-->
- 一个易于扩展,测试覆盖的 flutter 富文本编辑组件
-TODO: Put a short description of the package here that helps potential users
-know whether this package might be useful for them.
++<center><big><b>FlowyEditor</b></big></center>
++
++<p align="center">An easily extensible, test-covered rich text editing component for Flutter</p>
++
++![](documentation/images/example.png)
## Features
- * 易于扩展的
-TODO: List what your package can do. Maybe include images, gifs, or videos.
++* Extensible
++ * Support for extending different styles of views.
+ * 支持扩展不同样式的视图
- * 支持定制快捷键解析
- * 支持扩展toolbar/popup list样式(WIP)
++ * Support extending custom shortcut key parsing
++ * 支持扩展自定义快捷键解析
++ * Support extending toolbar/popup list(WIP)
++ * 支持扩展toolbar/popup list(WIP)
+ * ...
- * 协同结构 ready
- *
- * 质量保证的
- * 由于可扩展的结构,以及随着功能的增多,我们鼓励每个提交的文件或者代码段,都可以在test下增加对应的测试用例代码,尽可能得保证提交者不需要担心自己的代码影响了已有的逻辑。
++* Collaboration Ready
++ * All changes to the document are based on **operation**. Theoretically, collaborative editing will be supported in the future.
++ * 所有对文档的修改都是基于operation。理论上未来会支持协同编辑。
++* Good stability guarantees
++ * Current code coverage >= 60%, we will still continue to add more test cases.
++
++> 由于可扩展的结构,以及随着功能的增多,我们鼓励每个提交的文件或者代码段,都可以在test下增加对应的测试用例代码,尽可能得保证提交者不需要担心自己的代码影响了已有的逻辑。
++
++> Due to the extensible structure and the increase in functionality, we encourage each commit to add test case code under test to ensure that the committer does not have to worry about their code affecting the existing logic as much as possible.
+
## Getting started
@@@ -35,52 -25,15 +47,46 @@@ flutter pub ge
## Usage
- Empty document
-TODO: Include short and useful examples for package users. Add longer examples
-to `/example` folder.
++Creates editor with empty document
+```dart
+final editorState = EditorState.empty();
+final editor = FlowyEditor(
+ editorState: editorState,
+ keyEventHandlers: const [],
+ customBuilders: const {},
+);
+```
- 从JSON文件中读取
++Creates editor from JSON file
```dart
-const like = 'sample';
+final json = ...;
+final editorState = EditorState(StateTree.fromJson(data));
+final editor = FlowyEditor(
+ editorState: editorState,
+ keyEventHandlers: const [],
+ customBuilders: const {},
+);
+```
+
+For more. Run the example.
+```shell
+git clone https://github.com/AppFlowy-IO/AppFlowy.git
+cd frontend/app_flowy/packages/flowy_editor/example
+flutter run
```
-## Additional information
+## Examples
+* 样式扩展
+ * Checkbox text - 展示如何基于已有的富文本组件扩展新的样式,
+ * Image - 展示如何扩展新的节点,并且渲染
+* 快捷键扩展
+ * BUIS - 展示如何通过快捷键对文字进行加粗/下划线/斜体/加粗
+ * 粘贴HTML - 展示如何通过快捷键处理粘贴的样式
+
- ## Documentation
- * 术语表
-
++## Glossary
+
+
- ## Additional information
+
- 目前正在完善更多的文档信息
- * Selection
- *
- 我们还有很多工作需要继续完成,链接到contributing.md
- Project checker link.
-TODO: Tell users more about the package: where to find more information, how to
-contribute to the package, how to file issues, what response they can expect
-from the package authors, and more.
++## Contributing
++Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated. Please look at [CONTRIBUTING.md](documentation/contributing.md) for details.
diff --cc frontend/app_flowy/packages/flowy_editor/documentation/images/example.png
index 0000000000,0000000000..a810f0dae5
new file mode 100644
Binary files differ
diff --cc frontend/app_flowy/packages/flowy_editor/example/assets/example.json
index 549cd4f765,e6357d93f9..135b0492a7
--- a/frontend/app_flowy/packages/flowy_editor/example/assets/example.json
+++ b/frontend/app_flowy/packages/flowy_editor/example/assets/example.json
@@@ -37,16 -37,11 +37,24 @@@
"type": "text",
"delta": [
{
- "insert": "We are still developing more features. Please give us a star if the "
- "insert": "At "
++ "insert": "Since we are a community-driven open source editor, we very welcome and appreciate every pull request submissions from everyone.😄😄😄"
++ }
++ ]
++ },
++ {
++ "type": "text",
++ "delta": [
++ {
++ "insert": "To be honest, we are still in the alpha stage, there are still many functions that need to be completed. And we are still developing more features. Please give us a star if the "
},
- { "insert": "AppFlowy", "attributes": { "code": true, "bold": true, "color": "0xFFED459C"} },
{
- "insert": ", we embody what we value deep in our hearts, taking inspiration from other great companies while forging our own path. AppFlowy’s five core values are Mission Driven, Aim High & Iterate, Transparency, Collaboration, and Honesty. Together, they spell MATCH. We will continue to iterate and refine these values as we grow."
+ "insert": "FlowyEditor",
+ "attributes": {
+ "href": "https://github.com/AppFlowy-IO/AppFlowy"
+ }
+ },
+ {
- "insert": " helps you."
++ "insert": " helps you. 😊😊😊"
}
]
},