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: using [[ to create subpage with error text (#7434)

Morn249543d64f27
diff --git a/frontend/appflowy_flutter/integration_test/mobile/document/at_menu_test.dart b/frontend/appflowy_flutter/integration_test/mobile/document/at_menu_test.dart
index 394cacffd6..2b348d3a2e 100644
--- a/frontend/appflowy_flutter/integration_test/mobile/document/at_menu_test.dart
+++ b/frontend/appflowy_flutter/integration_test/mobile/document/at_menu_test.dart
@@ -37,5 +37,20 @@ void main() {
await tester.tap(actionWidgets.last);
expect(find.byType(MentionPageBlock), findsOneWidget);
});
+
+ testWidgets('create subpage with at menu', (tester) async {
+ await tester.launchInAnonymousMode();
+ await tester.createNewDocumentOnMobile(title);
+ await tester.editor.tapLineOfEditorAt(0);
+ const subpageName = 'Subpage';
+ await tester.ime.insertText('[[$subpageName');
+ await tester.pumpAndSettle();
+ final actionWidgets = find.byType(MobileInlineActionsWidget);
+ await tester.tapButton(actionWidgets.first);
+ final firstNode =
+ tester.editor.getCurrentEditorState().getNodeAtPath([0]);
+ assert(firstNode != null);
+ expect(firstNode!.delta?.toPlainText().contains('['), false);
+ });
});
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/page_reference_commands.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/page_reference_commands.dart
index 14402434b2..007e4ea298 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/page_reference_commands.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/page_reference_commands.dart
@@ -120,6 +120,7 @@ Future<bool> inlinePageReferenceCommandHandler(
editorState: editorState,
service: service,
initialResults: initialResults,
+ startCharAmount: previousChar != null ? 2 : 1,
style: style,
)
: InlineActionsMenu(