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

fix: Backspaces do not work when the code block contains initial data. #2836

Open
wants to merge 8 commits into
base: next
Choose a base branch
from
2 changes: 1 addition & 1 deletion src/components/utils/caret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export function checkContenteditableSliceForEmptiness(contenteditable: HTMLEleme
* @param input - input where caret should be checked
*/
export function isCaretAtStartOfInput(input: HTMLElement): boolean {
const firstNode = $.getDeepestNode(input);
const firstNode = $.isNativeInput(input) ? input : $.getDeepestNode(input);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to update getDeepestNode instead. It already contains a logic that will return a passed node, but seems like node[child] statement does not cover this case

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing it out.
I think you are right too.

Fixed in 8cec5c9.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neSpecc
Please re-review.


if (firstNode === null || $.isEmpty(input)) {
return true;
Expand Down