diff --git a/components.d.ts b/components.d.ts
index 0ad2d15f..70d38b10 100644
--- a/components.d.ts
+++ b/components.d.ts
@@ -302,6 +302,11 @@ declare module '@vue/runtime-core' {
NanoMemo: typeof import('./src/tools/nano-memo/nano-memo.vue')['default']
'NanoMemo.content': typeof import('./src/tools/nano-memo/nano-memo.content.md')['default']
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
+ NCode: typeof import('naive-ui')['NCode']
+ NConfigProvider: typeof import('naive-ui')['NConfigProvider']
+ NDivider: typeof import('naive-ui')['NDivider']
+ NEllipsis: typeof import('naive-ui')['NEllipsis']
+ NFormItem: typeof import('naive-ui')['NFormItem']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDivider: typeof import('naive-ui')['NDivider']
NEllipsis: typeof import('naive-ui')['NEllipsis']
@@ -311,6 +316,12 @@ declare module '@vue/runtime-core' {
NH1: typeof import('naive-ui')['NH1']
NH3: typeof import('naive-ui')['NH3']
NIcon: typeof import('naive-ui')['NIcon']
+ NInputNumber: typeof import('naive-ui')['NInputNumber']
+ NLayout: typeof import('naive-ui')['NLayout']
+ NLayoutSider: typeof import('naive-ui')['NLayoutSider']
+ NMenu: typeof import('naive-ui')['NMenu']
+ NScrollbar: typeof import('naive-ui')['NScrollbar']
+ NTable: typeof import('naive-ui')['NTable']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NMenu: typeof import('naive-ui')['NMenu']
diff --git a/src/components/TextareaCopyable.vue b/src/components/TextareaCopyable.vue
index f87dc226..97e41db2 100644
--- a/src/components/TextareaCopyable.vue
+++ b/src/components/TextareaCopyable.vue
@@ -31,6 +31,8 @@ const props = withDefaults(
wordWrap?: boolean
downloadFileName?: string
downloadButtonText?: string
+ scrollable?: boolean
+ maxHeight?: string
}>(),
{
followHeightOf: null,
@@ -39,6 +41,8 @@ const props = withDefaults(
copyMessage: 'Copy to clipboard',
downloadFileName: '',
downloadButtonText: 'Download',
+ scrollable: false,
+ maxHeight: '400px',
},
);
hljs.registerLanguage('sql', sqlHljs);
@@ -62,6 +66,17 @@ hljs.registerLanguage('protobuf', protobufHljs);
const { value, language, followHeightOf, copyPlacement, copyMessage, downloadFileName, downloadButtonText } = toRefs(props);
const { height } = followHeightOf.value ? useElementSize(followHeightOf) : { height: ref(null) };
+const scrollbarRef = ref();
+
+// Watch for content changes and scroll to bottom
+watch(value, () => {
+ nextTick(() => {
+ if (scrollbarRef.value) {
+ scrollbarRef.value.scrollTo({ top: scrollbarRef.value.scrollbarInstRef.containerRef.scrollHeight });
+ }
+ });
+}, { flush: 'post' });
+
const { copy, isJustCopied } = useCopy({ source: value, createToast: false });
const tooltipText = computed(() => isJustCopied.value ? 'Copied!' : copyMessage.value);
@@ -80,9 +95,14 @@ const { download } = useDownloadFileFromBase64(
:style="(copyPlacement === 'top-right' || copyPlacement === 'bottom-right') ? `padding-bottom: 50px` : ''"
>