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

Editor: Home/End (and cmd-a/cmd-e) move to end of paragraph, not line #8775

Closed
pokrface opened this issue Jul 29, 2017 · 5 comments · Fixed by TryGhost/Admin#870
Closed

Editor: Home/End (and cmd-a/cmd-e) move to end of paragraph, not line #8775

pokrface opened this issue Jul 29, 2017 · 5 comments · Fixed by TryGhost/Admin#870
Assignees
Labels
affects:admin Anything relating to Ghost Admin bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with

Comments

@pokrface
Copy link

Issue Summary

When using the editor to write a post, the home and end keys on Win10 and the equivalent cmd-a/cmd-e commands on macos position the cursor at the beginning and end of the current paragraph being edited, rather than the beginning and end of the current line.

Steps to Reproduce

  1. Create a new post or edit an existing post
  2. Position the cursor somewhere within a paragraph of text that spans multiple lines without a CR/LF
  3. Press home or end (or on macos, press cmd-a or cmd-e)
  4. Cursor will jump to beginning or end of the entire pararaph

Expected behavior is that the cursor would move to the beginning or end of the current line being edited. Pre-1.0 Ghost behaved correctly (and so does this GitHub text entry form). Current behavior subverts expected behavior of home/end and has made composing long posts in the editor more difficult.

Technical details:

  • Ghost Version: 1.1.0
  • Node Version: v6.11.1
  • Database: MySQL Ver 15.1 Distrib 10.1.25-MariaDB

Verified problem behavior with:
Firefox 54.0.1 / MacOS 10.12.5
Chrome 60.0.3112.78 / MacOS 10.12.5
Chrome 60.0.3112.78 / Windows 10 v1607 (build 14393.1198)
Edge 38.14393.1066.0 / Windows 10 v1607 (build 14393.1198)

@ErisDS ErisDS added affects:admin Anything relating to Ghost Admin bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with labels Jul 29, 2017
@kevinansfield
Copy link
Member

kevinansfield commented Jul 31, 2017

I've tested on macOS and the behaviour is correct (i.e. matches OS behaviour):

Ctrl+a: jump to beginning of paragraph
Ctrl+e: jump to end of paragraph
Cmd+left: jump to beginning of line
Cmd+right: jump to end of line

I haven't tested Windows yet but looking at the default CodeMirror keymap they've set Home and End to go to beginning/end of the current paragraph, it may be useful to open an issue there.

@kevinansfield
Copy link
Member

Testing Windows in a VM I'm seeing the following behaviour:

Edge textarea:
Home: jump to beginning of line
End: jump to end of line

Edge CodeMirror (Ghost's underlying editing canvas):
Home: jump to beginning of paragraph
End: jump to end of paragraph

I haven't been able to test properly with arrow keys as I think my VM host may be interpreting keyboard shortcuts from macOS and I can't find a way to send arrow key events directly as is possible with Home and End

@stucampbell
Copy link

stucampbell commented Sep 3, 2017

I agree with @pokrface. In Chrome on Windows 10 and in the Windows 10 app, Home and End don't work as expected. They take you to the beginning/end of the paragraph, instead of the beginning/end of the line. It's quite awkward - I didn't realise how much I use home and end until now! :)

Edit: just to be clear - I mean this only happens in the Ghost editor. Please can you fix it?

@jamesvhays
Copy link

I took a whack at it in this PR, using the extraKeys option in CodeMirror. There might be a more elegant way to do it, but not that I could see.

TryGhost/Admin#859.

kevinansfield added a commit to kevinansfield/Ghost-Admin that referenced this issue Sep 25, 2017
closes TryGhost/Ghost#8775
- upgrades our SimpleMDE fork
  - [bumps CodeMirror version to 5.30.0](kevinansfield/simplemde-markdown-editor@b3e9f8b)
  - [fixes Home/End key behaviour on Windows](kevinansfield/simplemde-markdown-editor@f2e9818)
kirrg001 pushed a commit to TryGhost/Admin that referenced this issue Sep 25, 2017
closes TryGhost/Ghost#8775

- upgrades our SimpleMDE fork
  - [bumps CodeMirror version to 5.30.0](kevinansfield/simplemde-markdown-editor@b3e9f8b)
  - [fixes Home/End key behaviour on Windows](kevinansfield/simplemde-markdown-editor@f2e9818)
@pokrface
Copy link
Author

Thank you, @jamesvhays!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:admin Anything relating to Ghost Admin bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with
Projects
None yet
6 participants