Skip to content

Commit

Permalink
chore: pre-release 0.1.1 (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 authored Mar 9, 2023
1 parent 7ba3f1d commit 682e3dc
Show file tree
Hide file tree
Showing 88 changed files with 2,142 additions and 981 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/commit_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Commit messages lint
on: [pull_request, push]

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4

40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: AppFlowyEditor test

on:
pull_request:
branches:
- "main"
- "release/*"

env:
FLUTTER_VERSION: "3.7.5"

jobs:
tests:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Run tests
run: |
flutter pub get
flutter analyze .
dart format --set-exit-if-changed .
flutter test --coverage
- uses: codecov/codecov-action@v3
with:
env_vars: ${{ matrix.os }}
fail_ci_if_error: true
verbose: true
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.1.1
* Support Flutter 3.7.5

## 0.1.0
* Support Flutter 3.7.5

## 0.0.9
* Support customize the text color and text background color.
* Fix some bugs.
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ and the Flutter guide for
</p>

<div align="center">
<img src="https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/documentation/images/appflowy_editor_example.mp4?raw=true" width = "700" style = "padding: 100"/>
<img src="https://github.com/AppFlowy-IO/appflowy-editor/blob/main/documentation/images/appflowy_editor_example.mp4?raw=true" width = "700" style = "padding: 100"/>
</div>

## Key Features
Expand All @@ -38,7 +38,7 @@ and the Flutter guide for
* shortcut events
* themes
* menu options (**coming soon!**)
* [Test-coverage](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/documentation/testing.md) and ongoing maintenance by AppFlowy's core team and community of more than 1,000 builders
* [Test-coverage](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/documentation/testing.md) and ongoing maintenance by AppFlowy's core team and community of more than 1,000 builders

## Getting Started

Expand All @@ -60,7 +60,7 @@ final editor = AppFlowyEditor(
);
```

You can also create an editor from a JSON object in order to configure your initial state. Or you can [create an editor from Markdown or Quill Delta](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/documentation/importing.md).
You can also create an editor from a JSON object in order to configure your initial state. Or you can [create an editor from Markdown or Quill Delta](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/documentation/importing.md).

```dart
final json = ...;
Expand Down Expand Up @@ -91,23 +91,23 @@ flutter run

### Customizing Components

Please refer to our documentation on customizing AppFlowy for a detailed discussion about [customizing components](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/documentation/customizing.md#customize-a-component).
Please refer to our documentation on customizing AppFlowy for a detailed discussion about [customizing components](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/documentation/customizing.md#customize-a-component).

Below are some examples of component customizations:

* [Checkbox Text](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/checkbox_text.dart) demonstrates how to extend new styles based on existing rich text components
* [Image](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/example/lib/plugin/network_image_node_widget.dart) demonstrates how to extend a new node and render it
* See further examples of [rich-text plugins](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text)
* [Checkbox Text](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/lib/src/render/rich_text/checkbox_text.dart) demonstrates how to extend new styles based on existing rich text components
* [Image](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/example/lib/plugin/network_image_node_widget.dart) demonstrates how to extend a new node and render it
* See further examples of [rich-text plugins](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/lib/src/render/rich_text)

### Customizing Shortcut Events

Please refer to our documentation on customizing AppFlowy for a detailed discussion about [customizing shortcut events](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/documentation/customizing.md#customize-a-shortcut-event).
Please refer to our documentation on customizing AppFlowy for a detailed discussion about [customizing shortcut events](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/documentation/customizing.md#customize-a-shortcut-event).

Below are some examples of shortcut event customizations:

* [BIUS](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/format_style_handler.dart) demonstrates how to make text bold/italic/underline/strikethrough through shortcut keys
* [Paste HTML](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/copy_paste_handler.dart) gives you an idea on how to handle pasted styles through shortcut keys
* Need more examples? Check out [Internal key event handlers](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers)
* [BIUS](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/lib/src/service/internal_key_event_handlers/format_style_handler.dart) demonstrates how to make text bold/italic/underline/strikethrough through shortcut keys
* [Paste HTML](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/lib/src/service/internal_key_event_handlers/copy_paste_handler.dart) gives you an idea on how to handle pasted styles through shortcut keys
* Need more examples? Check out [Internal key event handlers](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/lib/src/service/internal_key_event_handlers)

## Glossary
Please refer to the API documentation.
Expand All @@ -120,6 +120,6 @@ Please look at [CONTRIBUTING.md](https://appflowy.gitbook.io/docs/essential-docu
## License
All code contributed to the AppFlowy Editor project is dual-licensed, and released under both of the following licenses:
1. The GNU Affero General Public License Version 3
2. The Mozilla Public License, Version 2.0 (the “MPL”)
2. The Mozilla Public License, Version 2.0 (the “MPL”)

See [LICENSE](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/LICENSE) for more information.
18 changes: 9 additions & 9 deletions documentation/customizing.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ At this point, nothing magic will happen after typing `_xxx_`.

To implement our shortcut event we will create a `ShortcutEvent` instance to handle an underscore input.

We need to define `key` and `command` in a ShortCutEvent object to customize hotkeys. We recommend using the description of your event as a key. For example, if the underscore `_` is defined to make text italic, the key can be 'Underscore to italic'.
We need to define `key` and `command` in a ShortCutEvent object to customize hotkeys. We recommend using the description of your event as a key. For example, if the underscore `_` is defined to make text italic, the key can be 'Underscore to italic'.

> The command, made up of a single keyword such as `underscore` or a combination of keywords using the `+` sign in between to concatenate, is a condition that triggers a user-defined function. To see which keywords are available to define a command, please refer to [key_mapping.dart](../lib/src/service/shortcut_event/key_mapping.dart).
> If more than one commands trigger the same handler, then we use ',' to split them. For example, using CTRL and A or CMD and A to 'select all', we describe it as `cmd+a,ctrl+a`(case-insensitive).
Expand Down Expand Up @@ -67,10 +67,10 @@ ShortcutEventHandler _underscoreToItalicHandler = (editorState, event) {
}
```

Now, we deal with handling the underscore.
Now, we deal with handling the underscore.

Look for the position of the previous underscore and
1. if one is _not_ found, return without doing anything.
Look for the position of the previous underscore and
1. if one is _not_ found, return without doing anything.
2. if one is found, the text enclosed within the two underscores will be formatted to display in italics.

```dart
Expand Down Expand Up @@ -136,7 +136,7 @@ Widget build(BuildContext context) {

![After](./images/customize_a_shortcut_event_after.gif)

Check out the [complete code](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/markdown_syntax_to_styled_text.dart) file of this example.
Check out the [complete code](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/lib/src/service/internal_key_event_handlers/markdown_syntax_to_styled_text.dart) file of this example.


## Customizing a Component
Expand All @@ -162,7 +162,7 @@ Widget build(BuildContext context) {
}
```

Next, we will choose a unique string for your custom node's type.
Next, we will choose a unique string for your custom node's type.

We'll use `network_image` in this case. And we add `network_image_src` to the `attributes` to describe the link of the image.

Expand All @@ -176,7 +176,7 @@ We'll use `network_image` in this case. And we add `network_image_src` to the `a
```

Then, we create a class that inherits [NodeWidgetBuilder](../lib/src/service/render_plugin_service.dart). As shown in the autoprompt, we need to implement two functions:
1. one returns a widget
1. one returns a widget
2. the other verifies the correctness of the [Node](../lib/src/core/document/node.dart).


Expand Down Expand Up @@ -273,7 +273,7 @@ class NetworkImageNodeWidgetBuilder extends NodeWidgetBuilder {
```

... and register `NetworkImageNodeWidgetBuilder` in the `AppFlowyEditor`.

```dart
final editorState = EditorState(
document: StateTree.empty()
Expand Down Expand Up @@ -302,7 +302,7 @@ return AppFlowyEditor(

![Whew!](./images/customize_a_component.gif)

Check out the [complete code](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/example/lib/plugin/network_image_node_widget.dart) file of this example.
Check out the [complete code](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/example/lib/plugin/network_image_node_widget.dart) file of this example.

## Customizing a Theme (New Feature in 0.0.7)

Expand Down
2 changes: 1 addition & 1 deletion documentation/importing.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ final editorState = EditorState(
);
```

For more details, please refer to the function `_importFile` through this [link](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/example/lib/home_page.dart).
For more details, please refer to the function `_importFile` through this [link](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/example/lib/home_page.dart).
2 changes: 1 addition & 1 deletion documentation/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Get the node of a defined path. In this case we are getting the first node of th
final firstTextNode = editor.nodeAtPath([0]) as TextNode;
```

Update the [Selection](https://github.com/AppFlowy-IO/AppFlowy/blob/main/frontend/app_flowy/packages/appflowy_editor/lib/src/document/selection.dart) so that our text "Welcome to Appflowy 😁" is selected. We will start our selection from the beginning of the string.
Update the [Selection](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/lib/src/document/selection.dart) so that our text "Welcome to Appflowy 😁" is selected. We will start our selection from the beginning of the string.

```dart
await editor.updateSelection(
Expand Down
4 changes: 2 additions & 2 deletions documentation/translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
You can help Appflowy Editor in supporting various languages by contributing. Follow the steps below sequentially to contribute translations.

## Steps to modify an existing translation
Translation files are located in: `frontend/app_flowy/packages/appflowy_editor/lib/l10n/`
Translation files are located in: `lib/l10n/`
1. Install the Visual Studio Code plugin: [Flutter intl](https://marketplace.visualstudio.com/items?itemName=localizely.flutter-intl)
2. Modify the specific translation file.
3. Save the file and the translation will be generated automatically.

## Steps to add new language
Translation files are located in: `frontend/app_flowy/packages/appflowy_editor/lib/l10n/`
Translation files are located in: `lib/l10n/`
1. Install the Visual Studio Code plugin: [Flutter intl](https://marketplace.visualstudio.com/items?itemName=localizely.flutter-intl)
2. Copy the `intl_en.arb` as a base translation and rename the new file to `intl_<new_locale>.arb`
3. Modify the new translation file.
Expand Down
2 changes: 1 addition & 1 deletion example/lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC
var jsonString = '';
switch (fileType) {
case ExportFileType.json:
jsonString = jsonEncode(plainText);
jsonString = plainText;
break;
case ExportFileType.markdown:
jsonString = jsonEncode(markdownToDocument(plainText).toJson());
Expand Down
14 changes: 0 additions & 14 deletions example/lib/pages/simple_editor.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import 'dart:convert';

import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:example/plugin/AI/continue_to_write.dart';
import 'package:example/plugin/AI/auto_completion.dart';
import 'package:example/plugin/AI/gpt3.dart';
import 'package:example/plugin/AI/smart_edit.dart';
import 'package:flutter/material.dart';

class SimpleEditor extends StatelessWidget {
Expand Down Expand Up @@ -42,16 +38,6 @@ class SimpleEditor extends StatelessWidget {
editorState: editorState,
themeData: themeData,
autoFocus: editorState.document.isEmpty,
selectionMenuItems: [
// Open AI
if (apiKey.isNotEmpty) ...[
autoCompletionMenuItem,
continueToWriteMenuItem,
]
],
toolbarItems: [
smartEditItem,
],
);
} else {
return const Center(
Expand Down
2 changes: 1 addition & 1 deletion example/lib/plugin/AI/auto_completion.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

SelectionMenuItem autoCompletionMenuItem = SelectionMenuItem(
name: () => 'Auto generate content',
name: 'Auto generate content',
icon: (editorState, onSelected) => Icon(
Icons.rocket,
size: 18.0,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/plugin/AI/continue_to_write.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:example/plugin/AI/text_robot.dart';
import 'package:flutter/material.dart';

SelectionMenuItem continueToWriteMenuItem = SelectionMenuItem(
name: () => 'Continue To Write',
name: 'Continue To Write',
icon: (editorState, onSelected) => Icon(
Icons.print,
size: 18.0,
Expand Down
19 changes: 0 additions & 19 deletions example/linux/flutter/generated_plugin_registrant.cc

This file was deleted.

15 changes: 0 additions & 15 deletions example/linux/flutter/generated_plugin_registrant.h

This file was deleted.

25 changes: 0 additions & 25 deletions example/linux/flutter/generated_plugins.cmake

This file was deleted.

16 changes: 0 additions & 16 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift

This file was deleted.

2 changes: 1 addition & 1 deletion example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
platform :osx, '10.11'
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
8 changes: 4 additions & 4 deletions example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos

SPEC CHECKSUMS:
FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9
rich_clipboard_macos: 43364b66b9dc69d203eb8dd6d758e2d12e02723c
url_launcher_macos: c04e4fa86382d4f94f6b38f14625708be3ae52e2
url_launcher_macos: 5335912b679c073563f29d89d33d10d459f95451

PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7

COCOAPODS: 1.11.3
Loading

0 comments on commit 682e3dc

Please sign in to comment.