Exit callout/toggle cards on pressing enter

refs https://github.com/TryGhost/Team/issues/1206

-  When editing, pressing enter exists the edit mode and adds a new paragraph after the card.
This commit is contained in:
Thibaut Patel 2021-11-18 11:00:18 +01:00
parent 43d1981d73
commit 3024868250

View File

@ -132,7 +132,8 @@ export default class KoenigCardCalloutComponent extends Component {
registerEditor(textReplacementEditor) {
let commands = {
'META+ENTER': run.bind(this, this._enter, 'meta'),
'CTRL+ENTER': run.bind(this, this._enter, 'ctrl')
'CTRL+ENTER': run.bind(this, this._enter, 'ctrl'),
ENTER: run.bind(this, this._addParagraphAfterCard)
};
Object.keys(commands).forEach((str) => {
@ -166,6 +167,12 @@ export default class KoenigCardCalloutComponent extends Component {
}
}
_addParagraphAfterCard() {
if (this.args.isEditing) {
this.args.addParagraphAfterCard();
}
}
_placeCursorAtEnd() {
if (!this._textReplacementEditor) {
return;