From bc97cd39a80fd61d159f701f8f75e10625d12937 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Fri, 15 Jun 2018 14:21:01 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Koenig=20-=20Fixed=20cursor=20ju?= =?UTF-8?q?mping=20to=20title=20when=20pressing=20Up/Left=20on=20list=20it?= =?UTF-8?q?ems?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs https://github.com/TryGhost/Ghost/issues/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 --- ghost/admin/lib/koenig-editor/addon/options/key-commands.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ghost/admin/lib/koenig-editor/addon/options/key-commands.js b/ghost/admin/lib/koenig-editor/addon/options/key-commands.js index f88072ba71..2dbd90cf75 100644 --- a/ghost/admin/lib/koenig-editor/addon/options/key-commands.js +++ b/ghost/admin/lib/koenig-editor/addon/options/key-commands.js @@ -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'); @@ -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;