[GH-ISSUE #7854] [Bug] Dissapearing text when trying to change the text into Code - v0.8.9 #3447

Closed
opened 2026-03-23 21:30:15 +00:00 by mirror · 4 comments
Owner

Originally created by @kappafon on GitHub (Apr 29, 2025).
Original GitHub issue: https://github.com/AppFlowy-IO/AppFlowy/issues/7854

Originally assigned to: @LucasXu0 on GitHub.

Bug Description

When I type a text and select it then press backtikc key three times, the expectation is to wrap the text into code block, instead the text is gone. Then I press Ctrl + Z to undo and get the text back.
But if I go to another page and come back to the first one. The empty code block is back and the text is gone.

How to Reproduce

Write a text and select the whole block, then type triple backticks fast ``` to turn it into a Code block
- Text dissapears.
Press Ctrl+Z to undo, to restore the text, and go to another document and come back here.
- The empty Code block is visible instead of the text.

Expected Behavior

Write a text and select the whole block, then type triple backticks fast ``` to turn it into a Code block
- Text is now inside the code block.
Press Ctrl+Z to undo, to restore the text, and go to another document and come back here.
- The text is still there and visible.

Operating System

Windows

AppFlowy Version(s)

v0.8.9

Screenshots

https://github.com/user-attachments/assets/44ea31d8-d45a-42dc-9042-9e64a2b47e7e

Additional Context

No response

Originally created by @kappafon on GitHub (Apr 29, 2025). Original GitHub issue: https://github.com/AppFlowy-IO/AppFlowy/issues/7854 Originally assigned to: @LucasXu0 on GitHub. ### Bug Description When I type a text and select it then press backtikc key three times, the expectation is to wrap the text into code block, instead the text is gone. Then I press Ctrl + Z to undo and get the text back. But if I go to another page and come back to the first one. The empty code block is back and the text is gone. ### How to Reproduce Write a text and select the whole block, then type triple backticks fast ``` to turn it into a Code block **- Text dissapears.** Press Ctrl+Z to undo, to restore the text, and go to another document and come back here. **- The empty Code block is visible instead of the text.** ### Expected Behavior Write a text and select the whole block, then type triple backticks fast ``` to turn it into a Code block **- Text is now inside the code block.** Press Ctrl+Z to undo, to restore the text, and go to another document and come back here. **- The text is still there and visible.** ### Operating System Windows ### AppFlowy Version(s) v0.8.9 ### Screenshots https://github.com/user-attachments/assets/44ea31d8-d45a-42dc-9042-9e64a2b47e7e ### Additional Context _No response_
Author
Owner

@LucasXu0 commented on GitHub (Apr 30, 2025):

Write a text and select the whole block, then type triple backticks fast ``` to turn it into a Code block

  • Text is now inside the code block.

In my opinion, if you select the whole block, it means replacing the existing text with your input. If you want to convert the existing paragraph to a code block, you can put the cursor at the beginning of the sentence and press '`' three times.

https://github.com/user-attachments/assets/7d9f55ef-7248-45fb-9e94-c67d211bbcb4

<!-- gh-comment-id:2840652007 --> @LucasXu0 commented on GitHub (Apr 30, 2025): > Write a text and select the whole block, then type triple backticks fast ``` to turn it into a Code block > - Text is now inside the code block. In my opinion, if you select the whole block, it means replacing the existing text with your input. If you want to convert the existing paragraph to a code block, you can put the cursor at the beginning of the sentence and press '`' three times. https://github.com/user-attachments/assets/7d9f55ef-7248-45fb-9e94-c67d211bbcb4
Author
Owner

@kappafon commented on GitHub (Apr 30, 2025):

@LucasXu0
Sure, that would also work for me. In general I have quite a lot of code snippets in my docs and it would be great if that was also a 'shortcut' next to this 'inline code' icon
Image

But the editor bug where I undo something, leave the current page and come back is maybe a bigger issue for me.
I'm used to converting text to code snippets that way from using other editors so even if this is not expected for Appflowy I might slip from time to time, realize the mistake, undo, go work on other docs, meanwhile the text block is gone.

<!-- gh-comment-id:2840831880 --> @kappafon commented on GitHub (Apr 30, 2025): @LucasXu0 Sure, that would also work for me. In general I have quite a lot of code snippets in my docs and it would be great if that was also a 'shortcut' next to this 'inline code' icon ![Image](https://github.com/user-attachments/assets/1730b1e0-85c0-4864-9e94-7aa5dd59084f) But the editor bug where I undo something, leave the current page and come back is maybe a bigger issue for me. I'm used to converting text to code snippets that way from using other editors so even if this is not expected for Appflowy I might slip from time to time, realize the mistake, undo, go work on other docs, meanwhile the text block is gone.
Author
Owner

@LucasXu0 commented on GitHub (Apr 30, 2025):

@kappafon regarding the undo issue, I already have an idea to fix it. It may be related to the undoManager's debounce timer.

You can try the upcoming release (v0.9.0) to see if it's fixed on your end.

<!-- gh-comment-id:2841132575 --> @LucasXu0 commented on GitHub (Apr 30, 2025): @kappafon regarding the undo issue, I already have an idea to fix it. It may be related to the undoManager's debounce timer. You can try the upcoming release (v0.9.0) to see if it's fixed on your end.
Author
Owner

@kappafon commented on GitHub (May 3, 2025):

I can't reproduce the bug anymore on my side. Great work :)
Thanks!

<!-- gh-comment-id:2848425263 --> @kappafon commented on GitHub (May 3, 2025): I can't reproduce the bug anymore on my side. Great work :) Thanks!
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#3447
No description provided.