Ignore universal shortcuts inside inputs in cell output

This commit is contained in:
Jonatan Kłosko 2022-12-07 19:51:14 +01:00
parent e9d88ad7d7
commit a4cc14ce26

View file

@ -301,28 +301,35 @@ const Session = {
const key = event.key;
const keyBuffer = this.keyBuffer;
// Universal shortcuts
if (cmd && shift && !alt && key === "Enter") {
cancelEvent(event);
this.queueFullCellsEvaluation(true);
return;
} else if (!cmd && shift && !alt && key === "Enter") {
cancelEvent(event);
if (isEvaluable(this.focusedCellType())) {
this.queueFocusedCellEvaluation();
// Universal shortcuts (ignore editable elements in cell output)
if (
!(
isEditableElement(event.target) &&
event.target.closest(`[data-el-outputs-container]`)
)
) {
if (cmd && shift && !alt && key === "Enter") {
cancelEvent(event);
this.queueFullCellsEvaluation(true);
return;
} else if (!cmd && shift && !alt && key === "Enter") {
cancelEvent(event);
if (isEvaluable(this.focusedCellType())) {
this.queueFocusedCellEvaluation();
}
this.moveFocus(1);
return;
} else if (cmd && !alt && key === "Enter") {
cancelEvent(event);
if (isEvaluable(this.focusedCellType())) {
this.queueFocusedCellEvaluation();
}
return;
} else if (cmd && key === "s") {
cancelEvent(event);
this.saveNotebook();
return;
}
this.moveFocus(1);
return;
} else if (cmd && !alt && key === "Enter") {
cancelEvent(event);
if (isEvaluable(this.focusedCellType())) {
this.queueFocusedCellEvaluation();
}
return;
} else if (cmd && key === "s") {
cancelEvent(event);
this.saveNotebook();
return;
}
if (this.insertMode) {