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

Cell corruption when deleting block contents #43

Closed
JMSS-Unknown opened this issue Dec 23, 2023 · 8 comments · Fixed by #134
Closed

Cell corruption when deleting block contents #43

JMSS-Unknown opened this issue Dec 23, 2023 · 8 comments · Fixed by #134
Labels
bug Something isn't working

Comments

@JMSS-Unknown
Copy link

JMSS-Unknown commented Dec 23, 2023

Selecting the contents of an entire block and pressing CTRL + SHIFT + K (on windows) causes the block separator and language type (e.g. ∞∞∞markdown) to become text inside the next block and the next block's type becomes the previous block's type. See the following video:

heynote.2023-12-23.12-00-31.mp4
@JMSS-Unknown JMSS-Unknown changed the title Cell Corruption During Delete Cell corruption deleting entire block Dec 23, 2023
@JMSS-Unknown JMSS-Unknown changed the title Cell corruption deleting entire block Cell corruption when deleting block contents Dec 23, 2023
@heyman heyman added the bug Something isn't working label Dec 23, 2023
@heyman
Copy link
Owner

heyman commented Dec 23, 2023

Thanks for the report!

Note: Cmd + Shift + K causes the same bug on MacOS

@Maran1947
Copy link
Contributor

Maran1947 commented Jan 1, 2024

As I analyzed the issue, the bug doesn't occur when deleting the first block, but it arises when attempting to delete the second block. The reason it doesn't happen when deleting the first block is that 'block.js' contains a function called preventFirstBlockFromBeingDeleted that prevents this bug. If my understanding is correct, should we extend this solution to the remaining blocks or concentrate on improving how the editor handles Ctrl+Shift+K in keymaps?

@heyman, could you please guide me on resolving this issue?

@feh-pined0
Copy link
Contributor

Hey, saw your description of the problem a few days before and tried to implement your other solution as well. Didnt see you already had solved it lol. #118

@heyman
Copy link
Owner

heyman commented Jan 4, 2024

Codemirror bindsCtrl/Cmd-Shift-K to deleteLine which will result in broken block syntax when performed either in a block with just a single line, or when all of the content of a block is selected.

I think the proper solution is to implement a custom deleteLine that is block-aware (running deleteLine on a single-line block, should probably just remove the whole block).

@feh-pined0
Copy link
Contributor

hmm, @Maran1947 maybe adjust your commit then...? Since it's the closest to the desired solution, i think it would be easier that way.

@Maran1947
Copy link
Contributor

Maran1947 commented Jan 5, 2024

#134
In this PR, is this the correct way?

@heyman
Copy link
Owner

heyman commented Jan 7, 2024

As far as I can tell, #134 deletes a whole block and is not a block-aware equivalent to the deleteLine command in Codemirror.

@Maran1947
Copy link
Contributor

Maran1947 commented Jan 7, 2024

I've updated PR #134. I checked CodeMirror's deleteLine implementation and added a condition to fix the problem. Could you please check if this is correct or suggest any improvements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants