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.

fix: outline doesn't show when @dates are used in the headline (#8049)

Lucasca8b4f938481
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_column_block_width_resizer.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_column_block_width_resizer.dart
index 69bec33c61..eccc2da3b5 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_column_block_width_resizer.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_column_block_width_resizer.dart
@@ -3,6 +3,7 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/actions/dr
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/material.dart';
+import 'package:universal_platform/universal_platform.dart';
class SimpleColumnBlockWidthResizer extends StatefulWidget {
const SimpleColumnBlockWidthResizer({
@@ -55,6 +56,10 @@ class _SimpleColumnBlockWidthResizerState
child: ValueListenableBuilder<bool>(
valueListenable: isHovering,
builder: (context, isHovering, child) {
+ if (UniversalPlatform.isMobile) {
+ return const SizedBox.shrink();
+ }
+
final hide = isDraggingAppFlowyEditorBlock.value || !isHovering;
return MouseRegion(
cursor: SystemMouseCursors.resizeLeftRight,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart
index e3120356d9..230dd179eb 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart
@@ -287,9 +287,6 @@ class OutlineItemWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final editorState = context.read<EditorState>();
- final textStyle = editorState.editorStyle.textStyleConfiguration;
- final style = textStyle.href.combine(textStyle.text);
return FlowyButton(
onTap: () => scrollToBlock(context),
text: Row(
@@ -297,12 +294,7 @@ class OutlineItemWidget extends StatelessWidget {
children: [
HSpace(node.leftIndent),
Flexible(
- child: Text(
- node.outlineItemText,
- textDirection: textDirection,
- style: style,
- overflow: TextOverflow.ellipsis,
- ),
+ child: buildOutlineItemWidget(context),
),
],
),
@@ -320,6 +312,60 @@ class OutlineItemWidget extends StatelessWidget {
Position(path: node.path, offset: node.delta?.length ?? 0),
);
}
+
+ Widget buildOutlineItemWidget(BuildContext context) {
+ final editorState = context.read<EditorState>();
+ final textStyle = editorState.editorStyle.textStyleConfiguration;
+ final style = textStyle.href.combine(textStyle.text);
+
+ final textInserted = node.delta?.whereType<TextInsert>();
+ if (textInserted == null) {
+ return const SizedBox.shrink();
+ }
+
+ final children = <InlineSpan>[];
+
+ var i = 0;
+ for (final e in textInserted) {
+ final mentionAttribute = e.attributes?[MentionBlockKeys.mention];
+ final mention =
+ mentionAttribute is Map<String, dynamic> ? mentionAttribute : null;
+ final text = e.text;
+ if (mention != null) {
+ final type = mention[MentionBlockKeys.type];
+ children.add(
+ WidgetSpan(
+ alignment: PlaceholderAlignment.middle,
+ child: MentionBlock(
+ key: ValueKey(type),
+ node: node,
+ index: i,
+ mention: mention,
+ textStyle: style,
+ ),
+ ),
+ );
+ } else {
+ children.add(
+ TextSpan(
+ text: text,
+ style: style,
+ ),
+ );
+ }
+
+ i += text.length;
+ }
+
+ return IgnorePointer(
+ child: Text.rich(
+ TextSpan(
+ children: children,
+ style: style,
+ ),
+ ),
+ );
+ }
}
extension on Node {
@@ -339,8 +385,4 @@ extension on Node {
return 0.0;
}
-
- String get outlineItemText {
- return delta?.toPlainText() ?? '';
- }
}
diff --git a/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart b/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart
index 892b9df2ff..52ccbabbca 100644
--- a/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart
+++ b/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart
@@ -9,6 +9,7 @@ import 'package:appflowy/startup/tasks/deeplink/deeplink_handler.dart';
import 'package:appflowy/startup/tasks/deeplink/expire_login_deeplink_handler.dart';
import 'package:appflowy/startup/tasks/deeplink/invitation_deeplink_handler.dart';
import 'package:appflowy/startup/tasks/deeplink/login_deeplink_handler.dart';
+import 'package:appflowy/startup/tasks/deeplink/open_app_deeplink_handler.dart';
import 'package:appflowy/startup/tasks/deeplink/payment_deeplink_handler.dart';
import 'package:appflowy/user/application/auth/auth_error.dart';
import 'package:appflowy/user/application/user_auth_listener.dart';
@@ -28,7 +29,8 @@ class AppFlowyCloudDeepLink {
..register(LoginDeepLinkHandler())
..register(PaymentDeepLinkHandler())
..register(InvitationDeepLinkHandler())
- ..register(ExpireLoginDeepLinkHandler());
+ ..register(ExpireLoginDeepLinkHandler())
+ ..register(OpenAppDeepLinkHandler());
_deepLinkSubscription = _AppLinkWrapper.instance.listen(
(Uri? uri) async {
diff --git a/frontend/appflowy_flutter/lib/startup/tasks/deeplink/open_app_deeplink_handler.dart b/frontend/appflowy_flutter/lib/startup/tasks/deeplink/open_app_deeplink_handler.dart
new file mode 100644
index 0000000000..44d25e1a57
--- /dev/null
+++ b/frontend/appflowy_flutter/lib/startup/tasks/deeplink/open_app_deeplink_handler.dart
@@ -0,0 +1,20 @@
+import 'dart:async';
+
+import 'package:appflowy/startup/tasks/deeplink/deeplink_handler.dart';
+import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
+import 'package:appflowy_result/appflowy_result.dart';
+
+class OpenAppDeepLinkHandler extends DeepLinkHandler<void> {
+ @override
+ bool canHandle(Uri uri) {
+ return uri.toString() == 'appflowy-flutter://';
+ }
+
+ @override
+ Future<FlowyResult<void, FlowyError>> handle({
+ required Uri uri,
+ required DeepLinkStateHandler onStateChange,
+ }) async {
+ return FlowyResult.success(null);
+ }
+}
diff --git a/frontend/appflowy_flutter/test/unit_test/deeplink/deeplink_test.dart b/frontend/appflowy_flutter/test/unit_test/deeplink/deeplink_test.dart
index 75a6fb060c..d197bd5b90 100644
--- a/frontend/appflowy_flutter/test/unit_test/deeplink/deeplink_test.dart
+++ b/frontend/appflowy_flutter/test/unit_test/deeplink/deeplink_test.dart
@@ -1,6 +1,7 @@
import 'package:appflowy/startup/tasks/deeplink/deeplink_handler.dart';
import 'package:appflowy/startup/tasks/deeplink/invitation_deeplink_handler.dart';
import 'package:appflowy/startup/tasks/deeplink/login_deeplink_handler.dart';
+import 'package:appflowy/startup/tasks/deeplink/open_app_deeplink_handler.dart';
import 'package:appflowy/startup/tasks/deeplink/payment_deeplink_handler.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -9,7 +10,8 @@ void main() {
final deepLinkHandlerRegistry = DeepLinkHandlerRegistry.instance
..register(LoginDeepLinkHandler())
..register(PaymentDeepLinkHandler())
- ..register(InvitationDeepLinkHandler());
+ ..register(InvitationDeepLinkHandler())
+ ..register(OpenAppDeepLinkHandler());
test('invitation deep link handler', () {
final uri = Uri.parse(
@@ -53,5 +55,10 @@ void main() {
},
);
});
+
+ test('open app deep link handler', () {
+ final uri = Uri.parse('appflowy-flutter://');
+ expect(OpenAppDeepLinkHandler().canHandle(uri), true);
+ });
});
}