Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Koenig - Ensure Enter behaviour is consistent when a card is selected
Browse files Browse the repository at this point in the history
refs TryGhost/Ghost#9623
- clicking a card a second time while it is selected can move the invisible cursor to the beginning of a section in which case <kbd>Enter</kbd> would insert a blank paragraph above the card
- when <kbd>Enter</kbd> is pressed and a card is selected, move the cursor to the end of the card section without triggering our cursor change so that the default behaviour will always add a paragraph after the card
  • Loading branch information
kevinansfield committed Jun 20, 2018
1 parent 985e4b2 commit 6a314a7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/koenig-editor/addon/options/key-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export const DEFAULT_KEY_COMMANDS = [{
return;
}

// if a card is selected, move the cursor to the end of the card so that
// Enter consistently adds a new paragraph after the card
if (isCollapsed && section.isCardSection) {
koenig.moveCaretToTailOfSection(section, true);
}

return false;
}
}, {
Expand Down

0 comments on commit 6a314a7

Please sign in to comment.