diff --git a/front/src/editor/store/lines.js b/front/src/editor/store/lines.js index 90bd796f1c85e151397d6649ca5ccfaefee99a2c..65b1f66878746cab5652aca505e083c27a9668d4 100644 --- a/front/src/editor/store/lines.js +++ b/front/src/editor/store/lines.js @@ -85,7 +85,6 @@ export const mutations = { tr[transcription.transcription] = transcription state.all[index] = { ...state.all[index], transcriptions: tr } } - state.all[index] = { ...state.all[index], currentTrans: transcription } // Force reference update on the whole array // so that all components get a full refresh after an update state.all = [...state.all] diff --git a/front/src/editor/store/transcriptions.js b/front/src/editor/store/transcriptions.js index f56f915860c6c86ed15441d4ba24046fe348bbcd..36f73392aefc15271e343018ee35e8f615d4eb02 100644 --- a/front/src/editor/store/transcriptions.js +++ b/front/src/editor/store/transcriptions.js @@ -96,13 +96,16 @@ export const actions = { async updateLineTranscriptionVersion({commit, dispatch, rootState}, {line, content}) { commit('lines/updateTranscriptionVersion', { pk: line.pk, content: content }, {root: true}) - + const l = rootState.lines.all.find(li=>li.pk == line.pk) let data = { content: l.currentTrans.content, line: l.currentTrans.line, transcription: l.currentTrans.transcription } + if (rootState.lines.editedLine) { + commit('lines/setEditedLine', l, {root: true}) + } if (l.currentTrans.pk) { await dispatch('updateContent', {pk: l.currentTrans.pk, content: data, currentTransLine: l.currentTrans.line}) @@ -115,6 +118,7 @@ export const actions = { try { const resp = await api.createContent(rootState.document.id, rootState.parts.pk, content) commit('lines/setTranscriptions', { pk: currentTransLine, transcription: resp.data }, {root: true}) + commit('lines/updateCurrentTrans', resp.data.transcription, {root: true}) } catch (err) { console.log('couldnt create transcription!', err); } @@ -124,6 +128,7 @@ export const actions = { try { const resp = await api.updateContent(rootState.document.id, rootState.parts.pk, pk, content) commit('lines/setTranscriptions', { pk: currentTransLine, transcription: resp.data }, {root: true}) + commit('lines/updateCurrentTrans', resp.data.transcription, {root: true}) } catch (err) { console.log('couldnt update transcription!', err); } diff --git a/front/vue/components/TranscriptionModal.vue b/front/vue/components/TranscriptionModal.vue index 25c1671dfd0ad7a651c348c3ae2c2d6659bbe48c..1112da13443294bdb0eb174d6ddc7a4dc30d3b1a 100644 --- a/front/vue/components/TranscriptionModal.vue +++ b/front/vue/components/TranscriptionModal.vue @@ -162,7 +162,6 @@ import HelpVersions from './HelpVersions.vue'; import HelpCompareTranscriptions from './HelpCompareTranscriptions.vue'; export default Vue.extend({ - props: ['line'], components: { LineVersion, HelpVersions, @@ -196,6 +195,9 @@ export default Vue.extend({ } }, computed: { + line () { + return this.$store.state.lines.editedLine + }, momentDate() { return moment.tz(this.line.currentTrans.version_updated_at, this.timeZone); }, diff --git a/front/vue/components/VisuPanel.vue b/front/vue/components/VisuPanel.vue index b3414b563b8d75b2fa09c969672de1869585cbb2..9c00d6f0b23bd2e3ca5f6e2b7b84df76a303e372 100644 --- a/front/vue/components/VisuPanel.vue +++ b/front/vue/components/VisuPanel.vue @@ -17,8 +17,7 @@ </div> </div> - <TranscriptionModal v-if="$store.state.lines.editedLine" - v-bind:line="$store.state.lines.editedLine"> + <TranscriptionModal v-if="$store.state.lines.editedLine"> </TranscriptionModal> </div> </template>