11<script setup lang="ts">
22import {useGlobalStore } from ' @/stores/global' ;
3- import {defineExpose , nextTick , onMounted , onUnmounted , ref , watch } from ' vue' ;
3+ import {computed , defineExpose , nextTick , onMounted , onUnmounted , ref , watch } from ' vue' ;
44import type {IStructure , IStructureData } from ' @/interfaces' ;
55import {useLayout } from ' @/composables/layout' ;
66import StructureEditor from ' @/components/StructureEditor.vue' ;
@@ -24,11 +24,21 @@ const loaded = ref(false);
2424const loading = ref (false );
2525const killIframe = ref (false );
2626const siteNotCompatibleSnack = ref (false );
27+ const hoveringEditor = ref (false );
2728const { layoutSize, windowHeight, layoutPx } = useLayout ();
2829const { reloading, siteCompatible, sendMessageToIframe, getPathsFromSectionKey, listenIframeMessage, sendUserDataToIframe } = useIframe ();
2930const { userDataLoading } = useUserData ();
3031const iframeErrorMsg = ref (' This site is not JSONms compatible' );
3132
33+ const editorHeight = computed ((): number => {
34+ const padding = (globalStore .userSettings .data .layoutSitePreviewPadding ? 96 : 63 );
35+ const result = windowHeight .value - padding ;
36+ if (hoveringEditor .value ) {
37+ return result + 32 ;
38+ }
39+ return result - layoutSize .value .preview .height ;
40+ })
41+
3242const refresh = () => {
3343 if (siteCompatible .value ) {
3444 reloading .value = true ;
@@ -212,7 +222,15 @@ defineExpose({
212222 <template #append >
213223 <v-expand-transition >
214224 <div v-show =" globalStore.admin.previewMode === 'desktop' && globalStore.admin.structure" >
215- <v-card :height =" windowHeight - layoutSize.preview.height - (globalStore.userSettings.data.layoutSitePreviewPadding ? 96 : 63)" tile flat theme =" dark" >
225+ <v-card
226+ :height =" editorHeight"
227+ tile
228+ flat
229+ class =" editor-card"
230+ theme =" dark"
231+ @mouseover =" hoveringEditor = true"
232+ @mouseleave =" hoveringEditor = false"
233+ >
216234 <StructureEditor
217235 ref =" structureEditor"
218236 v-model =" structure"
@@ -238,4 +256,7 @@ defineExpose({
238256 transition : all 200ms ease ;
239257 }
240258}
259+ .editor-card {
260+ transition : height 300ms ease ;
261+ }
241262 </style >
0 commit comments