0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

🐛 Koenig - Fixed cursor jumping to title when pressing Up/Left on list items

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
This commit is contained in:
Kevin Ansfield 2018-06-15 14:21:01 +01:00
parent ea2a6a09dc
commit bc97cd39a8

View file

@ -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;