Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting the previous empty block will cause current block deleted #8303

Closed
1 of 2 tasks
situ2001 opened this issue Jan 11, 2023 · 4 comments · Fixed by #8974
Closed
1 of 2 tasks

Deleting the previous empty block will cause current block deleted #8303

situ2001 opened this issue Jan 11, 2023 · 4 comments · Fixed by #8974
Assignees
Labels
block-ref can-be-reproduced editor :type/bug Something isn't working. Affects daily use.

Comments

@situ2001
Copy link
Collaborator

Search first

  • I searched and no similar issues were found

What Happened?

As the title mentioned, deleting a previous empty block by pressing backspace at cursor position 0 of the next of the previous block will cause current block deleted and the content of this block will be moved to previous block. Because of the behavior, all block-ref to this block will be invalid.

Don't know if it is a feature or a bug.

Reproduce the Bug

The steps are presented at the following screen recording.

Expected Behavior

Should update all block-ref to this block when deleting previous empty block at the beginning of the next block of it. It is intuitive.

Screenshots

Kapture.2023-01-11.at.12.10.28.mp4

Desktop or Mobile Platform Information

App Version: 0.8.15
Git Revision: 2231919
Platform: Mozilla/5.0 (Macintosh Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML like Gecko) Logseq/0.8.15 Chrome/102.0.5005.167 Electron/19.1.8 Safari/537.36
Language: en-US

Additional Context

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR (Thank you!)
@situ2001 situ2001 changed the title [Editor] Deleting an empty block will cause current block deleted [Editor] Deleting an previous empty block will cause current block deleted Jan 11, 2023
@situ2001 situ2001 changed the title [Editor] Deleting an previous empty block will cause current block deleted [Editor] Deleting the previous empty block will cause current block deleted Jan 11, 2023
@Bad3r
Copy link
Collaborator

Bad3r commented Jan 11, 2023

can reproduce in Linux

@situ2001
Copy link
Collaborator Author

I reproduced it on Windows. I think it is OS-independent.

Jan.11th.2023.2023-01-11.12-56-51.mp4

@situ2001
Copy link
Collaborator Author

situ2001 commented Jan 11, 2023

@Bad3r This issue should be tagged with editor and block-ref.

@situ2001
Copy link
Collaborator Author

Here is the code handling backspace keydown when current cursor position is at 0.

(zero? current-pos)
(do
(util/stop e)
(when (and (if top-block? (string/blank? value) true)
(not root-block?)
(not single-block?))
(delete-block! repo false)))

@logseq logseq deleted a comment from situ2001 Jan 11, 2023
@Bad3r Bad3r added :type/bug Something isn't working. Affects daily use. and removed os:macos labels Jan 11, 2023
@Bad3r Bad3r changed the title [Editor] Deleting the previous empty block will cause current block deleted Deleting the previous empty block will cause current block deleted Jan 11, 2023
@megayu megayu self-assigned this Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block-ref can-be-reproduced editor :type/bug Something isn't working. Affects daily use.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants