Skip to content

Commit

Permalink
Merge branch 'main' into feat-zhiya
Browse files Browse the repository at this point in the history
* main:
  fix: unable to clear the style by toggling twice (AppFlowy-IO#532)
  fix: pinyin IME on Linux (AppFlowy-IO#531)
  fix: background color issues (AppFlowy-IO#530)
  fix: cursor blink at wrong location when inserting text (AppFlowy-IO#529)
  feat: enable toggling and canceling of the formatting with shortcuts (AppFlowy-IO#528)
  chore: bump version 1.4.4 (AppFlowy-IO#527)
  fix: the selection handles remain on the screen after cutting the text (AppFlowy-IO#526)
  fix: the selection should be clear if header or footer is focusing (AppFlowy-IO#525)
  feat: customize desktop toolbar style (AppFlowy-IO#519)
  feat: add regex and case sensitive to `FindReplaceMenu` (AppFlowy-IO#480)
  feat: export JSON in mobile and update mobile_example.json (AppFlowy-IO#515)
  feat: support customizing error block (AppFlowy-IO#524)
  fix: impossible to click on any sub-items if the top level item is off-screen (AppFlowy-IO#522)
  • Loading branch information
q200892907 committed Oct 12, 2023
2 parents 0432135 + 194fe2f commit 35293be
Show file tree
Hide file tree
Showing 62 changed files with 1,438 additions and 321 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## 1.4.4
* feat: support customizing error block by @LucasXu0 in ([#524](https://github.com/AppFlowy-IO/appflowy-editor/pull/524))
* feat: export JSON in mobile and update mobile_example.json by @hyj1204 in ([#515](https://github.com/AppFlowy-IO/appflowy-editor/pull/515))
* feat: add regex and case sensitive to `FindReplaceMenu` by @sun-jiao in ([#480](https://github.com/AppFlowy-IO/appflowy-editor/pull/480))
* feat: customize desktop toolbar style by @q200892907 in ([#519](https://github.com/AppFlowy-IO/appflowy-editor/pull/519))
* feat: support RTL in toolbar by @1akhanBaheti in ([#496](https://github.com/AppFlowy-IO/appflowy-editor/pull/496))
* feat: optimize the find and replace logic by @LucasXu0 in ([#510](https://github.com/AppFlowy-IO/appflowy-editor/pull/510))
* feat: enable shift+press for selection range by @Xazin in ([#512](https://github.com/AppFlowy-IO/appflowy-editor/pull/512))
* feat: image block revamp by @LucasXu0 in ([#516](https://github.com/AppFlowy-IO/appflowy-editor/pull/516))
* fix: undo failed in a nested list in a special case by @LucasXu0 in ([#503](https://github.com/AppFlowy-IO/appflowy-editor/pull/503))
* fix: the cursor will flicker one frame to its previous position by @LucasXu0 in ([#506](https://github.com/AppFlowy-IO/appflowy-editor/pull/506))
* fix: delete the divider on mobile will raise an error by @LucasXu0 in ([#508](https://github.com/AppFlowy-IO/appflowy-editor/pull/508))
* fix: unable to update selection sometimes when the editor lost focus by @LucasXu0 in ([#509](https://github.com/AppFlowy-IO/appflowy-editor/pull/509))
* fix: search integration issues by @LucasXu0 in ([#511](https://github.com/AppFlowy-IO/appflowy-editor/pull/511))
* fix: image block revamp issues by @LucasXu0 in ([#517](https://github.com/AppFlowy-IO/appflowy-editor/pull/517))
* fix: impossible to click on any sub-items if the top level item is off-screen by @LucasXu0 in ([#522](https://github.com/AppFlowy-IO/appflowy-editor/pull/522))
* fix: the selection should be clear if header or footer is focusing by @LucasXu0 in ([#525](https://github.com/AppFlowy-IO/appflowy-editor/pull/525))
* fix: the selection handles remain on the screen after cutting the text ([#526](https://github.com/AppFlowy-IO/appflowy-editor/pull/526))

## 1.4.3
* fix: the text within the `<mark>` tag didn't parse correctly when pasting HTML by @LucasXu0 in ([#501](https://github.com/AppFlowy-IO/appflowy-editor/pull/501))

Expand Down
51 changes: 51 additions & 0 deletions assets/images/case_sensitive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions assets/images/regex.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
141 changes: 1 addition & 140 deletions example/assets/mobile_example.json
Original file line number Diff line number Diff line change
@@ -1,140 +1 @@
{
"document": {
"type": "page",
"children": [
{
"type": "heading",
"data": {
"level": 2,
"delta": [
{ "insert": "👋 " },
{ "insert": "Welcome to", "attributes": { "bold": true } },
{ "insert": " " },
{
"insert": "AppFlowy Editor",
"attributes": { "italic": false, "bold": true }
}
],
"align": "center"
}
},
{
"type": "paragraph",
"data": {
"delta": [
{ "insert": "AppFlowy Editor is a" },
{ "insert": " " },
{
"insert": "highly customizable",
"attributes": { "bold": true, "bg_color": "0x7fffeb3b" }
},
{ "insert": " " },
{ "insert": "rich-text editor", "attributes": { "italic": true } },
{ "insert": " for " },
{ "insert": "Flutter", "attributes": { "underline": true } }
]
}
},
{
"type": "bulleted_list",
"data": {
"delta": [
{
"insert": "Customizable",
"attributes": { "bg_color": "0x4d00BCF0" }
}
]
}
},
{
"type": "bulleted_list",
"data": {
"delta": [
{
"insert": "Test-covered",
"attributes": { "bg_color": "0x4d00BCF0" }
}
]
}
},
{
"type": "bulleted_list",
"data": {
"delta": [
{ "insert": "More to come!", "attributes": { "code": true } }
]
}
},
{ "type": "paragraph", "data": { "delta": [] } },
{
"type": "heading",
"data": {
"delta": [{ "insert": "Here is an example you can give it a try" }],
"level": 4,
"align": "center"
}
},
{
"type": "todo_list",
"data": {
"checked": false,
"delta": [
{ "insert": "Use " },
{
"insert": "AppFlowy Editor",
"attributes": {
"italic": true,
"bold": true,
"font_color": "0xffD70040",
"bg_color": "0x6000BCF0"
}
},
{ "insert": " as a component to build your own app." }
]
}
},
{
"type": "todo_list",
"data": {
"checked": false,
"delta": [
{ "insert": "Select text to " },
{
"insert": "trigger the toolbar",
"attributes": { "bg_color": "0x4de91e63" }
},
{ "insert": " to " },
{
"insert": "format",
"attributes": {
"code": true,
"bold": true,
"underline": true,
"italic": true,
"font_color": "0xfff44336",
"bg_color": "0x4d4caf50"
}
},
{ "insert": " your notes." }
]
}
},
{ "type": "paragraph", "data": { "delta": [] } },
{
"type": "paragraph",
"data": {
"delta": [
{ "insert": "If you have questions or feedback, please " },
{
"insert": "submit an issue",
"attributes": { "bg_color": "0x4de91e63" }
},
{
"insert": " on Github or join the community along with 1000+ builders!"
}
]
}
}
]
}
}
{"document":{"type":"page","children":[{"type":"heading","data":{"level":3,"delta":[{"insert":"AppFlowy Editor is now in","attributes":{"italic":false,"bold":true}}]}},{"type":"heading","data":{"level":1,"delta":[{"insert":"👏 Mobile"},{"insert":" ","attributes":{"italic":false,"bold":true}},{"insert":"📱","attributes":{"bold":true}}]}},{"type":"paragraph","data":{"level":1,"delta":[{"insert":"AppFlowy Editor","attributes":{"bold":true,"italic":false,"underline":false}},{"insert":" empowers your flutter app with seamless document editing features.","attributes":{"bold":false,"italic":false,"underline":false}}]}},{"type":"paragraph","data":{"delta":[{"insert":"Adding the "},{"insert":"AppFlowy Editor","attributes":{"bold":true}},{"insert":" package in your flutter app will allow you to unlock powerful and customizable document editing capabilities, all without building it from scratch. "}]}},{"type":"heading","data":{"level":1,"delta":[{"insert":"👀 Let’s check it out"}]}},{"type":"heading","data":{"level":3,"delta":[{"insert":"Text Decoration"}]}},{"type":"paragraph","data":{"delta":[{"insert":"Bold","attributes":{"bold":true}},{"insert":" "},{"insert":"Italic ","attributes":{"italic":true}},{"insert":"underLine","attributes":{"italic":false,"underline":true}},{"insert":" ","attributes":{"italic":true}},{"insert":"Strikethrough","attributes":{"italic":false,"strikethrough":true}}]}},{"type":"heading","data":{"level":3,"delta":[{"insert":"Colorful Text"}]}},{"type":"paragraph","data":{"delta":[{"insert":"Infuse","attributes":{"font_color":"0xfff44336"}},{"insert":" "},{"insert":"your","attributes":{"font_color":"0xffffeb3b"}},{"insert":" "},{"insert":"texts","attributes":{"font_color":"0xff2196f3"}},{"insert":" "},{"insert":"with","attributes":{"font_color":"0xff4caf50"}},{"insert":" "},{"insert":"the","attributes":{"font_color":"0xff795548"}},{"insert":" "},{"insert":"vibrant","attributes":{"font_color":"0xffe91e63"}},{"insert":" "},{"insert":"hues","attributes":{"font_color":"0xff9c27b0"}},{"insert":" "},{"insert":"of","attributes":{"font_color":"0xff9e9e9e"}},{"insert":" "},{"insert":"a","attributes":{"bg_color":"0x4d9e9e9e"}},{"insert":" "},{"insert":"rainbow","attributes":{"bg_color":"0x4df44336"}},{"insert":" "},{"insert":"to","attributes":{"bg_color":"0x4d4caf50"}},{"insert":" "},{"insert":"brighten","attributes":{"bg_color":"0x4dffeb3b"}},{"insert":" "},{"insert":"up","attributes":{"bg_color":"0x4d795548"}},{"insert":" "},{"insert":"your","attributes":{"bg_color":"0x4d9c27b0"}},{"insert":" "},{"insert":"day","attributes":{"bg_color":"0x4d2196f3"}},{"insert":"! "}]}},{"type":"heading","data":{"level":3,"delta":[{"insert":"Lists"}]}},{"type":"todo_list","data":{"checked":false,"delta":[{"insert":"To Do List"}]}},{"type":"todo_list","data":{"delta":[{"insert":"Checked"}],"checked":true}},{"type":"bulleted_list","data":{"delta":[{"insert":"Bulleted List"}]}},{"type":"bulleted_list","data":{"delta":[]}},{"type":"numbered_list","data":{"delta":[{"insert":"Numbered List"}]}},{"type":"numbered_list","data":{"delta":[]}},{"type":"heading","data":{"level":3,"delta":[{"insert":"Link & Quote"}]}},{"type":"quote","data":{"delta":[{"insert":"Here’s where you can find the "},{"insert":"AppFlowy Editor flutter package","attributes":{"href":"https://pub.dev/packages/appflowy_editor"}},{"insert":" to add to your environment."}]}},{"type":"heading","data":{"level":3,"delta":[{"insert":"Code Inline"}]}},{"type":"paragraph","data":{"delta":[{"insert":"flutter pub add appflowy_editor\nflutter pub get","attributes":{"code":true}}]}}]}}
34 changes: 26 additions & 8 deletions example/lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:file_picker/file_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:path_provider/path_provider.dart';
import 'package:universal_html/html.dart' as html;

enum ExportFileType {
Expand Down Expand Up @@ -290,7 +291,31 @@ class _HomePageState extends State<HomePage> {
throw UnimplementedError();
}

if (!kIsWeb) {
if (kIsWeb) {
final blob = html.Blob([result], 'text/plain', 'native');
html.AnchorElement(
href: html.Url.createObjectUrlFromBlob(blob).toString(),
)
..setAttribute('download', 'document.${fileType.extension}')
..click();
} else if (PlatformExtension.isMobile) {
final appStorageDirectory = await getApplicationDocumentsDirectory();

final path = File(
'${appStorageDirectory.path}/${DateTime.now()}.${fileType.extension}',
);
await path.writeAsString(result);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'This document is saved to the ${appStorageDirectory.path}',
),
),
);
}
} else {
// for desktop
final path = await FilePicker.platform.saveFile(
fileName: 'document.${fileType.extension}',
);
Expand All @@ -304,13 +329,6 @@ class _HomePageState extends State<HomePage> {
);
}
}
} else {
final blob = html.Blob([result], 'text/plain', 'native');
html.AnchorElement(
href: html.Url.createObjectUrlFromBlob(blob).toString(),
)
..setAttribute('download', 'document.${fileType.extension}')
..click();
}
}

Expand Down
18 changes: 16 additions & 2 deletions example/lib/pages/focus_example_for_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class _FocusExampleForEditorState extends State<FocusExampleForEditor> {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
title: const Text('Custom Theme For Editor'),
title: const Text('Focus Node Example'),
titleTextStyle: const TextStyle(color: Colors.white),
iconTheme: const IconThemeData(
color: Colors.white,
Expand All @@ -52,7 +52,21 @@ class _FocusExampleForEditorState extends State<FocusExampleForEditor> {
builder: (context, snapshot) {
return !snapshot.hasData
? const Center(child: CircularProgressIndicator())
: AppFlowyEditor(editorState: snapshot.data!);
: AppFlowyEditor(
editorState: snapshot.data!,
header: const TextField(
textAlign: TextAlign.center,
decoration: InputDecoration(
hintText: 'Header: Please input something ...',
),
),
footer: const TextField(
textAlign: TextAlign.center,
decoration: InputDecoration(
hintText: 'Footer: Please input something ...',
),
),
);
},
),
),
Expand Down
10 changes: 6 additions & 4 deletions example/lib/pages/mobile_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,16 @@ class _MobileEditorState extends State<MobileEditor> {
// showcase 1: customize the editor style.
EditorStyle _buildMobileEditorStyle() {
return EditorStyle.mobile(
cursorColor: Colors.blue,
selectionColor: Colors.blue.shade200,
cursorColor: const Color.fromARGB(255, 134, 46, 247),
selectionColor: const Color.fromARGB(50, 134, 46, 247),
textStyleConfiguration: TextStyleConfiguration(
text: GoogleFonts.poppins(
fontSize: 14,
color: Colors.black,
),
code: GoogleFonts.badScript(),
code: GoogleFonts.sourceCodePro(
backgroundColor: Colors.grey.shade200,
),
),
padding: const EdgeInsets.symmetric(horizontal: 24.0),
);
Expand All @@ -140,7 +142,7 @@ class _MobileEditorState extends State<MobileEditor> {
fontWeight: FontWeight.w600,
),
);
map[ParagraphBlockKeys.type] = TextBlockComponentBuilder(
map[ParagraphBlockKeys.type] = ParagraphBlockComponentBuilder(
configuration: BlockComponentConfiguration(
placeholderText: (node) => 'Type something...',
),
Expand Down
Loading

0 comments on commit 35293be

Please sign in to comment.