Skip to content

Commit

Permalink
[#31420] Tweaks to inlineEdit
Browse files Browse the repository at this point in the history
  • Loading branch information
bd-viget committed Sep 23, 2024
1 parent 1326b2e commit 3941cde
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/js/components/Source/Editable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
style="padding: 0.5rem"
:class="{ stripe: 1 === sourceIndex % 2, 'alert-info': isDirty() }"
>
<div v-if="!editMode">
<div v-if="!editMode || !conceptEditMode()">
<div style="display: flex; gap: 0.5rem; align-items: baseline">
<div style="flex-basis: calc(100% - 0.5rem - 42px)">
<p class="mb-0" v-if="citation">{{ citation }}</p>
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/Term/Editable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
v-model="text"
@input="trackChanges"
@keydown.enter="emitSaveTerm"
@keydown.esc="cancelInlineEdit"
:class="{ 'alert-info': isDirty() }"
></BFormInput>

Expand Down Expand Up @@ -148,6 +149,9 @@ export default {
},
mounted() {
this.getConceptTerm();
if (this.inlineEdit){
this.$refs.termText.$el.focus();
}
},
methods: {
async getConceptTerm () {
Expand Down
13 changes: 13 additions & 0 deletions resources/js/components/Term/mixins/InlineEdit.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import state from '../../../states/concept';

export default {
data() {
return {
state,
};
},
computed: {
inlineEdit() {
return this.inEdit;
},
},
methods: {
conceptEditMode: function () {
return this.state.editMode;
},
showCancelModal() {
this.$refs.cancelModal.show();
},
Expand All @@ -21,6 +31,9 @@ export default {
this.$refs.confirmCancelButton.focus();
},
cancelInlineEdit() {
if (!this.inlineEdit || this.conceptEditMode()) {
return;
}
if (this.isDirty()) {
this.showCancelModal();
return;
Expand Down

0 comments on commit 3941cde

Please sign in to comment.