mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05: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
1 changed files with 4 additions and 2 deletions
|
@ -595,8 +595,9 @@ export default Component.extend({
|
||||||
// the doc
|
// the doc
|
||||||
handleUpKey(editor) {
|
handleUpKey(editor) {
|
||||||
let {isCollapsed, head: {offset, section}} = editor.range;
|
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();
|
this.cursorDidExitAtTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,7 +609,8 @@ export default Component.extend({
|
||||||
|
|
||||||
// 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
|
||||||
if (isCollapsed && !section.prev && offset === 0) {
|
let prevSection = section.isListItem ? section.parent.prev : section.prev;
|
||||||
|
if (isCollapsed && offset === 0 && !prevSection) {
|
||||||
this.cursorDidExitAtTop();
|
this.cursorDidExitAtTop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue