diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart index e050af080f..2dfa2b93c7 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart @@ -57,7 +57,9 @@ class _AppFlowyEditorPageState extends State { late final InlineActionsService inlineActionsService = InlineActionsService( context: context, handlers: [ - InlinePageReferenceService().inlinePageReferenceDelegate, + InlinePageReferenceService( + currentViewId: documentBloc.view.id, + ).inlinePageReferenceDelegate, DateReferenceService(context).dateReferenceDelegate, ReminderReferenceService(context).reminderReferenceDelegate, ], diff --git a/frontend/appflowy_flutter/lib/plugins/inline_actions/handlers/inline_page_reference.dart b/frontend/appflowy_flutter/lib/plugins/inline_actions/handlers/inline_page_reference.dart index 228739c748..3bfb4b2a0b 100644 --- a/frontend/appflowy_flutter/lib/plugins/inline_actions/handlers/inline_page_reference.dart +++ b/frontend/appflowy_flutter/lib/plugins/inline_actions/handlers/inline_page_reference.dart @@ -9,11 +9,12 @@ import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:easy_localization/easy_localization.dart'; class InlinePageReferenceService { - InlinePageReferenceService() { + InlinePageReferenceService({required this.currentViewId}) { init(); } final Completer _initCompleter = Completer(); + final String currentViewId; late final ViewBackendService service; List _items = []; @@ -22,7 +23,7 @@ class InlinePageReferenceService { Future init() async { service = ViewBackendService(); - _generatePageItems().then((value) { + _generatePageItems(currentViewId).then((value) { _items = value; _filtered = value; _initCompleter.complete(); @@ -59,7 +60,9 @@ class InlinePageReferenceService { ); } - Future> _generatePageItems() async { + Future> _generatePageItems( + String currentViewId, + ) async { final views = await service.fetchViews(); if (views.isEmpty) { return []; @@ -69,6 +72,10 @@ class InlinePageReferenceService { views.sort(((a, b) => b.createTime.compareTo(a.createTime))); for (final view in views) { + if (view.id == currentViewId) { + continue; + } + final pageSelectionMenuItem = InlineActionsMenuItem( keywords: [view.name.toLowerCase()], label: view.name,