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:
parent
ea2a6a09dc
commit
bc97cd39a8
1 changed files with 2 additions and 2 deletions
|
@ -195,7 +195,7 @@ export const DEFAULT_KEY_COMMANDS = [{
|
||||||
str: 'UP',
|
str: 'UP',
|
||||||
run(editor, koenig) {
|
run(editor, koenig) {
|
||||||
let {isCollapsed, head: {offset, section}} = editor.range;
|
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) {
|
if (isCollapsed && (offset === 0 || section.isCardSection) && !prevSection) {
|
||||||
koenig.send('exitCursorAtTop');
|
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
|
// 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
|
// 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) {
|
if (isCollapsed && (offset === 0 || section.isCardSection) && !prevSection) {
|
||||||
koenig.send('exitCursorAtTop');
|
koenig.send('exitCursorAtTop');
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue