From afd7291e6d287ebfa639b0283cd22a0a206631c7 Mon Sep 17 00:00:00 2001 From: "Mohammed R. M" Date: Tue, 5 Mar 2024 10:19:57 +0100 Subject: [PATCH 1/2] allow multilines textarea input --- .../chat/_chat.component.theme.scss | 11 +++++-- .../components/chat/chat-form.component.ts | 33 +++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/framework/theme/components/chat/_chat.component.theme.scss b/src/framework/theme/components/chat/_chat.component.theme.scss index feed35ffa8..1a8e4b3d06 100644 --- a/src/framework/theme/components/chat/_chat.component.theme.scss +++ b/src/framework/theme/components/chat/_chat.component.theme.scss @@ -266,10 +266,15 @@ flex-direction: row; display: flex; } - - input { + textarea { + resize: none; + max-height: 15em; + height: auto; + overflow-y: auto; + } + input, + textarea { flex: 1; - &.with-button { border-bottom-right-radius: 0; border-top-right-radius: 0; diff --git a/src/framework/theme/components/chat/chat-form.component.ts b/src/framework/theme/components/chat/chat-form.component.ts index 3d1983b0b7..da5c77348a 100644 --- a/src/framework/theme/components/chat/chat-form.component.ts +++ b/src/framework/theme/components/chat/chat-form.component.ts @@ -62,7 +62,25 @@ import { NbComponentOrCustomStatus } from '../component-status';
+ } @@ -252,4 +276,13 @@ export class NbChatFormComponent { onModelChange(value: string): void { this.onInputChange.emit(value); } + + adjustTextareaHeight(event: Event): void { + const textarea = event.target as HTMLTextAreaElement; + if (textarea) { + textarea.style.height = 'auto'; + const computedHeight = textarea.scrollHeight; + textarea.style.height = computedHeight + 'px'; + } + } } From 3d497bcb1e19d909bc80a573efe85687849d6b4a Mon Sep 17 00:00:00 2001 From: "Mohammed R. M" Date: Tue, 5 Mar 2024 10:33:27 +0100 Subject: [PATCH 2/2] set multiline by default to false --- src/framework/theme/components/chat/chat-form.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/framework/theme/components/chat/chat-form.component.ts b/src/framework/theme/components/chat/chat-form.component.ts index da5c77348a..b482675e98 100644 --- a/src/framework/theme/components/chat/chat-form.component.ts +++ b/src/framework/theme/components/chat/chat-form.component.ts @@ -163,7 +163,7 @@ export class NbChatFormComponent { * Allow multiline input * @type {boolean} */ - @Input() multiline: boolean = true; + @Input() multiline: boolean = false; /** *