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: add referenced page hint (#6679)

Mathias Mogensen5a047b9d2dfd
diff --git a/frontend/appflowy_flutter/integration_test/desktop/document/document_inline_sub_page_test.dart b/frontend/appflowy_flutter/integration_test/desktop/document/document_inline_sub_page_test.dart
index c2083009c2..ef9ef73b3c 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/document/document_inline_sub_page_test.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/document/document_inline_sub_page_test.dart
@@ -1,6 +1,5 @@
import 'dart:io';
-import 'package:appflowy/generated/flowy_svgs.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/workspace/presentation/home/menu/view/view_action_type.dart';
@@ -51,7 +50,6 @@ void main() {
expect(find.text(_createdPageName), findsNWidgets(2));
expect(find.byType(MentionSubPageBlock), findsOneWidget);
- expect(find.byFlowySvg(FlowySvgs.child_page_s), findsOneWidget);
// Delete from editor
await tester.editor.updateSelection(
@@ -125,7 +123,6 @@ void main() {
expect(find.text(_createdPageName), findsNWidgets(2));
expect(find.byType(MentionSubPageBlock), findsOneWidget);
- expect(find.byFlowySvg(FlowySvgs.child_page_s), findsOneWidget);
// Cut from editor
await tester.editor.updateSelection(
@@ -151,7 +148,6 @@ void main() {
expect(find.text(_createdPageName), findsNWidgets(2));
expect(find.byType(MentionSubPageBlock), findsOneWidget);
- expect(find.byFlowySvg(FlowySvgs.child_page_s), findsOneWidget);
// Cut again
await tester.editor.updateSelection(
@@ -195,7 +191,6 @@ void main() {
await tester.pumpAndSettle();
expect(find.text(_createdPageName), findsNWidgets(2));
- expect(find.byFlowySvg(FlowySvgs.child_page_s), findsOneWidget);
});
testWidgets(
'Cut+paste in same docuemnt and then paste again in same document',
@@ -214,7 +209,6 @@ void main() {
expect(find.text(_createdPageName), findsNWidgets(2));
expect(find.byType(MentionSubPageBlock), findsOneWidget);
- expect(find.byFlowySvg(FlowySvgs.child_page_s), findsOneWidget);
// Cut from editor
await tester.editor.updateSelection(
@@ -240,7 +234,6 @@ void main() {
expect(find.text(_createdPageName), findsNWidgets(2));
expect(find.byType(MentionSubPageBlock), findsOneWidget);
- expect(find.byFlowySvg(FlowySvgs.child_page_s), findsOneWidget);
// Paste again
await tester.simulateKeyEvent(
@@ -252,7 +245,6 @@ void main() {
expect(find.text(_createdPageName), findsNWidgets(2));
expect(find.byType(MentionSubPageBlock), findsNWidgets(2));
- expect(find.byFlowySvg(FlowySvgs.child_page_s), findsNWidgets(2));
expect(find.text('$_createdPageName (copy)'), findsNWidgets(2));
});
@@ -271,7 +263,6 @@ void main() {
expect(find.text(_createdPageName), findsNWidgets(2));
expect(find.byType(MentionSubPageBlock), findsOneWidget);
- expect(find.byFlowySvg(FlowySvgs.child_page_s), findsOneWidget);
final headingText = LocaleKeys.document_slashMenu_name_heading1.tr();
final paragraphText = LocaleKeys.document_slashMenu_name_text.tr();
@@ -283,7 +274,6 @@ void main() {
expect(find.text(_createdPageName), findsNWidgets(2));
expect(find.byType(MentionSubPageBlock), findsOneWidget);
- expect(find.byFlowySvg(FlowySvgs.child_page_s), findsOneWidget);
// Turn into paragraph
await tester.editor.openTurnIntoMenu([0]);
@@ -292,7 +282,6 @@ void main() {
expect(find.text(_createdPageName), findsNWidgets(2));
expect(find.byType(MentionSubPageBlock), findsOneWidget);
- expect(find.byFlowySvg(FlowySvgs.child_page_s), findsOneWidget);
});
testWidgets('Duplicate a block containing two sub page mentions',
@@ -331,7 +320,6 @@ void main() {
expect(find.text(_createdPageName), findsOneWidget);
expect(find.text("$_createdPageName (copy)"), findsOneWidget);
expect(find.byType(MentionSubPageBlock), findsNWidgets(2));
- expect(find.byFlowySvg(FlowySvgs.child_page_s), findsNWidgets(2));
// Duplicate node from block action menu
await tester.editor.hoverAndClickOptionMenuButton([0]);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
index 8e45b5f11d..7535d38852 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
@@ -11,6 +11,7 @@ import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart';
import 'package:appflowy/workspace/application/action_navigation/navigation_action.dart';
import 'package:appflowy/workspace/application/view/prelude.dart';
+import 'package:appflowy/workspace/application/view/view_ext.dart';
import 'package:appflowy/workspace/presentation/home/menu/menu_shared_state.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:appflowy_editor/appflowy_editor.dart'
@@ -408,7 +409,7 @@ class _MentionPageBlockContent extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
..._buildPrefixIcons(context, view, content, isChildPage),
- const HSpace(2),
+ const HSpace(4),
Flexible(
child: FlowyText(
text,
@@ -465,17 +466,33 @@ class _MentionPageBlockContent extends StatelessWidget {
} else if (shouldDisplayViewName) {
return [
const HSpace(4),
- view.icon.value.isNotEmpty
- ? FlowyText.emoji(
- view.icon.value,
- fontSize: emojiSize,
- lineHeight: textStyle?.height,
- optimizeEmojiAlign: true,
- )
- : FlowySvg(
- isChildPage ? FlowySvgs.child_page_s : FlowySvgs.link_to_page_s,
- size: Size.square(iconSize + 2.0),
+ Stack(
+ children: [
+ view.icon.value.isNotEmpty
+ ? FlowyText.emoji(
+ view.icon.value,
+ fontSize: emojiSize,
+ lineHeight: textStyle?.height,
+ optimizeEmojiAlign: true,
+ color: AFThemeExtension.of(context).strongText,
+ )
+ : FlowySvg(
+ view.layout.icon,
+ size: Size.square(iconSize + 2.0),
+ color: AFThemeExtension.of(context).strongText,
+ ),
+ if (!isChildPage) ...[
+ const Positioned(
+ right: 0,
+ bottom: 0,
+ child: FlowySvg(
+ FlowySvgs.referenced_page_s,
+ blendMode: BlendMode.dstIn,
+ ),
),
+ ],
+ ],
+ ),
];
}
diff --git a/frontend/resources/flowy_icons/16x/referenced_page.svg b/frontend/resources/flowy_icons/16x/referenced_page.svg
new file mode 100644
index 0000000000..802212ac98
--- /dev/null
+++ b/frontend/resources/flowy_icons/16x/referenced_page.svg
@@ -0,0 +1,4 @@
+<svg width="9" height="7" viewBox="0 0 9 7" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M5.14645 1.14645C5.34171 0.951184 5.65829 0.951184 5.85355 1.14645L7.85355 3.14645C8.04882 3.34171 8.04882 3.65829 7.85355 3.85355L5.85355 5.85355C5.65829 6.04882 5.34171 6.04882 5.14645 5.85355C4.95118 5.65829 4.95118 5.34171 5.14645 5.14645L6.29289 4H3.5C3.24668 4 2.85557 4.08011 2.54215 4.30577C2.25423 4.51307 2 4.86296 2 5.5C2 5.77614 1.77614 6 1.5 6C1.22386 6 1 5.77614 1 5.5C1 4.53704 1.41243 3.88693 1.95785 3.49423C2.47777 3.11989 3.08665 3 3.5 3H6.29289L5.14645 1.85355C4.95118 1.65829 4.95118 1.34171 5.14645 1.14645Z" fill="#1F2329"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M5.14664 1.85375C4.95138 1.65849 4.95138 1.3419 5.14664 1.14664C5.3419 0.95138 5.65849 0.95138 5.85375 1.14664L7.85375 3.14664C8.04901 3.3419 8.04901 3.65849 7.85375 3.85375L5.85375 5.85375C5.65849 6.04901 5.3419 6.04901 5.14664 5.85375C4.95138 5.65849 4.95138 5.3419 5.14664 5.14664L6.29309 4.0002H3.5002C3.24687 4.0002 2.85576 4.08031 2.54235 4.30596C2.25443 4.51326 2.0002 4.86316 2.0002 5.5002C2.0002 5.77634 1.77634 6.0002 1.5002 6.0002C1.22405 6.0002 1.0002 5.77634 1.0002 5.5002C1.0002 4.53724 1.41263 3.88713 1.95804 3.49443C2.47796 3.12009 3.08685 3.0002 3.5002 3.0002H6.29309L5.14664 1.85375ZM4.40442 2.2002H3.5002C2.95908 2.2002 2.17588 2.35179 1.4906 2.8452C0.739241 3.38618 0.200195 4.27643 0.200195 5.5002C0.200195 6.21816 0.782225 6.8002 1.5002 6.8002C2.21817 6.8002 2.8002 6.21816 2.8002 5.5002C2.8002 5.29081 2.84115 5.17293 2.87431 5.10863C2.90721 5.04483 2.95123 4.99735 3.00979 4.95519C3.07701 4.90679 3.16492 4.8659 3.26382 4.83761C3.36373 4.80903 3.45084 4.8002 3.5002 4.8002H4.40442C4.08237 5.30328 4.14121 5.97969 4.58096 6.41943C5.08864 6.92712 5.91175 6.92712 6.41943 6.41943L8.41943 4.41943C8.92711 3.91175 8.92712 3.08864 8.41943 2.58096L6.41943 0.580957C5.91175 0.0732746 5.08864 0.0732751 4.58096 0.580956C4.14121 1.0207 4.08237 1.69711 4.40442 2.2002Z" fill="white"/>
+</svg>