mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 14:47:13 -04:00
Revert "fix: hotfix issues for v0.7.7 (#6948)"
This reverts commit 8726df703e
.
This commit is contained in:
parent
8726df703e
commit
d3c7d4b1d2
17 changed files with 25 additions and 174 deletions
|
@ -2,12 +2,12 @@ import 'dart:io';
|
||||||
|
|
||||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart';
|
import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart';
|
||||||
import 'package:appflowy/plugins/inline_actions/inline_actions_menu.dart';
|
|
||||||
import 'package:appflowy/workspace/presentation/home/menu/view/view_action_type.dart';
|
import 'package:appflowy/workspace/presentation/home/menu/view/view_action_type.dart';
|
||||||
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
|
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:integration_test/integration_test.dart';
|
import 'package:integration_test/integration_test.dart';
|
||||||
|
|
||||||
|
@ -330,23 +330,6 @@ void main() {
|
||||||
expect(find.text("$_createdPageName (copy)"), findsNWidgets(2));
|
expect(find.text("$_createdPageName (copy)"), findsNWidgets(2));
|
||||||
expect(find.text("$_createdPageName (copy) (copy)"), findsOneWidget);
|
expect(find.text("$_createdPageName (copy) (copy)"), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Cancel inline page reference menu by space', (tester) async {
|
|
||||||
await tester.initializeAppFlowy();
|
|
||||||
await tester.tapAnonymousSignInButton();
|
|
||||||
await tester.createOpenRenameDocumentUnderParent(name: _firstDocName);
|
|
||||||
|
|
||||||
await tester.editor.tapLineOfEditorAt(0);
|
|
||||||
await tester.editor.showPlusMenu();
|
|
||||||
|
|
||||||
// Cancel by space
|
|
||||||
await tester.simulateKeyEvent(
|
|
||||||
LogicalKeyboardKey.space,
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
expect(find.byType(InlineActionsMenu), findsNothing);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,22 +117,6 @@ Future<bool> inlinePageReferenceCommandHandler(
|
||||||
initialResults: initialResults,
|
initialResults: initialResults,
|
||||||
style: style,
|
style: style,
|
||||||
startCharAmount: previousChar != null ? 2 : 1,
|
startCharAmount: previousChar != null ? 2 : 1,
|
||||||
cancelBySpaceHandler: () {
|
|
||||||
if (character == _plusChar) {
|
|
||||||
final currentSelection = editorState.selection;
|
|
||||||
if (currentSelection == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// check if the space is after the character
|
|
||||||
if (currentSelection.isCollapsed &&
|
|
||||||
currentSelection.start.offset ==
|
|
||||||
selection.start.offset + character.length) {
|
|
||||||
_cancelInlinePageReferenceMenu(editorState);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
selectionMenuService?.show();
|
selectionMenuService?.show();
|
||||||
|
@ -140,17 +124,3 @@ Future<bool> inlinePageReferenceCommandHandler(
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _cancelInlinePageReferenceMenu(EditorState editorState) {
|
|
||||||
selectionMenuService?.dismiss();
|
|
||||||
selectionMenuService = null;
|
|
||||||
|
|
||||||
// re-focus the selection
|
|
||||||
final selection = editorState.selection;
|
|
||||||
if (selection != null) {
|
|
||||||
editorState.updateSelectionWithReason(
|
|
||||||
selection,
|
|
||||||
reason: SelectionUpdateReason.uiEvent,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
export 'callout_node_parser.dart';
|
export 'callout_node_parser.dart';
|
||||||
export 'custom_image_node_parser.dart';
|
export 'custom_image_node_parser.dart';
|
||||||
export 'file_block_node_parser.dart';
|
|
||||||
export 'link_preview_node_parser.dart';
|
|
||||||
export 'math_equation_node_parser.dart';
|
export 'math_equation_node_parser.dart';
|
||||||
export 'simple_table_node_parser.dart';
|
|
||||||
export 'toggle_list_node_parser.dart';
|
export 'toggle_list_node_parser.dart';
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
|
||||||
|
|
||||||
class FileBlockNodeParser extends NodeParser {
|
|
||||||
const FileBlockNodeParser();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get id => FileBlockKeys.type;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String transform(Node node, DocumentMarkdownEncoder? encoder) {
|
|
||||||
final name = node.attributes[FileBlockKeys.name];
|
|
||||||
final url = node.attributes[FileBlockKeys.url];
|
|
||||||
if (name == null || url == null) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
return '[$name]($url)\n';
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
|
||||||
import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';
|
|
||||||
|
|
||||||
class LinkPreviewNodeParser extends NodeParser {
|
|
||||||
const LinkPreviewNodeParser();
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get id => LinkPreviewBlockKeys.type;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String transform(Node node, DocumentMarkdownEncoder? encoder) {
|
|
||||||
final href = node.attributes[LinkPreviewBlockKeys.url];
|
|
||||||
if (href == null) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
return '[$href]($href)\n';
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +1,6 @@
|
||||||
|
export 'callout_node_parser.dart';
|
||||||
|
export 'custom_image_node_parser.dart';
|
||||||
export 'markdown_code_parser.dart';
|
export 'markdown_code_parser.dart';
|
||||||
export 'markdown_simple_table_parser.dart';
|
export 'math_equation_node_parser.dart';
|
||||||
|
export 'toggle_list_node_parser.dart';
|
||||||
|
export 'simple_table_parser.dart';
|
||||||
|
|
|
@ -57,7 +57,6 @@ export 'openai/widgets/ai_writer_block_component.dart';
|
||||||
export 'openai/widgets/ask_ai_block_component.dart';
|
export 'openai/widgets/ask_ai_block_component.dart';
|
||||||
export 'openai/widgets/ask_ai_toolbar_item.dart';
|
export 'openai/widgets/ask_ai_toolbar_item.dart';
|
||||||
export 'outline/outline_block_component.dart';
|
export 'outline/outline_block_component.dart';
|
||||||
export 'parsers/document_markdown_parsers.dart';
|
|
||||||
export 'parsers/markdown_parsers.dart';
|
export 'parsers/markdown_parsers.dart';
|
||||||
export 'parsers/markdown_simple_table_parser.dart';
|
export 'parsers/markdown_simple_table_parser.dart';
|
||||||
export 'quote/quote_block_shortcuts.dart';
|
export 'quote/quote_block_shortcuts.dart';
|
||||||
|
|
|
@ -19,14 +19,12 @@ class InlineActionsMenu extends InlineActionsMenuService {
|
||||||
required this.initialResults,
|
required this.initialResults,
|
||||||
required this.style,
|
required this.style,
|
||||||
this.startCharAmount = 1,
|
this.startCharAmount = 1,
|
||||||
this.cancelBySpaceHandler,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final BuildContext context;
|
final BuildContext context;
|
||||||
final EditorState editorState;
|
final EditorState editorState;
|
||||||
final InlineActionsService service;
|
final InlineActionsService service;
|
||||||
final List<InlineActionsResult> initialResults;
|
final List<InlineActionsResult> initialResults;
|
||||||
final bool Function()? cancelBySpaceHandler;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final InlineActionsMenuStyle style;
|
final InlineActionsMenuStyle style;
|
||||||
|
@ -139,7 +137,6 @@ class InlineActionsMenu extends InlineActionsMenuService {
|
||||||
onSelectionUpdate: _onSelectionUpdate,
|
onSelectionUpdate: _onSelectionUpdate,
|
||||||
style: style,
|
style: style,
|
||||||
startCharAmount: startCharAmount,
|
startCharAmount: startCharAmount,
|
||||||
cancelBySpaceHandler: cancelBySpaceHandler,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -62,7 +62,6 @@ class InlineActionsHandler extends StatefulWidget {
|
||||||
required this.onSelectionUpdate,
|
required this.onSelectionUpdate,
|
||||||
required this.style,
|
required this.style,
|
||||||
this.startCharAmount = 1,
|
this.startCharAmount = 1,
|
||||||
this.cancelBySpaceHandler,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final InlineActionsService service;
|
final InlineActionsService service;
|
||||||
|
@ -73,7 +72,6 @@ class InlineActionsHandler extends StatefulWidget {
|
||||||
final VoidCallback onSelectionUpdate;
|
final VoidCallback onSelectionUpdate;
|
||||||
final InlineActionsMenuStyle style;
|
final InlineActionsMenuStyle style;
|
||||||
final int startCharAmount;
|
final int startCharAmount;
|
||||||
final bool Function()? cancelBySpaceHandler;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<InlineActionsHandler> createState() => _InlineActionsHandlerState();
|
State<InlineActionsHandler> createState() => _InlineActionsHandlerState();
|
||||||
|
@ -290,17 +288,12 @@ class _InlineActionsHandlerState extends State<InlineActionsHandler> {
|
||||||
/// that the selection change occurred from the handler.
|
/// that the selection change occurred from the handler.
|
||||||
widget.onSelectionUpdate();
|
widget.onSelectionUpdate();
|
||||||
|
|
||||||
if (event.logicalKey == LogicalKeyboardKey.space) {
|
|
||||||
final cancelBySpaceHandler = widget.cancelBySpaceHandler;
|
|
||||||
if (cancelBySpaceHandler != null && cancelBySpaceHandler()) {
|
|
||||||
return KeyEventResult.handled;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Interpolation to avoid having a getter for private variable
|
// Interpolation to avoid having a getter for private variable
|
||||||
_insertCharacter(event.character!);
|
_insertCharacter(event.character!);
|
||||||
return KeyEventResult.handled;
|
return KeyEventResult.handled;
|
||||||
} else if (moveKeys.contains(event.logicalKey)) {
|
}
|
||||||
|
|
||||||
|
if (moveKeys.contains(event.logicalKey)) {
|
||||||
_moveSelection(event.logicalKey);
|
_moveSelection(event.logicalKey);
|
||||||
return KeyEventResult.handled;
|
return KeyEventResult.handled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,23 +197,8 @@ class ShareBloc extends Bloc<ShareEvent, ShareState> {
|
||||||
(p) => false,
|
(p) => false,
|
||||||
);
|
);
|
||||||
|
|
||||||
// skip the "Record not found" error, it's because the view is not published yet
|
Log.info(
|
||||||
publishInfo.fold(
|
'get publish info: $publishInfo for view: ${view.name}(${view.id})',
|
||||||
(s) {
|
|
||||||
Log.info(
|
|
||||||
'get publish info success: $publishInfo for view: ${view.name}(${view.id})',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
(f) {
|
|
||||||
if (![
|
|
||||||
ErrorCode.RecordNotFound,
|
|
||||||
ErrorCode.LocalVersionNotSupport,
|
|
||||||
].contains(f.code)) {
|
|
||||||
Log.info(
|
|
||||||
'get publish info failed: $f for view: ${view.name}(${view.id})',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
String workspaceId = state.workspaceId;
|
String workspaceId = state.workspaceId;
|
||||||
|
|
|
@ -20,8 +20,6 @@ String customDocumentToMarkdown(Document document) {
|
||||||
const ToggleListNodeParser(),
|
const ToggleListNodeParser(),
|
||||||
const CustomImageNodeParser(),
|
const CustomImageNodeParser(),
|
||||||
const SimpleTableNodeParser(),
|
const SimpleTableNodeParser(),
|
||||||
const LinkPreviewNodeParser(),
|
|
||||||
const FileBlockNodeParser(),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart';
|
||||||
import 'package:appflowy_backend/protobuf/flowy-user/workspace.pb.dart';
|
import 'package:appflowy_backend/protobuf/flowy-user/workspace.pb.dart';
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
part 'sidebar_plan_bloc.freezed.dart';
|
part 'sidebar_plan_bloc.freezed.dart';
|
||||||
|
|
||||||
class SidebarPlanBloc extends Bloc<SidebarPlanEvent, SidebarPlanState> {
|
class SidebarPlanBloc extends Bloc<SidebarPlanEvent, SidebarPlanState> {
|
||||||
|
@ -114,8 +113,7 @@ class SidebarPlanBloc extends Bloc<SidebarPlanEvent, SidebarPlanState> {
|
||||||
} else if (error.code == ErrorCode.SingleUploadLimitExceeded) {
|
} else if (error.code == ErrorCode.SingleUploadLimitExceeded) {
|
||||||
emit(
|
emit(
|
||||||
state.copyWith(
|
state.copyWith(
|
||||||
tierIndicator:
|
tierIndicator: const SidebarToastTierIndicator.singleFileLimitHit(),
|
||||||
const SidebarToastTierIndicator.singleFileLimitHit(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -186,10 +184,13 @@ class SidebarPlanBloc extends Bloc<SidebarPlanEvent, SidebarPlanState> {
|
||||||
if (state.workspaceId != null) {
|
if (state.workspaceId != null) {
|
||||||
final payload = UserWorkspaceIdPB(workspaceId: state.workspaceId!);
|
final payload = UserWorkspaceIdPB(workspaceId: state.workspaceId!);
|
||||||
UserEventGetWorkspaceUsage(payload).send().then((result) {
|
UserEventGetWorkspaceUsage(payload).send().then((result) {
|
||||||
result.onSuccess(
|
result.fold(
|
||||||
(usage) {
|
(usage) {
|
||||||
add(SidebarPlanEvent.updateWorkspaceUsage(usage));
|
add(SidebarPlanEvent.updateWorkspaceUsage(usage));
|
||||||
},
|
},
|
||||||
|
(error) {
|
||||||
|
Log.error("Failed to get workspace usage, error: $error");
|
||||||
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -230,8 +231,7 @@ class SidebarPlanState with _$SidebarPlanState {
|
||||||
@freezed
|
@freezed
|
||||||
class SidebarToastTierIndicator with _$SidebarToastTierIndicator {
|
class SidebarToastTierIndicator with _$SidebarToastTierIndicator {
|
||||||
const factory SidebarToastTierIndicator.storageLimitHit() = _StorageLimitHit;
|
const factory SidebarToastTierIndicator.storageLimitHit() = _StorageLimitHit;
|
||||||
const factory SidebarToastTierIndicator.singleFileLimitHit() =
|
const factory SidebarToastTierIndicator.singleFileLimitHit() = _SingleFileLimitHit;
|
||||||
_SingleFileLimitHit;
|
|
||||||
const factory SidebarToastTierIndicator.aiMaxiLimitHit() = _aiMaxLimitHit;
|
const factory SidebarToastTierIndicator.aiMaxiLimitHit() = _aiMaxLimitHit;
|
||||||
const factory SidebarToastTierIndicator.loading() = _Loading;
|
const factory SidebarToastTierIndicator.loading() = _Loading;
|
||||||
}
|
}
|
||||||
|
|
|
@ -329,15 +329,14 @@ class SpaceBloc extends Bloc<SpaceEvent, SpaceState> {
|
||||||
final (spaces, _, _) = await _getSpaces();
|
final (spaces, _, _) = await _getSpaces();
|
||||||
final currentSpace = await _getLastOpenedSpace(spaces);
|
final currentSpace = await _getLastOpenedSpace(spaces);
|
||||||
|
|
||||||
Log.info(
|
|
||||||
'receive space update, current space: ${currentSpace?.name}(${currentSpace?.id})',
|
|
||||||
);
|
|
||||||
|
|
||||||
for (var i = 0; i < spaces.length; i++) {
|
for (var i = 0; i < spaces.length; i++) {
|
||||||
Log.info(
|
Log.info(
|
||||||
'receive space update[$i]: ${spaces[i].name}(${spaces[i].id})',
|
'did receive space update[$i]: ${spaces[i].name}(${spaces[i].id})',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Log.info(
|
||||||
|
'did receive space update, current space: ${currentSpace?.name}(${currentSpace?.id})',
|
||||||
|
);
|
||||||
|
|
||||||
emit(
|
emit(
|
||||||
state.copyWith(
|
state.copyWith(
|
||||||
|
|
|
@ -61,8 +61,8 @@ packages:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "157ded3"
|
ref: ac3b090
|
||||||
resolved-ref: "157ded3cd321b9a54d011c0cc27e270ded35d3aa"
|
resolved-ref: ac3b0906ea2e7f2e7e3c2c7852e9ec3529e07512
|
||||||
url: "https://github.com/AppFlowy-IO/appflowy-editor.git"
|
url: "https://github.com/AppFlowy-IO/appflowy-editor.git"
|
||||||
source: git
|
source: git
|
||||||
version: "4.0.0"
|
version: "4.0.0"
|
||||||
|
|
|
@ -173,7 +173,7 @@ dependency_overrides:
|
||||||
appflowy_editor:
|
appflowy_editor:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/AppFlowy-IO/appflowy-editor.git
|
url: https://github.com/AppFlowy-IO/appflowy-editor.git
|
||||||
ref: "157ded3"
|
ref: "ac3b090"
|
||||||
|
|
||||||
appflowy_editor_plugins:
|
appflowy_editor_plugins:
|
||||||
git:
|
git:
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
|
||||||
import 'package:appflowy/shared/markdown_to_document.dart';
|
|
||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
|
||||||
import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
group('export markdown to document', () {
|
|
||||||
test('file block', () async {
|
|
||||||
final document = Document.blank()
|
|
||||||
..insert(
|
|
||||||
[0],
|
|
||||||
[
|
|
||||||
fileNode(
|
|
||||||
name: 'file.txt',
|
|
||||||
url: 'https://file.com',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
final markdown = customDocumentToMarkdown(document);
|
|
||||||
expect(markdown, '[file.txt](https://file.com)\n');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('link preview', () {
|
|
||||||
final document = Document.blank()
|
|
||||||
..insert(
|
|
||||||
[0],
|
|
||||||
[linkPreviewNode(url: 'https://www.link_preview.com')],
|
|
||||||
);
|
|
||||||
final markdown = customDocumentToMarkdown(document);
|
|
||||||
expect(
|
|
||||||
markdown,
|
|
||||||
'[https://www.link_preview.com](https://www.link_preview.com)\n',
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue