diff --git a/src/devtools/mixins/data-field-edit.js b/src/devtools/mixins/data-field-edit.js index d32fef867b3571d1712d7bd39e4700f2cadb5928..7bba7d46f628cab75080cd81cc6ecb8a905253e4 100644 --- a/src/devtools/mixins/data-field-edit.js +++ b/src/devtools/mixins/data-field-edit.js @@ -21,6 +21,12 @@ function numberQuickEditMod (event) { } export default { + inject: { + InspectorInjection: { + default: null + } + }, + props: { editable: { type: Boolean, @@ -54,6 +60,7 @@ export default { }, isEditable () { + if (this.InspectorInjection && !this.InspectorInjection.editable) return false return this.editable && !this.fieldOptions.abstract && !this.fieldOptions.readOnly && diff --git a/src/devtools/views/vuex/VuexStateInspector.vue b/src/devtools/views/vuex/VuexStateInspector.vue index 76cb79c08474f4b023210404aa97457d90d09ec1..999be23869405e663c1ed73e7bb637b25ac903b5 100644 --- a/src/devtools/views/vuex/VuexStateInspector.vue +++ b/src/devtools/views/vuex/VuexStateInspector.vue @@ -100,7 +100,7 @@ import StateInspector from 'components/StateInspector.vue' import { searchDeepInObject, sortByKey, stringify, parse } from 'src/util' import debounce from 'lodash.debounce' import groupBy from 'lodash.groupby' -import { mapGetters, mapActions } from 'vuex' +import { mapState, mapGetters, mapActions } from 'vuex' export default { components: { @@ -109,22 +109,32 @@ export default { StateInspector }, + provide () { + return { + InspectorInjection: this.injection + } + }, + data () { return { showStateCopiedMessage: false, showBadJSONMessage: false, showImportStatePopup: false, - filter: '' + filter: '', + injection: { + editable: false + } } }, computed: { - ...mapGetters('vuex', [ - 'inspectedState', + ...mapState('vuex', [ + 'activeIndex', 'inspectedIndex' ]), ...mapGetters('vuex', [ + 'inspectedState', 'filteredHistory' ]), @@ -162,6 +172,10 @@ export default { isOnlyMutationPayload () { return Object.keys(this.inspectedState).length === 1 && this.inspectedState.mutation + }, + + isActive () { + return this.activeIndex === this.inspectedIndex } }, @@ -172,6 +186,13 @@ export default { this.$el.querySelector('textarea').focus() }) } + }, + + isActive: { + handler (value) { + this.injection.editable = value + }, + immediate: true } },