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

Cursor position not updated after press ENTER key in an empty code in Firefox #1106

Closed
Violeta-Amza opened this issue Nov 19, 2020 · 5 comments

Comments

@Violeta-Amza
Copy link

Steps to reproduce

  1. Load http://prosemirror.net/
  2. Insert a block code by typing ```
  3. Press ENTER key

Expected:

Cursor should appear on the new line

Actual:

A new line is inserted, but cursor position remains the same (the selection is also updated: if you type any text, this will be inserted on the new line)

Affected platforms

  • Firefox
marijnh added a commit to ProseMirror/prosemirror-view that referenced this issue Nov 20, 2020
…newlines

FIX: Fix an issue where pressing enter at the start of a line in a code block
would leave the visible cursor in the wrong place on Firefox.

Issue ProseMirror/prosemirror#1106
@marijnh
Copy link
Member

marijnh commented Nov 20, 2020

This seems to be the same Firefox bug as #1073. Attached patch tries to extend the workaround for that to also cover this, and seems to work for me. Could you give it a try?

@Violeta-Amza
Copy link
Author

Violeta-Amza commented Nov 20, 2020

Thanks for your response.

It's true that the attached patch covers some scenarios, but I still face this problem when press ENTER in a code node.
This happens because the condition for brKludge variable is evaluated to false(the previous node is not a BR node (it is a text with a new line))

Please see: https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L574 and https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L230

I was thinking if there a way to extend current condition to pass those situations as well.

Thanks

@marijnh
Copy link
Member

marijnh commented Nov 20, 2020

it is a text with a new line

That's exactly what patch ProseMirror/prosemirror-view@4d067de adds handling for. Did you test with the patch?

@Violeta-Amza
Copy link
Author

Thank you for your response.

You are right, I do not test with the attached patch. (I checked with the attached patch from the related issue).

Now, I tested with the attached patch, it seems to be okay.

@marijnh
Copy link
Member

marijnh commented Nov 23, 2020

Great. I've released prosemirror-view 1.16.3 with that change.

@marijnh marijnh closed this as completed Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants