mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
Koenig - Fixed UP or LEFT on a blank list item jumping cursor to title
refs https://github.com/TryGhost/Ghost/issues/9505 - ListItem sections have a parent rather than a prev section so we need to look for a section before the parent section when determining if the cursor is at the beginning of the doc for <kbd>Up</kbd> and <kbd>Left</kbd> key handling
This commit is contained in:
parent
4519ccd087
commit
d6a6fc3d7c
@ -595,8 +595,9 @@ export default Component.extend({
|
||||
// the doc
|
||||
handleUpKey(editor) {
|
||||
let {isCollapsed, head: {offset, section}} = editor.range;
|
||||
let prevSection = section.isListItem ? section.parent.prev : section.prev;
|
||||
|
||||
if (isCollapsed && !section.prev && offset === 0) {
|
||||
if (isCollapsed && offset === 0 && !prevSection) {
|
||||
this.cursorDidExitAtTop();
|
||||
}
|
||||
|
||||
@ -608,7 +609,8 @@ export default Component.extend({
|
||||
|
||||
// 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
|
||||
if (isCollapsed && !section.prev && offset === 0) {
|
||||
let prevSection = section.isListItem ? section.parent.prev : section.prev;
|
||||
if (isCollapsed && offset === 0 && !prevSection) {
|
||||
this.cursorDidExitAtTop();
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user