You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-21
Original file line number
Diff line number
Diff line change
@@ -33,12 +33,13 @@ and the Flutter guide for
33
33
## Key Features
34
34
35
35
* Build rich, intuitive editors
36
-
* Design and modify an everexpanding list of customizable features including
37
-
* components (such as form input controls, numbered lists, and rich text widgets)
36
+
* Design and modify an ever-expanding list of customizable features including
37
+
*block components (such as form input controls, numbered lists, and rich text widgets)
38
38
* shortcut events
39
39
* themes
40
-
* menu options (**coming soon!**)
41
-
*[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
40
+
* selection menu
41
+
* toolbar menu
42
+
*[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
42
43
43
44
## Getting Started
44
45
@@ -54,28 +55,28 @@ flutter pub get
54
55
Start by creating a new empty AppFlowyEditor object.
55
56
56
57
```dart
57
-
final editorState = EditorState.empty(); // an empty state
58
-
final editor = AppFlowyEditor(
59
-
editorState: editorState,
58
+
final editorState = EditorState.blank(withInitialText: true); // with an empty paragraph
59
+
final editor = AppFlowyEditor.standard(
60
+
editorState: editorState,
60
61
);
61
62
```
62
63
63
64
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).
64
65
65
66
```dart
66
-
final json = ...;
67
-
final editorState = EditorState(Document.fromJson(data));
68
-
final editor = AppFlowyEditor(
69
-
editorState: editorState,
67
+
final json = jsonDecode('YOUR INPUT JSON STRING');
68
+
final editorState = EditorState(document: Document.fromJson(json));
69
+
final editor = AppFlowyEditor.standard(
70
+
editorState: editorState,
70
71
);
71
72
```
72
73
73
74
> Note: The parameters `localizationsDelegates` need to be assigned in MaterialApp widget
74
75
```dart
75
76
MaterialApp(
76
-
localizationsDelegates: const [
77
-
AppFlowyEditorLocalizations.delegate,
78
-
],
77
+
localizationsDelegates: const [
78
+
AppFlowyEditorLocalizations.delegate,
79
+
],
79
80
);
80
81
```
81
82
@@ -89,25 +90,24 @@ flutter run
89
90
90
91
## Customizing Your Editor
91
92
92
-
### Customizing Components
93
+
### Customizing Block Components
93
94
94
95
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).
95
96
96
97
Below are some examples of component customizations:
97
98
98
-
*[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
99
-
*[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
100
-
* See further examples of [rich-text plugins](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/lib/src/render/rich_text)
99
+
*[Todo List Block Component](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/lib/src/editor/block_component/todo_list_block_component/todo_list_block_component.dart) demonstrates how to extend new styles based on existing rich text components
100
+
*[Divider Block Component](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/lib/src/editor/block_component/divider_block_component/divider_block_component.dart) demonstrates how to extend a new block component and render it
101
+
* See further examples of [Rich-Text Plugins](https://github.com/AppFlowy-IO/appflowy-editor/tree/main/lib/src/editor/block_component)
101
102
102
103
### Customizing Shortcut Events
103
104
104
105
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).
105
106
106
107
Below are some examples of shortcut event customizations:
107
108
108
-
*[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
109
-
*[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
110
-
* 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)
109
+
*[BIUS](https://github.com/AppFlowy-IO/appflowy-editor/tree/main/lib/src/editor/editor_component/service/shortcuts/character_shortcut_events/format_single_character) demonstrates how to make text bold/italic/underline/strikethrough through shortcut keys
110
+
* Need more examples? Check out [shortcuts](https://github.com/AppFlowy-IO/appflowy-editor/tree/main/lib/src/editor/editor_component/service/shortcuts)
Copy file name to clipboardExpand all lines: documentation/customizing.md
+53-102
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,5 @@
1
1
# Customizing Editor Features
2
2
3
-
Note: `AppFlowyEditor` has since been depreciated and `AppFlowyEditor.standard` or `AppFlowyEditor.custom` should be used instead. To recreate the examples below, you would use `AppFlowyEditor.custom`.
4
-
5
3
## Customizing a Shortcut Event
6
4
7
5
We will use a simple example to illustrate how to quickly add a shortcut event.
@@ -11,137 +9,90 @@ In this example, text that starts and ends with an underscore ( \_ ) character w
To implement our shortcut event we will create a `ShortcutEvent` instance to handle an underscore input.
33
+
To implement our shortcut event we will create a `CharacterShortcutEvent` instance to handle an underscore input.
34
34
35
-
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'.
35
+
We need to define `key` and `character` in a `CharacterShortcutEvent` 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'.
36
36
37
-
> 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).
38
-
> 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).
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.
89
+
Check out the [complete code](https://github.com/AppFlowy-IO/appflowy-editor/blob/main/example/lib/samples/underscore_to_italic.dart) file of this example.
142
90
143
91
144
92
## Customizing a Component
93
+
94
+
> ⚠️ Notes: The content below is outdated.
95
+
145
96
We will use a simple example to show how to quickly add a custom component.
146
97
147
98
In this example we will render an image from the network.
Copy file name to clipboardExpand all lines: lib/src/editor/editor_component/service/shortcuts/character_shortcut_events/format_single_character/format_single_character.dart
Copy file name to clipboardExpand all lines: test/new/service/shortcuts/character_shortcut_events/format_by_wrapping_with_single_char/format_italic_test.dart
0 commit comments