11<template >
2- <div class =" relative group flex items-center" >
2+ <div class =" relative group flex items-center" ref = " listCell " >
33 <!-- Normal value display -->
44 <div v-if =" column.editReadonly" class =" flex items-center" :class =" limitedText?.length > 50 ? 'min-w-48 max-w-full' : 'min-w-32'" >
55 {{ limitedText? limitedText : '-' }}
3636 </div >
3737
3838 <!-- Edit mode -->
39- <div v-else class =" flex flex-col gap-2" @click.stop >
39+ <div v-else class =" flex flex-col gap-2 trans-editor " @click.stop >
4040 <div class =" flex items-center max-w-full gap-2"
4141 :class =" limitedText?.length > 50 ? 'min-w-72' : 'min-w-64'"
4242 ref =" inputHolder"
8686</template >
8787
8888<script setup lang="ts">
89- import { ref , Ref , computed , nextTick } from ' vue' ;
89+ import { ref , Ref , computed , nextTick , onMounted } from ' vue' ;
9090import { IconPenSolid , IconCheckOutline , IconXOutline , IconQuestionCircleSolid } from ' @iconify-prerendered/vue-flowbite' ;
9191import { callAdminForthApi } from ' @/utils' ;
9292import { showErrorTost , showSuccesTost } from ' @/composables/useFrontendApi' ;
9393import ColumnValueInputWrapper from ' @/components/ColumnValueInputWrapper.vue' ;
9494import { useI18n } from ' vue-i18n' ;
9595import Tooltip from ' @/afcl/Tooltip.vue' ;
9696import Checkbox from ' @/afcl/Checkbox.vue' ;
97+ import { eventBus } from ' ./eventBus'
9798
99+ const listCell = ref (null );
98100const { t } = useI18n ();
99101const props = defineProps ([' column' , ' record' , ' resource' , ' adminUser' , ' meta' ]);
100102const isEditing = ref (false );
@@ -109,11 +111,23 @@ const unmasked = ref({});
109111const inputHolder = ref (null );
110112
111113const limitedText = computed (() => {
114+ if (props .column .name == props .meta ?.enFieldName && anyEditorOpen .value ) {
115+ return props .record [props .column .name ]; // keep english text
116+ }
112117 const text = props .record [props .column .name ];
113118 return text ?.length > 50 ? text .slice (0 , 50 ) + ' ...' : text ;
114119});
115120
116121const reviewed: Ref <boolean > = ref (false );
122+ const anyEditorOpen = ref (false ); // if any editor for lang page is open
123+
124+ onMounted (() => {
125+ eventBus .on (` editing-changed-${props .record .id } ` , async () => {
126+ console .log (' editing-changed' , props .record .id );
127+ await nextTick ();
128+ anyEditorOpen .value = listCell .value ?.closest (' tr' )?.querySelector (' .trans-editor' ) !== null ;
129+ });
130+ });
117131
118132
119133const originalReviewed = ref (false );
@@ -134,11 +148,14 @@ async function startEdit() {
134148 if (inputHolder .value ) {
135149 inputHolder .value .querySelector (' input, textarea, select' )?.focus ();
136150 }
151+ eventBus .emit (` editing-changed-${props .record .id } ` , null );
137152}
138153
139154function cancelEdit() {
140155 isEditing .value = false ;
141156 editValue .value = null ;
157+ eventBus .emit (` editing-changed-${props .record .id } ` , null );
158+
142159}
143160
144161function setCurrentValue(field , value , arrayIndex = undefined ) {
@@ -170,6 +187,8 @@ function setCurrentValue(field, value, arrayIndex = undefined) {
170187 currentValues .value [field ] = value ;
171188 editValue .value = value ;
172189 }
190+ eventBus .emit (` editing-changed-${props .record .id } ` , null );
191+
173192}
174193
175194async function saveEdit() {
0 commit comments