Fix Notebook enter key 6354 (#6365)
* Closes #6354 Notebook Enter key adds new lines - Removed enter key handlers from Vue component. - Added "Save" button. * entry must be selected before editing * focus on newly created entry * Closes #6354 Notebook Enter key adds new lines - Removed enter key handlers from Vue component. - Added "Save" button. * do not allow edit unless entry is selected * remove css for disabled cass --------- Co-authored-by: David Tsay <david.e.tsay@nasa.gov>
This commit is contained in:
committed by
GitHub
parent
73734d99ea
commit
39cff51db0
@@ -25,7 +25,10 @@
|
||||
<div
|
||||
class="c-notebook__entry c-ne has-local-controls"
|
||||
aria-label="Notebook Entry"
|
||||
:class="{ 'locked': isLocked, 'is-selected': isSelectedEntry }"
|
||||
:class="{ 'locked': isLocked,
|
||||
'is-selected': isSelectedEntry,
|
||||
'is-editing' : editMode
|
||||
}"
|
||||
@dragover="changeCursor"
|
||||
@drop.capture="cancelEditMode"
|
||||
@drop.prevent="dropOnEntry"
|
||||
@@ -80,12 +83,17 @@
|
||||
v-bind.prop="formattedText"
|
||||
@mouseover="checkEditability($event)"
|
||||
@mouseleave="canEdit = true"
|
||||
@mousedown="preventFocusIfNotSelected($event)"
|
||||
@focus="editingEntry()"
|
||||
@blur="updateEntryValue($event)"
|
||||
@keydown.enter.exact.prevent
|
||||
@keyup.enter.exact.prevent="forceBlur($event)"
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
v-if="editMode"
|
||||
class="c-ne__save-button"
|
||||
>
|
||||
<button class="c-button c-button--major icon-check"></button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
@@ -454,6 +462,13 @@ export default {
|
||||
|
||||
this.$emit('updateEntry', this.entry);
|
||||
},
|
||||
preventFocusIfNotSelected($event) {
|
||||
if (!this.isSelectedEntry) {
|
||||
$event.preventDefault();
|
||||
// blur the previous focused entry if clicking on non selected entry input
|
||||
document.activeElement.blur();
|
||||
}
|
||||
},
|
||||
editingEntry() {
|
||||
this.editMode = true;
|
||||
this.$emit('editingEntry');
|
||||
|
||||
Reference in New Issue
Block a user