Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 70bfd6b

Browse files
committed
feat: support set min height for editor el
1 parent c65c52e commit 70bfd6b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/VuePreview.vue

+3
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ provide('theme', themeComputed)
120120
const { copy, copied } = useClipboard({ source: store.state.activeFile.code, legacy: true })
121121
122122
const isCollapse = ref(props.collapse)
123+
const minHeightForCode = computed(() => isCollapse.value ? '0' : 'var(--vue-preview-editor-min-height)')
123124
const maxHeightForCode = computed(() => isCollapse.value ? '0' : 'var(--vue-preview-editor-max-height)')
124125
125126
const previewBodyStyle = computed<Partial<CSSStyleDeclaration>>(() => typeof props.previewBodyStyle === 'string' ? JSON.parse(decodeURIComponent(props.previewBodyStyle)) : props.previewBodyStyle)
@@ -168,6 +169,7 @@ const isHover = useElementHover(vuePreviewContainerRef)
168169
--vue-preview-color-icon-bg-hover: hsl(220, 95%, 95%);
169170
--vue-preview-color-model-bg: hsla(0, 0%, 80%, 0.1);
170171
--vue-preview-editor-max-height: 50vh;
172+
--vue-preview-editor-min-height: 200px;
171173
}
172174
</style>
173175

@@ -253,6 +255,7 @@ const isHover = useElementHover(vuePreviewContainerRef)
253255
box-sizing: border-box;
254256
overflow-y: scroll;
255257
border-radius: 0 0 var(--vue-preview-radius) var(--vue-preview-radius);
258+
min-height: v-bind('minHeightForCode');
256259
max-height: v-bind('maxHeightForCode');
257260
transition: max-height 0.3s;
258261
}

0 commit comments

Comments
 (0)