[PR #7719] [MERGED] chore: adjust replace, insert below, discard selection behavior #8067

Closed
opened 2026-03-23 23:22:27 +00:00 by mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/7719
Author: @richardshiue
Created: 4/10/2025
Status: Merged
Merged: 4/11/2025
Merged by: @richardshiue

Base: mainHead: fix/ai-writer-after-selection


📝 Commits (1)

  • a1c49d6 chore: adjust replace, insert below, discard selection behavior

📊 Changes

3 files changed (+20 additions, -4 deletions)

View changed files

📝 frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/operations/ai_writer_cubit.dart (+12 -1)
📝 frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/widgets/ai_writer_scroll_wrapper.dart (+1 -0)
📝 frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/markdown_text_robot.dart (+7 -3)

📄 Description

  1. clear the grey + strike-through for selected text before accepting (aka replacing), so that undoing the action using Ctrl + Z won't show the grey + strike-through
  2. update after selection to more acceptable positions
  3. After exiting, immediately request focus using the keyboard service

Feature Preview


PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Summary by Sourcery

Adjust the behavior of text replacement, insertion, and selection discarding in the AI writer functionality

Bug Fixes:

  • Prevent potential null pointer exceptions by adding null checks in AI writer operations
  • Ensure keyboard service is fully re-enabled after removing AI writer node

Enhancements:

  • Improve handling of AI writer node selection and text replacement operations
  • Enhance text robot discard method to support custom after-selection positioning

Chores:

  • Refactor AI writer and markdown text robot methods to be more robust and flexible

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AppFlowy-IO/AppFlowy/pull/7719 **Author:** [@richardshiue](https://github.com/richardshiue) **Created:** 4/10/2025 **Status:** ✅ Merged **Merged:** 4/11/2025 **Merged by:** [@richardshiue](https://github.com/richardshiue) **Base:** `main` ← **Head:** `fix/ai-writer-after-selection` --- ### 📝 Commits (1) - [`a1c49d6`](https://github.com/AppFlowy-IO/AppFlowy/commit/a1c49d6c4e519f0431003f4fc3cfae654b08590c) chore: adjust replace, insert below, discard selection behavior ### 📊 Changes **3 files changed** (+20 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/operations/ai_writer_cubit.dart` (+12 -1) 📝 `frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/widgets/ai_writer_scroll_wrapper.dart` (+1 -0) 📝 `frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/markdown_text_robot.dart` (+7 -3) </details> ### 📄 Description 1. clear the grey + strike-through for selected text before accepting (aka replacing), so that undoing the action using Ctrl + Z won't show the grey + strike-through 2. update after selection to more acceptable positions 3. After exiting, immediately request focus using the keyboard service ### Feature Preview <!--- List at least one issue here that this PR addresses. If it fixes the issue, please use the [fixes](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests) keyword to close the issue. For example: fixes https://github.com/AppFlowy-IO/AppFlowy/pull/2106 --> --- <!--- Before you mark this PR ready for review, run through this checklist! --> #### PR Checklist - [x] My code adheres to [AppFlowy's Conventions](https://docs.appflowy.io/docs/documentation/software-contributions/conventions) - [x] I've listed at least one issue that this PR fixes in the description above. - [x] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes. - [x] All existing tests are passing. ## Summary by Sourcery Adjust the behavior of text replacement, insertion, and selection discarding in the AI writer functionality Bug Fixes: - Prevent potential null pointer exceptions by adding null checks in AI writer operations - Ensure keyboard service is fully re-enabled after removing AI writer node Enhancements: - Improve handling of AI writer node selection and text replacement operations - Enhance text robot discard method to support custom after-selection positioning Chores: - Refactor AI writer and markdown text robot methods to be more robust and flexible --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
mirror 2026-03-23 23:22:27 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AppFlowy-IO/AppFlowy#8067
No description provided.