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: ai writer not working in database rows (#7746)

Richard Shiued01909830d83
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_document.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_document.dart
index 8e229f6b21..436dbd085d 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_document.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_document.dart
@@ -5,6 +5,7 @@ import 'package:appflowy/plugins/document/application/document_bloc.dart';
import 'package:appflowy/plugins/document/presentation/editor_drop_handler.dart';
import 'package:appflowy/plugins/document/presentation/editor_drop_manager.dart';
import 'package:appflowy/plugins/document/presentation/editor_page.dart';
+import 'package:appflowy/plugins/document/presentation/editor_plugins/ai/widgets/ai_writer_scroll_wrapper.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/shared_context/shared_context.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/transaction_handler/editor_transaction_service.dart';
import 'package:appflowy/plugins/document/presentation/editor_style.dart';
@@ -120,29 +121,34 @@ class _RowEditor extends StatelessWidget {
return context;
},
dispose: (_, editorContext) => editorContext.dispose(),
- child: EditorDropHandler(
+ child: AiWriterScrollWrapper(
viewId: view.id,
editorState: editorState,
- isLocalMode: context.read<DocumentBloc>().isLocalMode,
- dropManagerState: context.read<EditorDropManagerState>(),
- child: EditorTransactionService(
+ child: EditorDropHandler(
viewId: view.id,
editorState: editorState,
- child: Provider(
- create: (context) =>
- DatabasePluginWidgetBuilderSize(horizontalPadding: 0),
- child: AppFlowyEditorPage(
- shrinkWrap: true,
- autoFocus: false,
- editorState: editorState,
- styleCustomizer: EditorStyleCustomizer(
- context: context,
- padding: const EdgeInsets.only(left: 16, right: 54),
+ isLocalMode: context.read<DocumentBloc>().isLocalMode,
+ dropManagerState: context.read<EditorDropManagerState>(),
+ child: EditorTransactionService(
+ viewId: view.id,
+ editorState: editorState,
+ child: Provider(
+ create: (context) => DatabasePluginWidgetBuilderSize(
+ horizontalPadding: 0,
+ ),
+ child: AppFlowyEditorPage(
+ shrinkWrap: true,
+ autoFocus: false,
+ editorState: editorState,
+ styleCustomizer: EditorStyleCustomizer(
+ context: context,
+ padding: const EdgeInsets.only(left: 16, right: 54),
+ ),
+ showParagraphPlaceholder: (editorState, _) =>
+ editorState.document.isEmpty,
+ placeholderText: (_) =>
+ LocaleKeys.cardDetails_notesPlaceholder.tr(),
),
- showParagraphPlaceholder: (editorState, _) =>
- editorState.document.isEmpty,
- placeholderText: (_) =>
- LocaleKeys.cardDetails_notesPlaceholder.tr(),
),
),
),
diff --git a/frontend/appflowy_flutter/lib/plugins/database_document/database_document_page.dart b/frontend/appflowy_flutter/lib/plugins/database_document/database_document_page.dart
index 186671b427..9568784464 100644
--- a/frontend/appflowy_flutter/lib/plugins/database_document/database_document_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database_document/database_document_page.dart
@@ -9,6 +9,7 @@ import 'package:appflowy/plugins/document/presentation/banner.dart';
import 'package:appflowy/plugins/document/presentation/editor_drop_handler.dart';
import 'package:appflowy/plugins/document/presentation/editor_notification.dart';
import 'package:appflowy/plugins/document/presentation/editor_page.dart';
+import 'package:appflowy/plugins/document/presentation/editor_plugins/ai/widgets/ai_writer_scroll_wrapper.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/transaction_handler/editor_transaction_service.dart';
import 'package:appflowy/plugins/document/presentation/editor_style.dart';
import 'package:appflowy/shared/flowy_error_page.dart';
@@ -104,7 +105,11 @@ class _DatabaseDocumentPageState extends State<DatabaseDocumentPage> {
return BlocListener<ActionNavigationBloc, ActionNavigationState>(
listener: _onNotificationAction,
listenWhen: (_, curr) => curr.action != null,
- child: _buildEditorPage(context, state),
+ child: AiWriterScrollWrapper(
+ viewId: widget.view.id,
+ editorState: editorState,
+ child: _buildEditorPage(context, state),
+ ),
);
},
),