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: remove current page link option in page reference (#3600)

Narayancca500554127
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<AppFlowyEditorPage> {
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<void>();
+ final String currentViewId;
late final ViewBackendService service;
List<InlineActionsMenuItem> _items = [];
@@ -22,7 +23,7 @@ class InlinePageReferenceService {
Future<void> init() async {
service = ViewBackendService();
- _generatePageItems().then((value) {
+ _generatePageItems(currentViewId).then((value) {
_items = value;
_filtered = value;
_initCompleter.complete();
@@ -59,7 +60,9 @@ class InlinePageReferenceService {
);
}
- Future<List<InlineActionsMenuItem>> _generatePageItems() async {
+ Future<List<InlineActionsMenuItem>> _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,