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

Commit

Permalink
πŸ› fix backspace deleting cards whilst editing (#674)
Browse files Browse the repository at this point in the history
closes TryGhost/Ghost#8385
- If a card that is being edited is hard-selected then make sure that it is in fact soft-selected
  • Loading branch information
disordinary authored and kevinansfield committed Apr 25, 2017
1 parent 3e49b75 commit f022295
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/gh-koenig/addon/components/gh-koenig.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ export default Component.extend({
throw new Error('A selection must include a cardId');
}

// don't hard select an editing card.
if (this.editedCard && this.editedCard.id === cardId) {
this.send('editCard', cardId);
return;
}

let card = this.get('emberCards').find((card) => card.id === cardId);
let cardHolder = $(`#${cardId}`).parents('.kg-card');
let selectedCard = this.get('selectedCard');
Expand Down Expand Up @@ -369,6 +375,7 @@ export default Component.extend({
editCard(cardId) {
let card = this.get('emberCards').find((card) => card.id === cardId);
this.set('editedCard', card);
this.send('selectCard', cardId);
},
deleteCard(cardId, forwards = false) {
let editor = this.get('editor');
Expand Down

0 comments on commit f022295

Please sign in to comment.