heynote
heynote copied to clipboard
Cell corruption when deleting block contents
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:
https://github.com/heyman/heynote/assets/31131631/1d50b926-a780-4a75-9b0c-0d7fa905348b
Thanks for the report!
Note: Cmd + Shift + K
causes the same bug on MacOS
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?
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
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).
hmm, @Maran1947 maybe adjust your commit then...? Since it's the closest to the desired solution, i think it would be easier that way.
#134 In this PR, is this the correct way?
As far as I can tell, #134 deletes a whole block and is not a block-aware equivalent to the deleteLine
command in Codemirror.
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?