Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
🐛 Koenig - Fixed cursor jumping to title when pressing Up/Left on lis…
Browse files Browse the repository at this point in the history
…t items

refs TryGhost/Ghost#9623
- update "exit cursor at top" logic so it doesn't look at the parent ListSection until the cursor has reached the first ListItem in a ListSection
  • Loading branch information
kevinansfield committed Jun 15, 2018
1 parent 3978894 commit 4c0617b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/koenig-editor/addon/options/key-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const DEFAULT_KEY_COMMANDS = [{
str: 'UP',
run(editor, koenig) {
let {isCollapsed, head: {offset, section}} = editor.range;
let prevSection = section.isListItem ? section.parent.prev : section.prev;
let prevSection = section.isListItem && !section.prev ? section.parent.prev : section.prev;

if (isCollapsed && (offset === 0 || section.isCardSection) && !prevSection) {
koenig.send('exitCursorAtTop');
Expand All @@ -210,7 +210,7 @@ export const DEFAULT_KEY_COMMANDS = [{

// trigger a closure action to indicate that the caret "left" the top of
// the editor canvas if the caret is at the very beginning of the doc
let prevSection = section.isListItem ? section.parent.prev : section.prev;
let prevSection = section.isListItem && !section.prev ? section.parent.prev : section.prev;
if (isCollapsed && (offset === 0 || section.isCardSection) && !prevSection) {
koenig.send('exitCursorAtTop');
return;
Expand Down

0 comments on commit 4c0617b

Please sign in to comment.